fixed a serialization form of Result so that it works like a value type.

See http://d.hatena.ne.jp/masanobuimai/20090911#1252684658

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21663 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-09-14 22:56:08 +00:00
1 parent a06763a324
commit 73f1b2ebac
2 files changed
+57

No files matched your search

@@ -25,6 +25,8 @@ package hudson.util;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.mapper.Mapper;
import com.thoughtworks.xstream.mapper.MapperWrapper;
import com.thoughtworks.xstream.mapper.ImmutableTypesMapper;
import com.thoughtworks.xstream.converters.Converter;
import com.thoughtworks.xstream.converters.DataHolder;
import com.thoughtworks.xstream.converters.MarshallingContext;
@@ -34,6 +36,7 @@ import com.thoughtworks.xstream.io.HierarchicalStreamDriver;
import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import hudson.model.Hudson;
import hudson.model.Result;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -82,6 +85,14 @@ public class XStream2 extends XStream {
registerConverter(new RobustReflectionConverter(getMapper(),new JVM().bestReflectionProvider()),-19);
}
@Override
protected MapperWrapper wrapMapper(MapperWrapper next) {
// list up types that should be marshalled out like a value, without referencial integrity tracking.
ImmutableTypesMapper itm = new ImmutableTypesMapper(next);
itm.addImmutableType(Result.class);
return itm;
}
/**
* If a class defines a nested {@code ConverterImpl} subclass, use that as a {@link Converter}.
*/