logo       

[xstream-dev] [jira] Closed: (XSTR-100) Cannot deserialize DefaultStyledDoc: msg#00017

java.xstream.devel

Subject: [xstream-dev] [jira] Closed: (XSTR-100) Cannot deserialize DefaultStyledDocument

Message:

The following issue has been closed.

---------------------------------------------------------------------
View the issue:
http://jira.codehaus.org/browse/XSTR-100

Here is an overview of the issue:
---------------------------------------------------------------------
Key: XSTR-100
Summary: Cannot deserialize DefaultStyledDocument
Type: Bug

Status: Closed
Priority: Critical
Resolution: FIXED

Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown

Project: XStream
Components:
Core
Fix Fors:
1.0.2

Assignee:
Reporter: Joe Walnes

Created: Tue, 20 Jul 2004 8:34 AM
Updated: Fri, 23 Jul 2004 2:12 PM

Description:

I have a problem when deserializing an instance of the
javax.swing.text.DefaultStyledDocument class.
The problem is not really while deserializing : some private fields of this JDK
class are mentionned as "transient" fields (like this one : private transient
Vector listeningStyles;). So they are not serialized.

The problem starts when I use the deserialized object (with the 'fromXML'
method) : those previous "transient" fields have not been initialized and their
use via DefaultStyledDocument or other JDK classes methods raise a
NullPointerException...

So I tried the unmarshal method to initialise those fields with the default
constructor first, and then deserialize:

XStream xstream = new XStream();
DefaultStyledDocument doc = new DefaultStyledDocument();
String xml = xstream.toXML(doc);
DefaultStyledDocument tmpDoc = new DefaultStyledDocument();
doc = (DefaultStyledDocument) xstream.unmarshal(
new XppReader(new StringReader(xml)),
tmpDoc);

...but this code raise an exception (at the end of this message). Can someone
tell me what is wrong with this code or give me a solution to
serialize/deserialize a DefaultStyledDocument ?

Thanks in advance.

--
Sebastien



********************************************************
com.thoughtworks.xstream.converters.ConversionException: No such field
javax.swing.text.DefaultStyledDocument.children
---- Debugging information ----
required-type : javax.swing.text.DefaultStyledDocument$SectionElement
cause-message : No such field
javax.swing.text.DefaultStyledDocument.children
class : javax.swing.text.DefaultStyledDocument
message : No such field
javax.swing.text.DefaultStyledDocument.children
line number : 4
path :
/javax.swing.text.DefaultStyledDocument/buffer/root/children
cause-exception :
com.thoughtworks.xstream.converters.reflection.ObjectAccessException
-------------------------------
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(Unknown
Source)
at
com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(Unknown
Source)
at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter.unmarshal(Unknown
Source)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(Unknown
Source)
at
com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(Unknown
Source)
at
com.thoughtworks.xstream.converters.reflection.ReflectionConverter.unmarshal(Unknown
Source)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(Unknown
Source)
at
com.thoughtworks.xstream.core.ReferenceByXPathUnmarshaller.convertAnother(Unknown
Source)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(Unknown Source)
at
com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(Unknown
Source)
at com.thoughtworks.xstream.XStream.unmarshal(Unknown Source)
********************************************************



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise