History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: XSTR-502
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Joerg Schaible
Reporter: Kevin Bowman
Votes: 0
Watchers: 1
Operations

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

ClassNotFoundException with writeReplace() classes

Created: 27/Jun/08 12:37 AM   Updated: 28/Jun/08 12:42 PM
Component/s: Converters
Affects Version/s: 1.3
Fix Version/s: None

File Attachments: 1. Zip Archive WriteReplace_test_patch.zip (1 kb)
2. Text File xstream-1.1.2-FB10536.patch (0.4 kb)


JDK version and platform: Sun 1.5, Mac and Windows


 Description  « Hide
We're using XStream to pass some objects from sever-side back to the client. The server has some internal classes that only exist server-side, but during serialization they're writeReplace()'ed to a common API class. When the xml gets deserialized by XStream client-side it sees something like this:
...
<variable class="com.server.$$InternalClass$$" resolves-to="com.api.NormalClass">
...

The class 'com.server.$$InternalClass$$' doesn't exist client-side, but 'com.api.NormalClass' does. This shouldn't cause a problem, but XStream is still throwing a ClassNotFoundException.

I've attached a zip file containing two files:

  • WriteReplaceTest.java - a test case demonstrating the bug with a contrived example.
  • xstream-1.3-FB10536.patch - a simple patch that fixed this problem for our particular case. I'm hoping there's a better, more general solution.


 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Kevin Bowman - 28/Jun/08 12:42 PM
Found and patched in 1.1.2 as well. I will attach a 1.1.2 patch file.

Kevin Bowman - 28/Jun/08 12:42 PM
Equivalent patch for 1.1.2