Giter Site home page Giter Site logo

x-stream / xstream Goto Github PK

View Code? Open in Web Editor NEW
739.0 52.0 219.0 20.93 MB

Serialize Java objects to XML and back again.

Home Page: http://x-stream.github.io

License: Other

HTML 19.82% Java 79.84% CSS 0.20% XSLT 0.03% Batchfile 0.06% Shell 0.05%
xstream java xml

xstream's Introduction

master: CI with Maven Coverage Status
v-1.4.x: Build Status Coverage Status


XStream

Java to XML Serialization, and back again

Binaries

All binary artifacts are bundled in the -bin archive. It includes the XStream jars and any other library used at build time, or optional runtime extras. MXParser is recommend for use as it will greatly improve the performance of XStream.

Documentation

Documentation can be found at GitHub. This includes:

Source

The complete source for XStream is bundled in the -src archive. This includes:

  • Main API [xstream/src/java]
  • Unit Tests [xstream/src/test]
  • Maven Build Files [pom.xml]
  • Hibernate Module [xstream-hibernate]
  • Website [xstream-distribution]

xstream's People

Contributors

aaron13100 avatar ablekhman avatar aslakhellesoy avatar baptistemesta avatar basil avatar ca-stefan-cordes avatar carstenartur avatar famod avatar gorky avatar guilhermesilveira avatar hboutemy avatar hsujenkins avatar jglick avatar joehni avatar joewalnes avatar johnlbergqvist avatar jstrachan avatar jvanzyl avatar koebi avatar madlexa avatar maurotalevi avatar nixel2007 avatar purnhar avatar rkreis avatar surfing avatar tadams avatar wilx avatar wwannemacher avatar y-higuchi avatar zeshuai007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xstream's Issues

Broken parameter types in the xml serialization of a method

Serialization of a method shows broken type of a parameter if it is an array

package test;
import java.lang.reflect.Method;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.StaxDriver;
public class TestObject {  
  public void testMethod(int par00, int[] par01, long par02, long[] par03, String par04, String[] par05) { }  

public static void main(String[] args) {
    for(Method m : TestObject.class.getMethods()) {
      if(m.getName().equals("testMethod")) {
        XStream xstream = new XStream(new StaxDriver());
        String xml = xstream.toXML(m);
        System.out.println(xml);
        break;
      }
    }
  }
}

produces the output

<?xml version="1.0"?>
<method>
  <class>test.TestObject</class>
  <name>testMethod</name>
  <parameter-types>
    <class>int</class>
    <class>[I</class>
    <class>long</class>
    <class>[J</class>
    <class>java.lang.String</class>
    <class>[Ljava.lang.String;</class>
  </parameter-types>
</method>

NamedMapConverter ignores valueType when valueName is null

Hi there,

I'm trying to marshal some map of values into XML, and so I have a class field of type Map<String,Integer>. I want it marshaled in the following format:

<values>
  <val key="A">321</val>
  <val key="B">456</val>
  ...
</values>

I've added an annotation on the field like this:

@XStreamConverter(MapStringIntegerConverter.class)
private Map<String,Integer> keys;

And the class MapStringIntegerConverter extends NamedMapConverter, and looks like this:

public class MapStringIntegerConverter extends NamedMapConverter {
    public MapStringIntegerConverter(Mapper mapper, ConverterLookup lookup) {
        super(mapper,
                "key",                  // Name of encapsulating tag
                "name", String.class,   // Store key as attribute "name"
                null, Integer.class,    // Store value as node content
                true,                   // Store key as attributed
                true,                   // Store value as node content
                lookup);
    }
}

The problem is that when the XML is loaded, all values are loaded as String instead of Integer.
It works however when I put the value in an attribute or named tag (if I put something instead of "null").

But it should work with 'null', no?

Unneeded contention in DefaultConverterLookup

Hi,

DefaultConverterLookup#lookupConverterForType uses a synchronized Map, which produces a lot of contention with parallel threads.
This Map was made synhronized with fix for http://jira.codehaus.org/browse/XSTR-744.

I recommend to replace the synchronized Map with a thread-safe ConcurrentMap implementation (e.g. java.util.concurrent.ConcurrentHashMap) to make it
a) thread-safe (the original issue with XSTR-744
and
b) non-blocking on read-access

See for an example thread-dump showing several BLOCKED threads waiting for one RUNNABLE in read-access.

"Thread-7310" Id=8514 in RUNNABLE
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
      - locked java.util.Collections$SynchronizedMap@13ad5060
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.company.base.util.jaxb.XStreamJAXBConverter.marshal(XStreamJAXBConverter.java:77)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@3736819
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:132)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0


"Thread-7307" Id=8511 in RUNNABLE
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
      - locked java.util.Collections$SynchronizedMap@13ad5060
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.company.base.util.jaxb.XStreamJAXBConverter.marshal(XStreamJAXBConverter.java:77)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@406c3657
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.impl.SHCTaskProcessor.preInitiation(SHCTaskProcessor.java:138)
    at com.company.httpcontroller.core.SHCTaskInitiator.doInitiation(SHCTaskInitiator.java:197)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:152)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0


"Thread-7304" Id=8508 in BLOCKED on lock=java.util.Collections$SynchronizedMap@13ad5060     owned by Thread-7301 Id=8500
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@a0003e9
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.impl.SHCTaskProcessor.preInitiation(SHCTaskProcessor.java:138)
    at com.company.httpcontroller.core.SHCTaskInitiator.doInitiation(SHCTaskInitiator.java:197)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:152)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0


"Thread-7301" Id=8500 in RUNNABLE
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
      - locked java.util.Collections$SynchronizedMap@13ad5060
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@662c66c0
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.core.SHCTaskInitiator.doInitiation(SHCTaskInitiator.java:214)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:152)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0


"Thread-7293" Id=8497 in BLOCKED on lock=java.util.Collections$SynchronizedMap@13ad5060     owned by Thread-7301 Id=8500
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@4037f359
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.core.SHCTaskInitiator.doInitiation(SHCTaskInitiator.java:214)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:152)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0


"Thread-7291" Id=8495 in BLOCKED on lock=java.util.Collections$SynchronizedMap@13ad5060     owned by Thread-7301 Id=8500
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@3c420efe
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.core.SHCTaskInitiator.doInitiation(SHCTaskInitiator.java:214)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:152)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0


"Thread-7286" Id=8490 in RUNNABLE
    at java.util.Collections$SynchronizedMap.get(Collections.java:2584)
      - locked java.util.Collections$SynchronizedMap@13ad5060
    at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:49)
    at com.thoughtworks.xstream.XStream$1.lookupConverterForType(XStream.java:498)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:48)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.CollectionConverter.marshal(CollectionConverter.java:74)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.company.base.util.jaxb.XStreamJAXBConverter.marshal(XStreamJAXBConverter.java:77)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:88)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.writeItem(AbstractCollectionConverter.java:64)
    at com.thoughtworks.xstream.converters.collections.MapConverter.marshal(MapConverter.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller$1.convertAnother(AbstractReferenceMarshaller.java:84)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshallField(AbstractReflectionConverter.java:256)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.writeField(AbstractReflectionConverter.java:232)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter$2.(AbstractReflectionConverter.java:195)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doMarshal(AbstractReflectionConverter.java:141)
    at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.marshal(AbstractReflectionConverter.java:89)
    at com.thoughtworks.xstream.core.AbstractReferenceMarshaller.convert(AbstractReferenceMarshaller.java:69)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:58)
    at com.thoughtworks.xstream.core.TreeMarshaller.convertAnother(TreeMarshaller.java:43)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:82)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1043)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1032)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:1020)
    at com.company.recover.impl.fs.FSJobSerializer.serializeJob(FSJobSerializer.java:244)
      - locked com.company.recover.impl.GenericRecoveryJob@9829040
    at com.company.recover.impl.db.RecoveryPoolDBImpl.specificSave(RecoveryPoolDBImpl.java:291)
    at com.company.recover.impl.GenericRecoveryPool.saveJob(GenericRecoveryPool.java:231)
    at com.company.recover.RecoverManager.save(RecoverManager.java:479)
    at com.company.frame.core.FrameWorkRJobHandler.save(FrameWorkRJobHandler.java:511)
    at com.company.frame.header.GenericTask.save(GenericTask.java:434)
    at com.company.httpcontroller.core.SHCTaskInitiator.doInitiation(SHCTaskInitiator.java:222)
    at com.company.httpcontroller.core.SHCTaskInitiator.run(SHCTaskInitiator.java:152)
    at java.lang.Thread.run(Thread.java:745)

    Locked synchronizers: count = 0

Issue with PathConverter

Here's a simple example:

        XStream stream2 = new XStream();
        String xml2 = stream2.toXML(Paths.get("directory space"));
        Path readItBack = (Path) stream2.fromXML(xml2);
        System.out.println(readItBack);

which throws the following:

---- Debugging information ----
cause-exception : java.net.URISyntaxException
cause-message : Illegal character in path at index 9: directory space
class : java.nio.file.Path
required-type : java.nio.file.Path
converter-type : com.thoughtworks.xstream.converters.SingleValueConverterWrapper
wrapped-converter : com.thoughtworks.xstream.converters.extended.PathConverter
path : /path
line number : 1

version : 1.4.9

Which is purely due to the space between "directory" and "space". Am I missing some settings or is this a bug?

Java 8 - Could not instantiate mapper : com.thoughtworks.xstream.mapper.LambdaMapper

Hi, we're having an issue with xstream 1.4.8 (and 1.5.0-SNAPSHOT) on Java 8 but not Java 7. We're literally just calling the constructor which appears to loading lambda handler classes dynamically from the class loader when Java 8 is used.

Is this a known issue or should we be handling this differently?

The code to trigger this is a simple console app with the following in main:
XStream xs = new XStream();

Trace:
com.thoughtworks.xstream.InitializationException: Could not instantiate mapper : com.thoughtworks.xstream.mapper.LambdaMapper : com.thoughtworks.xstream.mapper.LambdaMapper at com.thoughtworks.xstream.XStream.buildMapperDynamically(XStream.java:595) at com.thoughtworks.xstream.XStream.buildMapper(XStream.java:575) at com.thoughtworks.xstream.XStream.<init>(XStream.java:544)

Serialize than deserialize an array with all possible chars fails with StaxDriver

It works with the default driver. It's not really a typical use-case though - it popped up when I generated some random test data.

    char[] chars = new char[(int) Character.MAX_VALUE];
    for (int i = 0; i < chars.length; i++)
        chars[i] = (char) i;
    XStream xstream = new XStream(new StaxDriver());
    // XStream xstream = new XStream(); // This works
    String serialized = xstream.toXML(chars);
    char[] deserialized = (char[]) xstream.fromXML(serialized);
    System.out.println(Arrays.equals(chars, deserialized));

Output xml is not able to replace element name with @XStreamAlias when polymorphism(interface)

I've encountered a case where I need to out toXml a ojbect, which is an aggregate root of a lot of other objects( in which contains a some implementation of interface).

The following is the test to demonstrate the issue.

  • Given I have a interface
    public interface SomeInterface { }
  • And I have an implementation of this interface
    @XStreamAlias("Child") public class Child implements SomeInterface { }
  • And I wrap this implementation with an other object
    @XStreamAlias("Parent") public class Parent { private SomeInterface item; public Parent(SomeInterface item) { this.item = item; } }
  • Then when I run this test , it fails:
    public void shouldGetCorrectAliasWhenPoly() throws Exception {
    String result = xStream.toXML(new Parent(new Child()));
    assertThat(result).isEqualTo("<Parent>\n" + " <Child/>\n" + "</Parent>"); }

Please let me know if this is an issue or not, and I am more than happy to issue a PR to fix this.

Multiple namespaces

I want to have an xml like this

<a:MD_Metadata xmlns:a="http://www.a" xmlns:b="http://www.b" xmlns:c="http://www.c" id="myId" xsi:schemaLocation="http://www.a">
    <a:fileIdA>
        <b:fieldB>myId</b:fieldB>
    </a:fileIdA>
</a:MD_Metadata>

But i have a lot of issues ::
first of all i can found how to remove default

second i can set more than one namespaces. I do that but i can found how to add more than one

     Object object = req.getObject();

    QNameMap nsm = new QNameMap();
    nsm.setDefaultPrefix("a");
    nsm.setDefaultNamespace("http://www.example.com");
    XStream xstream = new XStream(new StaxDriver(nsm));

xstream.alias("Test", ExportXMLDTO.class);
xstream.toXML(object);

I saw examples with new QName() but i get error
java.lang.ClassNotFoundException: javax.xml.namespace.QName not found

@XStreamConverter and registerLocalConverter do not work on attribute fields

I've so far been unable to come up with anything relating to this issue except for the following mailing list issue regarding this: http://markmail.org/thread/qkgmgewmplmav4kc

The following results in the local converter being ignored:

public class Formula {
@XStreamAlias("score")
@XStreamAsAttribute
@XStreamConverter(ScoreConverter.class)
private String score;
}

I've also tried XStream.registerLocalConverter(Formula.class, "score", new ScoreConverter()), but it still does not work.

Only when I remove the @XStreamAsAttribute annotation does the local converter work as expected.

According to the mailing list, the only workaround is to write a custom converter for the entire class. This class has a lot of fields, and I'd much rather allow the default converter to take over for most of the fields and only handle the score field manually.

Is there really no alternative but to write a custom converter for the entire class?

As a side note, what I'm trying to do is to make the attribute optional - as in, the score attribute will not show up if the score is empty. Is this the right way to go about doing so?

XStreamImplicit with ToAttributedValueConverter

Hi again! I continue to play with ToAttributedValueConverter and I've found one more thing that couldn't do with XStream:

I've got code from stackoverflow answer (it works well) and I've changed it like this:

@XStreamAlias("container")
@XStreamConverter(value = ToAttributedValueConverter.class, strings = "numberOfEmployees")
public class Container {
    private String name;

    // any element named numberOfEmployees should go into this list
    @XStreamImplicit(itemFieldName = "numberOfEmployees")
    protected List<NumberOfPersonnel> numberOfEmployees;

    public Container(String name, List<NumberOfPersonnel> noEmp) {
        this.name = name;
        this.numberOfEmployees = noEmp;
    }

    public String toString() {
        return name + ", " + numberOfEmployees;
    }
}

note that there was added the annontation @XStreamConverter(value = ToAttributedValueConverter.class, strings = "numberOfEmployees"). Other code has no changes. And result after marshalling is:

<container name="World" class="java.util.Arrays$ArrayList">
  <a class="ru.open.haven.risk.model.forts.NumberOfPersonnel-array">
    <ru.open.haven.risk.model.forts.NumberOfPersonnel year="2001">1000.0</ru.open.haven.risk.model.forts.NumberOfPersonnel>
    <ru.open.haven.risk.model.forts.NumberOfPersonnel year="2002">500.0</ru.open.haven.risk.model.forts.NumberOfPersonnel>
  </a>
</container>

If I right undestood (from this tutorial) the annotation XStreamImplicit with itemFieldName = "numberOfEmployees" should make marshalling like this:

<container name="World">
  <numberOfEmployees year="2001">1000.0</numberOfEmployees>
  <numberOfEmployees year="2002">500.0</numberOfEmployees>
</container>

(what I was expected)

Thank you!

ConversionException in custom converter

XStream 1.4.9.

XStream created as:
    XStream xStream = new XStream(new StaxDriver(new NoNameCoder()));
    xStream.alias("map", java.util.Map.class);
    xStream.registerConverter(new MapConverter());

the MapConverter code is:

    private static class MapConverter implements Converter {

        private ConcurrentHashMap<String, Class<?>> types = new ConcurrentHashMap<>();

        public boolean canConvert(Class clazz) {
            return Map.class.isAssignableFrom(clazz);
        }

        public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {

            Map<String, Object> map = (Map<String, Object>) value;
            for (Map.Entry<String, Object> entry : map.entrySet()) {
                writer.startNode(entry.getKey());
                Object val = entry.getValue();
                if (val != null) {
                    types.putIfAbsent(entry.getKey(), val.getClass());
                    writer.setValue(val.toString());
                }
                writer.endNode();
            }
        }

        public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {

            Map<String, Object> map = new HashMap<>();
            while (reader.hasMoreChildren()) {
                reader.moveDown();
                String key = reader.getNodeName(); 
                String val = reader.getValue();
                Object value = context.convertAnother(val, types.get(key)); // throws exception!
                map.put(key, value);
                reader.moveUp();
            }
            return map;
        }

    }

It works ok on marshaling phase. But at unmarshaling I get the exception:

com.thoughtworks.xstream.converters.ConversionException: 
---- Debugging information ----
cause-exception     : java.lang.IllegalStateException
cause-message       : Current state is not among the states START_ELEMENT , ATTRIBUTEvalid for getAttributeValue()
class               : java.util.HashMap
required-type       : java.util.HashMap
converter-type      : com.bagri.common.util.XMLUtils$MapEntryConverter
path                : /map/boolProp
line number         : 1
version             : 1.4.9
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:70)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1230)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1214)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1085)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1076)
    at com.bagri.common.util.XMLUtils.mapFromXML(XMLUtils.java:216)
    at com.bagri.xdm.cache.hazelcast.impl.DocumentManagementImpl.getDocumentAsMap(DocumentManagementImpl.java:509)
    at com.bagri.xdm.cache.hazelcast.impl.BindDocumentManagementTest.createMapDocumentTest(BindDocumentManagementTest.java:101)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalStateException: Current state is not among the states START_ELEMENT , ATTRIBUTEvalid for getAttributeValue()
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getAttributeValue(XMLStreamReaderImpl.java:817)
    at com.thoughtworks.xstream.io.xml.StaxReader.getAttribute(StaxReader.java:88)
    at com.thoughtworks.xstream.io.ReaderWrapper.getAttribute(ReaderWrapper.java:52)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:53)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.bagri.common.util.XMLUtils$MapEntryConverter.unmarshal(XMLUtils.java:249)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    ... 39 more

The exception is caused by StaxDriver, because it is not the right state to explore attributes.
The same code works well if I use DomDriver instead of StaxDriver. But I'd prefer to use the second one. Please have a look.

Thanks, Denis.

SqlTimestampConverter doesn't handle parsing strings without fractional second

With a string of "2018-10-11 11:35:17" I get the error below. Apparently fractional seconds are required though the message indicate them as optional. Also java.sql.Timestamp#valueOf(java.lang.String) handles strings without fractional seconds so it would be expected that SqlTimestampConverter would as well.

---- Debugging information ----
message             : Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
class               : java.sql.Timestamp
required-type       : java.sql.Timestamp
converter-type      : com.thoughtworks.xstream.converters.SingleValueConverterWrapper
wrapped-converter   : com.thoughtworks.xstream.converters.extended.SqlTimestampConverter
line number         : 13
class[1]            : se.ticket.order.domain.Order
converter-type[1]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version             : 1.4.9
-------------------------------

InitializationException eats exception of constructor called by @XStreamConverter

We have code like this (in optaplanner.org):

public class CloudBalance {

    @XStreamConverter(value = XStreamScoreConverter.class, types = {HardSoftScoreDefinition.class})
    private HardSoftScore score;

}

public class XStreamScoreConverter {

    public XStreamScoreConverter(Class scoreClass, Class scoreDefinitionClass) {
        if (scoreDefinitionClass.equals(HardSoftScoreDefinition.class)) { // true
            throw new IllegalStateException("Please don't eat me!!!");
        }
    }
}

And that throws this exception:

com.thoughtworks.xstream.InitializationException: Cannot instantiate converter ...XStreamScoreConverter for type ...HardSoftScore : Cannot construct ...XStreamScoreConverter : null

Notice that the IllegalStateException "Please don't eat me!!!" is actually eaten. Instead of being eaten, it should be wrapped as a cause:

Caused by: ...IllegalStateException Please don't eat me!!!

XStream and JavaFX Observable Collection Classes

I am trying to use XStream to Internalize/Externalize some classes that rely on JavaFX Properties and JavaFX Observable collections.

I have been using XStreamFX but have run into a problem with the deserialisation for ObservableListWrapper which seems to fail due is not having a no argument constructor.

I have reported the problem as an XStreamFX Issue but am wondering if XStream will add support for these commonly used FX data classes?

JavaBeanConverter is not handling the IgnoreUnknownElements flag

My post from Google Groups:

I am using XStream 1.4.7 to handle de/serialisation of POJOs. As the project develops, I will need to add new features and therefore new class fields. I would like old versions of the app to handle these changes gracefully and to ignore unknown tags.

xs = new XStream();
xs.setMode(XStream.NO_REFERENCES);
xs.ignoreUnknownElements();
xs.registerConverter(new JavaBeanConverter(xs.getMapper(),
    new TransientRespectingBeanProvider()), XStream.PRIORITY_VERY_LOW);

Yesterday I added a String field to one of my classes and serialised it. An older version of the app was not able to deserialise the xml.

com.thoughtworks.xstream.converters.ConversionException: No field 'materialNrVersion' found in class 'com.company.ProjectConfiguration' : No field 'materialNrVersion' found in class 'com.company.ProjectConfiguration'
---- Debugging information ----
message             : No field 'materialNrVersion' found in class 'com.company.ProjectConfiguration'
cause-exception     : com.thoughtworks.xstream.converters.reflection.MissingFieldException
cause-message       : No field 'materialNrVersion' found in class 'com.company.ProjectConfiguration'
class               : com.company.ProjectConfiguration
required-type       : com.company.ProjectConfiguration
converter-type      : com.thoughtworks.xstream.converters.javabean.JavaBeanConverter
line number         : 192
version             : 1.4.7

Should I be doing this a different way?

UPDATE If I comment out the registerConverter call, then the unknown fields are ignored. The JavaBeanConverter seems to be affecting the way the ignoreUnknownElements is handled. The TransientRespectingBeanProvider is intended to ignore properties which have a @Transientannotation.
----- END POST

My workaround was to override the JavaBeanConverter and make the following patch:

// New constructor
public MyJavaBeanConverter(Mapper mapper, JavaBeanProvider beanProvider, boolean ignoreUnknown) {
    this(mapper, beanProvider, null);
    setIgnoreUnknown(ignoreUnknown);
}

Somewhere near Line 142 in unmarshall() ...

if (mapper.shouldSerializeMember(resultType, propertyName)) {
    try {
        boolean propertyExistsInClass = beanProvider.propertyDefinedInClass(propertyName, resultType);
        if (propertyExistsInClass) {
            Class type = determineType(reader, result, propertyName);
            Object value = context.convertAnother(result, type);
            beanProvider.writeProperty(result, propertyName, value);
            seenProperties.add(new FastField(resultType, propertyName));
        } else {
            throw new MissingFieldException(resultType.getName(), propertyName);
        }
    } catch (MissingFieldException x) {
        // *** ignore missing elements? ***
        if (ignoreUnknown == false)
            throw x;
        else {
            System.out.println(String.format("Ignoring %s in %s", propertyName, resultType)); //$NON-NLS-1$
            }
    }
}

Hope the workaround is not too naïve but it works for me.

Xstream vs. serialPersistentFields

So xstream (v1.4.8) with this line

private Object More ...readField(ObjectStreamField field, Class type, Object instance) {
        try {
           Field javaField = type.getDeclaredField(field.getName());

tries to reach the field named "list" (field.getName() returns "list")

private static final ObjectStreamField[] serialPersistentFields = {
             new ObjectStreamField("list", VirtualFilePermission[].class)
     };

declared in org.jboss.vfs.VirtualFilePermissionCollection but runs into NoSuchFieldException. Why is that?

PowerMockito & x-stream: handle multi part e-mail

I'm trying to write a unit test for an e-mail service I'm working on. It uses an enum and I'm trying to extend that enum in order to see how the code deals with a new enum value.

I'm trying to use powermockito for it and this uses x-stream on the background. First I ran into an java 8 issue, that is fixed in 1.4.8, so I updated x-stream to 1.4.8 to get around that one. But now I'm running into something that I'm not able to fix with just a library upgrade. The debug information from xstream is:

com.thoughtworks.xstream.converters.ConversionException: Cannot construct class java.lang.Class, missing default constructor : javax.activation.ActivationDataFlavor.<init>()
---- Debugging information ----
message             : Cannot construct class java.lang.Class, missing default constructor
cause-exception     : java.lang.NoSuchMethodException
cause-message       : javax.activation.ActivationDataFlavor.<init>()
class               : javax.activation.ActivationDataFlavor
required-type       : javax.activation.ActivationDataFlavor
converter-type      : com.thoughtworks.xstream.converters.reflection.ExternalizableConverter
path                : /org.powermock.modules.junit4.rule.PowerMockStatement$1/outer-class/fNext/next/next/fTarget/emailGateway/mailSender/mimeMessages/javax.mail.internet.MimeMessage/dh/object/parts/javax.mail.internet.MimeBodyPart/dh/object/parts/javax.mail.internet.MimeBodyPart/dh/dataContentHandler/dch/myDF
line number         : 6233
class[1]            : com.sun.mail.handlers.multipart_mixed
converter-type[1]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
class[2]            : javax.activation.ObjectDataContentHandler
class[3]            : javax.activation.DataHandler
class[4]            : javax.mail.internet.MimeBodyPart
class[5]            : java.util.Vector
converter-type[2]   : com.thoughtworks.xstream.converters.collections.CollectionConverter
class[6]            : javax.mail.internet.MimeMultipart
class[7]            : javax.mail.internet.MimeMessage
class[8]            : [Ljavax.mail.internet.MimeMessage;
converter-type[3]   : com.thoughtworks.xstream.converters.collections.ArrayConverter
class[9]            : com.delgurth.service.message.test.MockJavaMailSender
class[10]           : com.delgurth.service.message.SmtpEmailGateway
class[11]           : com.delgurth.service.message.SmtpEmailGatewayTest
class[12]           : org.junit.internal.runners.statements.InvokeMethod
class[13]           : org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks
class[14]           : org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks
class[15]           : org.powermock.modules.junit4.rule.PowerMockStatement
class[16]           : org.powermock.modules.junit4.rule.PowerMockStatement$1
version             : 1.4.8
-------------------------------

Null valueFieldName for ToAttributedValueConverter with annotation XStreamConverter

Hi! I try to marshall class

    @AllArgsConstructor
    @XStreamAlias(value = "message")
    class RendezvousMessage {
        private int messageType;
        private String content;
    }

with ToAttributedValueConverter to next xml representation:

<message messageType="1" content="test"/>

If I init converter manualy:

XStream xStream = new XStream();
Converter converter = new ToAttributedValueConverter(RendezvousMessage.class,
xStream.getMapper(), xStream.getReflectionProvider(), xStream.getConverterLookup(), null);
xStream.registerConverter(converter);

RendezvousMessage msg = new RendezvousMessage(1, "test");
System.out.println(xStream.toXML(msg));

it works fine, but if I try init converter with annotation @XStreamConverter

    @XStreamConverter(value = ToAttributedValueConverter.class)
    @AllArgsConstructor
    @XStreamAlias(value = "message")
    static class RendezvousMessage {
        private int messageType;
        private String content;
    }

I get exeption

com.thoughtworks.xstream.InitializationException: Cannot instantiate converter com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter for type ru.open.haven.risk.model.forts.FutSeriesTest$RendezvousMessage : Cannot construct com.thoughtworks.xstream.converters.extended.ToAttributedValueConverter, none of the dependencies match any constructor's parameters

    at com.thoughtworks.xstream.mapper.AnnotationMapper.cacheConverter(AnnotationMapper.java:542)
    at com.thoughtworks.xstream.mapper.AnnotationMapper.processConverterAnnotations(AnnotationMapper.java:300)
    at com.thoughtworks.xstream.mapper.AnnotationMapper.processTypes(AnnotationMapper.java:194)
    at com.thoughtworks.xstream.mapper.AnnotationMapper.processAnnotations(AnnotationMapper.java:174)
    at com.thoughtworks.xstream.mapper.AnnotationMapper.serializedClass(AnnotationMapper.java:125)
    at com.thoughtworks.xstream.mapper.MapperWrapper.serializedClass(MapperWrapper.java:26)
    at com.thoughtworks.xstream.core.TreeMarshaller.start(TreeMarshaller.java:80)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.marshal(AbstractTreeMarshallingStrategy.java:37)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1022)
    at com.thoughtworks.xstream.XStream.marshal(XStream.java:1011)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:984)
    at com.thoughtworks.xstream.XStream.toXML(XStream.java:971)

What did I do wrong?
Thanks!

Failed to use @XStreamConverter to specify converter with non-default constructor and pass equal values into constructor

Hi.

XStream: 1.4.8

I faced issue that is described here (http://stackoverflow.com/questions/27926281/is-it-possible-to-use-namedmapconverter-in-annotation-how). We can't use @XStreamConverter annotation to specify converter if it has non-default constructor and we want to pass into this constructor equal values for some arguments (for example, NamedMapConverter with keyAsAttribute=true and valueAsAttribute=true). Proposed in stackoverflow workaround works but it is not a good solution

Error scanJAR unable to open input stream on Websphere 8.5.5 startup with XStream-1.4.8

When starting a small web app under Websphere 8.5.5 that uses XStream-1.4.8, I get the stacktrace, below. Using XStream-1.4.7 works as expected.

The exceptions involve the lambda expressions:
scanJAR unable to open input stream for resource com/thoughtworks/xstream/mapper/LambdaMapper.class
unable to open input stream for resource com/thoughtworks/xstream/converters/reflection/LambdaConverter.class

Here's the startup info - it seems to be using Java 1.6.

************ Start Display Current Environment ************
WebSphere Platform 8.5.5.3 [ND 8.5.5.3 cf031430.01][WXS 8.6.0.7 cf71512.19124620] running with process name fakecell-cell4\fakecell4-node1\fake02_1 and process id 3473416
Host Operating System is AIX, version 7.1
Java version = 1.6.0, Java Runtime Version = pap6460_26sr8ifx-20140630_01 (SR8), Java Compiler = j9jit26, Java VM name = IBM J9 VM

[5/18/15 14:07:04:268 EDT] 00000077 ecs W com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl scanJAR unable to open input stream for resource com/thoughtworks/xstream/mapper/LambdaMapper.class in archive WEB-INF/lib/xstream-1.4.8.jar
java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:147)
at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:124)
at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:120)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.scanJAR(ScannerContextImpl.java:275)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.scanJARs(ScannerContextImpl.java:315)
at com.ibm.ws.ecs.internal.scan.context.impl.WARScannerContext.scanInternal(WARScannerContext.java:76)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.scan(ScannerContextImpl.java:87)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.getScannedClasses(ScannerContextImpl.java:70)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.scanForHandlesTypesClasses(WebAppImpl.java:752)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5474)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:938)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)

[5/18/15 14:07:04:293 EDT] 00000077 ecs W com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl scanJAR unable to open input stream for resource com/thoughtworks/xstream/converters/reflection/LambdaConverter.class in archive WEB-INF/lib/xstream-1.4.8.jar
java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:147)
at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:124)
at com.ibm.ws.ecs.internal.scan.impl.ClassScanner.scanInputStream(ClassScanner.java:120)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.scanJAR(ScannerContextImpl.java:275)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.scanJARs(ScannerContextImpl.java:315)
at com.ibm.ws.ecs.internal.scan.context.impl.WARScannerContext.scanInternal(WARScannerContext.java:76)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.scan(ScannerContextImpl.java:87)
at com.ibm.ws.ecs.internal.scan.context.impl.ScannerContextImpl.getScannedClasses(ScannerContextImpl.java:70)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.scanForHandlesTypesClasses(WebAppImpl.java:752)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:600)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5474)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:389)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:332)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:119)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:938)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1864)

pom.xml refers to non-existent surefire plugin version

Shouldn't line 849 in pom.xml

  <version.plugin.maven.surefire>2.4.3</version.plugin.maven.surefire>

be this instead:
<version.plugin.maven.surefire>2.19.1</version.plugin.maven.surefire>
?

2.4.3 of surefire plugin doesn't exist. In any case, until I changed the version to 2.19.1, I could not build.

Failed to deserialized Java 8 ZonedDateTime (JSON format)

If ZonedDateTime be used in JSON format, Xtream would fail in deserialization.

Exception in thread "main" com.thoughtworks.xstream.converters.ConversionException: java.lang.Byte cannot be cast to java.lang.Integer : java.lang.Byte cannot be cast to java.lang.Integer
---- Debugging information ----
message             : java.lang.Byte cannot be cast to java.lang.Integer
cause-exception     : java.lang.ClassCastException
cause-message       : java.lang.Byte cannot be cast to java.lang.Integer
class               : java.time.Ser
required-type       : java.time.Ser
converter-type      : com.thoughtworks.xstream.converters.reflection.ExternalizableConverter
path                : /map/entry/java.time.ZonedDateTime
line number         : -1
class[1]            : java.util.HashMap
converter-type[1]   : com.thoughtworks.xstream.converters.collections.MapConverter
version             : 1.4.8
-------------------------------
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:71)
    at com.thoughtworks.xstream.converters.collections.MapConverter.putCurrentEntryIntoMap(MapConverter.java:110)
    at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:98)
    at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:92)
    at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:87)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
    at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
    at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
    at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1206)
    at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1190)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1061)
    at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1052)

Test Program:

package test;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.Map;

public class TestXStreamSerialization {

    public static void main(String[] args) {
        XStream xstream = new XStream(new JettisonMappedXmlDriver());

        Map<String, Object> toBeSerializedMap = new HashMap<>();
        toBeSerializedMap.put("my_date", ZonedDateTime.now());

        String jsonStr = xstream.toXML(toBeSerializedMap);

        // print {"map":[{"entry":{"string":"my_date","java.time.ZonedDateTime":{"@resolves-to":"java.time.Ser","byte":[6,8,27,10,2,59,32,7],"int":[2015,639000000],"string":"Asia\/Shanghai"}}}]}
        System.out.println("JSON String: " + jsonStr);

        // throw exception here        
        Map<String, Object> map = (Map<String, Object>) xstream.fromXML(jsonStr);
    }
}

SqlTimestampConverter Timezone UTC

Hello,

I got a problem with the fact that SqlTimestampConverter forces its time zone to UTC.
It makes me loose my time zone specificity, so the hour I got is not the good one.

As I use XStream to send my objects to M$ SqlServer, it inserts / updates the time with what I sent, so not the good one...
I tried with ISO8601SqlTimestampConverter, but M$ SqlServer is unable to parse the string to timestamp, so the stored procedure fails.

I had to extends SqlTimestampConverter so I could override "format" field (using reflection) with the good time zone value : "getDefault()".

It would be very convenient to be able to change the time zone with a specific constructor with the time zone as parameter.

Greetings.

Performance degradation through ImplicitCollectionMapper

After upgrading from XStream 1.4.8 to 1.4.9 i observed a huge degradation of the performance for XML (un-)marshalling. XStream suddenly got 50-100% slower.
I created a sampling with VisualVM. In my opinion the reason for the perfomance degradation is the new code for the fix "Implicit collection declaration is erroneously inherited or propagated to hidden field of same name." in the class ImplicitCollectionMapper. This fix leads to massive calls to Class.getDeclaredField, which is extremly expensive.

Would it be a possible, to cache the results of the getDeclaredField call or do you have any other idea for a performance optimization? I implemented a caching solution in the pull request #60 .

JavaBeanConverter can't serialize null values when the property's default value is non-null

As far as I can see, XStream has no way of representing null values (although often requested). While this is no problem for fields with a default value of null, or when the initialization is skipped, it makes JavaBeanConverter fail in simple cases like the following:
Test case where a bean can not be serialized and then deserialized correctly (TestBeanConverter.testNullValue fails while all other tests pass)

My current workaround is adding an is-null attribute to properties that are null . It would be nice to accomplish this without breaking XStream compatibility.

Custom converter on a attribut field

Hi,
i know this topic was often discussed in the past. But i never read a reliable answer.
I really appreciate a solution where i can use a custom converter on a attribute field.

Is there any possibility?

Here a test snippet - The method canConvert() is called. But marsahl() or unmarshal() is never called.

public class XmlTests {
    private String xml =
            "<car para1=\"value1\" para2=\"value2\">\n" +
            "    <another>what</another>\n" +
            "</car>";

    @Test
    public void testXStream() throws Exception {
        XStream xStream = new XStream(new StaxDriver());
        xStream.ignoreUnknownElements();

        // register a converter
        xStream.registerConverter(new MyEnumConverter());
        System.out.println(xStream.getConverterLookup().lookupConverterForType(MyEnum.class));

        xStream.processAnnotations(MyDTO.class);
        MyDTO dto = (MyDTO) xStream.fromXML(xml);
    }

    @XStreamAlias("car")
    public class MyDTO {

        @XStreamAlias("para1")
        @XStreamAsAttribute
        private MyEnum foo;

        @XStreamAlias("para2")
        @XStreamAsAttribute
        private String bar;
    }

    public enum MyEnum {
        VALUE1,
        VALUE2
    }

    public class MyEnumConverter implements Converter {

        @Override
        public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
        }

        @Override
        public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
            return null;
        }

        @Override
        public boolean canConvert(Class type) {
            return type.isEnum();
        }
    }
}

xstream:1.4.9 and 1.4.8 in Android Studio problem

compile 'com.thoughtworks.xstream:xstream:1.4.9'

Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Exception parsing classes
Error:1 error; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: >

com.android.ide.common.process.ProcessException:

java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_71\bin\java.exe'' finished with non-zero exit value 1

Not able to deserialize inner class

Here's a mockup of a class I'd like to serialize:

import java.util.HashMap;
public class OuterClass {
    class InnerClass extends HashMap<String, String> {
        public InnerClass(){
            put("key1","value1");
            put("key2","value2");
            put("key3","value3");
            put("key4","value4");
        }
    }
    private InnerClass field = new InnerClass();
}

with the following XStream serialization:

    XStream xstream = new XStream(new DomDriver());
    xstream.alias("OuterClass", OuterClass.class);
    xstream.registerLocalConverter(OuterClass.class,"field",
            new NamedMapConverter(xstream.getMapper(), "property", "name",
                        String.class, null, String.class,
                        true, false, xstream.getConverterLookup()){
                    public boolean canConvert(Class type){
                        return true;
                    }
                });
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OuterClass myObj = new OuterClass();
    xstream.toXML(myObj,baos);
    System.out.println(baos.toString());
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toString().getBytes());
    xstream.fromXML(bais, myObj);

produces this xml when serialized as expected:

<OuterClass>
  <field>
    <property name="key1">value1</property>
    <property name="key2">value2</property>
    <property name="key3">value3</property>
    <property name="key4">value4</property>
  </field>
</OuterClass>

but this error when deserialized:

com.thoughtworks.xstream.converters.ConversionException: Cannot instantiate OuterClass$InnerClass : OuterClass$InnerClass
---- Debugging information ----
message             : Cannot instantiate OuterClass$InnerClass
cause-exception     : java.lang.InstantiationException
cause-message       : OuterClass$InnerClass
class               : OuterClass$InnerClass
required-type       : OuterClass$InnerClass
converter-type      : SessionWriterTest$1
path                : /OuterClass/field
class[1]            : OuterClass
converter-type[1]   : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
version             : not available
-------------------------------

I'm using XStream 1.4.8. If I move the inner class into its own file, then both serialization and deserialization work.

Is there a bug or am I doing something wrong?

JDK9 : Usage of JDK private API sun.misc.Unsafe by xstream

Hello,
Within Apache JMeter project, we ran jdeps on jmeter and found xstream was using internal libraries from jdk:
xstream-1.4.8.jar ->
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/rt.jar
(Full JRE)
com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider
(xstream-1.4.8.jar)
-> sun.misc.Unsafe JDK
internal API (rt.jar)
com.thoughtworks.xstream.converters.reflection.SunUnsafeReflectionProvider
(xstream-1.4.8.jar)
-> sun.misc.Unsafe JDK
internal API (rt.jar)

Looking at code, it seems to handle correctly the potential missing class by defaulting to SunUnsafeReflectionProvider , but it appears usage is not recommended by Oracle JDK Team :
https://wiki.openjdk.java.net/display/JDK8/Java+Dependency+Analysis+Tool

So if Unsafe is removed , it would introduce some limitation:

  • Cannot newInstance: classes without public visibility, non-static inner classes, classes without default constructors.

Maybe this need should be reported to Oracle (if not already done) within their work to provide alternative to Unsafe through APIs.
Regards
Philippe M.

Converters for collection elements

I would like to see the ability to easily define custom converters for elements inside collections (maps, lists, arrays), especially using annotations, added to XStream. Currently it's only possible to declare custom converters for a type (which results in all conversions of that type to use specified converter), or field (which results in conversion of that field to use specified converter). However, there is no easy way to specify converters for elements in collection fields, which means they are only able to use default or type converters, alternatively one has to write a custom collection converter. It all boils down to being able to affect the selection of item converter in various collection-converting classes. For example in the all-important AbstractReflectionConverter map entries are written using writeItem method which simply calls
context.convertAnother(item);
while other fields are written using more sophisticated writeField and marshallField methods, which call
context.convertAnother(newObj, mapper.getLocalConverter(field.getDeclaringClass(), field.getName()));
looking for a local converter. I don't think it would be very hard to extend the first call to look for the same information, maybe just extend the XStreamConverter annotation to allow specifying whether given converter applies to the field itself, keys of the map, or values of the collection.

Unexpected node when value's type can't be resolved

With XStream 1.4.8 if a converter tries to unmarshal a map containing a value of a type that can't be resolved a ConversionException will be thrown as expected. However, if the converter catches that exception and then tries to continue the reader will be on an unexpected node (most likely "entry").

class whitelisting inconsistencies

I noticed the following inconsistency considering the classes whitelist specification.

When deserializing an object whose class contains Font, String needs to be added additionally to the class whitelist (see e.g. TextParameters and ClassWhitelistingTest).
This made me assume that all classes which are used to build the object would need to be whitelisted (if String needs to be whitelisted then, I thought, you would need to whitelist other classes as well).
This is however not the case which I found out only lately and was surprised by (because I then thought that whitelisting would not work correctly). E.g. it's not the case when String is used directly in one of custom classes (see StringWrapper and testDeserializationWithoutStringInAllowTypesButNoFont()), but I needed some time to find that out.

