Skip to content

Many exceptions occur in SSRF.fromXml() #20

Description

@hosokawatakeshi

I'm evaluating the openssrf.
My code is below.

public class Test extends HttpServlet {
    private static final long serialVersionUID = 1L;
 
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    PrintWriter out;
    SSRF ssrf = new SSRF()
      .withProperty("cls", "UNCLASSIFIED")
      .withContact(new Contact()
      .withEMail(new EMail()
      .withAddress("john.doe@internet.com"))
      .withLastName("Doe")
      .withFirstName("John")
      .withTelephoneFax(new TelephoneFax()
      .withNumber("(123)456.7890")));
    res.setContentType("text/html; charset=utf-8");
    out = res.getWriter();
    out.println("<html><body>");
    String xml;
    try {
      xml = ssrf.toXML();
      System.out.println(xml);
      SSRF ssrf2 = SSRF.fromXml(xml);
    } catch (Exception e) {
      e.printStackTrace();
    }
    out.println("</body></html>");
  }
}

The results are as follows.
toXML() is good, but fromXml is bad.
How should I resolve the following exception?

[apache-tomcat-8.5.71-2]: <?xml version="1.0" encoding="UTF-8"?>
<s:SSRF xmlns:s="urn:us:gov:dod:standard:ssrf:3.1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <s:Contact cls="U">
      <s:Serial cls="U">USA::CN:9af76d4e9d2449</s:Serial>
      <s:EntryDateTime cls="U">2021-09-27T01:23:34.020Z</s:EntryDateTime>
      <s:FirstName cls="U">John</s:FirstName>
      <s:LastName cls="U">Doe</s:LastName>
      <s:TelephoneFax>
         <s:Number cls="U">(123)456.7890</s:Number>
      </s:TelephoneFax>
      <s:EMail>
         <s:Address cls="U">john.doe@internet.com</s:Address>
      </s:EMail>
   </s:Contact>
</s:SSRF>

[apache-tomcat-8.5.71-2]: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 132 counts of IllegalAnnotationExceptions
@XmlValue is not allowed on a class that derives another class.
	this problem is related to the following location:
		at protected java.util.Calendar us.gov.dod.standard.ssrf._3_1.metadata.domains.D.value
		at us.gov.dod.standard.ssrf._3_1.metadata.domains.D
		at private us.gov.dod.standard.ssrf._3_1.metadata.domains.D us.gov.dod.standard.ssrf._3_1.Contact.effectiveDate
		at us.gov.dod.standard.ssrf._3_1.Contact
		at protected java.util.Set us.gov.dod.standard.ssrf._3_1.SchemaRoot.contact
		at us.gov.dod.standard.ssrf._3_1.SchemaRoot
		at us.gov.dod.standard.ssrf.SSRF
@XmlValue is not allowed on a class that derives another class.
	this problem is related to the following location:
		at protected java.lang.String us.gov.dod.standard.ssrf._3_1.metadata.domains.S10.value
		at us.gov.dod.standard.ssrf._3_1.metadata.domains.S10
		at private us.gov.dod.standard.ssrf._3_1.metadata.domains.S10 us.gov.dod.standard.ssrf._3_1.Contact.titleRank
		at us.gov.dod.standard.ssrf._3_1.Contact
		at protected java.util.Set us.gov.dod.standard.ssrf._3_1.SchemaRoot.contact
		at us.gov.dod.standard.ssrf._3_1.SchemaRoot
		at us.gov.dod.standard.ssrf.SSRF
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions