[
https://jira.jboss.org/jira/browse/JBESB-2922?page=com.atlassian.jira.plu...
]
David Ward commented on JBESB-2922:
-----------------------------------
I've debugged this a bit. The problem appears to be in a behavioral difference of
javax.xml.validation.Validator between JDK 1.5 and 1.6.
Inside SchemaValidationAction.java's validate(String):void method, you will find these
lines:
...
final DOMResult result = new DOMResult();
try
{
final Validator validator = schema.newValidator();
validator.validate(createDomSourceFromPayload(xml), result);
}
catch (final SAXException e)
{
final String errorMsg = "SAXException while trying to validate against schema
'" + xsd + "'";
log.error(errorMsg, e);
throw new ValidationException(errorMsg, e, result);
...
What I see while debugging is that the "result" object's node is not being
populated in JDK 1.6, whereas it is in JDK 1.5.
This means that when the ValidationException is created, and the DOMResult.getNode() is
serialized, in JDK 1.6 the serialized String is only the XML header (<?xml
version=...?>), whereas in JDK 1.5 it is the entire (albeit invalid) document
(including <shiporder orderid=...>).
This then has a ripple effect such that when ValidationException.getDomResult() is called,
and we try to parse the serialized String, in JDK 1.6 (which only has the XML header), we
get a "Premature end of file".
Now, here comes the big question... The only code that ever calls
ValidationException.getDomResult() are JUnit tests: JBESB_2916_UnitTest (which passes),
and SchemaValidationActionUnitTest (which fails under JDK 1.6 due to the above, but this
test was added on the branch that broke the CI build). So, do we try to get
javax.xml.validation.Validator to work the same on JDK 1.6 as it does on JDK 1.5, or is
this an invalid test?
SchemaValidationActionUnitTest test failure serialising DOM
-----------------------------------------------------------
Key: JBESB-2922
URL:
https://jira.jboss.org/jira/browse/JBESB-2922
Project: JBoss ESB
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Rosetta
Affects Versions: 4.6
Reporter: Kevin Conner
Assignee: David Ward
Fix For: 4.7
The following error is being seen on the CI machines, executing on JDK 1.6
[java] [junit] java.lang.RuntimeException: Unexpected error. Unable to
serialize DOM.
[java] [junit] at
org.jboss.soa.esb.actions.validation.ValidationException.getDomResult(ValidationException.java:59)
[java] [junit] at
org.jboss.soa.esb.actions.validation.SchemaValidationActionUnitTest.processInvalidXml(SchemaValidationActionUnitTest.java:65)
[java] [junit] Caused by: org.xml.sax.SAXParseException: Premature end of file.
[java] [junit] at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
[java] [junit] at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
Source)
[java] [junit] at
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
[java] [junit] at
org.jboss.soa.esb.dom.YADOMUtil.parseStream(YADOMUtil.java:148)
[java] [junit] at
org.jboss.soa.esb.dom.YADOMUtil.parseStream(YADOMUtil.java:114)
[java] [junit] at org.jboss.soa.esb.dom.YADOMUtil.parse(YADOMUtil.java:95)
[java] [junit] at
org.jboss.soa.esb.actions.validation.ValidationException.getDomResult(ValidationException.java:51)
Tom, are we trying to serialise parser specific classes here? If so this will fail in a
mixed environment.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira