Bug 54641 - XSLTC problem with StringUtils
Summary: XSLTC problem with StringUtils
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Optional Tasks (show other bugs)
Version: 1.8.4
Hardware: All All
: P2 critical with 1 vote (vote)
Target Milestone: 1.9.1
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-06 02:16 UTC by Jesse Glick
Modified: 2014-05-08 03:07 UTC (History)
4 users (show)



Attachments
First attempt at a fix (5.06 KB, patch)
2013-03-06 02:20 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2013-03-06 02:16:02 UTC
XMLResultAggregatorTest.testFrames fails on JDK 7u17 with:

Fatal error during transformation
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.fatalError(TraXLiaison.java:531)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:895)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.readTemplates(TraXLiaison.java:300)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.createTransformer(TraXLiaison.java:317)
	at org.apache.tools.ant.taskdefs.optional.TraXLiaison.transform(TraXLiaison.java:178)
	at org.apache.tools.ant.taskdefs.XSLTProcess.process(XSLTProcess.java:850)
	... 19 more
Caused by: javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:885)
	... 23 more

Bug #51668 comment #6 notes that this is known as https://bugs.eclipse.org/bugs/show_bug.cgi?id=384757 and (cannot read it but) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7167657 as well.

http://xml.apache.org/xalan-j/extensions.html#ext-func-calls says

TransformerFactory.newInstance().newTemplates(new StreamSource(new File("…src/etc/junit-noframes.xsl")));

should work but it fails:

ERROR:  'The first argument to the non-static Java function 'replace' is not a valid object reference.'
FATAL ERROR:  'Could not compile stylesheet'
Exception in thread "main" javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:843)

Apparently newer versions of XSLTC try to verify extension method signatures, or something like that, and StringUtils does not work here.
Comment 1 Jesse Glick 2013-03-06 02:20:32 UTC
Created attachment 30021 [details]
First attempt at a fix

Makes XMLResultAggregatorTest pass but causes failures in JUnitReportTest.
Comment 2 Jesse Glick 2013-03-06 12:04:49 UTC
http://stackoverflow.com/a/12364925/12916 claims to have a fix, will test.
Comment 3 Jesse Glick 2013-03-06 16:44:56 UTC
I think fixed in revision 1453414 (not in 1.9.0). Markus if you could verify that would be appreciated.
Comment 4 Markus Keller 2013-03-06 19:52:08 UTC
(In reply to comment #0)
> Apparently newer versions of XSLTC try to verify extension method
> signatures, or something like that, and StringUtils does not work here.

Note that Apache Xalan works fine, but Oracle copied Xalan and added changes like http://java.net/projects/jaxp-sources/sources/svn/revision/3040 , which broke some XSLTC functions when a security manager is present.

Unfortunately, Oracle's public bug database is in a horrible read-only state for more than a year now, and it continues to hide bug reports that used to be available. I also can't read their 7167657 any more.
Comment 5 Markus Keller 2013-03-06 20:00:04 UTC
(In reply to comment #3)
> I think fixed in revision 1453414 (not in 1.9.0). Markus if you could verify
> that would be appreciated.

The stylesheets look good and they do fix the problem in the Eclipse Ant runner (
https://bugs.eclipse.org/bugs/show_bug.cgi?id=384757 ).

I verified that funny characters are properly replaced; also with Java 1.4.
Comment 6 Jesse Glick 2013-03-06 20:36:07 UTC
Not in 1.9.0.