Index: 3rdParty_sources/versions.txt =================================================================== diff -u -r188531e2b734df509672788d897e1030e4b1a24a -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/versions.txt (.../versions.txt) (revision 188531e2b734df509672788d897e1030e4b1a24a) +++ 3rdParty_sources/versions.txt (.../versions.txt) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -61,6 +61,6 @@ xmltooling 1.4.0 -XStream 1.4.10 +XStream 1.4.11 websocket api_1.1_spec-1.1.3.Final \ No newline at end of file Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/XStream.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/XStream.java (.../XStream.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/XStream.java (.../XStream.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -338,7 +338,8 @@ private SecurityMapper securityMapper; private AnnotationConfiguration annotationConfiguration; - private transient boolean insecureWarning; + private transient boolean securityInitialized; + private transient boolean securityWarningGiven; public static final int NO_REFERENCES = 1001; public static final int ID_REFERENCES = 1002; @@ -611,19 +612,19 @@ mapper = new ArrayMapper(mapper); mapper = new DefaultImplementationsMapper(mapper); mapper = new AttributeMapper(mapper, converterLookup, reflectionProvider); - if (JVM.is15()) { + if (JVM.isVersion(5)) { mapper = buildMapperDynamically( "com.thoughtworks.xstream.mapper.EnumMapper", new Class[]{Mapper.class}, new Object[]{mapper}); } mapper = new LocalConversionMapper(mapper); mapper = new ImmutableTypesMapper(mapper); - if (JVM.is18()) { + if (JVM.isVersion(8)) { mapper = buildMapperDynamically("com.thoughtworks.xstream.mapper.LambdaMapper", new Class[]{Mapper.class}, new Object[]{mapper}); } mapper = new SecurityMapper(mapper); - if (JVM.is15()) { + if (JVM.isVersion(5)) { mapper = buildMapperDynamically(ANNOTATION_MAPPER_TYPE, new Class[]{ Mapper.class, ConverterRegistry.class, ConverterLookup.class, ClassLoaderReference.class, ReflectionProvider.class}, new Object[]{ @@ -696,7 +697,7 @@ } addPermission(AnyTypePermission.ANY); - insecureWarning = true; + securityInitialized = false; } /** @@ -711,7 +712,7 @@ * @since 1.4.10 */ public static void setupDefaultSecurity(final XStream xstream) { - if (xstream.insecureWarning) { + if (!xstream.securityInitialized) { xstream.addPermission(NoTypePermission.NONE); xstream.addPermission(NullPermission.NULL); xstream.addPermission(PrimitiveTypePermission.PRIMITIVES); @@ -758,7 +759,7 @@ types.add(JVM.loadClassForName("java.sql.Time")); types.add(JVM.loadClassForName("java.sql.Date")); } - if (JVM.is18()) { + if (JVM.isVersion(8)) { xstream.allowTypeHierarchy(JVM.loadClassForName("java.time.Clock")); types.add(JVM.loadClassForName("java.time.Duration")); types.add(JVM.loadClassForName("java.time.Instant")); @@ -871,7 +872,7 @@ alias("locale", Locale.class); alias("gregorian-calendar", Calendar.class); - if (JVM.is14()) { + if (JVM.isVersion(4)) { aliasDynamically("auth-subject", "javax.security.auth.Subject"); alias("linked-hash-map", JVM.loadClassForName("java.util.LinkedHashMap")); alias("linked-hash-set", JVM.loadClassForName("java.util.LinkedHashSet")); @@ -880,7 +881,7 @@ aliasType("charset", JVM.loadClassForName("java.nio.charset.Charset")); } - if (JVM.is15()) { + if (JVM.isVersion(5)) { aliasDynamically("xml-duration", "javax.xml.datatype.Duration"); alias("concurrent-hash-map", JVM.loadClassForName("java.util.concurrent.ConcurrentHashMap")); alias("enum-set", JVM.loadClassForName("java.util.EnumSet")); @@ -889,11 +890,11 @@ alias("uuid", JVM.loadClassForName("java.util.UUID")); } - if (JVM.is17()) { + if (JVM.isVersion(7)) { aliasType("path", JVM.loadClassForName("java.nio.file.Path")); } - if (JVM.is18()) { + if (JVM.isVersion(8)) { alias("fixed-clock", JVM.loadClassForName("java.time.Clock$FixedClock")); alias("offset-clock", JVM.loadClassForName("java.time.Clock$OffsetClock")); alias("system-clock", JVM.loadClassForName("java.time.Clock$SystemClock")); @@ -1016,7 +1017,7 @@ registerConverter(new LocaleConverter(), PRIORITY_NORMAL); registerConverter(new GregorianCalendarConverter(), PRIORITY_NORMAL); - if (JVM.is14()) { + if (JVM.isVersion(4)) { // late bound converters - allows XStream to be compiled on earlier JDKs registerConverterDynamically( "com.thoughtworks.xstream.converters.extended.SubjectConverter", @@ -1039,7 +1040,7 @@ PRIORITY_NORMAL, null, null); } - if (JVM.is15()) { + if (JVM.isVersion(5)) { // late bound converters - allows XStream to be compiled on earlier JDKs if (JVM.loadClassForName("javax.xml.datatype.Duration") != null) { registerConverterDynamically( @@ -1066,11 +1067,11 @@ registerConverterDynamically("com.thoughtworks.xstream.converters.extended.ActivationDataFlavorConverter", PRIORITY_NORMAL, null, null); } - if (JVM.is17()) { + if (JVM.isVersion(7)) { registerConverterDynamically("com.thoughtworks.xstream.converters.extended.PathConverter", PRIORITY_NORMAL, null, null); } - if (JVM.is18()) { + if (JVM.isVersion(8)) { registerConverterDynamically("com.thoughtworks.xstream.converters.time.ChronologyConverter", PRIORITY_NORMAL, null, null); registerConverterDynamically("com.thoughtworks.xstream.converters.time.DurationConverter", PRIORITY_NORMAL, @@ -1176,7 +1177,7 @@ addImmutableType(File.class, false); addImmutableType(Class.class, false); - if (JVM.is17()) { + if (JVM.isVersion(7)) { Class type = JVM.loadClassForName("java.nio.file.Paths"); if (type != null) { Method methodGet; @@ -1200,13 +1201,13 @@ addImmutableTypeDynamically("java.awt.font.TextAttribute", false); } - if (JVM.is14()) { + if (JVM.isVersion(4)) { // late bound types - allows XStream to be compiled on earlier JDKs addImmutableTypeDynamically("java.nio.charset.Charset", true); addImmutableTypeDynamically("java.util.Currency", true); } - if (JVM.is15()) { + if (JVM.isVersion(5)) { addImmutableTypeDynamically("java.util.UUID", true); } @@ -1215,7 +1216,7 @@ addImmutableType(Collections.EMPTY_SET.getClass(), true); addImmutableType(Collections.EMPTY_MAP.getClass(), true); - if (JVM.is18()) { + if (JVM.isVersion(8)) { addImmutableTypeDynamically("java.time.Duration", false); addImmutableTypeDynamically("java.time.Instant", false); addImmutableTypeDynamically("java.time.LocalDate", false); @@ -1479,8 +1480,8 @@ */ public Object unmarshal(HierarchicalStreamReader reader, Object root, DataHolder dataHolder) { try { - if (insecureWarning) { - insecureWarning = false; + if (!securityInitialized && !securityWarningGiven) { + securityWarningGiven = true; System.err.println("Security framework of XStream not initialized, XStream is probably vulnerable."); } return marshallingStrategy.unmarshal( @@ -2359,7 +2360,7 @@ */ public void addPermission(TypePermission permission) { if (securityMapper != null) { - insecureWarning &= permission != NoTypePermission.NONE; + securityInitialized = true; securityMapper.addPermission(permission); } } @@ -2510,6 +2511,11 @@ denyPermission(new WildcardTypePermission(patterns)); } + private Object readResolve() { + securityWarningGiven = true; + return this; + } + /** * @deprecated As of 1.3, use {@link com.thoughtworks.xstream.InitializationException} * instead @@ -2538,7 +2544,7 @@ public boolean canConvert(final Class type) { return (type == void.class || type == Void.class) - || (insecureWarning + || (!securityInitialized && type != null && (type.getName().equals("java.beans.EventHandler") || type.getName().endsWith("$LazyIterator") Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/XStreamer.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/XStreamer.java (.../XStreamer.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/XStreamer.java (.../XStreamer.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2014, 2016, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2014, 2016, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -36,7 +36,6 @@ import com.thoughtworks.xstream.io.naming.NameCoder; import com.thoughtworks.xstream.io.xml.XppDriver; import com.thoughtworks.xstream.mapper.Mapper; -import com.thoughtworks.xstream.security.AnyTypePermission; import com.thoughtworks.xstream.security.TypeHierarchyPermission; import com.thoughtworks.xstream.security.TypePermission; import com.thoughtworks.xstream.security.WildcardTypePermission; @@ -252,7 +251,7 @@ */ public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml) throws IOException, ClassNotFoundException { - return fromXML(driver, xml, new TypePermission[]{AnyTypePermission.ANY}); + return fromXML(driver, xml, PERMISSIONS); } /** Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BigDecimalConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BigDecimalConverter.java (.../BigDecimalConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BigDecimalConverter.java (.../BigDecimalConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -22,7 +22,7 @@ public class BigDecimalConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(BigDecimal.class); + return type == BigDecimal.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BigIntegerConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BigIntegerConverter.java (.../BigIntegerConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BigIntegerConverter.java (.../BigIntegerConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -21,7 +21,7 @@ public class BigIntegerConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(BigInteger.class); + return type == BigInteger.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BooleanConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BooleanConverter.java (.../BooleanConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/BooleanConverter.java (.../BooleanConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2014 XStream Committers. + * Copyright (C) 2006, 2007, 2014, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -22,9 +22,7 @@ public class BooleanConverter extends AbstractSingleValueConverter { public static final BooleanConverter TRUE_FALSE = new BooleanConverter("true", "false", false); - public static final BooleanConverter YES_NO = new BooleanConverter("yes", "no", false); - public static final BooleanConverter BINARY = new BooleanConverter("1", "0", true); private final String positive; @@ -49,7 +47,7 @@ } public boolean canConvert(final Class type) { - return type.equals(boolean.class) || type.equals(Boolean.class); + return type == boolean.class || type == Boolean.class; } public Object fromString(final String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/ByteConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/ByteConverter.java (.../ByteConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/ByteConverter.java (.../ByteConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -20,7 +20,7 @@ public class ByteConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(byte.class) || type.equals(Byte.class); + return type == byte.class || type == Byte.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/CharConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/CharConverter.java (.../CharConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/CharConverter.java (.../CharConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -28,7 +28,7 @@ public class CharConverter implements Converter, SingleValueConverter { public boolean canConvert(Class type) { - return type.equals(char.class) || type.equals(Character.class); + return type == char.class || type == Character.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/DateConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/DateConverter.java (.../DateConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/DateConverter.java (.../DateConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -201,7 +201,7 @@ } public boolean canConvert(Class type) { - return type.equals(Date.class); + return type == Date.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/DoubleConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/DoubleConverter.java (.../DoubleConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/DoubleConverter.java (.../DoubleConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -20,7 +20,7 @@ public class DoubleConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(double.class) || type.equals(Double.class); + return type == double.class || type == Double.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/FloatConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/FloatConverter.java (.../FloatConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/FloatConverter.java (.../FloatConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -20,7 +20,7 @@ public class FloatConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(float.class) || type.equals(Float.class); + return type == float.class || type == Float.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/IntConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/IntConverter.java (.../IntConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/IntConverter.java (.../IntConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2014, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -20,7 +20,7 @@ public class IntConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(int.class) || type.equals(Integer.class); + return type == int.class || type == Integer.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/LongConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/LongConverter.java (.../LongConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/LongConverter.java (.../LongConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -19,7 +19,7 @@ public class LongConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(long.class) || type.equals(Long.class); + return type == long.class || type == Long.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/ShortConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/ShortConverter.java (.../ShortConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/ShortConverter.java (.../ShortConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -20,7 +20,7 @@ public class ShortConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(short.class) || type.equals(Short.class); + return type == short.class || type == Short.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringBufferConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringBufferConverter.java (.../StringBufferConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringBufferConverter.java (.../StringBufferConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -23,6 +23,6 @@ } public boolean canConvert(Class type) { - return type.equals(StringBuffer.class); + return type == StringBuffer.class; } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringBuilderConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringBuilderConverter.java (.../StringBuilderConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringBuilderConverter.java (.../StringBuilderConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 XStream Committers. + * Copyright (C) 2008, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -22,6 +22,6 @@ } public boolean canConvert(Class type) { - return type.equals(StringBuilder.class); + return type == StringBuilder.class; } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringConverter.java (.../StringConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/StringConverter.java (.../StringConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2011 XStream Committers. + * Copyright (C) 2006, 2007, 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -81,7 +81,7 @@ } public boolean canConvert(final Class type) { - return type.equals(String.class); + return type == String.class; } public Object fromString(final String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/URIConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/URIConverter.java (.../URIConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/URIConverter.java (.../URIConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 XStream Committers. + * Copyright (C) 2010, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -24,7 +24,7 @@ public class URIConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(URI.class); + return type == URI.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/URLConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/URLConverter.java (.../URLConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/URLConverter.java (.../URLConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -24,7 +24,7 @@ public class URLConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(URL.class); + return type == URL.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/UUIDConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/UUIDConverter.java (.../UUIDConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/basic/UUIDConverter.java (.../UUIDConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 XStream Committers. + * Copyright (C) 2008, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -23,7 +23,7 @@ public class UUIDConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(UUID.class); + return type == UUID.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/AbstractCollectionConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/AbstractCollectionConverter.java (.../AbstractCollectionConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/AbstractCollectionConverter.java (.../AbstractCollectionConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2013, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -51,28 +51,104 @@ public abstract Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context); - - + /** + * @deprecated As of 1.4.11 use {@link #writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)} + * instead. + */ protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) { // PUBLISHED API METHOD! If changing signature, ensure backwards compatibility. if (item == null) { // todo: this is duplicated in TreeMarshaller.start() - String name = mapper().serializedClass(null); - ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, Mapper.Null.class); - writer.endNode(); + writeNullItem(context, writer); } else { String name = mapper().serializedClass(item.getClass()); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, item.getClass()); - context.convertAnother(item); + writeBareItem(item, context, writer); writer.endNode(); } } - protected Object readItem(HierarchicalStreamReader reader, UnmarshallingContext context, Object current) { + /** + * Write an item of the collection into the writer including surrounding tags. + * + * @param item the item to write + * @param context the current marshalling context + * @param writer the target writer + * @since 1.4.11 + */ + protected void writeCompleteItem(final Object item, final MarshallingContext context, + final HierarchicalStreamWriter writer) { + writeItem(item, context, writer); + } + + /** + * Write the bare item of the collection into the writer. + * + * @param item the item to write + * @param context the current marshalling context + * @param writer the target writer + * @since 1.4.11 + */ + protected void writeBareItem(final Object item, final MarshallingContext context, + final HierarchicalStreamWriter writer) { + context.convertAnother(item); + } + + /** + * Write a null item of the collection into the writer. The method readItem should be able to process the written + * data i.e. it has to write the tags or may not write anything at all. + * + * @param context the current marshalling context + * @param writer the target writer + * @since 1.4.11 + */ + protected void writeNullItem(final MarshallingContext context, final HierarchicalStreamWriter writer) { + final String name = mapper().serializedClass(null); + ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, Mapper.Null.class); + writer.endNode(); + } + + /** + * @deprecated As of 1.4.11 use {@link #readBareItem(HierarchicalStreamReader, UnmarshallingContext, Object)} or + * {@link #readCompleteItem(HierarchicalStreamReader, UnmarshallingContext, Object)} instead. + */ + protected Object readItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, + final Object current) { + return readBareItem(reader, context, current); + } + + /** + * Read a bare item of the collection from the reader. + * + * @param reader the source reader + * @param context the unmarshalling context + * @param current the target collection (if already available) + * @return the read item + * @since 1.4.11 + */ + protected Object readBareItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, + final Object current) { Class type = HierarchicalStreams.readClassType(reader, mapper()); return context.convertAnother(current, type); } + /** + * Read an item of the collection including the tags from the reader. + * + * @param reader the source reader + * @param context the unmarshalling context + * @param current the target collection (if already available) + * @return the read item + * @since 1.4.11 + */ + protected Object readCompleteItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, + final Object current) { + reader.moveDown(); + final Object result = readItem(reader, context, current); + reader.moveUp(); + return result; + } + protected Object createCollection(Class type) { ErrorWritingException ex = null; Class defaultType = mapper().defaultImplementationOf(type); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/ArrayConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/ArrayConverter.java (.../ArrayConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/ArrayConverter.java (.../ArrayConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -35,14 +35,14 @@ } public boolean canConvert(Class type) { - return type.isArray(); + return type != null && type.isArray(); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { int length = Array.getLength(source); for (int i = 0; i < length; i++) { - Object item = Array.get(source, i); - writeItem(item, context, writer); + final Object item = Array.get(source, i); + writeCompleteItem(item, context, writer); } } @@ -51,10 +51,8 @@ // read the items from xml into a list List items = new ArrayList(); while (reader.hasMoreChildren()) { - reader.moveDown(); - Object item = readItem(reader, context, null); // TODO: arg, what should replace null? + final Object item = readCompleteItem(reader, context, null); // TODO: arg, what should replace null? items.add(item); - reader.moveUp(); } // now convertAnother the list into an array // (this has to be done as a separate list as the array size is not Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/BitSetConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/BitSetConverter.java (.../BitSetConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/BitSetConverter.java (.../BitSetConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -29,7 +29,7 @@ public class BitSetConverter implements Converter { public boolean canConvert(Class type) { - return type.equals(BitSet.class); + return type == BitSet.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/CharArrayConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/CharArrayConverter.java (.../CharArrayConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/CharArrayConverter.java (.../CharArrayConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -26,7 +26,7 @@ public class CharArrayConverter implements Converter { public boolean canConvert(Class type) { - return type.isArray() && type.getComponentType().equals(char.class); + return type != null && type.isArray() && type.getComponentType().equals(char.class); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/CollectionConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/CollectionConverter.java (.../CollectionConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/CollectionConverter.java (.../CollectionConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2010, 2011, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -13,7 +13,6 @@ import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.UnmarshallingContext; -import com.thoughtworks.xstream.core.JVM; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.mapper.Mapper; @@ -22,6 +21,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.Vector; @@ -64,14 +64,14 @@ || type.equals(HashSet.class) || type.equals(LinkedList.class) || type.equals(Vector.class) - || (JVM.is14() && type.getName().equals("java.util.LinkedHashSet")); + || type.equals(LinkedHashSet.class); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Collection collection = (Collection) source; for (Iterator iterator = collection.iterator(); iterator.hasNext();) { Object item = iterator.next(); - writeItem(item, context, writer); + writeCompleteItem(item, context, writer); } } @@ -95,7 +95,7 @@ protected void addCurrentElementToCollection(HierarchicalStreamReader reader, UnmarshallingContext context, Collection collection, Collection target) { - Object item = readItem(reader, context, collection); + final Object item = readItem(reader, context, collection); // call readBareItem when deprecated method is removed target.add(item); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/MapConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/MapConverter.java (.../MapConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/MapConverter.java (.../MapConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -75,8 +75,8 @@ Map.Entry entry = (Map.Entry) iterator.next(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, entryName, entry.getClass()); - writeItem(entry.getKey(), context, writer); - writeItem(entry.getValue(), context, writer); + writeCompleteItem(entry.getKey(), context, writer); + writeCompleteItem(entry.getValue(), context, writer); writer.endNode(); } @@ -102,14 +102,8 @@ protected void putCurrentEntryIntoMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map map, Map target) { - reader.moveDown(); - Object key = readItem(reader, context, map); - reader.moveUp(); - - reader.moveDown(); - Object value = readItem(reader, context, map); - reader.moveUp(); - + final Object key = readCompleteItem(reader, context, map); + final Object value = readCompleteItem(reader, context, map); target.put(key, value); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/SingletonCollectionConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/SingletonCollectionConverter.java (.../SingletonCollectionConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/SingletonCollectionConverter.java (.../SingletonCollectionConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 XStream Committers. + * Copyright (C) 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -47,9 +47,7 @@ } public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { - reader.moveDown(); - Object item = readItem(reader, context, null); - reader.moveUp(); + final Object item = readCompleteItem(reader, context, null); return context.getRequiredType() == LIST ? (Object)Collections.singletonList(item) : (Object)Collections.singleton(item); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/SingletonMapConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/SingletonMapConverter.java (.../SingletonMapConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/SingletonMapConverter.java (.../SingletonMapConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 XStream Committers. + * Copyright (C) 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -46,14 +46,9 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { reader.moveDown(); - reader.moveDown(); - Object key = readItem(reader, context, null); + final Object key = readCompleteItem(reader, context, null); + final Object value = readCompleteItem(reader, context, null); reader.moveUp(); - - reader.moveDown(); - Object value = readItem(reader, context, null); - reader.moveUp(); - reader.moveUp(); return Collections.singletonMap(key, value); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/TreeMapConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/TreeMapConverter.java (.../TreeMapConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/TreeMapConverter.java (.../TreeMapConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -74,7 +74,7 @@ TreeMap result = comparatorField != null ? new TreeMap() : null; final Comparator comparator = unmarshalComparator(reader, context, result); if (result == null) { - result = comparator == null ? new TreeMap() : new TreeMap(comparator); + result = comparator == null || comparator == NULL_MARKER ? new TreeMap() : new TreeMap(comparator); } populateTreeMap(reader, context, result, comparator); return result; Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/TreeSetConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/TreeSetConverter.java (.../TreeSetConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/collections/TreeSetConverter.java (.../TreeSetConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2014, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2014, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -150,7 +150,7 @@ protected void putCurrentEntryIntoMap(HierarchicalStreamReader reader, UnmarshallingContext context, Map map, Map target) { - Object key = readItem(reader, context, map); + final Object key = readItem(reader, context, map); // call readBareItem when deprecated method is removed target.put(key, key); } }; Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumConverter.java (.../EnumConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumConverter.java (.../EnumConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2009, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2009, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -31,7 +31,7 @@ public class EnumConverter implements Converter { public boolean canConvert(Class type) { - return type.isEnum() || Enum.class.isAssignableFrom(type); + return type != null && type.isEnum() || Enum.class.isAssignableFrom(type); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumSetConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumSetConverter.java (.../EnumSetConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumSetConverter.java (.../EnumSetConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -47,7 +47,7 @@ } public boolean canConvert(Class type) { - return typeField != null && EnumSet.class.isAssignableFrom(type); + return typeField != null && type != null && EnumSet.class.isAssignableFrom(type); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumSingleValueConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumSingleValueConverter.java (.../EnumSingleValueConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumSingleValueConverter.java (.../EnumSingleValueConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2010, 2013 XStream Committers. + * Copyright (C) 2008, 2009, 2010, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -33,7 +33,7 @@ @Override public boolean canConvert(Class type) { - return enumType.isAssignableFrom(type); + return type != null && enumType.isAssignableFrom(type); } @Override Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumToStringConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumToStringConverter.java (.../EnumToStringConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/enums/EnumToStringConverter.java (.../EnumToStringConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2016 XStream Committers. + * Copyright (C) 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -78,7 +78,7 @@ @Override public boolean canConvert(Class type) { - return enumType.isAssignableFrom(type); + return type != null && enumType.isAssignableFrom(type); } @Override Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/CharsetConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/CharsetConverter.java (.../CharsetConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/CharsetConverter.java (.../CharsetConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -23,7 +23,7 @@ public class CharsetConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return Charset.class.isAssignableFrom(type); + return type != null && Charset.class.isAssignableFrom(type); } public String toString(Object obj) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ColorConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ColorConverter.java (.../ColorConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ColorConverter.java (.../ColorConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -33,7 +33,7 @@ public boolean canConvert(Class type) { // String comparison is used here because Color.class loads the class which in turns instantiates AWT, // which is nasty if you don't want it. - return type.getName().equals("java.awt.Color"); + return type != null && type.getName().equals("java.awt.Color"); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/CurrencyConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/CurrencyConverter.java (.../CurrencyConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/CurrencyConverter.java (.../CurrencyConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -25,7 +25,7 @@ public class CurrencyConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(Currency.class); + return type == Currency.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/DurationConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/DurationConverter.java (.../DurationConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/DurationConverter.java (.../DurationConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2011 XStream Committers. + * Copyright (C) 2007, 2008, 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -48,8 +48,8 @@ this.factory = factory; } - public boolean canConvert(Class c) { - return factory != null && Duration.class.isAssignableFrom(c); + public boolean canConvert(Class type) { + return factory != null && type != null && Duration.class.isAssignableFrom(type); } public Object fromString(String s) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/DynamicProxyConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/DynamicProxyConverter.java (.../DynamicProxyConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/DynamicProxyConverter.java (.../DynamicProxyConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2010, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2010, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -72,7 +72,7 @@ } public boolean canConvert(Class type) { - return type.equals(DynamicProxyMapper.DynamicProxy.class) || Proxy.isProxyClass(type); + return type != null && (type.equals(DynamicProxyMapper.DynamicProxy.class) || Proxy.isProxyClass(type)); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/EncodedByteArrayConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/EncodedByteArrayConverter.java (.../EncodedByteArrayConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/EncodedByteArrayConverter.java (.../EncodedByteArrayConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,12 +1,12 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2010 XStream Committers. + * Copyright (C) 2006, 2007, 2010, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD * style license a copy of which has been included with this distribution in * the LICENSE.txt file. - * + * * Created on 03. March 2004 by Joe Walnes */ package com.thoughtworks.xstream.converters.extended; @@ -16,7 +16,8 @@ import com.thoughtworks.xstream.converters.SingleValueConverter; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.converters.basic.ByteConverter; -import com.thoughtworks.xstream.core.util.Base64Encoder; +import com.thoughtworks.xstream.core.JVM; +import com.thoughtworks.xstream.core.StringCodec; import com.thoughtworks.xstream.io.HierarchicalStreamReader; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; @@ -25,18 +26,35 @@ import java.util.List; /** - * Converts a byte array to a single Base64 encoding string. + * Converts a byte array by default to a single Base64 encoding string. * * @author Joe Walnes * @author Jörg Schaible */ public class EncodedByteArrayConverter implements Converter, SingleValueConverter { - private static final Base64Encoder base64 = new Base64Encoder(); private static final ByteConverter byteConverter = new ByteConverter(); + private final StringCodec codec; + /** + * Constructs an EncodedByteArrayConverter. Initializes the converter with a Base64 codec. + */ + public EncodedByteArrayConverter() { + this(JVM.getBase64Codec()); + } + + /** + * Constructs an EncodedByteArrayConverter with a provided string codec. + * + * @param stringCodec the codec to encode and decode the data as string + * @since 1.4.11 + */ + public EncodedByteArrayConverter(final StringCodec stringCodec) { + codec = stringCodec; + } + public boolean canConvert(Class type) { - return type.isArray() && type.getComponentType().equals(byte.class); + return type != null && type.isArray() && type.getComponentType().equals(byte.class); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { @@ -73,11 +91,11 @@ return result; } - public String toString(Object obj) { - return base64.encode((byte[]) obj); + public String toString(final Object obj) { + return codec.encode((byte[])obj); } - public Object fromString(String str) { - return base64.decode(str); + public Object fromString(final String str) { + return codec.decode(str); } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/FileConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/FileConverter.java (.../FileConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/FileConverter.java (.../FileConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -24,7 +24,7 @@ public class FileConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(File.class); + return type == File.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/FontConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/FontConverter.java (.../FontConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/FontConverter.java (.../FontConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -60,7 +60,8 @@ public boolean canConvert(Class type) { // String comparison is used here because Font.class loads the class which in turns instantiates AWT, // which is nasty if you don't want it. - return type.getName().equals("java.awt.Font") || type.getName().equals("javax.swing.plaf.FontUIResource"); + return type != null + && (type.getName().equals("java.awt.Font") || type.getName().equals("javax.swing.plaf.FontUIResource")); } public void marshal(Object source, HierarchicalStreamWriter writer, @@ -113,7 +114,7 @@ } else { attributes = Collections.EMPTY_MAP; } - if (!JVM.is16()) { + if (!JVM.isVersion(6)) { for (Iterator iter = attributes.values().iterator(); iter.hasNext(); ) { if (iter.next() == null) { iter.remove(); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/GregorianCalendarConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/GregorianCalendarConverter.java (.../GregorianCalendarConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/GregorianCalendarConverter.java (.../GregorianCalendarConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -32,7 +32,7 @@ public class GregorianCalendarConverter implements Converter { public boolean canConvert(Class type) { - return type.equals(GregorianCalendar.class); + return type == GregorianCalendar.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601DateConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601DateConverter.java (.../ISO8601DateConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601DateConverter.java (.../ISO8601DateConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -29,7 +29,7 @@ private final ISO8601GregorianCalendarConverter converter = new ISO8601GregorianCalendarConverter(); public boolean canConvert(Class type) { - return type.equals(Date.class) && converter.canConvert(GregorianCalendar.class); + return type == Date.class && converter.canConvert(GregorianCalendar.class); } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601GregorianCalendarConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601GregorianCalendarConverter.java (.../ISO8601GregorianCalendarConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601GregorianCalendarConverter.java (.../ISO8601GregorianCalendarConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2011, 2013, 2014, 2015, 2016, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2011, 2013, 2014, 2015, 2016, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -35,7 +35,7 @@ public ISO8601GregorianCalendarConverter() { SingleValueConverter svConverter = null; - final Class type = JVM.loadClassForName(JVM.is18() + final Class type = JVM.loadClassForName(JVM.isVersion(8) ? "com.thoughtworks.xstream.core.util.ISO8601JavaTimeConverter" : "com.thoughtworks.xstream.core.util.ISO8601JodaTimeConverter"); try { @@ -54,7 +54,7 @@ } public boolean canConvert(final Class type) { - return converter != null && type.equals(GregorianCalendar.class); + return converter != null && type == GregorianCalendar.class; } public Object fromString(final String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601SqlTimestampConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601SqlTimestampConverter.java (.../ISO8601SqlTimestampConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ISO8601SqlTimestampConverter.java (.../ISO8601SqlTimestampConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -27,7 +27,7 @@ private final static String PADDING = "000000000"; public boolean canConvert(Class type) { - return type.equals(Timestamp.class) && super.canConvert(Date.class); + return type == Timestamp.class && super.canConvert(Date.class); } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/JavaFieldConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/JavaFieldConverter.java (.../JavaFieldConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/JavaFieldConverter.java (.../JavaFieldConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2013 XStream Committers. + * Copyright (C) 2009, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -61,7 +61,7 @@ } public boolean canConvert(Class type) { - return type.equals(Field.class); + return type == Field.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/JavaMethodConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/JavaMethodConverter.java (.../JavaMethodConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/JavaMethodConverter.java (.../JavaMethodConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2009, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2009, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -61,7 +61,7 @@ } public boolean canConvert(Class type) { - return type.equals(Method.class) || type.equals(Constructor.class); + return type == Method.class || type == Constructor.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/LocaleConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/LocaleConverter.java (.../LocaleConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/LocaleConverter.java (.../LocaleConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -24,7 +24,7 @@ public class LocaleConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(Locale.class); + return type == Locale.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/LookAndFeelConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/LookAndFeelConverter.java (.../LookAndFeelConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/LookAndFeelConverter.java (.../LookAndFeelConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2013 XStream Committers. + * Copyright (C) 2007, 2008, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -41,6 +41,6 @@ } public boolean canConvert(Class type) { - return LookAndFeel.class.isAssignableFrom(type) && canAccess(type); + return type != null && LookAndFeel.class.isAssignableFrom(type) && canAccess(type); } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/NamedCollectionConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/NamedCollectionConverter.java (.../NamedCollectionConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/NamedCollectionConverter.java (.../NamedCollectionConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 XStream Committers. + * Copyright (C) 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -62,8 +62,17 @@ this.type = itemType; } + protected void writeCompleteItem(final Object item, final MarshallingContext context, + final HierarchicalStreamWriter writer) { + writeItem(item, context, writer); + } + + /** + * @deprecated As of 1.4.11 use {@link #writeCompleteItem(Object, MarshallingContext, HierarchicalStreamWriter)} + * instead. + */ protected void writeItem(Object item, MarshallingContext context, HierarchicalStreamWriter writer) { - Class itemType = item == null ? Mapper.Null.class : item.getClass(); + final Class itemType = item == null ? Mapper.Null.class : item.getClass(); ExtendedHierarchicalStreamWriterHelper.startNode(writer, name, itemType); if (!itemType.equals(type)) { String attributeName = mapper().aliasForSystemAttribute("class"); @@ -77,9 +86,10 @@ writer.endNode(); } - protected Object readItem(HierarchicalStreamReader reader, UnmarshallingContext context, Object current) { - String className = HierarchicalStreams.readClassAttribute(reader, mapper()); - Class itemType = className == null ? type : mapper().realClass(className); + protected Object readBareItem(final HierarchicalStreamReader reader, final UnmarshallingContext context, + final Object current) { + final String className = HierarchicalStreams.readClassAttribute(reader, mapper()); + final Class itemType = className == null ? type : mapper().realClass(className); if (Mapper.Null.class.equals(itemType)) { return null; } else { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/NamedMapConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/NamedMapConverter.java (.../NamedMapConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/NamedMapConverter.java (.../NamedMapConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013, 2016 XStream Committers. + * Copyright (C) 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -208,7 +208,7 @@ this.keyAsAttribute = keyAsAttribute; this.valueAsAttribute = valueAsAttribute; this.lookup = lookup; - enumMapper = JVM.is15() ? UseAttributeForEnumMapper.createEnumMapper(mapper) : null; + enumMapper = JVM.isVersion(5) ? UseAttributeForEnumMapper.createEnumMapper(mapper) : null; if (keyType == null || valueType == null) { throw new IllegalArgumentException("Class types of key and value are mandatory"); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/PathConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/PathConverter.java (.../PathConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/PathConverter.java (.../PathConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 XStream Committers. + * Copyright (C) 2016, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -14,9 +14,11 @@ import java.net.URI; import java.net.URISyntaxException; import java.nio.file.FileSystems; +import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.nio.file.Paths; +import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.converters.basic.AbstractSingleValueConverter; @@ -30,20 +32,24 @@ @Override public boolean canConvert(@SuppressWarnings("rawtypes") final Class type) { - return Path.class.isAssignableFrom(type); + return type != null && Path.class.isAssignableFrom(type); } @Override public Path fromString(final String str) { try { - final URI uri = new URI(str); - if (uri.getScheme() == null) { + try { + final URI uri = new URI(str); + if (uri.getScheme() == null || uri.getScheme().length() == 1) { + return Paths.get(File.separatorChar != '/' ? str.replace('/', File.separatorChar) : str); + } else { + return Paths.get(uri); + } + } catch (final URISyntaxException e) { return Paths.get(str); - } else { - return Paths.get(uri); } - } catch (final URISyntaxException e) { - return Paths.get(str); + } catch (final InvalidPathException e) { + throw new ConversionException(e); } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/RegexPatternConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/RegexPatternConverter.java (.../RegexPatternConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/RegexPatternConverter.java (.../RegexPatternConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -40,7 +40,7 @@ } public boolean canConvert(final Class type) { - return type.equals(Pattern.class); + return type == Pattern.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlDateConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlDateConverter.java (.../SqlDateConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlDateConverter.java (.../SqlDateConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -23,7 +23,7 @@ public class SqlDateConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(Date.class); + return type == Date.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlTimeConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlTimeConverter.java (.../SqlTimeConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlTimeConverter.java (.../SqlTimeConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -23,7 +23,7 @@ public class SqlTimeConverter extends AbstractSingleValueConverter { public boolean canConvert(Class type) { - return type.equals(Time.class); + return type == Time.class; } public Object fromString(String str) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlTimestampConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlTimestampConverter.java (.../SqlTimestampConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SqlTimestampConverter.java (.../SqlTimestampConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2003, 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2012, 2014, 2016, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2012, 2014, 2016, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -53,7 +53,7 @@ } public boolean canConvert(Class type) { - return type.equals(Timestamp.class); + return type == Timestamp.class; } public String toString(final Object obj) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/StackTraceElementConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/StackTraceElementConverter.java (.../StackTraceElementConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/StackTraceElementConverter.java (.../StackTraceElementConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -36,7 +36,7 @@ private static final StackTraceElementFactory FACTORY; static { StackTraceElementFactory factory = null; - if (JVM.is15()) { + if (JVM.isVersion(5)) { Class factoryType = JVM.loadClassForName( "com.thoughtworks.xstream.converters.extended.StackTraceElementFactory15", false); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SubjectConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SubjectConverter.java (.../SubjectConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/SubjectConverter.java (.../SubjectConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -39,7 +39,7 @@ } public boolean canConvert(Class type) { - return type.equals(Subject.class); + return type == Subject.class; } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { @@ -54,7 +54,7 @@ writer.startNode("principals"); for (final Iterator iter = principals.iterator(); iter.hasNext();) { final Object principal = iter.next(); // pre jdk 1.4 a Principal was also in javax.security - writeItem(principal, context, writer); + writeCompleteItem(principal, context, writer); } writer.endNode(); }; @@ -102,10 +102,8 @@ Set set = new HashSet(); reader.moveDown(); while (reader.hasMoreChildren()) { - reader.moveDown(); - Object elementl = readItem(reader, context, set); - reader.moveUp(); - set.add(elementl); + final Object principal = readCompleteItem(reader, context, set); + set.add(principal); } reader.moveUp(); return set; Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ThrowableConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ThrowableConverter.java (.../ThrowableConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ThrowableConverter.java (.../ThrowableConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -46,7 +46,7 @@ } public boolean canConvert(final Class type) { - return Throwable.class.isAssignableFrom(type); + return type != null && Throwable.class.isAssignableFrom(type); } public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ToAttributedValueConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ToAttributedValueConverter.java (.../ToAttributedValueConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ToAttributedValueConverter.java (.../ToAttributedValueConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2013, 2016 XStream Committers. + * Copyright (C) 2011, 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -122,7 +122,7 @@ } this.valueField = field; } - enumMapper = JVM.is15() ? UseAttributeForEnumMapper.createEnumMapper(mapper) : null; + enumMapper = JVM.isVersion(5) ? UseAttributeForEnumMapper.createEnumMapper(mapper) : null; } public boolean canConvert(final Class type) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ToStringConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ToStringConverter.java (.../ToStringConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/extended/ToStringConverter.java (.../ToStringConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -36,7 +36,7 @@ ctor = clazz.getConstructor(STRING_PARAMETER); } public boolean canConvert(Class type) { - return type.equals(clazz); + return type == clazz; } public String toString(Object obj) { return obj == null ? null : obj.toString(); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java (.../AbstractReflectionConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java (.../AbstractReflectionConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -141,84 +141,8 @@ } }); - new Object() { - { - final Map hiddenMappers = new HashMap(); - for (Iterator fieldIter = fields.iterator(); fieldIter.hasNext();) { - FieldInfo info = (FieldInfo)fieldIter.next(); - if (info.value != null) { - final Field defaultField = (Field)defaultFieldDefinition.get(info.fieldName); - Mapper.ImplicitCollectionMapping mapping = mapper - .getImplicitCollectionDefForFieldName( - defaultField.getDeclaringClass() == info.definedIn ? sourceType : info.definedIn, - info.fieldName); - if (mapping != null) { - Set mappings = (Set)hiddenMappers.get(info.fieldName); - if (mappings == null) { - mappings = new HashSet(); - mappings.add(mapping); - hiddenMappers.put(info.fieldName, mappings); - } else { - if (!mappings.add(mapping)) { - mapping = null; - } - } - } - if (mapping != null) { - if (context instanceof ReferencingMarshallingContext) { - if (info.value != Collections.EMPTY_LIST - && info.value != Collections.EMPTY_SET - && info.value != Collections.EMPTY_MAP) { - ReferencingMarshallingContext refContext = (ReferencingMarshallingContext)context; - refContext.registerImplicit(info.value); - } - } - final boolean isCollection = info.value instanceof Collection; - final boolean isMap = info.value instanceof Map; - final boolean isEntry = isMap && mapping.getKeyFieldName() == null; - final boolean isArray = info.value.getClass().isArray(); - for (Iterator iter = isArray - ? new ArrayIterator(info.value) - : isCollection ? ((Collection)info.value).iterator() : isEntry - ? ((Map)info.value).entrySet().iterator() - : ((Map)info.value).values().iterator(); iter.hasNext();) { - Object obj = iter.next(); - final String itemName; - final Class itemType; - if (obj == null) { - itemType = Object.class; - itemName = mapper.serializedClass(null); - } else if (isEntry) { - final String entryName = mapping.getItemFieldName() != null - ? mapping.getItemFieldName() - : mapper.serializedClass(Map.Entry.class); - Map.Entry entry = (Map.Entry)obj; - ExtendedHierarchicalStreamWriterHelper.startNode( - writer, entryName, entry.getClass()); - writeItem(entry.getKey(), context, writer); - writeItem(entry.getValue(), context, writer); - writer.endNode(); - continue; - } else if (mapping.getItemFieldName() != null) { - itemType = mapping.getItemType(); - itemName = mapping.getItemFieldName(); - } else { - itemType = obj.getClass(); - itemName = mapper.serializedClass(itemType); - } - writeField( - info.fieldName, itemName, itemType, info.definedIn, obj); - } - } else { - writeField( - info.fieldName, null, info.type, info.definedIn, info.value); - } - } - } - - } - - void writeField(String fieldName, String aliasName, Class fieldType, + final FieldMarshaller fieldMarshaller = new FieldMarshaller() { + public void writeField(String fieldName, String aliasName, Class fieldType, Class definedIn, Object newObj) { Class actualType = newObj != null ? newObj.getClass() : fieldType; ExtendedHierarchicalStreamWriterHelper.startNode(writer, aliasName != null @@ -252,8 +176,7 @@ writer.endNode(); } - void writeItem(Object item, MarshallingContext context, - HierarchicalStreamWriter writer) { + public void writeItem(Object item) { if (item == null) { String name = mapper.serializedClass(null); ExtendedHierarchicalStreamWriterHelper.startNode( @@ -268,6 +191,79 @@ } } }; + + final Map hiddenMappers = new HashMap(); + for (Iterator fieldIter = fields.iterator(); fieldIter.hasNext();) { + FieldInfo info = (FieldInfo)fieldIter.next(); + if (info.value != null) { + final Field defaultField = (Field)defaultFieldDefinition.get(info.fieldName); + Mapper.ImplicitCollectionMapping mapping = mapper + .getImplicitCollectionDefForFieldName( + defaultField.getDeclaringClass() == info.definedIn ? sourceType : info.definedIn, + info.fieldName); + if (mapping != null) { + Set mappings = (Set)hiddenMappers.get(info.fieldName); + if (mappings == null) { + mappings = new HashSet(); + mappings.add(mapping); + hiddenMappers.put(info.fieldName, mappings); + } else { + if (!mappings.add(mapping)) { + mapping = null; + } + } + } + if (mapping != null) { + if (context instanceof ReferencingMarshallingContext) { + if (info.value != Collections.EMPTY_LIST + && info.value != Collections.EMPTY_SET + && info.value != Collections.EMPTY_MAP) { + ReferencingMarshallingContext refContext = (ReferencingMarshallingContext)context; + refContext.registerImplicit(info.value); + } + } + final boolean isCollection = info.value instanceof Collection; + final boolean isMap = info.value instanceof Map; + final boolean isEntry = isMap && mapping.getKeyFieldName() == null; + final boolean isArray = info.value.getClass().isArray(); + for (Iterator iter = isArray + ? new ArrayIterator(info.value) + : isCollection ? ((Collection)info.value).iterator() : isEntry + ? ((Map)info.value).entrySet().iterator() + : ((Map)info.value).values().iterator(); iter.hasNext();) { + Object obj = iter.next(); + final String itemName; + final Class itemType; + if (obj == null) { + itemType = Object.class; + itemName = mapper.serializedClass(null); + } else if (isEntry) { + final String entryName = mapping.getItemFieldName() != null + ? mapping.getItemFieldName() + : mapper.serializedClass(Map.Entry.class); + Map.Entry entry = (Map.Entry)obj; + ExtendedHierarchicalStreamWriterHelper.startNode( + writer, entryName, entry.getClass()); + fieldMarshaller.writeItem(entry.getKey()); + fieldMarshaller.writeItem(entry.getValue()); + writer.endNode(); + continue; + } else if (mapping.getItemFieldName() != null) { + itemType = mapping.getItemType(); + itemName = mapping.getItemFieldName(); + } else { + itemType = obj.getClass(); + itemName = mapper.serializedClass(itemType); + } + fieldMarshaller.writeField( + info.fieldName, itemName, itemType, info.definedIn, obj); + } + } else { + fieldMarshaller.writeField( + info.fieldName, null, info.type, info.definedIn, info.value); + } + } + } } protected void marshallField(final MarshallingContext context, Object newObj, Field field) { @@ -662,6 +658,12 @@ } } + private interface FieldMarshaller { + void writeItem(final Object item); + void writeField(final String fieldName, final String aliasName, final Class fieldType, + final Class definedIn, final Object newObj); + } + private static class ArraysList extends ArrayList { final Class physicalFieldType; Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter.java (.../CGLIBEnhancedConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter.java (.../CGLIBEnhancedConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2010, 2011, 2013, 2014, 2015, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2010, 2011, 2013, 2014, 2015, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -89,7 +89,7 @@ } public boolean canConvert(Class type) { - return (Enhancer.isEnhanced(type) && type.getName().indexOf(DEFAULT_NAMING_MARKER) > 0) + return type != null && Enhancer.isEnhanced(type) && type.getName().indexOf(DEFAULT_NAMING_MARKER) > 0 || type == CGLIBMapper.Marker.class; } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.java (.../ExternalizableConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.java (.../ExternalizableConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -76,7 +76,7 @@ } public boolean canConvert(Class type) { - return JVM.canCreateDerivedObjectOutputStream() && Externalizable.class.isAssignableFrom(type); + return type != null && JVM.canCreateDerivedObjectOutputStream() && Externalizable.class.isAssignableFrom(type); } public void marshal(final Object original, final HierarchicalStreamWriter writer, final MarshallingContext context) { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java (.../FieldDictionary.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java (.../FieldDictionary.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2018 XStream Committers. * All rights reserved. * The software in this package is published under the terms of the BSD * style license a copy of which has been included with this distribution in @@ -35,6 +35,7 @@ Collections.EMPTY_MAP); private transient Map dictionaryEntries; + private transient FieldUtil fieldUtil; private final FieldKeySorter sorter; public FieldDictionary() { @@ -48,6 +49,14 @@ private void init() { dictionaryEntries = new HashMap(); + if (JVM.is15()) + try { + fieldUtil = (FieldUtil)JVM.loadClassForName("com.thoughtworks.xstream.converters.reflection.FieldUtil15", true).newInstance(); + } catch (Exception e) { + ; + } + if (fieldUtil == null) + fieldUtil = new FieldUtil14(); } /** @@ -160,6 +169,9 @@ } for (int i = 0; i < fields.length; i++) { final Field field = fields[i]; + if (fieldUtil.isSynthetic(field) && field.getName().startsWith("$jacoco")) { + continue; + } if (!field.isAccessible()) { field.setAccessible(true); } @@ -194,6 +206,10 @@ return this; } + interface FieldUtil { + boolean isSynthetic(Field field); + } + private static final class DictionaryEntry { private final Map keyedByFieldName; Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldUtil14.java =================================================================== diff -u --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldUtil14.java (revision 0) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldUtil14.java (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2018 XStream Committers. + * All rights reserved. + * The software in this package is published under the terms of the BSD + * style license a copy of which has been included with this distribution in + * the LICENSE.txt file. + * Created on 10. October 2018 by Joerg Schaible. + */ +package com.thoughtworks.xstream.converters.reflection; + +import java.lang.reflect.Field; + +/** + * @author Jörg Schaible + */ +class FieldUtil14 implements FieldDictionary.FieldUtil { + + public boolean isSynthetic(final Field field) { + return false; + } +} Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldUtil15.java =================================================================== diff -u --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldUtil15.java (revision 0) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/FieldUtil15.java (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2018 XStream Committers. + * All rights reserved. + * The software in this package is published under the terms of the BSD + * style license a copy of which has been included with this distribution in + * the LICENSE.txt file. + * Created on 10. October 2018 by Joerg Schaible. + */ +package com.thoughtworks.xstream.converters.reflection; + +import java.lang.reflect.Field; + +/** + * @author Jörg Schaible + */ +class FieldUtil15 implements FieldDictionary.FieldUtil { + + public boolean isSynthetic(final Field field) { + return field.isSynthetic(); + } +} Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/PureJavaReflectionProvider.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/PureJavaReflectionProvider.java (.../PureJavaReflectionProvider.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/reflection/PureJavaReflectionProvider.java (.../PureJavaReflectionProvider.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2009, 2011, 2013, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2009, 2011, 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -168,7 +168,7 @@ protected void validateFieldAccess(Field field) { if (Modifier.isFinal(field.getModifiers())) { - if (JVM.is15()) { + if (JVM.isVersion(5)) { if (!field.isAccessible()) { field.setAccessible(true); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/ChronologyConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/ChronologyConverter.java (.../ChronologyConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/ChronologyConverter.java (.../ChronologyConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 XStream Committers. + * Copyright (C) 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -27,7 +27,7 @@ @Override public boolean canConvert(@SuppressWarnings("rawtypes") final Class type) { - return Chronology.class.isAssignableFrom(type); + return type != null && Chronology.class.isAssignableFrom(type); } @Override Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/JapaneseEraConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/JapaneseEraConverter.java (.../JapaneseEraConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/JapaneseEraConverter.java (.../JapaneseEraConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 XStream Committers. + * Copyright (C) 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -26,7 +26,7 @@ @Override public boolean canConvert(@SuppressWarnings("rawtypes") final Class type) { - return JapaneseEra.class.isAssignableFrom(type); + return type != null && JapaneseEra.class.isAssignableFrom(type); } @Override Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/ZoneIdConverter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/ZoneIdConverter.java (.../ZoneIdConverter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/converters/time/ZoneIdConverter.java (.../ZoneIdConverter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 XStream Committers. + * Copyright (C) 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -28,7 +28,7 @@ @Override public boolean canConvert(@SuppressWarnings("rawtypes") final Class type) { - return ZoneId.class.isAssignableFrom(type); + return type != null && ZoneId.class.isAssignableFrom(type); } @Override Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/AbstractReferenceUnmarshaller.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/AbstractReferenceUnmarshaller.java (.../AbstractReferenceUnmarshaller.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/AbstractReferenceUnmarshaller.java (.../AbstractReferenceUnmarshaller.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2011, 2015 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2011, 2015, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -67,11 +67,16 @@ } else { Object currentReferenceKey = getCurrentReferenceKey(); parentStack.push(currentReferenceKey); - result = super.convert(parent, type, converter); - if (currentReferenceKey != null) { - values.put(currentReferenceKey, result == null ? NULL : result); + Object localResult = null; + try { + localResult = super.convert(parent, type, converter); + } finally { + result = localResult; + if (currentReferenceKey != null) { + values.put(currentReferenceKey, result == null ? NULL : result); + } + parentStack.popSilently(); } - parentStack.popSilently(); } return result; } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/DefaultConverterLookup.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/DefaultConverterLookup.java (.../DefaultConverterLookup.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/DefaultConverterLookup.java (.../DefaultConverterLookup.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -15,15 +15,16 @@ import com.thoughtworks.xstream.converters.Converter; import com.thoughtworks.xstream.converters.ConverterLookup; import com.thoughtworks.xstream.converters.ConverterRegistry; +import com.thoughtworks.xstream.core.util.Cloneables; import com.thoughtworks.xstream.core.util.PrioritizedList; import com.thoughtworks.xstream.mapper.Mapper; -import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -import java.util.WeakHashMap; + /** * The default implementation of converters lookup. * @@ -35,30 +36,46 @@ private final PrioritizedList converters = new PrioritizedList(); private transient Map typeToConverterMap; + private Map serializationMap = null; public DefaultConverterLookup() { - readResolve(); + this(new HashMap()); } /** + * Constructs a DefaultConverterLookup with a provided map. + * + * @param map the map to use + * @throws NullPointerException if map is null + * @since 1.4.11 + */ + public DefaultConverterLookup(Map map) { + typeToConverterMap = map; + typeToConverterMap.clear(); + } + + /** * @deprecated As of 1.3, use {@link #DefaultConverterLookup()} */ public DefaultConverterLookup(Mapper mapper) { + this(); } public Converter lookupConverterForType(Class type) { - Converter cachedConverter = (Converter) typeToConverterMap.get(type); + Converter cachedConverter = type != null ? (Converter)typeToConverterMap.get(type.getName()) : null; if (cachedConverter != null) { return cachedConverter; } final Map errors = new LinkedHashMap(); Iterator iterator = converters.iterator(); while (iterator.hasNext()) { - Converter converter = (Converter) iterator.next(); + Converter converter = (Converter)iterator.next(); try { if (converter.canConvert(type)) { - typeToConverterMap.put(type, converter); + if (type != null) { + typeToConverterMap.put(type.getName(), converter); + } return converter; } } catch (final RuntimeException e) { @@ -80,36 +97,32 @@ } throw exception; } - + public void registerConverter(Converter converter, int priority) { + typeToConverterMap.clear(); converters.add(converter, priority); - for (Iterator iter = typeToConverterMap.keySet().iterator(); iter.hasNext();) { - Class type = (Class) iter.next(); - try { - if (converter.canConvert(type)) { - iter.remove(); - } - } catch (final RuntimeException e) { - // ignore - } catch (final LinkageError e) { - // ignore - } - } } - + public void flushCache() { typeToConverterMap.clear(); Iterator iterator = converters.iterator(); while (iterator.hasNext()) { - Converter converter = (Converter) iterator.next(); + Converter converter = (Converter)iterator.next(); if (converter instanceof Caching) { ((Caching)converter).flushCache(); } } } + private Object writeReplace() { + serializationMap = (Map)Cloneables.cloneIfPossible(typeToConverterMap); + serializationMap.clear(); + return this; + } + private Object readResolve() { - typeToConverterMap = Collections.synchronizedMap(new WeakHashMap()); + typeToConverterMap = serializationMap == null ? new HashMap() : serializationMap; + serializationMap = null; return this; } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/JVM.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/JVM.java (.../JVM.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/JVM.java (.../JVM.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,25 +1,16 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD * style license a copy of which has been included with this distribution in * the LICENSE.txt file. - * + * * Created on 09. May 2004 by Joe Walnes */ package com.thoughtworks.xstream.core; -import com.thoughtworks.xstream.converters.reflection.FieldDictionary; -import com.thoughtworks.xstream.converters.reflection.ObjectAccessException; -import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; -import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; -import com.thoughtworks.xstream.core.util.CustomObjectOutputStream; -import com.thoughtworks.xstream.core.util.DependencyInjectionFactory; -import com.thoughtworks.xstream.core.util.PresortedMap; -import com.thoughtworks.xstream.core.util.PresortedSet; - import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -32,6 +23,17 @@ import java.util.TreeMap; import java.util.TreeSet; +import com.thoughtworks.xstream.converters.reflection.FieldDictionary; +import com.thoughtworks.xstream.converters.reflection.ObjectAccessException; +import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider; +import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; +import com.thoughtworks.xstream.core.util.Base64Encoder; +import com.thoughtworks.xstream.core.util.CustomObjectOutputStream; +import com.thoughtworks.xstream.core.util.DependencyInjectionFactory; +import com.thoughtworks.xstream.core.util.PresortedMap; +import com.thoughtworks.xstream.core.util.PresortedSet; + + public class JVM implements Caching { private ReflectionProvider reflectionProvider; @@ -52,6 +54,7 @@ private static final float DEFAULT_JAVA_VERSION = 1.4f; private static final boolean reverseFieldOrder = false; private static final Class reflectionProviderType; + private static final StringCodec base64Codec; static class Test { private Object o; @@ -110,7 +113,8 @@ cls = null; } if (cls == null) { - cls = loadClassForName("com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider"); + cls = loadClassForName( + "com.thoughtworks.xstream.converters.reflection.SunLimitedUnsafeReflectionProvider"); } type = cls; } catch (ObjectAccessException e) { @@ -171,6 +175,23 @@ isAWTAvailable = loadClassForName("java.awt.Color", false) != null; isSwingAvailable = loadClassForName("javax.swing.LookAndFeel", false) != null; isSQLAvailable = loadClassForName("java.sql.Date") != null; + + StringCodec base64 = null; + Class base64Class = loadClassForName( + "com.thoughtworks.xstream.core.util.Base64JavaUtilCodec"); + if (base64Class == null) { + base64Class = loadClassForName("com.thoughtworks.xstream.core.util.Base64JAXBCodec"); + } + if (base64Class != null) { + try { + base64 = (StringCodec)base64Class.newInstance(); + } catch (final Exception e) { + } + } + if (base64 == null) { + base64 = new Base64Encoder(); + } + base64Codec = base64; } /** @@ -180,8 +201,7 @@ } /** - * Parses the java version system property to determine the major java version, - * i.e. 1.x + * Parses the java version system property to determine the major java version, i.e. 1.x * * @return A float of the form 1.x */ @@ -198,53 +218,70 @@ * @deprecated As of 1.4.4, minimal JDK version is 1.4 already */ public static boolean is14() { - return majorJavaVersion >= 1.4f; + return isVersion(4); } /** * @deprecated As of 1.4.4, minimal JDK version will be 1.7 for next major release */ public static boolean is15() { - return majorJavaVersion >= 1.5f; + return isVersion(5); } /** * @deprecated As of 1.4.4, minimal JDK version will be 1.7 for next major release */ public static boolean is16() { - return majorJavaVersion >= 1.6f; + return isVersion(6); } /** * @since 1.4 * @deprecated As of 1.4.10, minimal JDK version will be 1.7 for next major release */ public static boolean is17() { - return majorJavaVersion >= 1.7f; + return isVersion(7); } /** * @since 1.4 + * @deprecated As of 1.4.11 use {@link #isVersion(int)}. */ public static boolean is18() { - return majorJavaVersion >= 1.8f; + return isVersion(8); } /** * @since 1.4.8 - * @deprecated As of upcoming use {@link #is9()} + * @deprecated As of 1.4.10 use {@link #isVersion(int)}. */ public static boolean is19() { return majorJavaVersion >= 1.9f; } /** * @since 1.4.10 + * @deprecated As of 1.4.11 use {@link #isVersion(int)} */ public static boolean is9() { - return majorJavaVersion >= 9f; + return isVersion(9); } + /** + * Checks current runtime against provided major Java version. + * + * @param version the requested major Java version + * @return true if current runtime is at least the provided major version + * @since 1.4.11 + */ + public static boolean isVersion(final int version) { + if (version < 1) { + throw new IllegalArgumentException("Java version range starts with at least 1."); + } + final float v = majorJavaVersion < 9 ? 1f + version * 0.1f : version; + return majorJavaVersion >= v; + } + private static boolean isIBM() { return vendor.indexOf("IBM") != -1; } @@ -258,10 +295,11 @@ /** * Load a XStream class for the given name. - * - *
This method is not meant to use loading arbitrary classes. It is used by XStream bootstrap - * until it is able to use the user provided or the default {@link ClassLoader}.
- * + *+ * This method is not meant to use loading arbitrary classes. It is used by XStream bootstrap until it is able to + * use the user provided or the default {@link ClassLoader}. + *
+ * * @since 1.4.5 */ public static Class loadClassForName(String name) { @@ -277,10 +315,11 @@ /** * Load a XStream class for the given name. - * - *This method is not meant to use loading arbitrary classes. It is used by XStream bootstrap - * until it is able to use the user provided or the default {@link ClassLoader}.
- * + *+ * This method is not meant to use loading arbitrary classes. It is used by XStream bootstrap until it is able to + * use the user provided or the default {@link ClassLoader}. + *
+ * * @since 1.4.5 */ public static Class loadClassForName(String name, boolean initialize) { @@ -304,7 +343,7 @@ /** * Create the best matching ReflectionProvider. - * + * * @return a new instance * @since 1.4.5 */ @@ -332,13 +371,13 @@ * implementations configured in lib/stax.properties or registered with the Service * API. * - * + * * @return the XMLInputFactory implementation or null * @throws ClassNotFoundException if the standard class cannot be found * @since 1.4.5 */ public static Class getStaxInputFactory() throws ClassNotFoundException { - if (is16()) { + if (isVersion(6)) { if (isIBM()) { return Class.forName("com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl"); } else { @@ -357,13 +396,13 @@ * implementations configured in lib/stax.properties or registered with the Service * API. * - * + * * @return the XMLOutputFactory implementation or null * @throws ClassNotFoundException if the standard class cannot be found * @since 1.4.5 */ public static Class getStaxOutputFactory() throws ClassNotFoundException { - if (is16()) { + if (isVersion(6)) { if (isIBM()) { return Class.forName("com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl"); } else { @@ -374,6 +413,17 @@ } /** + * Get an available Base64 implementation. Prefers java.util.Base64 over DataTypeConverter from JAXB over XStream's + * own implementation. + * + * @return a Base64 codec implementation + * @since 1.4.11 + */ + public static StringCodec getBase64Codec() { + return base64Codec; + } + + /** * @deprecated As of 1.4.5 use {@link #newReflectionProvider()} */ public synchronized ReflectionProvider bestReflectionProvider() { @@ -384,7 +434,7 @@ } private static boolean canUseSunUnsafeReflectionProvider() { - return canAllocateWithUnsafe && is14(); + return canAllocateWithUnsafe; } private static boolean canUseSunLimitedUnsafeReflectionProvider() { @@ -400,14 +450,16 @@ /** * Checks if AWT is available. + * * @since 1.4.5 */ public static boolean isAWTAvailable() { return isAWTAvailable; } /** - * Checks if the jvm supports awt. + * Checks if the JVM supports AWT. + * * @deprecated As of 1.4.5 use {@link #isAWTAvailable()} */ public boolean supportsAWT() { @@ -416,14 +468,16 @@ /** * Checks if Swing is available. + * * @since 1.4.5 */ public static boolean isSwingAvailable() { return isSwingAvailable; } /** - * Checks if the jvm supports swing. + * Checks if the JVM supports Swing. + * * @deprecated As of 1.4.5 use {@link #isSwingAvailable()} */ public boolean supportsSwing() { @@ -432,14 +486,16 @@ /** * Checks if SQL is available. + * * @since 1.4.5 */ public static boolean isSQLAvailable() { return isSQLAvailable; } /** - * Checks if the jvm supports sql. + * Checks if the JVM supports SQL. + * * @deprecated As of 1.4.5 use {@link #isSQLAvailable()} */ public boolean supportsSQL() { @@ -448,7 +504,7 @@ /** * Checks if TreeSet.addAll is optimized for SortedSet argument. - * + * * @since 1.4 */ public static boolean hasOptimizedTreeSetAddAll() { @@ -457,7 +513,7 @@ /** * Checks if TreeMap.putAll is optimized for SortedMap argument. - * + * * @since 1.4 */ public static boolean hasOptimizedTreeMapPutAll() { @@ -539,11 +595,13 @@ System.out.println("Java Beans EventHandler present: " + (loadClassForName("java.beans.EventHandler") != null)); System.out.println("Standard StAX XMLInputFactory: " + staxInputFactory); System.out.println("Standard StAX XMLOutputFactory: " + staxOutputFactory); + System.out.println("Standard Base64 Codec: " + getBase64Codec().getClass().toString()); System.out.println("Optimized TreeSet.addAll: " + hasOptimizedTreeSetAddAll()); System.out.println("Optimized TreeMap.putAll: " + hasOptimizedTreeMapPutAll()); System.out.println("Can parse UTC date format: " + canParseUTCDateFormat()); System.out.println("Can create derive ObjectOutputStream: " + canCreateDerivedObjectOutputStream()); System.out.println("Reverse field order detected for JDK: " + reverseJDK); - System.out.println("Reverse field order detected (only if JVM class itself has been compiled): " + reverseLocal); + System.out.println("Reverse field order detected (only if JVM class itself has been compiled): " + + reverseLocal); } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/StringCodec.java =================================================================== diff -u --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/StringCodec.java (revision 0) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/StringCodec.java (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2017, 2018 XStream Committers. + * All rights reserved. + * + * The software in this package is published under the terms of the BSD + * style license a copy of which has been included with this distribution in + * the LICENSE.txt file. + * + * Created on 12. August 2017 by Joerg Schaible + */ +package com.thoughtworks.xstream.core; + +/** + * Interface for an encoder and decoder of data to string values and back. + * + * @author Jörg Schaible + * @since 1.4.11 + */ +public interface StringCodec { + + /** + * Decode the provided encoded string. + * + * @param encoded the encoded string + * @return the decoded data + * @since 1.4.11 + */ + byte[] decode(String encoded); + + /** + * Encode the provided data. + * + * @param data the data to encode + * @return the data encoded as string + * @since 1.4.11 + */ + String encode(byte[] data); +} \ No newline at end of file Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/TreeUnmarshaller.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/TreeUnmarshaller.java (.../TreeUnmarshaller.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/TreeUnmarshaller.java (.../TreeUnmarshaller.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2011 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -67,18 +67,18 @@ } protected Object convert(Object parent, Class type, Converter converter) { + types.push(type); try { - types.push(type); - Object result = converter.unmarshal(reader, this); - types.popSilently(); - return result; - } catch (ConversionException conversionException) { + return converter.unmarshal(reader, this); + } catch (final ConversionException conversionException) { addInformationTo(conversionException, type, converter, parent); throw conversionException; } catch (RuntimeException e) { ConversionException conversionException = new ConversionException(e); addInformationTo(conversionException, type, converter, parent); throw conversionException; + } finally { + types.popSilently(); } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64Encoder.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64Encoder.java (.../Base64Encoder.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64Encoder.java (.../Base64Encoder.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,12 +1,12 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2017, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD * style license a copy of which has been included with this distribution in * the LICENSE.txt file. - * + * * Created on 06. August 2004 by Joe Walnes */ package com.thoughtworks.xstream.core.util; @@ -16,78 +16,139 @@ import java.io.Reader; import java.io.StringReader; +import com.thoughtworks.xstream.core.StringCodec; + + /** * Encodes binary data to plain text as Base64. + *+ * Despite there being a gazillion other Base64 implementations out there, this has been written as part of XStream as + * it forms a core part but is too trivial to warrant an extra dependency. Recent Java Runtimes (since Java 6) provide + * an own Base64 codec though. + *
+ *+ * By default it will not insert line breaks to support Base64 values also as attribute values. However, the standard as + * described in RFC 1521, section 5.2 requires line breaks, + * allowing other Base64 tools to manipulate the data. You can configure the Base64Encoder to be RFC compliant. + *
* - *Despite there being a gazillion other Base64 implementations out there, this has been written as part of XStream as - * it forms a core part but is too trivial to warrant an extra dependency.
- * - *This meets the standard as described in RFC 1521, section 5.2
+ * The encoder will not insert any line breaks. + *
+ * + * @since 1.4.11 + */ + public Base64Encoder() { + this(false); + } + + /** + * Constructs a Base64Encoder. + * + * @param lineBreaks flag to insert line breaks + * @since 1.4.11 + */ + public Base64Encoder(final boolean lineBreaks) { + this.lineBreaks = lineBreaks; + } + + public String encode(final byte[] input) { + final int stringSize = computeResultingStringSize(input); + final StringBuffer result = new StringBuffer(stringSize); int outputCharCount = 0; for (int i = 0; i < input.length; i += 3) { - int remaining = Math.min(3, input.length - i); - int oneBigNumber = (input[i] & 0xff) << 16 | (remaining <= 1 ? 0 : input[i + 1] & 0xff) << 8 | (remaining <= 2 ? 0 : input[i + 2] & 0xff); - for (int j = 0; j < 4; j++) result.append(remaining + 1 > j ? SIXTY_FOUR_CHARS[0x3f & oneBigNumber >> 6 * (3 - j)] : '='); - if ((outputCharCount += 4) % 76 == 0) result.append('\n'); + final int remaining = Math.min(3, input.length - i); + final int oneBigNumber = (input[i] & 0xff) << 16 + | (remaining <= 1 ? 0 : input[i + 1] & 0xff) << 8 + | (remaining <= 2 ? 0 : input[i + 2] & 0xff); + for (int j = 0; j < 4; j++) { + result.append(remaining + 1 > j ? SIXTY_FOUR_CHARS[0x3f & oneBigNumber >> 6 * (3 - j)] : '='); + } + if (lineBreaks && (outputCharCount += 4) % 76 == 0 && i + 3 < input.length) { + result.append('\n'); + } } - return result.toString(); + final String s = result.toString(); + return s; } - public byte[] decode(String input) { + // package private for testing purpose + int computeResultingStringSize(final byte[] input) { + int stringSize = input.length / 3 + (input.length % 3 == 0 ? 0 : 1); + stringSize *= 4; + if (lineBreaks) { + stringSize += stringSize / 76; + } + return stringSize; + } + + public byte[] decode(final String input) { try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - StringReader in = new StringReader(input); + final ByteArrayOutputStream out = new ByteArrayOutputStream(); + final StringReader in = new StringReader(input); for (int i = 0; i < input.length(); i += 4) { - int a[] = {mapCharToInt(in), mapCharToInt(in), mapCharToInt(in), mapCharToInt(in)}; - int oneBigNumber = (a[0] & 0x3f) << 18 | (a[1] & 0x3f) << 12 | (a[2] & 0x3f) << 6 | (a[3] & 0x3f); - for (int j = 0; j < 3; j++) if (a[j + 1] >= 0) out.write(0xff & oneBigNumber >> 8 * (2 - j)); + final int a[] = {mapCharToInt(in), mapCharToInt(in), mapCharToInt(in), mapCharToInt(in)}; + final int oneBigNumber = (a[0] & 0x3f) << 18 | (a[1] & 0x3f) << 12 | (a[2] & 0x3f) << 6 | a[3] & 0x3f; + for (int j = 0; j < 3; j++) { + if (a[j + 1] >= 0) { + out.write(0xff & oneBigNumber >> 8 * (2 - j)); + } + } } return out.toByteArray(); - } catch (IOException e) { + } catch (final IOException e) { throw new Error(e + ": " + e.getMessage()); } } - private int mapCharToInt(Reader input) throws IOException { + private int mapCharToInt(final Reader input) throws IOException { int c; while ((c = input.read()) != -1) { - int result = REVERSE_MAPPING[c]; - if (result != 0) return result -1; - if (c == '=') return -1; + final int result = REVERSE_MAPPING[c]; + if (result != 0) { + return result - 1; + } + if (c == '=') { + return -1; + } } return -1; } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64JAXBCodec.java =================================================================== diff -u --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64JAXBCodec.java (revision 0) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64JAXBCodec.java (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2017, 2018 XStream Committers. + * All rights reserved. + * + * The software in this package is published under the terms of the BSD + * style license a copy of which has been included with this distribution in + * the LICENSE.txt file. + * + * Created on 12. August 2017 by Joerg Schaible + */ +package com.thoughtworks.xstream.core.util; + +import javax.xml.bind.DatatypeConverter; + +import com.thoughtworks.xstream.core.StringCodec; + + +/** + * Base64 codec implementation based on JAXB. + * + * @author Jörg Schaible + * @since 1.4.11 + */ +public class Base64JAXBCodec implements StringCodec { + + @Override + public byte[] decode(final String base64) { + return DatatypeConverter.parseBase64Binary(base64); + } + + @Override + public String encode(final byte[] data) { + return DatatypeConverter.printBase64Binary(data); + } +} Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64JavaUtilCodec.java =================================================================== diff -u --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64JavaUtilCodec.java (revision 0) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/Base64JavaUtilCodec.java (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2017, 2018 XStream Committers. + * All rights reserved. + * + * The software in this package is published under the terms of the BSD + * style license a copy of which has been included with this distribution in + * the LICENSE.txt file. + * + * Created on 12. August 2017 by Joerg Schaible + */ +package com.thoughtworks.xstream.core.util; + +import java.util.Base64; + +import com.thoughtworks.xstream.core.StringCodec; + + +/** + * Base64 codec implementation based on java.util.Base64. + * + * @author Jörg Schaible + * @since 1.4.11 + */ +public class Base64JavaUtilCodec implements StringCodec { + final private Base64.Decoder decoder; + final private Base64.Encoder encoder; + + /** + * Constructs a Base64JavaUtilCodec. + *+ * The implementation will use a basic encoder and a MIME decoder by default. + *
+ * + * @since 1.4.11 + */ + public Base64JavaUtilCodec() { + this(Base64.getEncoder(), Base64.getMimeDecoder()); + } + + /** + * Constructs a Base64JavaUtilCodec with provided encoder and decoder. + * + * @param encoder the encoder instance + * @param decoder the decoder instance + * @since 1.4.11 + */ + public Base64JavaUtilCodec(final Base64.Encoder encoder, final Base64.Decoder decoder) { + this.encoder = encoder; + this.decoder = decoder; + } + + @Override + public byte[] decode(final String base64) { + return decoder.decode(base64); + } + + @Override + public String encode(final byte[] data) { + return encoder.encodeToString(data); + } +} Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/CompositeClassLoader.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/CompositeClassLoader.java (.../CompositeClassLoader.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/CompositeClassLoader.java (.../CompositeClassLoader.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2011, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2011, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -53,7 +53,7 @@ */ public class CompositeClassLoader extends ClassLoader { static { - if (JVM.is17()) { + if (JVM.isVersion(7)) { // see http://www.cs.duke.edu/csed/java/jdk1.7/technotes/guides/lang/cl-mt.html try { Method m = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable", (Class[])null); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/CustomObjectInputStream.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/CustomObjectInputStream.java (.../CustomObjectInputStream.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/core/util/CustomObjectInputStream.java (.../CustomObjectInputStream.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2016 XStream Committers. + * Copyright (C) 2006, 2007, 2010, 2011, 2013, 2016, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -136,11 +136,7 @@ } public int readUnsignedByte() throws IOException { - int b = ((Byte)peekCallback().readFromStream()).byteValue(); - if (b < 0) { - b += Byte.MAX_VALUE; - } - return b; + return ((Byte)peekCallback().readFromStream()).intValue() & 0xff; } public int readInt() throws IOException { @@ -168,11 +164,7 @@ } public int readUnsignedShort() throws IOException { - int b = ((Short)peekCallback().readFromStream()).shortValue(); - if (b < 0) { - b += Short.MAX_VALUE; - } - return b; + return ((Short)peekCallback().readFromStream()).intValue() & 0xffff; } public String readUTF() throws IOException { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamReader.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamReader.java (.../ExtendedHierarchicalStreamReader.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamReader.java (.../ExtendedHierarchicalStreamReader.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 XStream Committers. + * Copyright (C) 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -13,6 +13,7 @@ /** * @author Jörg Schaible * @since 1.4.2 + * @deprecated As of 1.4.11, this interface will be merged into parent with version 1.5.0. */ public interface ExtendedHierarchicalStreamReader extends HierarchicalStreamReader { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamWriter.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamWriter.java (.../ExtendedHierarchicalStreamWriter.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamWriter.java (.../ExtendedHierarchicalStreamWriter.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -13,6 +13,7 @@ /** * @author Paul Hammant + * @deprecated As of 1.4.11, this interface will be merged into parent with version 1.5.0. */ public interface ExtendedHierarchicalStreamWriter extends HierarchicalStreamWriter { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamWriterHelper.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamWriterHelper.java (.../ExtendedHierarchicalStreamWriterHelper.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/ExtendedHierarchicalStreamWriterHelper.java (.../ExtendedHierarchicalStreamWriterHelper.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Joe Walnes. - * Copyright (C) 2006, 2007 XStream Committers. + * Copyright (C) 2006, 2007, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -11,10 +11,17 @@ */ package com.thoughtworks.xstream.io; +/** + * @deprecated As of 1.4.11, this helper is no longer required since version 1.5.0. + */ public class ExtendedHierarchicalStreamWriterHelper { + /** + * @deprecated As of 1.4.11, with version 1.5.0 use {@link HierarchicalStreamWriter#startNode(String, Class)} + * directly. This helper will be no longer required. + */ public static void startNode(HierarchicalStreamWriter writer, String name, Class clazz) { if (writer instanceof ExtendedHierarchicalStreamWriter) { - ((ExtendedHierarchicalStreamWriter) writer).startNode(name, clazz); + ((ExtendedHierarchicalStreamWriter)writer).startNode(name, clazz); } else { writer.startNode(name); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/BEAStaxDriver.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/BEAStaxDriver.java (.../BEAStaxDriver.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/BEAStaxDriver.java (.../BEAStaxDriver.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011, 2014, 2015 XStream Committers. + * Copyright (C) 2009, 2011, 2014, 2015, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -22,9 +22,14 @@ * * @author Jörg Schaible * @since 1.4 + * @deprecated As of 1.4.11 use {@link StandardStaxDriver} or {@link WstxDriver} instead. BEA StAX implementation is + * outdated, unmaintained and has security issues. */ public class BEAStaxDriver extends StaxDriver { + /** + * @deprecated As of 1.4.11 use {@link StandardStaxDriver} or {@link WstxDriver} instead. + */ public BEAStaxDriver() { super(); } @@ -38,12 +43,16 @@ /** * @since 1.4.6 + * @deprecated As of 1.4.11 use {@link StandardStaxDriver} or {@link WstxDriver} instead. */ public BEAStaxDriver(QNameMap qnameMap, NameCoder nameCoder) { super(qnameMap, nameCoder); } - public BEAStaxDriver(QNameMap qnameMap) { + /** + * @deprecated As of 1.4.11 use {@link StandardStaxDriver} or {@link WstxDriver} instead. + */ + public BEAStaxDriver(final QNameMap qnameMap) { super(qnameMap); } @@ -56,6 +65,7 @@ /** * @since 1.4.6 + * @deprecated As of 1.4.11 use {@link StandardStaxDriver} or {@link WstxDriver} instead. */ public BEAStaxDriver(NameCoder nameCoder) { super(nameCoder); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/Dom4JDriver.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/Dom4JDriver.java (.../Dom4JDriver.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/Dom4JDriver.java (.../Dom4JDriver.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2009, 2011, 2014, 2015 XStream Committers. + * Copyright (C) 2006, 2007, 2009, 2011, 2014, 2015, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -19,6 +19,7 @@ import java.io.Reader; import java.io.Writer; import java.net.URL; +import java.nio.charset.Charset; import org.dom4j.Document; import org.dom4j.DocumentException; @@ -142,7 +143,9 @@ } public HierarchicalStreamWriter createWriter(final OutputStream out) { - final Writer writer = new OutputStreamWriter(out); + final String encoding = getOutputFormat() != null ? getOutputFormat().getEncoding() : null; + final Charset charset = encoding != null && Charset.isSupported(encoding) ? Charset.forName(encoding) : null; + final Writer writer = charset != null ? new OutputStreamWriter(out, charset) : new OutputStreamWriter(out); return createWriter(writer); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/Dom4JReader.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/Dom4JReader.java (.../Dom4JReader.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/Dom4JReader.java (.../Dom4JReader.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2009, 2011 XStream Committers. + * Copyright (C) 2006, 2007, 2009, 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -14,14 +14,23 @@ import com.thoughtworks.xstream.converters.ErrorWriter; import com.thoughtworks.xstream.io.naming.NameCoder; import java.util.List; + +import org.dom4j.Branch; import org.dom4j.Document; import org.dom4j.Element; public class Dom4JReader extends AbstractDocumentReader { private Element currentElement; - public Dom4JReader(Element rootElement) { + /** + * @since 1.4.11 + */ + public Dom4JReader(final Branch branch) { + this(branch instanceof Element ? (Element)branch : ((Document)branch).getRootElement()); + } + + public Dom4JReader(final Element rootElement) { this(rootElement, new XmlFriendlyNameCoder()); } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/DomDriver.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/DomDriver.java (.../DomDriver.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/DomDriver.java (.../DomDriver.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2014, 2015 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2014, 2015, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -140,7 +140,7 @@ */ protected DocumentBuilderFactory createDocumentBuilderFactory() { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - if (JVM.is15()) { + if (JVM.isVersion(5)) { try { Method method = DocumentBuilderFactory.class.getMethod("setFeature", new Class[]{ String.class, boolean.class }); @@ -151,7 +151,7 @@ throw new ObjectAccessException("Cannot set feature of DocumentBuilderFactory.", e); } catch (InvocationTargetException e) { Throwable cause = e.getCause(); - if (JVM.is16() + if (JVM.isVersion(6) || (cause instanceof ParserConfigurationException && cause.getMessage().indexOf("disallow-doctype-decl") < 0)) { throw new StreamException(cause); Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/XppDomDriver.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/XppDomDriver.java (.../XppDomDriver.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/XppDomDriver.java (.../XppDomDriver.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2011 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -11,13 +11,12 @@ */ package com.thoughtworks.xstream.io.xml; -import com.thoughtworks.xstream.io.HierarchicalStreamDriver; -import com.thoughtworks.xstream.io.naming.NameCoder; - import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlPullParserFactory; +import com.thoughtworks.xstream.io.HierarchicalStreamDriver; +import com.thoughtworks.xstream.io.naming.NameCoder; + /** * A {@link HierarchicalStreamDriver} for XPP DOM using the XmlPullParserFactory to locate an parser. * @@ -26,8 +25,6 @@ */ public class XppDomDriver extends AbstractXppDomDriver { - private static XmlPullParserFactory factory; - public XppDomDriver() { super(new XmlFriendlyNameCoder()); } @@ -47,13 +44,7 @@ super(replacer); } - /** - * {@inheritDoc} - */ protected synchronized XmlPullParser createParser() throws XmlPullParserException { - if (factory == null) { - factory = XmlPullParserFactory.newInstance(null, XppDomDriver.class); - } - return factory.newPullParser(); + return XppDriver.createDefaultParser(); } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/XppDriver.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/XppDriver.java (.../XppDriver.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/io/xml/XppDriver.java (.../XppDriver.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,12 +1,12 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD * style license a copy of which has been included with this distribution in * the LICENSE.txt file. - * + * * Created on 08. March 2004 by Joe Walnes */ package com.thoughtworks.xstream.io.xml; @@ -50,12 +50,21 @@ } /** - * {@inheritDoc} + * Create a default XML Pull Parser. The method uses the Java Service API to get the registered + * {@link XmlPullParserFactory} and let it create a new parser. + * + * @return a new instance of an XML Pull Parser + * @throws XmlPullParserException if the creation of a new parser fails. + * @since 1.4.11 */ - protected synchronized XmlPullParser createParser() throws XmlPullParserException { + public static synchronized XmlPullParser createDefaultParser() throws XmlPullParserException { if (factory == null) { factory = XmlPullParserFactory.newInstance(); } return factory.newPullParser(); } + + protected XmlPullParser createParser() throws XmlPullParserException { + return createDefaultParser(); + } } Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/mapper/AnnotationConfiguration.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/mapper/AnnotationConfiguration.java (.../AnnotationConfiguration.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/mapper/AnnotationConfiguration.java (.../AnnotationConfiguration.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2013 XStream Committers. + * Copyright (C) 2007, 2008, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -15,7 +15,7 @@ * * @author Jörg Schaible * @since 1.3 - * @deprecated As of 1.4.5, minimal JDK version will be 1.6 for next major release + * @deprecated As of 1.4.5, minimal JDK version will be 1.7 for next major release */ public interface AnnotationConfiguration { Index: 3rdParty_sources/xstream/com/thoughtworks/xstream/mapper/AttributeMapper.java =================================================================== diff -u -re22799e3f19d9b43efda2fcad687abb2e111fa81 -rb8e9a833ffc463d276048d34b20d1ae57480556e --- 3rdParty_sources/xstream/com/thoughtworks/xstream/mapper/AttributeMapper.java (.../AttributeMapper.java) (revision e22799e3f19d9b43efda2fcad687abb2e111fa81) +++ 3rdParty_sources/xstream/com/thoughtworks/xstream/mapper/AttributeMapper.java (.../AttributeMapper.java) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2013, 2018 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -107,8 +107,8 @@ } else if (fieldNameToTypeMap.get(fieldName) == type) { return true; } else if (fieldName != null && definedIn != null) { - Field field = reflectionProvider.getField(definedIn, fieldName); - return fieldToUseAsAttribute.contains(field); + final Field field = reflectionProvider.getFieldOrNull(definedIn, fieldName); + return field != null && fieldToUseAsAttribute.contains(field); } return false; } @@ -140,8 +140,8 @@ * @deprecated As of 1.3.1, use {@link #getConverterFromAttribute(Class, String, Class)} */ public SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute) { - Field field = reflectionProvider.getField(definedIn, attribute); - return getConverterFromAttribute(definedIn, attribute, field.getType()); + final Field field = reflectionProvider.getFieldOrNull(definedIn, attribute); + return field != null ? getConverterFromAttribute(definedIn, attribute, field.getType()) : null; } public SingleValueConverter getConverterFromAttribute(Class definedIn, String attribute, Class type) { @@ -160,19 +160,20 @@ * @param field the field itself * @since 1.2.2 */ - public void addAttributeFor(Field field) { - fieldToUseAsAttribute.add(field); + public void addAttributeFor(final Field field) { + if (field != null) { + fieldToUseAsAttribute.add(field); + } } /** * Tells this mapper to use an attribute for this field. * * @param definedIn the declaring class of the field * @param fieldName the name of the field - * @throws IllegalArgumentException if the field does not exist * @since 1.3 */ public void addAttributeFor(Class definedIn, String fieldName) { - fieldToUseAsAttribute.add(reflectionProvider.getField(definedIn, fieldName)); + addAttributeFor(reflectionProvider.getField(definedIn, fieldName)); } } Index: lams_build/3rdParty.userlibraries =================================================================== diff -u -rbe86c0bc220914398d3ce8ec9ae9cab91b47353a -rb8e9a833ffc463d276048d34b20d1ae57480556e --- lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision be86c0bc220914398d3ce8ec9ae9cab91b47353a) +++ lams_build/3rdParty.userlibraries (.../3rdParty.userlibraries) (revision b8e9a833ffc463d276048d34b20d1ae57480556e) @@ -32,7 +32,7 @@