jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • XStream
  • XSTR-554

XStream fromXml of groovy objects fails within a syncronsized map

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: 1.1.3
  • Fix Version/s: 1.2
  • Component/s: None
  • Labels:
    None
  • JDK version and platform:
    JDK 1.6.0_11 on Windows XP

Description

re-persisting an object with a package level variable after its been loaded by xstream fails with the following exception:

---- Debugging information ----
message             : Could not call
java.util.Collections$SynchronizedMap.writeObject() 
cause-message       : null 
cause-exception     : java.lang.reflect.InvocationTargetException 
------------------------------- org.groovymud.shell.telnetd.MudShell 
com.thoughtworks.xstream.converters.ConversionException: Could not call
java.util.Collections$SynchronizedMap.writeObject()
---- Debugging information ----
message             : Could not call
java.util.Collections$SynchronizedMap.writeObject() 
cause-message       : null 
cause-exception     : java.lang.reflect.InvocationTargetException 
-------------------------------
	at
com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:92)
	at
com.thoughtworks.xstream.converters.reflection.SerializableConverter.marshal(SerializableConverter.java:186)
	at
com.thoughtworks.xstream.core.ReferenceByXPathMarshaller.convertAnother(ReferenceByXPathMarshaller.java:36)
	at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter$1.writeField(ReflectionConverter.java:81)
	at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter$1.visit(ReflectionConverter.java:59)
	at
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:108)
	at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter.marshal(ReflectionConverter.java:44)
	at
com.thoughtworks.xstream.core.ReferenceByXPathMarshaller.convertAnother(ReferenceByXPathMarshaller.java:36)
	at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter$1.writeField(ReflectionConverter.java:81)
	at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter$1.visit(ReflectionConverter.java:59)
	at
com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider.visitSerializableFields(PureJavaReflectionProvider.java:108)
	at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter.marshal(ReflectionConverter.java:44)
	at
com.thoughtworks.xstream.core.ReferenceByXPathMarshaller.convertAnother(ReferenceByXPathMarshaller.java:36)
	at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:46)
	at
com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.marshal(ReferenceByXPathMarshallingStrategy.java:17)
	at com.thoughtworks.xstream.XStream.marshal(XStream.java:476)
	at com.thoughtworks.xstream.XStream.marshal(XStream.java:466)
	at com.thoughtworks.xstream.XStream.toXML(XStream.java:458)
	at
org.groovymud.object.registry.MudObjectAttendant.savePlayerData(MudObjectAttendant.java:260)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
	at
org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
	at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
	at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
	at commands.player.save.run(save.groovy:13)
	at groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:386)
	at
org.groovymud.shell.command.CommandInterpreter.doCommand(CommandInterpreter.java:165)
	at
org.groovymud.shell.command.CommandInterpreter$1.run(CommandInterpreter.java:113)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAsPrivileged(Subject.java:454)
	at
org.groovymud.shell.command.CommandInterpreter.doShellCommand(CommandInterpreter.java:104)
	at org.groovymud.shell.telnetd.MudShell.handleRequest(MudShell.java:58)
	at org.groovymud.shell.telnetd.MudShell.run(MudShell.java:32)
	at net.wimpi.telnetd.net.Connection.run(Connection.java:119)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at
com.thoughtworks.xstream.converters.reflection.SerializationMethodInvoker.callWriteObject(SerializationMethodInvoker.java:88)
	... 39 more
Caused by: com.thoughtworks.xstream.converters.ConversionException: Could
not call java.util.Collections$SynchronizedMap.writeObject()

the groovy object is in a synchronized map and has a package level variable which, in another exception I do not have to hand, seems to be the cause of the problem.

Reproduce (using Java, not Groovy - you should load the groovy object using the GroovyScriptEngine):

1. persist an object using XStream with a synchronized map that contains a groovy object with a package protected variable in it
2. load that object using fromXML with the same XStream object
3. try to persist that object using the same XStream object

Interestingly, if you use a different XStream object, as suggested at

http://www.bobsgear.com/display/bobsgear/Could+not+get+field+class+error+with+xstream

... this works fine. I have worked round this for now with that exact solution.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
Hide
Permalink
Joerg Schaible added a comment - 18/Mar/09 11:03 AM

Can you verify this with the latest XStream version 1.3.1?

Show
Joerg Schaible added a comment - 18/Mar/09 11:03 AM Can you verify this with the latest XStream version 1.3.1?
Hide
Permalink
Matthew Corby-Eaglen added a comment - 18/Mar/09 4:40 PM

I'm using maven and there doesn't seem to be a deployment of 1.3.1 on repo1.maven.org..?

Show
Matthew Corby-Eaglen added a comment - 18/Mar/09 4:40 PM I'm using maven and there doesn't seem to be a deployment of 1.3.1 on repo1.maven.org..?
Hide
Permalink
Matthew Corby-Eaglen added a comment - 18/Mar/09 4:58 PM

seems to work in 1.2.2... if it happens again i'll report it again.

thanks!

Show
Matthew Corby-Eaglen added a comment - 18/Mar/09 4:58 PM seems to work in 1.2.2... if it happens again i'll report it again. thanks!
Hide
Permalink
Joerg Schaible added a comment - 19/Mar/09 2:19 AM

Well, XStream has changed the groupId more than two years ago: http://www.jarvana.com/jarvana/search?search_type=project&project=xstream
I believe the bug itself has been fixed for 1.2.

Show
Joerg Schaible added a comment - 19/Mar/09 2:19 AM Well, XStream has changed the groupId more than two years ago: http://www.jarvana.com/jarvana/search?search_type=project&project=xstream I believe the bug itself has been fixed for 1.2.

People

  • Assignee:
    Joerg Schaible
    Reporter:
    Matthew Corby-Eaglen
Vote (0)
Watch (0)

Dates

  • Created:
    18/Mar/09 4:26 AM
    Updated:
    02/Dec/10 2:56 AM
    Resolved:
    19/Mar/09 2:19 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.