Perhaps one should document (on http://x-stream.github.io/security.html) that:

  • only the outer-most classes need to be whitelisted and
  • only in case some special classes are used (e.g. Font), one needs to additionally whitelist String.
    (Or alternatively one could make FontConverter trust String by default?)

ClassAliasingMapper itemTypeAsAttribute never works.

I'm pretty sure this can never work, whatever it's intended purpose ( I was trying to create a Shortname class mapper which still respected the aliases. )

public boolean itemTypeAsAttribute(final Class<?> clazz) { return classToName.containsKey(clazz); }

The keys in the map are String type.

Collection conversion seems broken

The implementation of canConvert seems very dubious.
We ran into a production issue where a Guava ImmutableList got converted into an array of arrays instead of a simple array.

Why not, at the very least, replace hardcoded list implementations with List.class.isAssignableFrom(type)?

"Corrupted" values on load and save

My team has recently inherited a codebase that utilizes XStream 1.4.7 to load and save XML for configuration settings which then de-/serializes them from/to custom POCOs. The problem that we're having is that some of the values are getting corrupted during reads or writes. It isn't consistently occurring either which makes it that much more unusual. In most cases, it works perfectly fine with the exact same XML and the exact same POCOs.

A very simplified example (I can't post the exact code and it's a bit more complex so I'm going for an easy way to explain what we're seeing) is given the XML:

<monitor>
  <autostart>true</autostart>
  <name>MYVALUE</name>
</monitor>

Mapped to a POCO:

public class MonitorEntry {
    public Boolean autostart;
    public String name;
}

Loaded with XStream:

XStream xStream = new XStream(new DomDriver());
xStream.alias("Monitor", MonitorEntry.class);
Monitor monitor = (Monitor)xStream.fromXML(myFile);

The value of name in the Monitor object is read in as arVALUE instead of MYVALUE. The garbage characters at the beginning are what throws things off. Even more strangely, if we change the value of the <autostart> element to false then the XML is mapped correctly and the garbage characters do not appear.

To add to the mystery, on our end we're only seeing the corruption on loading XML to objects, but on one particular customer system they are seeing corruption only when actually saving the XML from objects. In this case, it's exactly the opposite of the above scenario. Given the same POCO with name set to MYVALUE, the actual XML written to the XML file becomes:

<monitor>
    <autostart>true</autostart>
    <name>arVALUE</name>
</monitor>

Now for a string value such as name it isn't much of a functional issue as it's just a name that is then just spelled wrong but where this becomes a problem is when mapping the XML value to, for example, an enum and the mapping can't find the enum value.

An example being if there is an enum:

public enum Type { VALUE1, VALUE2 };

And the POCO is:

public class MonitorEntry {
    public Boolean autostart;
    public String name;
    public Type type;
}

With the XML:

<monitor>
    <autostart>true</autostart>
    <name>MYNAME</name>
    <type>VALUE2</type>
</monitor>

But the XML value is being read by XStream as erLUE2 then the XStream mapping won't be able to match the correct enum value and throws an exception such as:

No enum const class com.sample.MonitorEntry$Type.erLUE2

We tried updating to XStream 1.4.8 just to see if perhaps something had been fixed but the behavior persists. The codebase is set to compile to Java 1.6 but we've tried 1.6, 7, and 8 as runtimes just to see if it was a JRE difference or something else environmental.

Has anyone else seen similar issues or have any suggestions on what might cause this? I can further update my post to include more detail if necessary. We've used XStream quite a bit before but never had issues so this is a bit unusual.

context.convertAnother(..) disables xstream.aliasField(..)

If I use context.convertAnother (within a Converter class) it converts it and adds it as a subnode. Yes, however, it's not referred to by the class name instead of the property name.

Example,

public class Node {
    SomeType SomeProperty;
}
public class NodeConverter implements Converter {
    ...
    public void marshal(Object value, HierarchicalStreamWriter writer,  MarshallingContext context) {
        Node node = (Node) value;
        node.convertAnother(node.getSomeProperty);
    }
}

The resulting xml will be something like:

<NodeConverter>
         <SomeObject>..</SomeObject>
</NodeConverter>

Instead of:

<NodeConverter>
         <SomeProperty>..</SomeProperty>
</NodeConverter>

As a result, xstream.aliasField(..) is useless / has no effect. Is this right?

Unmarshalled Throwable's do not allow to add suppressed exceptions

When xstream marshals a Throwable without suppressed exceptions, it keeps the suppressedExceptions collection as-is (i.e. it is the SUPPRESSED_SENTINEL). When it later unmarshals it, it results in a new instance of the unmodifiable collection behind it.

However, since it is not the SUPPRESSED_SENTINEL instance, addSuppressed() does not replace it with an ArrayList. By consequent, trying to add a new suppressed exception throws an UnsupportedOperationException:

java.lang.UnsupportedOperationException
    at java.util.Collections$UnmodifiableCollection.add(Collections.java:1075)
    at java.lang.Throwable.addSuppressed(Throwable.java:1054)
…

I agree that one could argue that this is a bug in addSuppressed. Nevertheless, the implementation of Throwable.readObject() explicitly replaces the suppressedExceptions with SUPPRESSED_SENTINEL if it is an empty list.

Tested with xstream 1.4.8 on Oracle JDK 1.7.0_72-b14.

Add Configuration to XStream to allow initialization on 'first type encounter'

Tried posting this to the mailing group, didnt get any kind of delivery failure, I just didn't get it sent to me, and I presume the mailing lists aren't working.

Hey guys,

Despite our continued use of XStream we still don't have a comfortable place to do XStream configuration. Theres a hodge-podge of serialization configuration, some of it is trying to avoid a direct dependency on XStream, other parts of it are trying to avoid direct dependencies on other jars inside our own codebase, but all of it isn't nice.

Well after spending quite a bit of time learning how XStream works in XSTR-773. I was hoping I could convert all of these places to do something like this:

class MyModel{
    static{      
        OurSerializerInterface.staticRegistry.addConfiguration(“modeA”, “modeB”, “modeC”);
        //This typically results in a new Converter being registered with XStream
    }
    //…
}

The problem with such a system is that if the first ‘encounter’ with a MyModel is its deserialization, then the converter resulting from the ‘doConfiguration’ call wont be registered in time. When XStream is determining what type is represented by the MyModel node in the XML document, it explicitly doesn't load the type (dodging the converter registration), and its only when the actual unmarshalling occurs, and the sun reflection provider creates an instance of the type, that the static block is called.

I stepped into the type-locating and converter-finding logic and discovered that the default mapper decides whether or not to initialize the class (ie, call the static block) based on whether or not the nodes name (typically the fully-canonical name of the type being deserialized) starts with a open square bracket.

What’s the purpose of this code? Can I make a feature request to make it configurable (ie something like xstream.setAlwaysInitializeTypes(true))?

Cheers,

-Geoff

Code bug in xStream 1.4.8 (java.lang.NoSuchFieldError: serializationMembers)?

I am upgrading xStream 1.2 to xStream 1.4.8

I get the following error on application startup:

Caused by: java.lang.NoSuchFieldError: serializationMembers
at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.(AbstractReflectionConverter.java:62)
at com.thoughtworks.xstream.converters.reflection.ReflectionConverter.(reflection:ReflectionConverter.java):8)
at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.(AnnotationReflectionConverter.java:49)
... 37 more

It seems a code bug (in version 1.4.8) to me: AbstractReflectionConverter class accesses serializationMembers field member of serializationMethodInvoker class, serializationMembers is moved to util package in 1.4.8 but access modifier is still default. Which could be an issue because AbstractReflectionConverter and SerializationMethodInvoker both are in the same package but SerializationMembers is in a different package, so access modifier should be changed to public or it should be accessed using getter methods.

AbstractReflectionConverter.Java:
Line 62: serializationMembers = serializationMethodInvoker.serializationMembers;

SerializationMethodInvoker.Java
Line 30: SerializationMembers serializationMembers = new SerializationMembers();

As per documentation this class has been moved to util package. nt

Please let me know if my understanding is correct or doing anything wrong here.

NamedMapConverter not using my valueType

I'm registering a NamedMapConverter for my HashMap like this:

xstream.registerConverter(new MyValueConverter());
xstream.registerConverter(new NamedMapConverter(xstream.getMapper(),
                "mol", "i", Long.class, null, MyValue.class,
                true, false, xstream.getConverterLookup()){
            public boolean canConvert(Class type){
                return type.equals(MoleculeCache.class);
            }
        });

where MyValueConverter is implements SingleValueConverter. Using print statements, I can see MyValueConverter.toString being called, but MyValueConverter.fromString is not when I'm deserializing. If I switch to this type of NamedMapConverter, then my MyValueConverter.fromString is being called:

new NamedMapConverter(xstream.getMapper(), null, "key", String.class, "value", MyValue.class)

Am I doing something wrong?

Sometimes the high concurrency can lead to CPU 100%

Sometimes the high concurrency can lead to CPU 100%.Proposed 'com.thoughtworks.xstream.core.util.PrioritizedList:private final Set set = new TreeSet();' to 'private final Set set = new ConcurrentSkipListSet();'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.