groovy

Groovy fails to complie against latest Xalan 2.6.0

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-beta-6
  • Fix Version/s: 1.1-beta-1
  • Component/s: None
  • Labels:
    None
  • Environment:
    j2sdk1.4.2_05 + Xalan-2.6.0 in JAVA_HOME/jre/lib/endorsed on WinXP
  • Number of attachments :
    0

Description

There are some groovy tests that are failing because they are referencing a method in Xalan that was, apparently, removed in more recent versions than Groovy is declaring as a dependency. The tests are...

groovy.xml.NameSpaceDOMTest
groovy.xml.SAXTest
groovy.xml.SmallNamespaceDOMTest
groovy.xml.VerboseDOMTest
groovy.xml.XmlTest

They all fail (have errors) with (common part of stacktrace)...

java.lang.NoSuchMethodError: org.apache.xalan.templates.OutputProperties.getIntProperty(Ljava/lang/String;Ljava/util/Properties;)I
at org.apache.xalan.serialize.SerializerToXML.init(SerializerToXML.java:408)
at org.apache.xalan.serialize.SerializerToXML.init(SerializerToXML.java:538)
at groovy.xml.TestXmlSupport.createSerializer(TestXmlSupport.java:76)
at groovy.xml.TestXmlSupport.dump(TestXmlSupport.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.codehaus.groovy.runtime.ReflectionMetaMethod.invoke(ReflectionMetaMethod.java:63)
at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1117)
at groovy.lang.MetaClass.invokeMethod(MetaClass.java:307)
at gjdk.groovy.lang.MetaClass_GroovyReflector.invoke(MetaClass_GroovyReflector.java)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1117)
at groovy.lang.MetaClass.invokeMethod(MetaClass.java:307)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:143)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:106)

This just goes to show that maybe the developers ought to be keeping up on the versions. Here are some examples (first column is what Groovy-core project.xml declares, second is the latest version of that library)....

asm-1.4.1 | asm-1.4.3
asm-util-1.4.1 | asm-util-1.4.3
xerces-2.4.0 | xerces-2.6.2
xml-apis-1.0.b2 | xml-apis-1.2.01

Actually, Xalan isn't declared as a dependency. This must assume that JDk1.4+ is being used to compile Groovy. Either way, might want to verify that Groovy is using a forward compatible way to use Xalan in order to work with more recent versions than the old buggy versions that are included in the JDK.

Jake

Activity

Hide
Bing Ran added a comment -

I think this was me

I was trying to reduce the dependence on xerces for the XML serializer (xerces seemed to slow down many of the XML test cases quite a bit). I did not realize that Xalan in JDK was not up to date.

Can someone roll back the changes in the TestXmlSupport.java please ? The crapy network connection I have had for the past few days is preventing me from doing anything

Show
Bing Ran added a comment - I think this was me I was trying to reduce the dependence on xerces for the XML serializer (xerces seemed to slow down many of the XML test cases quite a bit). I did not realize that Xalan in JDK was not up to date. Can someone roll back the changes in the TestXmlSupport.java please ? The crapy network connection I have had for the past few days is preventing me from doing anything
Hide
Jacob Kjome added a comment -

Ok, here's some more information. Sorry I didn't look at the stack trace more closely. I had been thinking it was a problem with Groovy, but it is a problem inherent to Xalan itself. SerializerToXML, along with most of the other classes in the org.apache.xalan.serialize package were remove immediately after version 2.5D1. See comments at:
http://cvs.apache.org/viewcvs.cgi/xml-xalan/java/src/org/apache/xalan/serialize/Attic/SerializerToXML.java

As of version 2.5.0, all serializers were moved to a common package that both Xerces and Xalan could share under org.apache.xml.serializer.

So, what is happening is that the JDK contains a version of Xalan previous to 2.5.0 which still contains SerializerToXML, but since I have Xalan-2.6.0 in jre/lib/endorsed, the OutputProperties class is being loaded from 2.6.0. SerializerToXML.init() is, apparently, pointing to a method in OutputProperties that no longer exists in version 2.6.0. In fact, I just checked, and the getIntProperty(String, Properties) method was there in 2.5D1, but not as of 2.5.0.

It kind of sucks that Xalan broke backward compatibility so much, but then again, it has been 15 months since 2.5.0 was tagged. Unfortunately, the JDK seems to stay a little over a year behind the curve.

I leave the fix to you. You could just mandate that Xalan-2.5.0 or better be used with Groovy (making sure to provide instructions to override the version that comes with the JDK by putting the jar in jre/lib/endorsed) or you could go back to using Xerces (or you could use something XOM, except that it dependes on a certain minimum version of Xerces to do its work properly).

Jake

Show
Jacob Kjome added a comment - Ok, here's some more information. Sorry I didn't look at the stack trace more closely. I had been thinking it was a problem with Groovy, but it is a problem inherent to Xalan itself. SerializerToXML, along with most of the other classes in the org.apache.xalan.serialize package were remove immediately after version 2.5D1. See comments at: http://cvs.apache.org/viewcvs.cgi/xml-xalan/java/src/org/apache/xalan/serialize/Attic/SerializerToXML.java As of version 2.5.0, all serializers were moved to a common package that both Xerces and Xalan could share under org.apache.xml.serializer. So, what is happening is that the JDK contains a version of Xalan previous to 2.5.0 which still contains SerializerToXML, but since I have Xalan-2.6.0 in jre/lib/endorsed, the OutputProperties class is being loaded from 2.6.0. SerializerToXML.init() is, apparently, pointing to a method in OutputProperties that no longer exists in version 2.6.0. In fact, I just checked, and the getIntProperty(String, Properties) method was there in 2.5D1, but not as of 2.5.0. It kind of sucks that Xalan broke backward compatibility so much, but then again, it has been 15 months since 2.5.0 was tagged. Unfortunately, the JDK seems to stay a little over a year behind the curve. I leave the fix to you. You could just mandate that Xalan-2.5.0 or better be used with Groovy (making sure to provide instructions to override the version that comes with the JDK by putting the jar in jre/lib/endorsed) or you could go back to using Xerces (or you could use something XOM, except that it dependes on a certain minimum version of Xerces to do its work properly). Jake
Hide
Paul King added a comment -

Latest Groovy seems to work fine with latest xerces and latest xalan.

Show
Paul King added a comment - Latest Groovy seems to work fine with latest xerces and latest xalan.
Hide
Paul King added a comment -

Assigning fix version

Show
Paul King added a comment - Assigning fix version

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: