[prev in list] [next in list] [prev in thread] [next in thread]
List: webservices-general
Subject: [jira] [Created] (XMLSCHEMA-54) Circularity not handled in schema serialization
From: "Guillaume (JIRA)" <jira () apache ! org>
Date: 2018-08-22 16:49:00
Message-ID: JIRA.13180515.1534956487000.136375.1534956540105 () Atlassian ! JIRA
[Download RAW message or body]
Guillaume created XMLSCHEMA-54:
----------------------------------
Summary: Circularity not handled in schema serialization
Key: XMLSCHEMA-54
URL: https://issues.apache.org/jira/browse/XMLSCHEMA-54
Project: XmlSchema
Issue Type: Bug
Affects Versions: 2.2.3
Environment: Windows Server 2016
IntelliJ IDEA 2018
Reporter: Guillaume
Hello,
I am using version 2.2.3.
I am creating a Xml Schema using the classes defined in xmlschema-core, and expecting \
to write out the schema to a file.
{code:java}
XmlSchemaCollection schemaCollection;
try {
schemaCollection = schemaGenerator.generateSchema();
logger.fine("Schema created");
} catch (Exception e) {
e.printStackTrace();
return;
}
XmlSchema schema = schemaCollection.getXmlSchemas()[0];
try {
schema.write(System.out);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
{code}
But I get the exception :
{code:java}
Exception in thread "main" java.lang.StackOverflowError
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeElement(XmlSchemaSerializer.java:1031)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSequence(XmlSchemaSerializer.java:1749)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeComplexType(XmlSchemaSerializer.java:918)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeElement(XmlSchemaSerializer.java:1086)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeSequence(XmlSchemaSerializer.java:1749)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeComplexType(XmlSchemaSerializer.java:918)
at org.apache.ws.commons.schema.XmlSchemaSerializer.serializeElement(XmlSchemaSerializer.java:1086)
at
{code}
and so on. It happens at the line :
{code:java}
XmlSchema schema = schemaCollection.getXmlSchemas()[0];{code}
I used the debugger and from what I see, the XmlSchemaSerializer does not handle the \
circularity. It just do recursively without discriminating whether or not the \
XmlSchemaType is being serialized already in an upper scope. Note that all my \
ComplexType instances are at the top level :
{code:java}
XmlSchemaComplexType xsType = new XmlSchemaComplexType(schema, true);
{code}
but in the code it doesn't seem to me that _XmlSchemaType.isTopLevel()_ is used \
anywhere during the serialization, which is counter intuitive.
Am I doing it wrong ? I really think that this is a bug though.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic