[
https://issues.apache.org/jira/browse/UIMA-2453?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13429490#comment-13429490
]
Marshall Schor commented on UIMA-2453:
--------------------------------------
It took a day to track this down. I found that running the Junit test in
Eclipse (the single class) worked with Java 7. To get it to fail, I had to set
JAVA_HOME to Java or a late Sun Java 6, and run "mvn test". The failure was
eventually traced to a bit of sloppy test code which, for this particular test,
failed to specify one way or the other if the UIMA parser should be run as a
"validating" parser or not. It turns out that this is implemented as a
stateful (remembered) aspect of the UIMA framework, settable by UIMAFrameWork
Because this test class didn't specify,
UIMAFramework.getXMLParser().enableSchemaValidation(true) (or false), it just
got whatever setting a previous test left the parser in. Maven surefire ran
the junit tests in some order, which for Java 7 ended up running with
schemaValidation set to true. Before Java 7, the order ended up running with
it set to false.
If schemavalidation is false, then the XML parser can't tell if white space is
"ignorable" or not, so it assumes it's not, and calls the SAX handler
"characters". If it's true, then for ignorable white space it calls the SAX
handler "ignorableWhiteSpace".
The way UIMA's XML parser is implemented is to do SAX parsing, get SAX events,
and transform them into a DOM using an "identity" XSLT transform. (The reason
for this design I don't know - it's from a long time ago). The "identity" XSLT
transform, for ignorable white space, ignores it... Which means, it isn't
captured in the DOM. When preserving comments and white space, we need to
capture it. So, the fix is to change the logic for the SAX handlers use when
parsing - if preserve comments is true, we'll convert an ignorableWhiteSpace
call (only called by SAX when in validating mode) to a characters call - so the
DOM will preserve the ignorable white space.
> Some JUnit tests fail with Java 7
> ---------------------------------
>
> Key: UIMA-2453
> URL: https://issues.apache.org/jira/browse/UIMA-2453
> Project: UIMA
> Issue Type: Bug
> Components: Core Java Framework
> Environment: Java 7
> Reporter: Burn Lewis
> Assignee: Marshall Schor
> Priority: Minor
> Fix For: 2.4.1SDK
>
>
> Problem reported by Alan Sergeant
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira