Issue Details (XML | Word | Printable)

Key: XSTR-452
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Vasily Zakharov
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XStream

EnumSetConverter addresses non-specified field EnumSet.elementType

Created: 26/Nov/07 11:12 AM   Updated: 26/Nov/07 03:30 PM   Resolved: 26/Nov/07 11:27 AM
Return to search
Component/s: Converters
Affects Version/s: None
Fix Version/s: 1.2.2

Issue Links:
Duplicate
 

JDK version and platform: Apache Harmony


 Description  « Hide

com.thoughtworks.xstream.converters.enums.EnumSetConverter, at its line 31 (rev. 538) uses reflection to address field elementType in class java.util.EnumSet.

That field is package private and is not covered by the Java API, and thus may be missing in implementations other than Sun's.

Thus, addressing this field limits the XStream's capability to run on Apache Harmony and other implementations lacking that Sun-implementation-specific field.

For example, this issue interferes with Apache Geronimo Unit Tests running on Apache Harmony.

The stack looks as follows:

com.thoughtworks.xstream.XStream$InitializationException: Could not instatiate converter : com.thoughtworks.xstream.converters.enums.EnumSetConverter : null
at com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:395)
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:378)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:196)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:181)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:156)
at org.apache.geronimo.timer.jdbc.JDBCWorkerPersistence.serialize(JDBCWorkerPersistence.java:305)
at org.apache.geronimo.timer.jdbc.JDBCWorkerPersistence.save(JDBCWorkerPersistence.java:118)
at org.apache.geronimo.timer.jdbc.JDBCWorkerPersistenceTestAbstract.testSaveCancel(JDBCWorkerPersistenceTestAbstract.java:66)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
at java.lang.reflect.Method.invoke(Method.java:317)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
at java.lang.reflect.Method.invoke(Method.java:317)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)
at java.lang.reflect.Method.invoke(Method.java:317)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.VMReflection.newClassInstance(VMReflection.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:283)
at com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:392)
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:378)
... 26 more
Caused by: java.lang.RuntimeException: Could not access java.util.EnumSet.elementType field
at com.thoughtworks.xstream.core.util.Fields.find(Fields.java:18)
at com.thoughtworks.xstream.converters.enums.EnumSetConverter.<init>(EnumSetConverter.java:31)
at java.lang.reflect.VMReflection.newClassInstance(VMReflection.java)
... 29 more



Vasily Zakharov added a comment - 26/Nov/07 11:17 AM

Here's the Apache Harmony effort to workaround this compatibility issue from its side: http://issues.apache.org/jira/browse/HARMONY-5196
However, the (potential) problem in XStream implementation remains.


Vasily Zakharov added a comment - 26/Nov/07 11:26 AM

This issue is found to be duplicate of XSTR-379.


Vasily Zakharov made changes - 26/Nov/07 11:26 AM
Field Original Value New Value
Resolution Fixed [ 1 ]
Fix Version/s 1.2.2 [ 13038 ]
Status Open [ 1 ] Resolved [ 5 ]
Vasily Zakharov made changes - 26/Nov/07 11:27 AM
Status Resolved [ 5 ] Reopened [ 4 ]
Resolution Fixed [ 1 ]
Vasily Zakharov made changes - 26/Nov/07 11:27 AM
Resolution Duplicate [ 3 ]
Status Reopened [ 4 ] Resolved [ 5 ]
Joerg Schaible made changes - 26/Nov/07 03:29 PM
Link This issue duplicates XSTR-379 [ XSTR-379 ]
Joerg Schaible added a comment - 26/Nov/07 03:30 PM

Thanks for your references in XSTR-379, Vasily!


Joerg Schaible made changes - 26/Nov/07 03:30 PM
Status Resolved [ 5 ] Closed [ 6 ]