Initial load
diff --git a/test/java/beans/XMLEncoder/4741757/AbstractTest.java b/test/java/beans/XMLEncoder/4741757/AbstractTest.java
new file mode 100644
index 0000000..4d93f4d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/4741757/AbstractTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+abstract class AbstractTest {
+ public abstract int getValue();
+
+ public final String toString() {
+ return Integer.toString(getValue());
+ }
+
+ static void test(AbstractTest object) {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+ XMLEncoder encoder = new XMLEncoder(output);
+ encoder.setPersistenceDelegate(
+ object.getClass(),
+ new DefaultPersistenceDelegate(new String[] {"value"}));
+
+ encoder.writeObject(object);
+ encoder.close();
+
+ System.out.print(output);
+
+ ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
+ XMLDecoder decoder = new XMLDecoder(input);
+ AbstractTest result = (AbstractTest) decoder.readObject();
+ decoder.close();
+
+ if (object.getValue() != result.getValue())
+ throw new Error("Should be " + object);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/4741757/TestFieldAccess.java b/test/java/beans/XMLEncoder/4741757/TestFieldAccess.java
new file mode 100644
index 0000000..9a5cafd
--- /dev/null
+++ b/test/java/beans/XMLEncoder/4741757/TestFieldAccess.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4741757
+ * @summary Tests encoding with wrong field name
+ * @author Sergey Malenkov
+ */
+
+public final class TestFieldAccess extends AbstractTest {
+ public static void main(String[] args) {
+ test(new TestFieldAccess(5));
+ }
+
+ /**
+ * The name of this field is the same as the name of property.
+ */
+ private int value = -1;
+
+ private int property;
+
+ public TestFieldAccess(int value) {
+ this.property = value;
+ }
+
+ public int getValue() {
+ return this.property;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/4741757/TestSecurityManager.java b/test/java/beans/XMLEncoder/4741757/TestSecurityManager.java
new file mode 100644
index 0000000..c683668
--- /dev/null
+++ b/test/java/beans/XMLEncoder/4741757/TestSecurityManager.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4741757
+ * @summary Tests encoding with security manager
+ * @author Sergey Malenkov
+ */
+
+public final class TestSecurityManager extends AbstractTest {
+ public static void main(String[] args) {
+ System.setSecurityManager(new SecurityManager());
+ test(new TestSecurityManager(5));
+ }
+
+ private int value;
+
+ public TestSecurityManager(int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return this.value;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/4741757/TestStackOverflow.java b/test/java/beans/XMLEncoder/4741757/TestStackOverflow.java
new file mode 100644
index 0000000..a0f2a6c
--- /dev/null
+++ b/test/java/beans/XMLEncoder/4741757/TestStackOverflow.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4741757
+ * @summary Tests stack overflow if equals is defined
+ * @author Sergey Malenkov
+ */
+
+public final class TestStackOverflow extends AbstractTest {
+ public static void main(String[] args) {
+ test(new TestStackOverflow(5));
+ }
+
+ /**
+ * The name of this field is the same as the name of property.
+ */
+ private int value = -1;
+
+ private int property;
+
+ public TestStackOverflow(int value) {
+ this.property = value;
+ }
+
+ public int getValue() {
+ return this.property;
+ }
+
+ public boolean equals(Object object) {
+ if (object instanceof TestStackOverflow) {
+ TestStackOverflow test = (TestStackOverflow) object;
+ return test.property == this.property;
+ }
+ return false;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/AbstractTest.java b/test/java/beans/XMLEncoder/AbstractTest.java
new file mode 100644
index 0000000..a01deb6
--- /dev/null
+++ b/test/java/beans/XMLEncoder/AbstractTest.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.beans.ExceptionListener;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import java.nio.charset.Charset;
+
+abstract class AbstractTest<T> implements ExceptionListener {
+ private final BeanValidator validator = new BeanValidator();
+
+ public final void exceptionThrown(Exception exception) {
+ throw new Error("unexpected exception", exception);
+ }
+
+ /**
+ * Returns an object to test.
+ * This object will be encoded and decoded
+ * and the object creation will be tested.
+ *
+ * @return an object to test
+ */
+ protected abstract T getObject();
+
+ /**
+ * Returns a different object to test.
+ * If this object is not {@code null}
+ * it will be encoded and decoded
+ * and the object updating will be tested.
+ *
+ * @return a different object to test
+ */
+ protected T getAnotherObject() {
+ return null;
+ }
+
+ /**
+ * This method should be overriden
+ * if specified encoder should be initialized.
+ *
+ * @param encoder the XML encoder to initialize
+ */
+ protected void initialize(XMLEncoder encoder) {
+ }
+
+ /**
+ * This method should be overriden
+ * if specified decoder should be initialized.
+ *
+ * @param decoder the XML decoder to initialize
+ */
+ protected void initialize(XMLDecoder decoder) {
+ }
+
+ /**
+ * This method should be overriden
+ * for test-specific comparison.
+ *
+ * @param before the object before encoding
+ * @param after the object after decoding
+ */
+ protected void validate(T before, T after) {
+ this.validator.validate(before, after);
+ }
+
+ /**
+ * This is entry point to start testing.
+ *
+ * @param security use {@code true} to start
+ * second pass in secure context
+ */
+ final void test(boolean security) {
+ Bean.DEFAULT = null;
+ T object = getObject();
+
+ System.out.println("Test object");
+ validate(object, testObject(object));
+
+ System.out.println("Test object creating");
+ validate(object, testBean(object));
+
+ Bean.DEFAULT = object;
+ object = getAnotherObject();
+ if (object != null) {
+ System.out.println("Test another object");
+ validate(object, testObject(object));
+
+ System.out.println("Test object updating");
+ validate(object, testBean(object));
+ }
+ if (security) {
+ System.setSecurityManager(new SecurityManager());
+ test(false);
+ }
+ }
+
+ private T testBean(T object) {
+ Bean bean = new Bean();
+ bean.setValue(object);
+ bean = testObject(bean);
+ return (T) bean.getValue();
+ }
+
+ private <Z> Z testObject(Z object) {
+ byte[] array = writeObject(object);
+ System.out.print(new String(array, Charset.forName("UTF-8")));
+ return (Z) readObject(array);
+ }
+
+ private byte[] writeObject(Object object) {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ XMLEncoder encoder = new XMLEncoder(output);
+ initialize(encoder);
+ encoder.writeObject(object);
+ encoder.close();
+ return output.toByteArray();
+ }
+
+ private Object readObject(byte[] array) {
+ ByteArrayInputStream input = new ByteArrayInputStream(array);
+ XMLDecoder decoder = new XMLDecoder(input);
+ initialize(decoder);
+ Object object = decoder.readObject();
+ decoder.close();
+ return object;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Bean.java b/test/java/beans/XMLEncoder/Bean.java
new file mode 100644
index 0000000..9faf439
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Bean.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+public final class Bean {
+ public static Object DEFAULT;
+
+ private Object value = DEFAULT;
+
+ public Object getValue() {
+ return this.value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/BeanValidator.java b/test/java/beans/XMLEncoder/BeanValidator.java
new file mode 100644
index 0000000..82105eb
--- /dev/null
+++ b/test/java/beans/XMLEncoder/BeanValidator.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.IdentityHashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.SortedMap;
+import java.util.SortedSet;
+
+final class BeanValidator {
+ private final Map<Object, Object> cache = new IdentityHashMap<Object, Object>();
+
+ public void validate(Object object1, Object object2) {
+ // compare references
+ if (object1 == object2) {
+ return;
+ }
+ // check for null
+ if ((object1 == null) || (object2 == null)) {
+ throw new IllegalStateException("could not compare object with null");
+ }
+ // resolve self references
+ if (isCyclic(object1, object2)) {
+ return;
+ }
+ // resolve cross references
+ if (isCyclic(object2, object1)) {
+ return;
+ }
+ Class type = object1.getClass();
+ if (!type.equals(object2.getClass())) {
+ throw new IllegalStateException("could not compare objects with different types");
+ }
+ // validate elements of arrays
+ if (type.isArray()) {
+ int length = Array.getLength(object1);
+ if (length != Array.getLength(object2)) {
+ throw new IllegalStateException("could not compare arrays with different lengths");
+ }
+ try {
+ this.cache.put(object1, object2);
+ for (int i = 0; i < length; i++) {
+ log("validate array element", Integer.valueOf(i));
+ validate(Array.get(object1, i), Array.get(object2, i));
+ }
+ } finally {
+ this.cache.remove(object1);
+ }
+ return;
+ }
+ // validate objects using equals()
+ // we assume that the method equals(Object) can be called,
+ // if the class declares such method
+ if (isDefined(type, "equals", Object.class)) {
+ if (object1.equals(object2)) {
+ return;
+ }
+ throw new IllegalStateException("the first object is not equal to the second one");
+ }
+ // validate comparable objects using compareTo()
+ // we assume that the method compareTo(Object) can be called,
+ // if the class declares such method and implements interface Comparable
+ if (Comparable.class.isAssignableFrom(type) && isDefined(type, "compareTo", Object.class)) {
+ Comparable cmp = (Comparable) object1;
+ if (0 == cmp.compareTo(object2)) {
+ return;
+ }
+ throw new IllegalStateException("the first comparable object is not equal to the second one");
+ }
+ try {
+ this.cache.put(object1, object2);
+ // validate values of public fields
+ for (Field field : getFields(type)) {
+ int mod = field.getModifiers();
+ if (!Modifier.isStatic(mod)) {
+ log("validate field", field.getName());
+ validate(object1, object2, field);
+ }
+ }
+ // validate values of properties
+ for (PropertyDescriptor pd : getDescriptors(type)) {
+ Method method = pd.getReadMethod();
+ if (method != null) {
+ log("validate property", pd.getName());
+ validate(object1, object2, method);
+ }
+ }
+ // validate contents of maps
+ if (SortedMap.class.isAssignableFrom(type)) {
+ validate((Map) object1, (Map) object2, true);
+ } else if (Map.class.isAssignableFrom(type)) {
+ validate((Map) object1, (Map) object2, false);
+ }
+ // validate contents of collections
+ if (SortedSet.class.isAssignableFrom(type)) {
+ validate((Collection) object1, (Collection) object2, true);
+ } else if (List.class.isAssignableFrom(type)) {
+ validate((Collection) object1, (Collection) object2, true);
+ } else if (Queue.class.isAssignableFrom(type)) {
+ validate((Collection) object1, (Collection) object2, true);
+ } else if (Collection.class.isAssignableFrom(type)) {
+ validate((Collection) object1, (Collection) object2, false);
+ }
+ } finally {
+ this.cache.remove(object1);
+ }
+ }
+
+ private void validate(Object object1, Object object2, Field field) {
+ try {
+ object1 = field.get(object1);
+ object2 = field.get(object2);
+
+ validate(object1, object2);
+ }
+ catch (IllegalAccessException exception) {
+ log(exception);
+ }
+ }
+
+ private void validate(Object object1, Object object2, Method method) {
+ try {
+ object1 = method.invoke(object1);
+ object2 = method.invoke(object2);
+
+ validate(object1, object2);
+ }
+ catch (IllegalAccessException exception) {
+ log(exception);
+ }
+ catch (InvocationTargetException exception) {
+ log(exception.getCause());
+ }
+ }
+
+ private void validate(Collection c1, Collection c2, boolean sorted) {
+ if (c1.size() != c2.size()) {
+ throw new IllegalStateException("could not compare collections with different sizes");
+ }
+ if (sorted) {
+ Iterator first = c1.iterator();
+ Iterator second = c2.iterator();
+ for (int i = 0; first.hasNext() && second.hasNext(); i++) {
+ log("validate collection element", Integer.valueOf(i));
+ validate(first.next(), second.next());
+ }
+ if (first.hasNext() || second.hasNext()) {
+ throw new IllegalStateException("one collection contains more elements than another one");
+ }
+ } else {
+ List list = new ArrayList(c2);
+ Iterator first = c1.iterator();
+ for (int i = 0; first.hasNext(); i++) {
+ Object value = first.next();
+ log("validate collection element", Integer.valueOf(i));
+ Iterator second = list.iterator();
+ for (int j = 0; second.hasNext(); j++) {
+ log("validate collection element against", Integer.valueOf(j));
+ try {
+ validate(value, second.next());
+ second.remove();
+ break;
+ } catch (IllegalStateException exception) {
+ if (!second.hasNext()) {
+ throw new IllegalStateException("one collection does not contain some elements from another one", exception);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private void validate(Map map1, Map map2, boolean sorted) {
+ if (map1.size() != map2.size()) {
+ throw new IllegalStateException("could not compare maps with different sizes");
+ }
+ if (sorted) {
+ Iterator first = map1.entrySet().iterator();
+ Iterator second = map2.entrySet().iterator();
+ int index = 0;
+ while (first.hasNext() && second.hasNext()) {
+ log("validate map entry", Integer.valueOf(index++));
+ validate(first.next(), second.next());
+ }
+ if (first.hasNext() || second.hasNext()) {
+ throw new IllegalStateException("one map contains more entries than another one");
+ }
+ } else {
+ // assume that equals() can be used for keys
+ for (Object key : map1.keySet()) {
+ log("validate map value for key", key);
+ validate(map1.get(key), map2.get(key));
+ }
+ }
+ }
+
+ private boolean isCyclic(Object object1, Object object2) {
+ Object object = this.cache.get(object1);
+ if (object == null) {
+ return false;
+ }
+ if (object == object2) {
+ return true;
+ }
+ throw new IllegalStateException("could not resolve cyclic reference");
+ }
+
+ private boolean isDefined(Class type, String name, Class... params) {
+ try {
+ return type.equals(type.getMethod(name, params).getDeclaringClass());
+ }
+ catch (NoSuchMethodException exception) {
+ log(exception);
+ }
+ catch (SecurityException exception) {
+ log(exception);
+ }
+ return false;
+ }
+
+ private static final Field[] FIELDS = {};
+
+ private Field[] getFields(Class type) {
+ try {
+ return type.getFields();
+ }
+ catch (SecurityException exception) {
+ log(exception);
+ }
+ return FIELDS;
+ }
+
+ private static final PropertyDescriptor[] DESCRIPTORS = {};
+
+ private PropertyDescriptor[] getDescriptors(Class type) {
+ try {
+ return Introspector.getBeanInfo(type, Object.class).getPropertyDescriptors();
+ }
+ catch (IntrospectionException exception) {
+ log(exception);
+ }
+ return DESCRIPTORS;
+ }
+
+ private final StringBuilder sb = new StringBuilder(1024);
+
+ private void log(String message, Object value) {
+ this.sb.setLength(0);
+ int size = this.cache.size();
+ while (0 < size--) {
+ this.sb.append(" ");
+ }
+ this.sb.append(" - ");
+ this.sb.append(message);
+ if (value != null) {
+ this.sb.append(": ");
+ this.sb.append(value);
+ }
+ System.out.println(this.sb.toString());
+ }
+
+ private void log(Throwable throwable) {
+ this.sb.setLength(0);
+ int size = this.cache.size();
+ while (0 < size--) {
+ this.sb.append(" ");
+ }
+ this.sb.append(" ? ");
+ this.sb.append(throwable);
+ System.out.println(this.sb.toString());
+ }
+}
diff --git a/test/java/beans/XMLEncoder/EnumPrivate.java b/test/java/beans/XMLEncoder/EnumPrivate.java
new file mode 100644
index 0000000..eb69ac6
--- /dev/null
+++ b/test/java/beans/XMLEncoder/EnumPrivate.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+enum EnumPrivate {
+ A0,B0,C0,D0,E0,F0,G0,H0,I0,J0,K0,L0,M0,N0,O0,P0,Q0,R0,S0,T0,U0,V0,W0,X0,Y0,Z0,
+ A1,B1,C1,D1,E1,F1,G1,H1,I1,J1,K1,L1,M1,N1,O1,P1,Q1,R1,S1,T1,U1,V1,W1,X1,Y1,Z1,
+ A2,B2,C2,D2,E2,F2,G2,H2,I2,J2,K2,L2,M2,N2,O2,P2,Q2,R2,S2,T2,U2,V2,W2,X2,Y2,Z2,
+ A3,B3,C3,D3,E3,F3,G3,H3,I3,J3,K3,L3,M3,N3,O3,P3,Q3,R3,S3,T3,U3,V3,W3,X3,Y3,Z3,
+ A4,B4,C4,D4,E4,F4,G4,H4,I4,J4,K4,L4,M4,N4,O4,P4,Q4,R4,S4,T4,U4,V4,W4,X4,Y4,Z4,
+ A5,B5,C5,D5,E5,F5,G5,H5,I5,J5,K5,L5,M5,N5,O5,P5,Q5,R5,S5,T5,U5,V5,W5,X5,Y5,Z5,
+ A6,B6,C6,D6,E6,F6,G6,H6,I6,J6,K6,L6,M6,N6,O6,P6,Q6,R6,S6,T6,U6,V6,W6,X6,Y6,Z6,
+ A7,B7,C7,D7,E7,F7,G7,H7,I7,J7,K7,L7,M7,N7,O7,P7,Q7,R7,S7,T7,U7,V7,W7,X7,Y7,Z7,
+ A8,B8,C8,D8,E8,F8,G8,H8,I8,J8,K8,L8,M8,N8,O8,P8,Q8,R8,S8,T8,U8,V8,W8,X8,Y8,Z8,
+ A9,B9,C9,D9,E9,F9,G9,H9,I9,J9,K9,L9,M9,N9,O9,P9,Q9,R9,S9,T9,U9,V9,W9,X9,Y9,Z9,
+}
diff --git a/test/java/beans/XMLEncoder/EnumPublic.java b/test/java/beans/XMLEncoder/EnumPublic.java
new file mode 100644
index 0000000..e735b41
--- /dev/null
+++ b/test/java/beans/XMLEncoder/EnumPublic.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+public enum EnumPublic {A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
diff --git a/test/java/beans/XMLEncoder/Test4625418.java b/test/java/beans/XMLEncoder/Test4625418.java
new file mode 100644
index 0000000..6cfd4b4
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4625418.java
@@ -0,0 +1,409 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4625418
+ * @summary Tests XML <a href="http://download.java.net/jdk6/docs/technotes/guides/intl/encoding.doc.html">encoding</a>
+ * @author Sergey Malenkov
+ *
+ * @run main Test4625418 ASCII
+ * @run main Test4625418 Big5
+ * ?run main Test4625418 Big5-HKSCS
+ * ?run main Test4625418 Big5_HKSCS
+ * @run main Test4625418 Big5_Solaris
+ * ?run main Test4625418 Cp037
+ * @run main Test4625418 Cp1006
+ * ?run main Test4625418 Cp1025
+ * -run main Test4625418 Cp1026
+ * @run main Test4625418 Cp1046
+ * @run main Test4625418 Cp1047
+ * @run main Test4625418 Cp1097
+ * @run main Test4625418 Cp1098
+ * ?run main Test4625418 Cp1112
+ * ?run main Test4625418 Cp1122
+ * ?run main Test4625418 Cp1123
+ * @run main Test4625418 Cp1124
+ * ?run main Test4625418 Cp1140
+ * ?run main Test4625418 Cp1141
+ * ?run main Test4625418 Cp1142
+ * ?run main Test4625418 Cp1143
+ * ?run main Test4625418 Cp1144
+ * ?run main Test4625418 Cp1145
+ * ?run main Test4625418 Cp1146
+ * ?run main Test4625418 Cp1147
+ * ?run main Test4625418 Cp1148
+ * ?run main Test4625418 Cp1149
+ * @run main Test4625418 Cp1250
+ * @run main Test4625418 Cp1251
+ * @run main Test4625418 Cp1252
+ * @run main Test4625418 Cp1253
+ * @run main Test4625418 Cp1254
+ * @run main Test4625418 Cp1255
+ * @run main Test4625418 Cp1256
+ * @run main Test4625418 Cp1257
+ * @run main Test4625418 Cp1258
+ * ?run main Test4625418 Cp1381
+ * ?run main Test4625418 Cp1383
+ * ?run main Test4625418 Cp273
+ * ?run main Test4625418 Cp277
+ * ?run main Test4625418 Cp278
+ * ?run main Test4625418 Cp280
+ * ?run main Test4625418 Cp284
+ * ?run main Test4625418 Cp285
+ * ?run main Test4625418 Cp297
+ * ?run main Test4625418 Cp33722
+ * ?run main Test4625418 Cp420
+ * ?run main Test4625418 Cp424
+ * @run main Test4625418 Cp437
+ * ?run main Test4625418 Cp500
+ * ?run main Test4625418 Cp50220
+ * ?run main Test4625418 Cp50221
+ * @run main Test4625418 Cp737
+ * @run main Test4625418 Cp775
+ * -run main Test4625418 Cp834
+ * ?run main Test4625418 Cp838
+ * @run main Test4625418 Cp850
+ * @run main Test4625418 Cp852
+ * @run main Test4625418 Cp855
+ * @run main Test4625418 Cp856
+ * @run main Test4625418 Cp857
+ * @run main Test4625418 Cp858
+ * @run main Test4625418 Cp860
+ * @run main Test4625418 Cp861
+ * @run main Test4625418 Cp862
+ * @run main Test4625418 Cp863
+ * @run main Test4625418 Cp864
+ * @run main Test4625418 Cp865
+ * @run main Test4625418 Cp866
+ * @run main Test4625418 Cp868
+ * @run main Test4625418 Cp869
+ * ?run main Test4625418 Cp870
+ * ?run main Test4625418 Cp871
+ * @run main Test4625418 Cp874
+ * ?run main Test4625418 Cp875
+ * ?run main Test4625418 Cp918
+ * @run main Test4625418 Cp921
+ * @run main Test4625418 Cp922
+ * -run main Test4625418 Cp930
+ * @run main Test4625418 Cp933
+ * ?run main Test4625418 Cp935
+ * ?run main Test4625418 Cp937
+ * ?run main Test4625418 Cp939
+ * ?run main Test4625418 Cp942
+ * ?run main Test4625418 Cp942C
+ * @run main Test4625418 Cp943
+ * ?run main Test4625418 Cp943C
+ * @run main Test4625418 Cp948
+ * @run main Test4625418 Cp949
+ * ?run main Test4625418 Cp949C
+ * @run main Test4625418 Cp950
+ * @run main Test4625418 Cp964
+ * ?run main Test4625418 Cp970
+ * ?run main Test4625418 EUC-JP
+ * @run main Test4625418 EUC-KR
+ * @run main Test4625418 EUC_CN
+ * ?run main Test4625418 EUC_JP
+ * ?run main Test4625418 EUC_JP_LINUX
+ * ?run main Test4625418 EUC_JP_Solaris
+ * @run main Test4625418 EUC_KR
+ * ?run main Test4625418 EUC_TW
+ * @run main Test4625418 GB18030
+ * @run main Test4625418 GB2312
+ * @run main Test4625418 GBK
+ * ?run main Test4625418 IBM-Thai
+ * @run main Test4625418 IBM00858
+ * ?run main Test4625418 IBM01140
+ * ?run main Test4625418 IBM01141
+ * ?run main Test4625418 IBM01142
+ * ?run main Test4625418 IBM01143
+ * ?run main Test4625418 IBM01144
+ * ?run main Test4625418 IBM01145
+ * ?run main Test4625418 IBM01146
+ * ?run main Test4625418 IBM01147
+ * ?run main Test4625418 IBM01148
+ * ?run main Test4625418 IBM01149
+ * ?run main Test4625418 IBM037
+ * -run main Test4625418 IBM1026
+ * @run main Test4625418 IBM1047
+ * ?run main Test4625418 IBM273
+ * ?run main Test4625418 IBM277
+ * ?run main Test4625418 IBM278
+ * ?run main Test4625418 IBM280
+ * ?run main Test4625418 IBM284
+ * ?run main Test4625418 IBM285
+ * ?run main Test4625418 IBM297
+ * ?run main Test4625418 IBM420
+ * ?run main Test4625418 IBM424
+ * @run main Test4625418 IBM437
+ * ?run main Test4625418 IBM500
+ * @run main Test4625418 IBM775
+ * @run main Test4625418 IBM850
+ * @run main Test4625418 IBM852
+ * @run main Test4625418 IBM855
+ * @run main Test4625418 IBM857
+ * @run main Test4625418 IBM860
+ * @run main Test4625418 IBM861
+ * @run main Test4625418 IBM862
+ * @run main Test4625418 IBM863
+ * @run main Test4625418 IBM864
+ * @run main Test4625418 IBM865
+ * @run main Test4625418 IBM866
+ * @run main Test4625418 IBM868
+ * @run main Test4625418 IBM869
+ * ?run main Test4625418 IBM870
+ * ?run main Test4625418 IBM871
+ * ?run main Test4625418 IBM918
+ * ?run main Test4625418 ISCII91
+ * -run main Test4625418 ISO-2022-CN
+ * @run main Test4625418 ISO-2022-JP
+ * @run main Test4625418 ISO-2022-KR
+ * @run main Test4625418 ISO-8859-1
+ * @run main Test4625418 ISO-8859-13
+ * @run main Test4625418 ISO-8859-15
+ * @run main Test4625418 ISO-8859-2
+ * @run main Test4625418 ISO-8859-3
+ * @run main Test4625418 ISO-8859-4
+ * @run main Test4625418 ISO-8859-5
+ * @run main Test4625418 ISO-8859-6
+ * @run main Test4625418 ISO-8859-7
+ * @run main Test4625418 ISO-8859-8
+ * @run main Test4625418 ISO-8859-9
+ * -run main Test4625418 ISO2022CN
+ * @run main Test4625418 ISO2022JP
+ * @run main Test4625418 ISO2022KR
+ * -run main Test4625418 ISO2022_CN_CNS
+ * -run main Test4625418 ISO2022_CN_GB
+ * @run main Test4625418 ISO8859_1
+ * @run main Test4625418 ISO8859_13
+ * @run main Test4625418 ISO8859_15
+ * @run main Test4625418 ISO8859_2
+ * @run main Test4625418 ISO8859_3
+ * @run main Test4625418 ISO8859_4
+ * @run main Test4625418 ISO8859_5
+ * @run main Test4625418 ISO8859_6
+ * @run main Test4625418 ISO8859_7
+ * @run main Test4625418 ISO8859_8
+ * @run main Test4625418 ISO8859_9
+ * -run main Test4625418 JISAutoDetect
+ * ?run main Test4625418 JIS_X0201
+ * -run main Test4625418 JIS_X0212-1990
+ * @run main Test4625418 KOI8-R
+ * @run main Test4625418 KOI8-U
+ * @run main Test4625418 KOI8_R
+ * @run main Test4625418 KOI8_U
+ * @run main Test4625418 MS874
+ * ?run main Test4625418 MS932
+ * ?run main Test4625418 MS936
+ * @run main Test4625418 MS949
+ * @run main Test4625418 MS950
+ * ?run main Test4625418 MS950_HKSCS
+ * @run main Test4625418 MacArabic
+ * @run main Test4625418 MacCentralEurope
+ * @run main Test4625418 MacCroatian
+ * @run main Test4625418 MacCyrillic
+ * -run main Test4625418 MacDingbat
+ * @run main Test4625418 MacGreek
+ * @run main Test4625418 MacHebrew
+ * @run main Test4625418 MacIceland
+ * @run main Test4625418 MacRoman
+ * @run main Test4625418 MacRomania
+ * -run main Test4625418 MacSymbol
+ * @run main Test4625418 MacThai
+ * @run main Test4625418 MacTurkish
+ * @run main Test4625418 MacUkraine
+ * ?run main Test4625418 PCK
+ * ?run main Test4625418 SJIS
+ * ?run main Test4625418 Shift_JIS
+ * @run main Test4625418 TIS-620
+ * @run main Test4625418 TIS620
+ * @run main Test4625418 US-ASCII
+ * @run main Test4625418 UTF-16
+ * @run main Test4625418 UTF-16BE
+ * @run main Test4625418 UTF-16LE
+ * @run main Test4625418 UTF-32
+ * @run main Test4625418 UTF-32BE
+ * @run main Test4625418 UTF-32LE
+ * @run main Test4625418 UTF-8
+ * @run main Test4625418 UTF8
+ * @run main Test4625418 UTF_32
+ * @run main Test4625418 UTF_32BE
+ * -run main Test4625418 UTF_32BE_BOM
+ * @run main Test4625418 UTF_32LE
+ * -run main Test4625418 UTF_32LE_BOM
+ * @run main Test4625418 UnicodeBig
+ * @run main Test4625418 UnicodeBigUnmarked
+ * @run main Test4625418 UnicodeLittle
+ * @run main Test4625418 UnicodeLittleUnmarked
+ * @run main Test4625418 windows-1250
+ * @run main Test4625418 windows-1251
+ * @run main Test4625418 windows-1252
+ * @run main Test4625418 windows-1253
+ * @run main Test4625418 windows-1254
+ * @run main Test4625418 windows-1255
+ * @run main Test4625418 windows-1256
+ * @run main Test4625418 windows-1257
+ * @run main Test4625418 windows-1258
+ * ?run main Test4625418 windows-31j
+ * -run main Test4625418 x-Big5_Solaris
+ * ?run main Test4625418 x-EUC-TW
+ * @run main Test4625418 x-IBM1006
+ * ?run main Test4625418 x-IBM1025
+ * @run main Test4625418 x-IBM1046
+ * @run main Test4625418 x-IBM1097
+ * @run main Test4625418 x-IBM1098
+ * ?run main Test4625418 x-IBM1112
+ * ?run main Test4625418 x-IBM1122
+ * ?run main Test4625418 x-IBM1123
+ * @run main Test4625418 x-IBM1124
+ * ?run main Test4625418 x-IBM1381
+ * ?run main Test4625418 x-IBM1383
+ * ?run main Test4625418 x-IBM33722
+ * @run main Test4625418 x-IBM737
+ * -run main Test4625418 x-IBM834
+ * @run main Test4625418 x-IBM856
+ * @run main Test4625418 x-IBM874
+ * ?run main Test4625418 x-IBM875
+ * @run main Test4625418 x-IBM921
+ * @run main Test4625418 x-IBM922
+ * -run main Test4625418 x-IBM930
+ * @run main Test4625418 x-IBM933
+ * ?run main Test4625418 x-IBM935
+ * ?run main Test4625418 x-IBM937
+ * ?run main Test4625418 x-IBM939
+ * ?run main Test4625418 x-IBM942
+ * ?run main Test4625418 x-IBM942C
+ * @run main Test4625418 x-IBM943
+ * ?run main Test4625418 x-IBM943C
+ * @run main Test4625418 x-IBM948
+ * @run main Test4625418 x-IBM949
+ * ?run main Test4625418 x-IBM949C
+ * @run main Test4625418 x-IBM950
+ * @run main Test4625418 x-IBM964
+ * ?run main Test4625418 x-IBM970
+ * ?run main Test4625418 x-ISCII91
+ * -run main Test4625418 x-ISO2022-CN-CNS
+ * -run main Test4625418 x-ISO2022-CN-GB
+ * -run main Test4625418 x-JIS0208
+ * -run main Test4625418 x-JISAutoDetect
+ * @run main Test4625418 x-Johab
+ * ?run main Test4625418 x-MS950-HKSCS
+ * @run main Test4625418 x-MacArabic
+ * @run main Test4625418 x-MacCentralEurope
+ * @run main Test4625418 x-MacCroatian
+ * @run main Test4625418 x-MacCyrillic
+ * -run main Test4625418 x-MacDingbat
+ * @run main Test4625418 x-MacGreek
+ * @run main Test4625418 x-MacHebrew
+ * @run main Test4625418 x-MacIceland
+ * @run main Test4625418 x-MacRoman
+ * @run main Test4625418 x-MacRomania
+ * -run main Test4625418 x-MacSymbol
+ * @run main Test4625418 x-MacThai
+ * @run main Test4625418 x-MacTurkish
+ * @run main Test4625418 x-MacUkraine
+ * ?run main Test4625418 x-PCK
+ * @run main Test4625418 x-UTF-16LE-BOM
+ * -run main Test4625418 x-UTF-32BE-BOM
+ * -run main Test4625418 x-UTF-32LE-BOM
+ * ?run main Test4625418 x-euc-jp-linux
+ * ?run main Test4625418 x-eucJP-Open
+ * @run main Test4625418 x-iso-8859-11
+ * @run main Test4625418 x-mswin-936
+ * ?run main Test4625418 x-windows-50220
+ * ?run main Test4625418 x-windows-50221
+ * @run main Test4625418 x-windows-874
+ * @run main Test4625418 x-windows-949
+ * @run main Test4625418 x-windows-950
+ * ?run main Test4625418 x-windows-iso2022jp
+ */
+
+import java.beans.ExceptionListener;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.UnsupportedCharsetException;
+
+public final class Test4625418 implements ExceptionListener {
+ public static void main(String[] args) {
+ new Test4625418(args[0]).test(createString(0x10000));
+ System.out.println("Test passed: " + args[0]);
+ }
+
+ private static String createString(int length) {
+ StringBuilder sb = new StringBuilder(length);
+ while (0 < length--)
+ sb.append((char) length);
+
+ return sb.toString();
+ }
+
+ private final String encoding;
+
+ private Test4625418(String encoding) {
+ this.encoding = encoding;
+ }
+
+ private void test(String string) {
+ try {
+ File file = new File("4625418." + this.encoding + ".xml");
+
+ FileOutputStream output = new FileOutputStream(file);
+ XMLEncoder encoder = new XMLEncoder(output, this.encoding, true, 0);
+ encoder.setExceptionListener(this);
+ encoder.writeObject(string);
+ encoder.close();
+
+ FileInputStream input = new FileInputStream(file);
+ XMLDecoder decoder = new XMLDecoder(input);
+ decoder.setExceptionListener(this);
+ Object object = decoder.readObject();
+ decoder.close();
+
+ if (!string.equals(object))
+ throw new Error(this.encoding + " - can't read properly");
+
+ file.delete();
+ }
+ catch (FileNotFoundException exception) {
+ throw new Error(this.encoding + " - file not found", exception);
+ }
+ catch (IllegalCharsetNameException exception) {
+ throw new Error(this.encoding + " - illegal charset name", exception);
+ }
+ catch (UnsupportedCharsetException exception) {
+ throw new Error(this.encoding + " - unsupported charset", exception);
+ }
+ catch (UnsupportedOperationException exception) {
+ throw new Error(this.encoding + " - unsupported encoder", exception);
+ }
+ }
+
+ public void exceptionThrown(Exception exception) {
+ throw new Error(this.encoding + " - internal", exception);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4631471.java b/test/java/beans/XMLEncoder/Test4631471.java
new file mode 100644
index 0000000..1f9fc26
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4631471.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4631471
+ * @summary Tests DefaultTreeModel encoding
+ * @author Sergey Malenkov, Mark Davidson
+ */
+
+import java.beans.XMLEncoder;
+import javax.swing.JTree;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreeNode;
+
+public abstract class Test4631471 extends AbstractTest {
+ public static void main(String[] args) throws Exception {
+ // the DefaultMutableTreeNode will archive correctly
+ new Test4631471() {
+ protected Object getObject() {
+ return getRoot();
+ }
+ }.test(false);
+
+ // the DefaultTreeModel will also archive correctly
+ new Test4631471() {
+ protected Object getObject() {
+ return getModel();
+ }
+ }.test(false);
+
+ // create a new model from the root node
+ // this simulates the the MetaData ctor:
+ // registerConstructor("javax.swing.tree.DefaultTreeModel", new String[]{"root"});
+ new Test4631471() {
+ protected Object getObject() {
+ return new DefaultTreeModel((TreeNode) getModel().getRoot());
+ }
+ }.test(false);
+
+ // the JTree will archive correctly too
+ new Test4631471() {
+ protected Object getObject() {
+ return getTree();
+ }
+ }.test(false);
+ }
+
+ protected final void validate(Object before, Object after) {
+ // do not any validation
+ }
+
+ protected final void initialize(XMLEncoder encoder) {
+ encoder.setExceptionListener(this);
+ }
+
+ public static TreeNode getRoot() {
+ DefaultMutableTreeNode node = new DefaultMutableTreeNode("root");
+ DefaultMutableTreeNode first = new DefaultMutableTreeNode("first");
+ DefaultMutableTreeNode second = new DefaultMutableTreeNode("second");
+ DefaultMutableTreeNode third = new DefaultMutableTreeNode("third");
+
+ first.add(new DefaultMutableTreeNode("1.1"));
+ first.add(new DefaultMutableTreeNode("1.2"));
+ first.add(new DefaultMutableTreeNode("1.3"));
+
+ second.add(new DefaultMutableTreeNode("2.1"));
+ second.add(new DefaultMutableTreeNode("2.2"));
+ second.add(new DefaultMutableTreeNode("2.3"));
+
+ third.add(new DefaultMutableTreeNode("3.1"));
+ third.add(new DefaultMutableTreeNode("3.2"));
+ third.add(new DefaultMutableTreeNode("3.3"));
+
+ node.add(first);
+ node.add(second);
+ node.add(third);
+
+ return node;
+ }
+
+ public static JTree getTree() {
+ return new JTree(getRoot());
+ }
+
+ public static TreeModel getModel() {
+ return getTree().getModel();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4646747.java b/test/java/beans/XMLEncoder/Test4646747.java
new file mode 100644
index 0000000..025ddeb
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4646747.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4646747
+ * @summary Tests that persistence delegate is correct after memory stress
+ * @author Mark Davidson
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.PersistenceDelegate;
+import java.beans.XMLEncoder;
+
+/**
+ * This bug was introduced in 1.4 FCS but was working in 1.4.beta3
+ */
+public class Test4646747 {
+ public static void main(String[] args) {
+ XMLEncoder encoder = new XMLEncoder(System.out);
+ encoder.setPersistenceDelegate(Test4646747.class, new MyPersistenceDelegate());
+ // WARNING: This can eat up a lot of memory
+ Object[] obs = new Object[10000];
+ for (int i = 0; i < obs.length; i++) {
+ obs[i] = new int[1000];
+ }
+ System.gc();
+ System.gc();
+ PersistenceDelegate pd = encoder.getPersistenceDelegate(Test4646747.class);
+ if (!(pd instanceof MyPersistenceDelegate))
+ throw new Error("persistence delegate has been lost");
+ }
+
+ private static class MyPersistenceDelegate extends DefaultPersistenceDelegate {
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4652928.java b/test/java/beans/XMLEncoder/Test4652928.java
new file mode 100644
index 0000000..2567ae2
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4652928.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2002-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4652928
+ * @summary Tests encoding of collections
+ * @author Sergey Malenkov, Mark Davidson
+ */
+
+import java.beans.beancontext.BeanContext;
+import java.beans.beancontext.BeanContextServicesSupport;
+import java.beans.beancontext.BeanContextSupport;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JLabel;
+
+public class Test4652928 extends AbstractTest<List> {
+ public static void main(String[] args) {
+ new Test4652928().test(true);
+ }
+
+ protected List getObject() {
+ List<BeanContext> list = new ArrayList<BeanContext>();
+ list.add(fill(new BeanContextSupport()));
+ list.add(fill(new BeanContextServicesSupport()));
+ return list;
+ }
+
+ private static BeanContext fill(BeanContext context) {
+ context.add(new JLabel("label"));
+ context.add(new JButton("button"));
+
+ JButton button = new JButton();
+ button.setText("another button");
+ context.add(button);
+
+ return context;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4679556.java b/test/java/beans/XMLEncoder/Test4679556.java
new file mode 100644
index 0000000..4623541
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4679556.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4679556
+ * @summary Tests for duplication of some kind instances
+ * @author Sergey Malenkov, Mark Davidson, Philip Milne
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.XMLEncoder;
+
+/**
+ * Demonstrates the archiver bug, where the XMLEncoder duplicates
+ * the instance of class A because it is required as the target of
+ * a factory method (to produce an instance of class C).
+ * See the output in the file Test.xml for the results and note
+ * the (invalid) forward reference to the instance of class C.
+ *
+ * TO FIX
+ *
+ * Move the first line of the XMLEncoder::mark(Statement method)
+ * to the end of the method.
+ * I.e. replace the mark() method in XMLEncoder with this:
+ * <pre>private void mark(Statement stm) {
+ * Object[] args = stm.getArguments();
+ * for (int i = 0; i < args.length; i++) {
+ * Object arg = args[i];
+ * mark(arg, true);
+ * }
+ * mark(stm.getTarget(), false);
+ * }</pre>
+ *
+ * VALID ARCHIVE (WITH FIX):
+ * <pre><?xml version="1.0" encoding="UTF-8"?>
+ * <java version="1.4.0" class="java.beans.XMLDecoder">
+ * <object class="TestDuplicates$A">
+ * <void id="TestDuplicates$C0" method="createC"/>
+ * <void property="x">
+ * <void property="x">
+ * <object idref="TestDuplicates$C0"/>
+ * </void>
+ * </void>
+ * </object>
+ * </java></pre>
+ *
+ * INVALID ARCHIVE (WITHOUT FIX):
+ * <object class="TestDuplicates$A">
+ * <void property="x">
+ * <void property="x">
+ * <void class="TestDuplicates$A">
+ * <void property="x">
+ * <void property="x">
+ * <object idref="TestDuplicates$C0"/>
+ * </void>
+ * </void>
+ * <void id="TestDuplicates$C0" method="createC"/>
+ * </void>
+ * <object idref="TestDuplicates$C0"/>
+ * </void>
+ * </void>
+ * <void id="TestDuplicates$C0" method="createC"/>
+ * </object>
+ * </java></pre>
+ */
+public class Test4679556 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test4679556().test(true);
+ }
+
+ protected Object getObject() {
+ A a = new A();
+ B b = (B) a.getX();
+ b.setX(a.createC());
+ return a;
+ }
+
+ protected Object getAnotherObject() {
+ return new A();
+ }
+
+ protected void initialize(XMLEncoder encoder) {
+ encoder.setExceptionListener(this);
+ encoder.setPersistenceDelegate(C.class, new DefaultPersistenceDelegate() {
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ C c = (C) oldInstance;
+ return new Expression(c, c.getX(), "createC", new Object[] {});
+ }
+ });
+ }
+
+ public static class Base {
+ private Object x;
+
+ public Object getX() {
+ return this.x;
+ }
+
+ public void setX(Object x) {
+ this.x = x;
+ }
+ }
+
+ public static class A extends Base {
+ public A() {
+ setX(new B());
+ }
+
+ public C createC() {
+ return new C(this);
+ }
+ }
+
+ public static class B extends Base {
+ }
+
+ public static class C extends Base {
+ private C(Object x) {
+ setX(x);
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4822050.java b/test/java/beans/XMLEncoder/Test4822050.java
new file mode 100644
index 0000000..a3d857d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4822050.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4822050
+ * @run main/timeout=1000 Test4822050
+ * @summary Tests concurrent decoding
+ * @author Sergey Malenkov
+ */
+
+import java.beans.ExceptionListener;
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.swing.JLabel;
+
+public class Test4822050 implements ExceptionListener, Runnable {
+ private static final int THREADS = 40;
+ private static final int ATTEMPTS = 100;
+
+ public static void main(String[] args) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ XMLEncoder encoder = new XMLEncoder(baos);
+ encoder.writeObject(new JLabel("hello")); // NON-NLS: test message
+ encoder.close();
+
+ byte[] buffer = baos.toByteArray();
+ for (int i = 0; i < THREADS; i++)
+ start(buffer);
+ }
+
+ private static void start(byte[] buffer) {
+ Thread thread = new Thread(new Test4822050(buffer));
+ thread.start();
+ }
+
+
+ private byte[] buffer;
+
+ public Test4822050(byte[] buffer) {
+ this.buffer = buffer;
+ }
+
+ public void exceptionThrown(Exception exception) {
+ throw new Error(exception);
+ }
+
+ public void run() {
+ for (int i = 0; i < ATTEMPTS; i++)
+ parse();
+ }
+
+ private void parse() {
+ XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(this.buffer));
+ decoder.readObject();
+ decoder.close();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4880633.java b/test/java/beans/XMLEncoder/Test4880633.java
new file mode 100644
index 0000000..a491d59
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4880633.java
@@ -0,0 +1,923 @@
+/*
+ * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4880633
+ * @summary Tests multi threaded access to the XMLEncoder
+ * @author Mark Davidson
+ */
+
+import java.beans.ExceptionListener;
+import java.beans.XMLEncoder;
+import java.io.ByteArrayOutputStream;
+
+public class Test4880633 implements ExceptionListener, Runnable {
+ private static final int THREADS_COUNT = 10;
+ private static final int THREAD_LENGTH = 90;
+
+ public static void main(String[] args) {
+ Runnable[] tests = new Runnable[THREADS_COUNT];
+ for (int i = 0; i < tests.length; i++) {
+ ValueObject object = new ValueObject();
+ object.setA("Value a" + i);
+ object.setAa("Value aa" + i);
+ object.setAaa("Value aaa" + i);
+ object.setAaaa("Value aaaa" + i);
+ object.setAaaaa("Value aaaaa" + i);
+ object.setAaaaaa("Value aaaaaa" + i);
+ object.setAaaaaaa("Value aaaaaaa" + i);
+ object.setAaaaaaaa("Value aaaaaaaa" + i);
+ object.setAaaaaaaaa("Value aaaaaaaaa" + i);
+ object.setAaaaaaaaaa("Value aaaaaaaaaa" + i);
+ object.setAaaaaaaaaaa("Value aaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaa("Value aaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaa("Value aaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaa("Value aaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ object.setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa("Value aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + i);
+ // set encoder thread to use this object
+ tests[i] = new Test4880633(object);
+ }
+ //start all threads
+ for (int i = 0; i < tests.length; i++) {
+ Thread thread = new Thread(tests[i]);
+ thread.setName("Bug Thread " + i);
+ thread.start();
+ }
+ }
+
+ private final Object object;
+
+ public Test4880633(Object object) {
+ this.object = object;
+ }
+
+ public void run() {
+ // run thread a few time
+ // object stays the same but NullPointerException appears randomly
+ // on dual proccessor a lock is generated
+ for (int i = 0; i < THREAD_LENGTH; i++) {
+ // create XMLEncoder to ByteArrayOutputStream
+ // this is to exclude file locking problems
+ XMLEncoder encoder = new XMLEncoder(new ByteArrayOutputStream());
+ encoder.setExceptionListener(this);
+ // write the object
+ // will see randomly null pointer exceptions
+ // a bug as object is same through different encode phases
+ encoder.writeObject(this.object);
+ //close encoder
+ encoder.close();
+ }
+ System.out.println(Thread.currentThread().getName() + " is finished");
+ }
+
+ public void exceptionThrown(Exception exception) {
+ throw new Error("unexpected exception", exception);
+ }
+
+ public static class ValueObject {
+ private String a;
+
+ public void setA(String a) {
+ this.a = a;
+ }
+
+ public String getA() {
+ return this.a;
+ }
+
+
+ private String aa;
+
+ public void setAa(String a) {
+ this.aa = a;
+ }
+
+ public String getAa() {
+ return this.aa;
+ }
+
+
+ private String aaa;
+
+ public void setAaa(String a) {
+ this.aaa = a;
+ }
+
+ public String getAaa() {
+ return this.aaa;
+ }
+
+
+ private String aaaa;
+
+ public void setAaaa(String a) {
+ this.aaaa = a;
+ }
+
+ public String getAaaa() {
+ return this.aaaa;
+ }
+
+
+ private String aaaaa;
+
+ public void setAaaaa(String a) {
+ this.aaaaa = a;
+ }
+
+ public String getAaaaa() {
+ return this.aaaaa;
+ }
+
+
+ private String aaaaaa;
+
+ public void setAaaaaa(String a) {
+ this.aaaaaa = a;
+ }
+
+ public String getAaaaaa() {
+ return this.aaaaaa;
+ }
+
+
+ private String aaaaaaa;
+
+ public void setAaaaaaa(String a) {
+ this.aaaaaaa = a;
+ }
+
+ public String getAaaaaaa() {
+ return this.aaaaaaa;
+ }
+
+
+ private String aaaaaaaa;
+
+ public void setAaaaaaaa(String a) {
+ this.aaaaaaaa = a;
+ }
+
+ public String getAaaaaaaa() {
+ return this.aaaaaaaa;
+ }
+
+
+ private String aaaaaaaaa;
+
+ public void setAaaaaaaaa(String a) {
+ this.aaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaa() {
+ return this.aaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaa;
+
+ public void setAaaaaaaaaa(String a) {
+ this.aaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaa() {
+ return this.aaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaa;
+
+ public void setAaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaa() {
+ return this.aaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+
+
+ private String aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+ public void setAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(String a) {
+ this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = a;
+ }
+
+ public String getAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa() {
+ return this.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4903007.java b/test/java/beans/XMLEncoder/Test4903007.java
new file mode 100644
index 0000000..e1d408b
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4903007.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4903007
+ * @summary Tests encoding of container with boxes and BoxLayout
+ * @author Sergey Malenkov, Mark Davidson
+ */
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+public class Test4903007 extends AbstractTest<JPanel> {
+ public static void main(String[] args) throws Exception {
+ new Test4903007().test(false); // TODO: could not encode with security manager
+ }
+
+ protected JPanel getObject() {
+ Box vBox = Box.createVerticalBox();
+ vBox.add(new JButton("button"));
+ vBox.add(Box.createVerticalStrut(10));
+ vBox.add(new JLabel("label"));
+ vBox.add(Box.createVerticalGlue());
+ vBox.add(new JButton("button"));
+ vBox.add(Box.createVerticalStrut(10));
+ vBox.add(new JLabel("label"));
+
+ Box hBox = Box.createHorizontalBox();
+ hBox.add(new JButton("button"));
+ hBox.add(Box.createHorizontalStrut(10));
+ hBox.add(new JLabel("label"));
+ hBox.add(Box.createHorizontalGlue());
+ hBox.add(new JButton("button"));
+ hBox.add(Box.createHorizontalStrut(10));
+ hBox.add(new JLabel("label"));
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
+ panel.add(vBox);
+ panel.add(Box.createGlue());
+ panel.add(hBox);
+ return panel;
+ }
+
+ protected JPanel getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new JPanel();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4936682.java b/test/java/beans/XMLEncoder/Test4936682.java
new file mode 100644
index 0000000..9dc9d9b
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4936682.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4936682
+ * @summary Tests encoding of reference to target
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.XMLEncoder;
+
+public final class Test4936682 extends AbstractTest<Object[]> {
+ public static void main(String[] args) {
+ new Test4936682().test(true);
+ }
+
+ protected Object[] getObject() {
+ OuterClass outer = new OuterClass();
+ return new Object [] {outer.getInner(), outer};
+ }
+
+ protected void initialize(XMLEncoder encoder) {
+ encoder.setPersistenceDelegate(
+ OuterClass.InnerClass.class,
+ new DefaultPersistenceDelegate() {
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ OuterClass.InnerClass inner = (OuterClass.InnerClass) oldInstance;
+ OuterClass outer = inner.getOuter();
+ return new Expression(inner, outer, "getInner", new Object[0]);
+ }
+ }
+ );
+ }
+
+ protected void validate(Object[] before, Object[] after) {
+ validate(before);
+ validate(after);
+ }
+
+ private static void validate(Object[] array) {
+ if (2 != array.length) {
+ throw new Error("unexpected array length: " + array.length);
+ }
+ OuterClass outer = (OuterClass) array[1];
+ if (!outer.getInner().equals(array[0])) {
+ throw new Error("unexpected array content");
+ }
+ }
+
+ public static final class OuterClass {
+ private final InnerClass inner = new InnerClass();
+
+ public InnerClass getInner() {
+ return this.inner;
+ }
+
+ public class InnerClass {
+ private InnerClass() {
+ }
+
+ public OuterClass getOuter() {
+ return OuterClass.this;
+ }
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4950122.java b/test/java/beans/XMLEncoder/Test4950122.java
new file mode 100644
index 0000000..bb4e9b0
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4950122.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4950122
+ * @summary Tests DefaultPersistenceDelegate with boolean and integer property
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.ExceptionListener;
+import java.beans.Expression;
+
+public final class Test4950122 {
+ public static void main(String[] args) {
+ TestBean bean = new TestBean(true, 11);
+ Encoder encoder = new Encoder();
+ encoder.setExceptionListener(bean);
+ new TestDPD().instantiate(bean, encoder);
+ }
+
+ public static class TestDPD extends DefaultPersistenceDelegate {
+ public TestDPD() {
+ super(new String[] {"boolean", "integer"});
+ }
+
+ public Expression instantiate(Object oldInstance, Encoder out) {
+ return super.instantiate(oldInstance, out);
+ }
+ }
+
+ public static class TestBean implements ExceptionListener {
+ private boolean b;
+ private int i;
+
+ public TestBean(boolean b, int i) {
+ this.b = b;
+ this.i = i;
+ }
+
+ public boolean isBoolean() {
+ return this.b;
+ }
+
+ public int getInteger() {
+ return this.i;
+ }
+
+ public void exceptionThrown(Exception exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4968523.java b/test/java/beans/XMLEncoder/Test4968523.java
new file mode 100644
index 0000000..212c1a1
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4968523.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4968523
+ * @summary Tests persistence delegate in different encoders
+ * @author Sergey Malenkov
+ */
+
+import java.beans.DefaultPersistenceDelegate;
+import java.beans.Encoder;
+import java.beans.XMLEncoder;
+import java.beans.PersistenceDelegate;
+import java.util.Date;
+
+public class Test4968523 {
+ public static void main(String[] args) {
+ String[] names = {"time"};
+ test(Date.class, new DefaultPersistenceDelegate(names));
+ test(null, new DefaultPersistenceDelegate());
+ }
+
+ private static void test(Class<?> type, PersistenceDelegate pd) {
+ Encoder encoder1 = new Encoder();
+ Encoder encoder2 = new XMLEncoder(System.out);
+
+ PersistenceDelegate pd1 = encoder1.getPersistenceDelegate(type);
+ PersistenceDelegate pd2 = encoder2.getPersistenceDelegate(type);
+
+ encoder1.setPersistenceDelegate(type, pd);
+
+ if (pd1 == encoder1.getPersistenceDelegate(type))
+ throw new Error("first persistence delegate is not changed");
+
+ if (pd2 != encoder2.getPersistenceDelegate(type))
+ throw new Error("second persistence delegate is changed");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test4993777.java b/test/java/beans/XMLEncoder/Test4993777.java
new file mode 100644
index 0000000..e344a2f
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test4993777.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4993777
+ * @summary Tests encoding of multi-dimensional arrays
+ * @author Sergey Malenkov
+ */
+
+public final class Test4993777 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test4993777().test(true);
+ }
+
+ protected ArrayBean getObject() {
+ ArrayBean data = new ArrayBean();
+ data.setArray(
+ new InnerObject("one"),
+ new InnerObject("two")
+ );
+ return data;
+ }
+
+ protected ArrayBean getAnotherObject() {
+ ArrayBean data = new ArrayBean();
+ data.setArray2D(
+ new InnerObject[] {
+ new InnerObject("1"),
+ new InnerObject("2"),
+ new InnerObject("3"),
+ },
+ new InnerObject[] {
+ new InnerObject("4"),
+ new InnerObject("5"),
+ new InnerObject("6"),
+ }
+ );
+ return data;
+ }
+
+ public static final class ArrayBean {
+ private InnerObject[] array;
+ private InnerObject[][] array2D;
+
+ public InnerObject[] getArray() {
+ return this.array;
+ }
+
+ public void setArray(InnerObject... array) {
+ this.array = array;
+ }
+
+ public InnerObject[][] getArray2D() {
+ return this.array2D;
+ }
+
+ public void setArray2D(InnerObject[]... array2D) {
+ this.array2D = array2D;
+ }
+ }
+
+ public static final class InnerObject {
+ private String name;
+
+ public InnerObject() {
+ }
+
+ private InnerObject(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test5023552.java b/test/java/beans/XMLEncoder/Test5023552.java
new file mode 100644
index 0000000..a8ef5b3
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test5023552.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5023552
+ * @summary Tests reference count updating
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.XMLEncoder;
+
+public final class Test5023552 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test5023552().test(true);
+ }
+
+ protected Object getObject() {
+ Component component = new Component();
+ return component.create(component);
+ }
+
+ protected void initialize(XMLEncoder encoder) {
+ encoder.setPersistenceDelegate(Container.class, new PersistenceDelegate() {
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ Container container = (Container) oldInstance;
+ Component component = container.getComponent();
+ return new Expression(container, component, "create", new Object[] {component});
+ }
+ });
+ }
+
+ public static final class Component {
+ public Container create(Component component) {
+ return new Container(component);
+ }
+ }
+
+ public static final class Container {
+ private final Component component;
+
+ public Container(Component component) {
+ this.component = component;
+ }
+
+ public Component getComponent() {
+ return this.component;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test5023559.java b/test/java/beans/XMLEncoder/Test5023559.java
new file mode 100644
index 0000000..56f64bc
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test5023559.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5023559
+ * @summary Tests encoding of the object with nested target
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.XMLEncoder;
+
+public final class Test5023559 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test5023559().test(true);
+ }
+
+ protected Object getObject() {
+ return new GrandParent().create().create();
+ }
+
+ protected void initialize(XMLEncoder encoder) {
+ encoder.setPersistenceDelegate(Parent.class, new PersistenceDelegate() {
+ protected Expression instantiate(Object old, Encoder out) {
+ Parent parent = (Parent) old;
+ return new Expression(old, parent.getParent(), "create", new Object[] {});
+ }
+ });
+ encoder.setPersistenceDelegate(Child.class, new PersistenceDelegate() {
+ protected Expression instantiate(Object old, Encoder out) {
+ Child child = (Child) old;
+ return new Expression(old, child.getParent(), "create", new Object[] {});
+ }
+ });
+ }
+
+ public static final class GrandParent {
+ public Parent create() {
+ return new Parent(this);
+ }
+ }
+
+ public static final class Parent {
+ private final GrandParent parent;
+
+ private Parent(GrandParent parent) {
+ this.parent = parent;
+ }
+
+ public GrandParent getParent() {
+ return this.parent;
+ }
+
+ public Child create() {
+ return new Child(this);
+ }
+ }
+
+ public static final class Child {
+ private final Parent parent;
+
+ private Child(Parent parent) {
+ this.parent = parent;
+ }
+
+ public Parent getParent() {
+ return this.parent;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6176120.java b/test/java/beans/XMLEncoder/Test6176120.java
new file mode 100644
index 0000000..61b8320
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6176120.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6176120
+ * @summary Tests bean that contains constructor marked with ConstructorProperties annotation
+ * @author Sergey Malenkov
+ */
+
+import java.beans.ConstructorProperties;
+
+public final class Test6176120 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test6176120().test(true);
+ }
+
+ protected ImmutableBean getObject() {
+ return new ImmutableBean(1, -1);
+ }
+
+ protected ImmutableBean getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new ImmutableBean(-1, 1);
+ }
+
+ public static final class ImmutableBean {
+ private final int x;
+ private final int y;
+
+ @ConstructorProperties({"x", "y"})
+ public ImmutableBean( int x, int y ) {
+ this.x = x;
+ this.y = y;
+ }
+
+ public int getX() {
+ return this.x;
+ }
+
+ public int getY() {
+ return this.y;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6187118.java b/test/java/beans/XMLEncoder/Test6187118.java
new file mode 100644
index 0000000..faee48e
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6187118.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6187118
+ * @summary Tests encoding of immutable list that creates itself
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Encoder;
+import java.beans.Expression;
+import java.beans.PersistenceDelegate;
+import java.beans.XMLEncoder;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+public final class Test6187118 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test6187118().test(true);
+ }
+
+ protected ImmutableList<String> getObject() {
+ return new ImmutableList<String>();
+ }
+
+ protected ImmutableList<String> getAnotherObject() {
+ return new ImmutableList<String>().add("1").add("2").add("3").add("4");
+ }
+
+ protected void initialize(XMLEncoder encoder) {
+ encoder.setPersistenceDelegate(
+ ImmutableList.class,
+ new PersistenceDelegate() {
+ protected boolean mutatesTo(Object oldInstance, Object newInstance) {
+ return oldInstance.equals(newInstance);
+ }
+
+ protected Expression instantiate(Object oldInstance, Encoder out) {
+ ImmutableList list = (ImmutableList) oldInstance;
+ if (!list.hasEntries()) {
+ return getExpression(oldInstance, ImmutableList.class, "new");
+ }
+ Object object = list.getLast();
+ ImmutableList shortenedList = list.removeLast();
+ return getExpression(oldInstance, shortenedList, "add", object);
+ }
+
+ private Expression getExpression(Object value, Object target, String method, Object... args) {
+ return new Expression(value, target, method, args);
+ }
+ }
+ );
+ }
+
+ public static final class ImmutableList<T> implements Iterable {
+ private final List<T> list = new ArrayList<T>();
+
+ public ImmutableList() {
+ }
+
+ private ImmutableList(Iterable<T> iterable) {
+ for (T object : iterable) {
+ this.list.add(object);
+ }
+ }
+
+ public Iterator<T> iterator() {
+ return Collections.unmodifiableList(this.list).iterator();
+ }
+
+ public ImmutableList<T> add(T object) {
+ ImmutableList<T> list = new ImmutableList<T>(this.list);
+ list.list.add(object);
+ return list;
+ }
+
+ public ImmutableList<T> removeLast() {
+ ImmutableList<T> list = new ImmutableList<T>(this.list);
+ int size = list.list.size();
+ if (0 < size) {
+ list.list.remove(size - 1);
+ }
+ return list;
+ }
+
+ public T getLast() {
+ int size = this.list.size();
+ return (0 < size)
+ ? this.list.get(size - 1)
+ : null;
+ }
+
+ public boolean hasEntries() {
+ return 0 < this.list.size();
+ }
+
+ public boolean equals(Object object) {
+ if (object instanceof ImmutableList) {
+ ImmutableList list = (ImmutableList) object;
+ return this.list.equals(list.list);
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return this.list.hashCode();
+ }
+
+ public String toString() {
+ return this.list.toString();
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6256805.java b/test/java/beans/XMLEncoder/Test6256805.java
new file mode 100644
index 0000000..46ee65e
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6256805.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6256805
+ * @summary Tests invalid XML characters encoding
+ * @author Sergey Malenkov
+ */
+
+public final class Test6256805 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test6256805().test(true);
+ }
+
+ protected CharacterBean getObject() {
+ CharacterBean bean = new CharacterBean();
+ bean.setString("\u0000\ud800\udc00\uFFFF");
+ return bean;
+ }
+
+ protected CharacterBean getAnotherObject() {
+ CharacterBean bean = new CharacterBean();
+ bean.setPrimitive('\uD800');
+ bean.setChar(Character.valueOf('\u001F'));
+ return bean;
+ }
+
+ public static final class CharacterBean {
+ private char primitive;
+ private Character character;
+ private String string;
+
+ public char getPrimitive() {
+ return this.primitive;
+ }
+
+ public void setPrimitive( char primitive ) {
+ this.primitive = primitive;
+ }
+
+ public Character getChar() {
+ return this.character;
+ }
+
+ public void setChar( Character character ) {
+ this.character = character;
+ }
+
+ public String getString() {
+ return this.string;
+ }
+
+ public void setString( String string ) {
+ this.string = string;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6437265.java b/test/java/beans/XMLEncoder/Test6437265.java
new file mode 100644
index 0000000..854c88a
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6437265.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6437265
+ * @summary Tests encoding of container with BorderLayout
+ * @author Sergey Malenkov
+ */
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+public final class Test6437265 extends AbstractTest<JPanel> {
+ private static final String[] NAMES = {
+ BorderLayout.EAST,
+ BorderLayout.WEST,
+ BorderLayout.NORTH,
+ BorderLayout.SOUTH,
+ BorderLayout.CENTER,
+ BorderLayout.LINE_END,
+ BorderLayout.PAGE_END,
+ BorderLayout.LINE_START,
+ BorderLayout.PAGE_START};
+
+ public static void main(String[] args) {
+ new Test6437265().test(true);
+ }
+
+ protected JPanel getObject() {
+ JPanel panel = new MyPanel();
+ for (String name : NAMES) {
+ panel.add(name, new JLabel(name));
+ }
+ return panel;
+ }
+
+ protected void validate(JPanel before, JPanel after) {
+ validate(before);
+ validate(after);
+ super.validate(before, after);
+ }
+
+ private static void validate(JPanel panel) {
+ BorderLayout layout = (BorderLayout) panel.getLayout();
+ for (Component component : panel.getComponents()) {
+ String name = (String) layout.getConstraints(component);
+ if (name == null)
+ throw new Error("The component is not layed out: " + component);
+
+ JLabel label = (JLabel) component;
+ if (!name.equals(label.getText()))
+ throw new Error("The component is layed out on " + name + ": " + component);
+ }
+ }
+
+ public static final class MyPanel extends JPanel {
+ public MyPanel() {
+ // the bug is reproducible for containers
+ // that uses BorderLayout as default layout manager.
+ super(new BorderLayout(3, 3));
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6501431.java b/test/java/beans/XMLEncoder/Test6501431.java
new file mode 100644
index 0000000..0cab7b6
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6501431.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6501431
+ * @summary Tests encoding of JMenuItem with accelerator property
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JMenuItem;
+import javax.swing.KeyStroke;
+
+public final class Test6501431 extends AbstractTest<JMenuItem> {
+ public static void main(String[] args) {
+ new Test6501431().test(true);
+ }
+
+ protected JMenuItem getObject() {
+ JMenuItem menu = new JMenuItem();
+ menu.setAccelerator(KeyStroke.getKeyStroke("ctrl F2"));
+ return menu;
+ }
+
+ protected JMenuItem getAnotherObject() {
+ return new JMenuItem();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6505888.java b/test/java/beans/XMLEncoder/Test6505888.java
new file mode 100644
index 0000000..6ebdf96
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6505888.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests bean with the property that is guarded by UnmodifiableList
+ * @author Sergey Malenkov
+ */
+
+import java.beans.ConstructorProperties;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public final class Test6505888 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test6505888().test(true);
+ }
+
+ protected ListBean getObject() {
+ List<Integer> list = new ArrayList<Integer>();
+ list.add(Integer.valueOf(26));
+ list.add(Integer.valueOf(10));
+ list.add(Integer.valueOf(74));
+ return new ListBean(list);
+ }
+
+ protected ListBean getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new ListBean(new ArrayList<Integer>());
+ }
+
+ public static final class ListBean {
+ private List<Integer> list;
+
+ @ConstructorProperties("list")
+ public ListBean(List<Integer> list) {
+ this.list = new ArrayList<Integer>(list);
+ }
+
+ public List<Integer> getList() {
+ return Collections.unmodifiableList(this.list);
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6531597.java b/test/java/beans/XMLEncoder/Test6531597.java
new file mode 100644
index 0000000..ca4e7ad
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6531597.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6531597
+ * @summary Tests encoding of arrays of primitives
+ * @author Sergey Malenkov
+ */
+
+public final class Test6531597 extends AbstractTest {
+ public static void main(String[] args) {
+ new Test6531597().test(true);
+ }
+
+ protected Object getObject() {
+ return new Object[] {
+ new byte[] {0, 1, 2},
+ new short[] {0, 1, 2, 3, 4},
+ new int[] {0, 1, 2, 3, 4, 5, 6},
+ new long[] {0, 1, 2, 3, 4, 5, 6, 7, 8},
+ new float[] {0.0f, 1.1f, 2.2f},
+ new double[] {0.0, 1.1, 2.2, 3.3, 4.4},
+ new char[] {'a', 'b', 'c'},
+ new boolean[] {true, false},
+ };
+ }
+}
diff --git a/test/java/beans/XMLEncoder/Test6570354.java b/test/java/beans/XMLEncoder/Test6570354.java
new file mode 100644
index 0000000..403f965
--- /dev/null
+++ b/test/java/beans/XMLEncoder/Test6570354.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6570354
+ * @summary Tests listeners removing
+ * @author Sergey Malenkov
+ */
+
+import java.beans.PropertyChangeListener;
+import javax.swing.JLabel;
+
+public final class Test6570354 extends AbstractTest<JLabel> {
+ public static void main(String[] args) {
+ new Test6570354().test(true);
+ }
+
+ protected JLabel getObject() {
+ JLabel label = new JLabel("");
+ label.removePropertyChangeListener((PropertyChangeListener) label.getUI());
+ return label;
+ }
+
+ protected JLabel getAnotherObject() {
+ return new JLabel("");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java b/test/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java
new file mode 100644
index 0000000..0bee510
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_AWTKeyStroke.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6501431
+ * @summary Tests AWTKeyStroke encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.AWTKeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.InputEvent;
+
+public final class java_awt_AWTKeyStroke extends AbstractTest<AWTKeyStroke> {
+ public static void main(String[] args) {
+ new java_awt_AWTKeyStroke().test(true);
+ }
+
+ protected AWTKeyStroke getObject() {
+ return AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_A, InputEvent.SHIFT_DOWN_MASK, true);
+ }
+
+ protected AWTKeyStroke getAnotherObject() {
+ return AWTKeyStroke.getAWTKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Color.java b/test/java/beans/XMLEncoder/java_awt_Color.java
new file mode 100644
index 0000000..4ca196b
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Color.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests Color encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+
+public final class java_awt_Color extends AbstractTest<Color> {
+ public static void main(String[] args) {
+ new java_awt_Color().test(true);
+ }
+
+ protected Color getObject() {
+ return new Color(0x88, 0x44, 0x22, 0x11);
+ }
+
+ protected Color getAnotherObject() {
+ return Color.BLACK;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Cursor.java b/test/java/beans/XMLEncoder/java_awt_Cursor.java
new file mode 100644
index 0000000..8296f2d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Cursor.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests Cursor encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Cursor;
+
+public final class java_awt_Cursor extends AbstractTest<Cursor> {
+ public static void main(String[] args) {
+ new java_awt_Cursor().test(true);
+ }
+
+ protected Cursor getObject() {
+ return new Cursor(Cursor.MOVE_CURSOR);
+ }
+
+ protected Cursor getAnotherObject() {
+ return null; // TODO: could not update property
+ // return Cursor.getDefaultCursor();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Dimension.java b/test/java/beans/XMLEncoder/java_awt_Dimension.java
new file mode 100644
index 0000000..daf3bcf
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Dimension.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4741757 6402062 6471539
+ * @summary Tests Dimension encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Dimension;
+
+public final class java_awt_Dimension extends AbstractTest<Dimension> {
+ public static void main(String[] args) {
+ new java_awt_Dimension().test(true);
+ }
+
+ protected Dimension getObject() {
+ return new Dimension();
+ }
+
+ protected Dimension getAnotherObject() {
+ return new Dimension(-5, 5);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Font.java b/test/java/beans/XMLEncoder/java_awt_Font.java
new file mode 100644
index 0000000..c7d660c
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Font.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4951733 6402062
+ * @summary Tests Font encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Font;
+import java.awt.font.TextAttribute;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class java_awt_Font extends AbstractTest<Font> {
+ public static void main(String[] args) {
+ new java_awt_Font().test(true);
+ }
+
+ protected Font getObject() {
+ Map<TextAttribute, Object> map = new HashMap<TextAttribute, Object>();
+ map.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
+ return new Font(map);
+ }
+
+ protected Font getAnotherObject() {
+ return new Font("SansSerif", Font.BOLD, 10).deriveFont(12.12f);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_GridBagConstraints.java b/test/java/beans/XMLEncoder/java_awt_GridBagConstraints.java
new file mode 100644
index 0000000..452491c
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_GridBagConstraints.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062
+ * @summary Tests GridBagConstraints encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.GridBagConstraints;
+
+public final class java_awt_GridBagConstraints extends AbstractTest<GridBagConstraints> {
+ public static void main(String[] args) {
+ new java_awt_GridBagConstraints().test(true);
+ }
+
+ protected GridBagConstraints getObject() {
+ GridBagConstraints gbc = new GridBagConstraints();
+ gbc.gridx = 1;
+ gbc.gridy = 2;
+ gbc.gridwidth = 3;
+ gbc.gridheight = 4;
+ gbc.weightx = 0.1;
+ gbc.weighty = 0.2;
+ gbc.anchor = GridBagConstraints.NORTH;
+ gbc.fill = GridBagConstraints.VERTICAL;
+ gbc.insets.top = 1;
+ gbc.insets.left = 2;
+ gbc.insets.right = 3;
+ gbc.insets.bottom = 4;
+ gbc.ipadx = -1;
+ gbc.ipady = -2;
+ return gbc;
+ }
+
+ protected GridBagConstraints getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new GridBagConstraints();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Insets.java b/test/java/beans/XMLEncoder/java_awt_Insets.java
new file mode 100644
index 0000000..2d24c96
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Insets.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6471539
+ * @summary Tests Insets encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Insets;
+
+public final class java_awt_Insets extends AbstractTest<Insets> {
+ public static void main(String[] args) {
+ new java_awt_Insets().test(true);
+ }
+
+ protected Insets getObject() {
+ return new Insets(1, 2, 3, 4);
+ }
+
+ protected Insets getAnotherObject() {
+ return new Insets(0, 0, 0, 0);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_MenuShortcut.java b/test/java/beans/XMLEncoder/java_awt_MenuShortcut.java
new file mode 100644
index 0000000..7a46e25
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_MenuShortcut.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4818598
+ * @summary Tests MenuShortcut value encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.MenuShortcut;
+import java.awt.event.KeyEvent;
+
+public final class java_awt_MenuShortcut extends AbstractTest<MenuShortcut> {
+ public static void main(String[] args) {
+ new java_awt_MenuShortcut().test(true);
+ }
+
+ protected MenuShortcut getObject() {
+ return new MenuShortcut(KeyEvent.VK_A);
+ }
+
+ protected MenuShortcut getAnotherObject() {
+ return new MenuShortcut(KeyEvent.VK_Z, true);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Point.java b/test/java/beans/XMLEncoder/java_awt_Point.java
new file mode 100644
index 0000000..1cba389
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Point.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4741757 6402062 6471539
+ * @summary Tests Point encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Point;
+
+public final class java_awt_Point extends AbstractTest<Point> {
+ public static void main(String[] args) {
+ new java_awt_Point().test(true);
+ }
+
+ protected Point getObject() {
+ return new Point(-5, 5);
+ }
+
+ protected Point getAnotherObject() {
+ return new Point();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_Rectangle.java b/test/java/beans/XMLEncoder/java_awt_Rectangle.java
new file mode 100644
index 0000000..53cc05f
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_Rectangle.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4741757 6402062 6471539
+ * @summary Tests Rectangle encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Rectangle;
+
+public final class java_awt_Rectangle extends AbstractTest<Rectangle> {
+ public static void main(String[] args) {
+ new java_awt_Rectangle().test(true);
+ }
+
+ protected Rectangle getObject() {
+ return new Rectangle(1, 2, 3, 4);
+ }
+
+ protected Rectangle getAnotherObject() {
+ return new Rectangle();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_awt_ScrollPane.java b/test/java/beans/XMLEncoder/java_awt_ScrollPane.java
new file mode 100644
index 0000000..4bdeed1
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_awt_ScrollPane.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests ScrollPane encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.ScrollPane;
+
+public final class java_awt_ScrollPane extends AbstractTest<ScrollPane> {
+ public static void main(String[] args) {
+ new java_awt_ScrollPane().test(true);
+ }
+
+ protected ScrollPane getObject() {
+ return new ScrollPane(ScrollPane.SCROLLBARS_NEVER);
+ }
+
+ protected ScrollPane getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_beans_EventHandler.java b/test/java/beans/XMLEncoder/java_beans_EventHandler.java
new file mode 100644
index 0000000..1d9355b
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_beans_EventHandler.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests EventHandler encoding
+ * @author Sergey Malenkov
+ */
+
+import java.beans.EventHandler;
+
+public final class java_beans_EventHandler extends AbstractTest<EventHandler> {
+ public static void main(String[] args) {
+ new java_beans_EventHandler().test(true);
+ }
+
+ protected EventHandler getObject() {
+ return new EventHandler("target", "action", "property", "listener");
+ }
+
+ protected EventHandler getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new EventHandler("target", "action", null, null);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_beans_Expression.java b/test/java/beans/XMLEncoder/java_beans_Expression.java
new file mode 100644
index 0000000..a79e778
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_beans_Expression.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests Expression encoding
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Expression;
+
+public final class java_beans_Expression extends AbstractTest<Expression> {
+ public static void main(String[] args) {
+ new java_beans_Expression().test(true);
+ }
+
+ protected Expression getObject() {
+ return new Expression("target", "equals", new String[] {"argument"});
+ }
+
+ protected Expression getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new Expression("target", "equals", null);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_beans_Statement.java b/test/java/beans/XMLEncoder/java_beans_Statement.java
new file mode 100644
index 0000000..55b8ca8
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_beans_Statement.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests Statement encoding
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Statement;
+
+public final class java_beans_Statement extends AbstractTest<Statement> {
+ public static void main(String[] args) {
+ new java_beans_Statement().test(true);
+ }
+
+ protected Statement getObject() {
+ return new Statement("target", "method", new String[] {"arg1", "arg2"});
+ }
+
+ protected Statement getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new Statement("target", "method", null);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_lang_Character.java b/test/java/beans/XMLEncoder/java_lang_Character.java
new file mode 100644
index 0000000..7cd212e
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_lang_Character.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6256805
+ * @summary Tests invalid XML character encoding
+ * @author Sergey Malenkov
+ */
+
+public final class java_lang_Character extends AbstractTest<Character> {
+ public static void main(String[] args) {
+ new java_lang_Character().test(true);
+ }
+
+ protected Character getObject() {
+ return Character.valueOf('\\');
+ }
+
+ protected Character getAnotherObject() {
+ return Character.valueOf('\uFFFF');
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_lang_Class.java b/test/java/beans/XMLEncoder/java_lang_Class.java
new file mode 100644
index 0000000..94507ba
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_lang_Class.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4818598
+ * @summary Tests Class value encoding
+ * @author Sergey Malenkov
+ */
+
+public final class java_lang_Class extends AbstractTest<Class> {
+ public static void main(String[] args) {
+ new java_lang_Class().test(true);
+ }
+
+ protected Class getObject() {
+ return String.class;
+ }
+
+ protected Class getAnotherObject() {
+ return Number.class;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_lang_Enum.java b/test/java/beans/XMLEncoder/java_lang_Enum.java
new file mode 100644
index 0000000..97bd534
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_lang_Enum.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5015403
+ * @summary Tests Enum value encoding
+ * @author Sergey Malenkov
+ */
+
+public final class java_lang_Enum extends AbstractTest {
+ public static void main(String[] args) {
+ new java_lang_Enum().test(true);
+ }
+
+ protected Object getObject() {
+ return Alpha.A;
+ }
+
+ protected Object getAnotherObject() {
+ return Alpha.Z;
+ }
+
+ public enum Alpha {
+ A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_lang_String.java b/test/java/beans/XMLEncoder/java_lang_String.java
new file mode 100644
index 0000000..1974c58
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_lang_String.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6256805
+ * @summary Tests invalid XML string encoding
+ * @author Sergey Malenkov
+ */
+
+public final class java_lang_String extends AbstractTest<String> {
+ public static void main(String[] args) {
+ new java_lang_String().test(true);
+ }
+
+ protected String getObject() {
+ return "\u0000\ud800\udc00\uFFFF";
+ }
+
+ protected String getAnotherObject() {
+ int length = 0x10000;
+ StringBuilder sb = new StringBuilder(length);
+ while (0 < length--) {
+ sb.append((char) length);
+ }
+ return sb.toString();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_lang_reflect_Field.java b/test/java/beans/XMLEncoder/java_lang_reflect_Field.java
new file mode 100644
index 0000000..f711a63
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_lang_reflect_Field.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4818598
+ * @summary Tests Field value encoding
+ * @author Sergey Malenkov
+ */
+
+import java.lang.reflect.Field;
+
+public final class java_lang_reflect_Field extends AbstractTest<Field> {
+ public int f1;
+ public int f2;
+
+ public static void main(String[] args) {
+ new java_lang_reflect_Field().test(true);
+ }
+
+ protected Field getObject() {
+ try {
+ return java_lang_reflect_Field.class.getField("f1");
+ } catch (NoSuchFieldException exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+
+ protected Field getAnotherObject() {
+ try {
+ return java_lang_reflect_Field.class.getField("f2");
+ } catch (NoSuchFieldException exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_lang_reflect_Method.java b/test/java/beans/XMLEncoder/java_lang_reflect_Method.java
new file mode 100644
index 0000000..74f0c19
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_lang_reflect_Method.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4818598
+ * @summary Tests Method value encoding
+ * @author Sergey Malenkov
+ */
+
+import java.lang.reflect.Method;
+
+public final class java_lang_reflect_Method extends AbstractTest<Method> {
+ public static void main(String[] args) {
+ new java_lang_reflect_Method().test(true);
+ }
+
+ protected Method getObject() {
+ try {
+ return java_lang_reflect_Method.class.getMethod("m1");
+ } catch (NoSuchMethodException exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+
+ protected Method getAnotherObject() {
+ try {
+ return java_lang_reflect_Method.class.getMethod("m2");
+ } catch (NoSuchMethodException exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+
+ public void m1() {
+ }
+
+ public void m2() {
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_net_URI.java b/test/java/beans/XMLEncoder/java_net_URI.java
new file mode 100644
index 0000000..c4e7091
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_net_URI.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6245149
+ * @summary Tests URI encoding
+ * @author Sergey Malenkov
+ */
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+public final class java_net_URI extends AbstractTest<URI> {
+ public static void main(String[] args) {
+ new java_net_URI().test(true);
+ }
+
+ protected URI getObject() {
+ try {
+ return new URI("http://www.sun.com/");
+ } catch (URISyntaxException exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+
+ protected URI getAnotherObject() {
+ try {
+ return new URI("ftp://www.sun.com/");
+ } catch (URISyntaxException exception) {
+ throw new Error("unexpected exception", exception);
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_sql_Date.java b/test/java/beans/XMLEncoder/java_sql_Date.java
new file mode 100644
index 0000000..564d432
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_sql_Date.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4733558 6471539
+ * @summary Tests Date encoding
+ * @author Sergey Malenkov
+ */
+
+import java.sql.Date;
+
+public final class java_sql_Date extends AbstractTest<Date> {
+ public static void main(String[] args) {
+ new java_sql_Date().test(true);
+ }
+
+ protected Date getObject() {
+ return new Date(System.currentTimeMillis());
+ }
+
+ protected Date getAnotherObject() {
+ return new Date(0L);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_sql_Time.java b/test/java/beans/XMLEncoder/java_sql_Time.java
new file mode 100644
index 0000000..7b94e51
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_sql_Time.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4733558 6471539
+ * @summary Tests Time encoding
+ * @author Sergey Malenkov
+ */
+
+import java.sql.Time;
+
+public final class java_sql_Time extends AbstractTest<Time> {
+ public static void main(String[] args) {
+ new java_sql_Time().test(true);
+ }
+
+ protected Time getObject() {
+ return new Time(System.currentTimeMillis());
+ }
+
+ protected Time getAnotherObject() {
+ return new Time(0L);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_sql_Timestamp.java b/test/java/beans/XMLEncoder/java_sql_Timestamp.java
new file mode 100644
index 0000000..48662a4
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_sql_Timestamp.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4733558 6471539
+ * @summary Tests Timestamp encoding
+ * @author Sergey Malenkov
+ */
+
+import java.sql.Timestamp;
+
+public final class java_sql_Timestamp extends AbstractTest<Timestamp> {
+ public static void main(String[] args) {
+ new java_sql_Timestamp().test(true);
+ }
+
+ protected Timestamp getObject() {
+ Timestamp timestamp = new Timestamp(System.currentTimeMillis());
+ timestamp.setNanos(1 + timestamp.getNanos());
+ return timestamp;
+ }
+
+ protected Timestamp getAnotherObject() {
+ return new Timestamp(0L);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_ArrayList.java b/test/java/beans/XMLEncoder/java_util_ArrayList.java
new file mode 100644
index 0000000..fa6fe97
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_ArrayList.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4631471
+ * @summary Tests ArrayList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+public final class java_util_ArrayList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_ArrayList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = new ArrayList<String>();
+ list.add(null);
+ list.add("string");
+ return list;
+ }
+
+ protected List<String> getAnotherObject() {
+ return new ArrayList<String>();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedCollection.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedCollection.java
new file mode 100644
index 0000000..5ef6397
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedCollection.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedCollection encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_CheckedCollection extends AbstractTest<Collection<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedCollection().test(true);
+ }
+
+ protected Collection<String> getObject() {
+ List<String> list = Collections.singletonList("string");
+ return Collections.checkedCollection(list, String.class);
+ }
+
+ protected Collection<String> getAnotherObject() {
+ List<String> list = Collections.emptyList();
+ return Collections.checkedCollection(list, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedList.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedList.java
new file mode 100644
index 0000000..4f7c1b6
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedList.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_CheckedList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = Collections.singletonList("string");
+ return Collections.checkedList(list, String.class);
+ }
+
+ protected List<String> getAnotherObject() {
+ List<String> list = Collections.emptyList();
+ return Collections.checkedList(list, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedMap.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedMap.java
new file mode 100644
index 0000000..ee46c72
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedMap.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Map;
+
+public final class java_util_Collections_CheckedMap extends AbstractTest<Map<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedMap().test(true);
+ }
+
+ protected Map<String, String> getObject() {
+ Map<String, String> map = Collections.singletonMap("key", "value");
+ return Collections.checkedMap(map, String.class, String.class);
+ }
+
+ protected Map<String, String> getAnotherObject() {
+ Map<String, String> map = Collections.emptyMap();
+ return Collections.checkedMap(map, String.class, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedRandomAccessList.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedRandomAccessList.java
new file mode 100644
index 0000000..52b4ae0
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedRandomAccessList.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedRandomAccessList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_CheckedRandomAccessList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedRandomAccessList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = new ArrayList<String>();
+ list.add("string");
+ return Collections.checkedList(list, String.class);
+ }
+
+ protected List<String> getAnotherObject() {
+ List<String> list = new ArrayList<String>();
+ return Collections.checkedList(list, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedSet.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedSet.java
new file mode 100644
index 0000000..1a5a226
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedSet.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Set;
+
+public final class java_util_Collections_CheckedSet extends AbstractTest<Set<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedSet().test(true);
+ }
+
+ protected Set<String> getObject() {
+ Set<String> set = Collections.singleton("string");
+ return Collections.checkedSet(set, String.class);
+ }
+
+ protected Set<String> getAnotherObject() {
+ Set<String> set = Collections.emptySet();
+ return Collections.checkedSet(set, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedSortedMap.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedSortedMap.java
new file mode 100644
index 0000000..19b673e
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedSortedMap.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedSortedMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+public final class java_util_Collections_CheckedSortedMap extends AbstractTest<SortedMap<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedSortedMap().test(true);
+ }
+
+ protected SortedMap<String, String> getObject() {
+ SortedMap<String, String> map = new TreeMap<String, String>();
+ map.put("key", "value");
+ return Collections.checkedSortedMap(map, String.class, String.class);
+ }
+
+ protected SortedMap<String, String> getAnotherObject() {
+ SortedMap<String, String> map = new TreeMap<String, String>();
+ return Collections.checkedSortedMap(map, String.class, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_CheckedSortedSet.java b/test/java/beans/XMLEncoder/java_util_Collections_CheckedSortedSet.java
new file mode 100644
index 0000000..27f66bd
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_CheckedSortedSet.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests CheckedSortedSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public final class java_util_Collections_CheckedSortedSet extends AbstractTest<SortedSet<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_CheckedSortedSet().test(true);
+ }
+
+ protected SortedSet<String> getObject() {
+ SortedSet<String> set = new TreeSet<String>();
+ set.add("string");
+ return Collections.checkedSortedSet(set, String.class);
+ }
+
+ protected SortedSet<String> getAnotherObject() {
+ SortedSet<String> set = new TreeSet<String>();
+ return Collections.checkedSortedSet(set, String.class);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_EmptyList.java b/test/java/beans/XMLEncoder/java_util_Collections_EmptyList.java
new file mode 100644
index 0000000..527598a
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_EmptyList.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests EmptyList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_EmptyList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_EmptyList().test(true);
+ }
+
+ protected List<String> getObject() {
+ return Collections.emptyList();
+ }
+
+ protected List<String> getAnotherObject() {
+ return Collections.singletonList("string");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java b/test/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java
new file mode 100644
index 0000000..cde32f2
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_EmptyMap.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests EmptyMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Map;
+
+public final class java_util_Collections_EmptyMap extends AbstractTest<Map<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_EmptyMap().test(true);
+ }
+
+ protected Map<String, String> getObject() {
+ return Collections.emptyMap();
+ }
+
+ protected Map<String, String> getAnotherObject() {
+ return Collections.singletonMap("key", "value");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_EmptySet.java b/test/java/beans/XMLEncoder/java_util_Collections_EmptySet.java
new file mode 100644
index 0000000..3e771ac
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_EmptySet.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests EmptySet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Set;
+
+public final class java_util_Collections_EmptySet extends AbstractTest<Set<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_EmptySet().test(true);
+ }
+
+ protected Set<String> getObject() {
+ return Collections.emptySet();
+ }
+
+ protected Set<String> getAnotherObject() {
+ return Collections.singleton("string");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SingletonList.java b/test/java/beans/XMLEncoder/java_util_Collections_SingletonList.java
new file mode 100644
index 0000000..4e9be0a
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SingletonList.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SingletonList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_SingletonList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SingletonList().test(true);
+ }
+
+ protected List<String> getObject() {
+ return Collections.singletonList("string");
+ }
+
+ protected List<String> getAnotherObject() {
+ return Collections.singletonList("object");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java b/test/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java
new file mode 100644
index 0000000..05bc8d6
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SingletonMap.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SingletonMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Map;
+
+public final class java_util_Collections_SingletonMap extends AbstractTest<Map<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SingletonMap().test(true);
+ }
+
+ protected Map<String, String> getObject() {
+ return Collections.singletonMap("key", "value");
+ }
+
+ protected Map<String, String> getAnotherObject() {
+ return Collections.singletonMap("value", "key");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java b/test/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java
new file mode 100644
index 0000000..72622c4
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SingletonSet.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SingletonSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Set;
+
+public final class java_util_Collections_SingletonSet extends AbstractTest<Set<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SingletonSet().test(true);
+ }
+
+ protected Set<String> getObject() {
+ return Collections.singleton("string");
+ }
+
+ protected Set<String> getAnotherObject() {
+ return Collections.singleton("object");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java
new file mode 100644
index 0000000..47ddfed
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedCollection.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedCollection encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_SynchronizedCollection extends AbstractTest<Collection<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedCollection().test(true);
+ }
+
+ protected Collection<String> getObject() {
+ List<String> list = Collections.singletonList("string");
+ return Collections.synchronizedCollection(list);
+ }
+
+ protected Collection<String> getAnotherObject() {
+ List<String> list = Collections.emptyList();
+ return Collections.synchronizedCollection(list);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java
new file mode 100644
index 0000000..db6d19f
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedList.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_SynchronizedList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = Collections.singletonList("string");
+ return Collections.synchronizedList(list);
+ }
+
+ protected List<String> getAnotherObject() {
+ List<String> list = Collections.emptyList();
+ return Collections.synchronizedList(list);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java
new file mode 100644
index 0000000..24a85e1
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedMap.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Map;
+
+public final class java_util_Collections_SynchronizedMap extends AbstractTest<Map<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedMap().test(true);
+ }
+
+ protected Map<String, String> getObject() {
+ Map<String, String> map = Collections.singletonMap("key", "value");
+ return Collections.synchronizedMap(map);
+ }
+
+ protected Map<String, String> getAnotherObject() {
+ Map<String, String> map = Collections.emptyMap();
+ return Collections.synchronizedMap(map);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java
new file mode 100644
index 0000000..003d72d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedRandomAccessList.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedRandomAccessList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_SynchronizedRandomAccessList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedRandomAccessList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = new ArrayList<String>();
+ list.add("string");
+ return Collections.synchronizedList(list);
+ }
+
+ protected List<String> getAnotherObject() {
+ List<String> list = new ArrayList<String>();
+ return Collections.synchronizedList(list);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java
new file mode 100644
index 0000000..effa209
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSet.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Set;
+
+public final class java_util_Collections_SynchronizedSet extends AbstractTest<Set<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedSet().test(true);
+ }
+
+ protected Set<String> getObject() {
+ Set<String> set = Collections.singleton("string");
+ return Collections.synchronizedSet(set);
+ }
+
+ protected Set<String> getAnotherObject() {
+ Set<String> set = Collections.emptySet();
+ return Collections.synchronizedSet(set);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java
new file mode 100644
index 0000000..54f958a
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedMap.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedSortedMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+public final class java_util_Collections_SynchronizedSortedMap extends AbstractTest<SortedMap<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedSortedMap().test(true);
+ }
+
+ protected SortedMap<String, String> getObject() {
+ SortedMap<String, String> map = new TreeMap<String, String>();
+ map.put("key", "value");
+ return Collections.synchronizedSortedMap(map);
+ }
+
+ protected SortedMap<String, String> getAnotherObject() {
+ SortedMap<String, String> map = new TreeMap<String, String>();
+ return Collections.synchronizedSortedMap(map);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java
new file mode 100644
index 0000000..a104dc7
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_SynchronizedSortedSet.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests SynchronizedSortedSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public final class java_util_Collections_SynchronizedSortedSet extends AbstractTest<SortedSet<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_SynchronizedSortedSet().test(true);
+ }
+
+ protected SortedSet<String> getObject() {
+ SortedSet<String> set = new TreeSet<String>();
+ set.add("string");
+ return Collections.synchronizedSortedSet(set);
+ }
+
+ protected SortedSet<String> getAnotherObject() {
+ SortedSet<String> set = new TreeSet<String>();
+ return Collections.synchronizedSortedSet(set);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java
new file mode 100644
index 0000000..29db73a
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableCollection.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableCollection encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_UnmodifiableCollection extends AbstractTest<Collection<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableCollection().test(true);
+ }
+
+ protected Collection<String> getObject() {
+ List<String> list = Collections.singletonList("string");
+ return Collections.unmodifiableCollection(list);
+ }
+
+ protected Collection<String> getAnotherObject() {
+ List<String> list = Collections.emptyList();
+ return Collections.unmodifiableCollection(list);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java
new file mode 100644
index 0000000..ba57069
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableList.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_UnmodifiableList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = Collections.singletonList("string");
+ return Collections.unmodifiableList(list);
+ }
+
+ protected List<String> getAnotherObject() {
+ List<String> list = Collections.emptyList();
+ return Collections.unmodifiableList(list);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java
new file mode 100644
index 0000000..78b7951
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableMap.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Map;
+
+public final class java_util_Collections_UnmodifiableMap extends AbstractTest<Map<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableMap().test(true);
+ }
+
+ protected Map<String, String> getObject() {
+ Map<String, String> map = Collections.singletonMap("key", "value");
+ return Collections.unmodifiableMap(map);
+ }
+
+ protected Map<String, String> getAnotherObject() {
+ Map<String, String> map = Collections.emptyMap();
+ return Collections.unmodifiableMap(map);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java
new file mode 100644
index 0000000..12cc355
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableRandomAccessList.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableRandomAccessList encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public final class java_util_Collections_UnmodifiableRandomAccessList extends AbstractTest<List<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableRandomAccessList().test(true);
+ }
+
+ protected List<String> getObject() {
+ List<String> list = new ArrayList<String>();
+ list.add("string");
+ return Collections.unmodifiableList(list);
+ }
+
+ protected List<String> getAnotherObject() {
+ List<String> list = new ArrayList<String>();
+ return Collections.unmodifiableList(list);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java
new file mode 100644
index 0000000..488ad26
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSet.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.Set;
+
+public final class java_util_Collections_UnmodifiableSet extends AbstractTest<Set<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableSet().test(true);
+ }
+
+ protected Set<String> getObject() {
+ Set<String> set = Collections.singleton("string");
+ return Collections.unmodifiableSet(set);
+ }
+
+ protected Set<String> getAnotherObject() {
+ Set<String> set = Collections.emptySet();
+ return Collections.unmodifiableSet(set);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java
new file mode 100644
index 0000000..71722e1
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedMap.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableSortedMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+public final class java_util_Collections_UnmodifiableSortedMap extends AbstractTest<SortedMap<String, String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableSortedMap().test(true);
+ }
+
+ protected SortedMap<String, String> getObject() {
+ SortedMap<String, String> map = new TreeMap<String, String>();
+ map.put("key", "value");
+ return Collections.unmodifiableSortedMap(map);
+ }
+
+ protected SortedMap<String, String> getAnotherObject() {
+ SortedMap<String, String> map = new TreeMap<String, String>();
+ return Collections.unmodifiableSortedMap(map);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java
new file mode 100644
index 0000000..2e70e00
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Collections_UnmodifiableSortedSet.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6505888
+ * @summary Tests UnmodifiableSortedSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Collections;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+public final class java_util_Collections_UnmodifiableSortedSet extends AbstractTest<SortedSet<String>> {
+ public static void main(String[] args) {
+ new java_util_Collections_UnmodifiableSortedSet().test(true);
+ }
+
+ protected SortedSet<String> getObject() {
+ SortedSet<String> set = new TreeSet<String>();
+ set.add("string");
+ return Collections.unmodifiableSortedSet(set);
+ }
+
+ protected SortedSet<String> getAnotherObject() {
+ SortedSet<String> set = new TreeSet<String>();
+ return Collections.unmodifiableSortedSet(set);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_Date.java b/test/java/beans/XMLEncoder/java_util_Date.java
new file mode 100644
index 0000000..7dbbb6d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_Date.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4733558 6471539
+ * @summary Tests Date encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Date;
+
+public final class java_util_Date extends AbstractTest<Date> {
+ public static void main(String[] args) {
+ new java_util_Date().test(true);
+ }
+
+ protected Date getObject() {
+ return new Date(System.currentTimeMillis());
+ }
+
+ protected Date getAnotherObject() {
+ return new Date(0L);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_EnumMap.java b/test/java/beans/XMLEncoder/java_util_EnumMap.java
new file mode 100644
index 0000000..066ac18
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_EnumMap.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6536295
+ * @summary Tests EnumMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.EnumMap;
+import java.util.Map;
+
+public final class java_util_EnumMap extends AbstractTest<Map<EnumPublic, String>> {
+ public static void main(String[] args) {
+ new java_util_EnumMap().test(true);
+ }
+
+ protected Map<EnumPublic, String> getObject() {
+ return new EnumMap<EnumPublic, String>(EnumPublic.class);
+ }
+
+ protected Map<EnumPublic, String> getAnotherObject() {
+ Map<EnumPublic, String> map = new EnumMap<EnumPublic, String>(EnumPublic.class);
+ map.put(EnumPublic.A, "value");
+ map.put(EnumPublic.Z, null);
+ return map;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_HashMap.java b/test/java/beans/XMLEncoder/java_util_HashMap.java
new file mode 100644
index 0000000..9a9771f
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_HashMap.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4631471 4921212
+ * @summary Tests HashMap encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public final class java_util_HashMap extends AbstractTest<Map<String, String>> {
+ public static void main(String[] args) {
+ new java_util_HashMap().test(true);
+ }
+
+ protected Map<String, String> getObject() {
+ return new HashMap<String, String>();
+ }
+
+ protected Map<String, String> getAnotherObject() {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put(null, "null-value");
+ map.put("key", "value");
+ map.put("key-null", null);
+ return map;
+ }
+
+ protected void validate(Map<String, String> before, Map<String, String> after) {
+ super.validate(before, after);
+ validate(before);
+ validate(after);
+ }
+
+ private static void validate(Map<String, String> map) {
+ if (!map.isEmpty()) {
+ validate(map, null, "null-value");
+ validate(map, "key", "value");
+ validate(map, "key-null", null);
+ }
+ }
+
+ private static void validate(Map<String, String> map, String key, String value) {
+ if (!map.containsKey(key))
+ throw new Error("There are no key: " + key);
+
+ if (!map.containsValue(value))
+ throw new Error("There are no value: " + value);
+
+ if (!isEqual(value, map.get(key)))
+ throw new Error("There are no entry: " + key + ", " + value);
+ }
+
+ private static boolean isEqual(String str1, String str2) {
+ return (str1 == null)
+ ? str2 == null
+ : str1.equals(str2);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_JumboEnumSet.java b/test/java/beans/XMLEncoder/java_util_JumboEnumSet.java
new file mode 100644
index 0000000..ea4b6c5
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_JumboEnumSet.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6536295
+ * @summary Tests JumboEnumSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.EnumSet;
+import java.util.Set;
+
+public final class java_util_JumboEnumSet extends AbstractTest<Set<EnumPrivate>> {
+ public static void main(String[] args) {
+ new java_util_JumboEnumSet().test(true);
+ }
+
+ protected Set<EnumPrivate> getObject() {
+ return EnumSet.noneOf(EnumPrivate.class);
+ }
+
+ protected Set<EnumPrivate> getAnotherObject() {
+ Set<EnumPrivate> set = EnumSet.noneOf(EnumPrivate.class);
+ set.add(EnumPrivate.A0);
+ set.add(EnumPrivate.Z9);
+ return set;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/java_util_RegularEnumSet.java b/test/java/beans/XMLEncoder/java_util_RegularEnumSet.java
new file mode 100644
index 0000000..f9ad55f
--- /dev/null
+++ b/test/java/beans/XMLEncoder/java_util_RegularEnumSet.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6536295
+ * @summary Tests RegularEnumSet encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.EnumSet;
+import java.util.Set;
+
+public final class java_util_RegularEnumSet extends AbstractTest<Set<EnumPublic>> {
+ public static void main(String[] args) {
+ new java_util_RegularEnumSet().test(true);
+ }
+
+ protected Set<EnumPublic> getObject() {
+ return EnumSet.noneOf(EnumPublic.class);
+ }
+
+ protected Set<EnumPublic> getAnotherObject() {
+ Set<EnumPublic> set = EnumSet.noneOf(EnumPublic.class);
+ set.add(EnumPublic.A);
+ set.add(EnumPublic.Z);
+ return set;
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_Box.java b/test/java/beans/XMLEncoder/javax_swing_Box.java
new file mode 100644
index 0000000..f50e6ae
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_Box.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4818598
+ * @summary Tests Box value encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+
+public final class javax_swing_Box extends AbstractTest<Box> {
+ public static void main(String[] args) {
+ new javax_swing_Box().test(true);
+ }
+
+ protected Box getObject() {
+ return new Box(BoxLayout.LINE_AXIS);
+ }
+
+ protected Box getAnotherObject() {
+ return Box.createHorizontalBox();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_BoxLayout.java b/test/java/beans/XMLEncoder/javax_swing_BoxLayout.java
new file mode 100644
index 0000000..f4b299c
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_BoxLayout.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6405175 6487891
+ * @summary Tests BoxLayout encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.BoxLayout;
+import javax.swing.JLabel;
+
+public final class javax_swing_BoxLayout extends AbstractTest<BoxLayout> {
+ public static void main(String[] args) {
+ new javax_swing_BoxLayout().test(true);
+ }
+
+ protected BoxLayout getObject() {
+ return new BoxLayout(new JLabel("TEST"), BoxLayout.LINE_AXIS);
+ }
+
+ protected BoxLayout getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new BoxLayout(new JPanel(), BoxLayout.X_AXIS);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_Box_Filler.java b/test/java/beans/XMLEncoder/javax_swing_Box_Filler.java
new file mode 100644
index 0000000..dccb409
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_Box_Filler.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests Filler encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Dimension;
+import javax.swing.Box.Filler;
+
+public final class javax_swing_Box_Filler extends AbstractTest<Filler> {
+ public static void main(String[] args) {
+ new javax_swing_Box_Filler().test(true);
+ }
+
+ protected Filler getObject() {
+ return new Filler(
+ new Dimension(1, 2),
+ new Dimension(3, 4),
+ new Dimension(5, 6));
+ }
+
+ protected Filler getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new Filler(
+ // new Dimension(9, 8),
+ // new Dimension(7, 6),
+ // new Dimension(5, 4));
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java b/test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java
new file mode 100644
index 0000000..9523c26
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_DefaultCellEditor.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests DefaultCellEditor encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.DefaultCellEditor;
+import javax.swing.JTextField;
+import javax.swing.text.JTextComponent;
+
+public final class javax_swing_DefaultCellEditor extends AbstractTest<DefaultCellEditor> {
+ public static void main(String[] args) {
+ new javax_swing_DefaultCellEditor().test(true);
+ }
+
+ protected DefaultCellEditor getObject() {
+ return new DefaultCellEditor(new JTextField("First"));
+ }
+
+ protected DefaultCellEditor getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new DefaultCellEditor(new JTextField("Second"));
+ }
+
+ protected void validate(DefaultCellEditor before, DefaultCellEditor after) {
+ String text = ((JTextComponent) after.getComponent()).getText();
+ if (!text.equals(((JTextComponent) before.getComponent()).getText()))
+ throw new Error("Invalid text in component: " + text);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_JButton.java b/test/java/beans/XMLEncoder/javax_swing_JButton.java
new file mode 100644
index 0000000..4ffc02a
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_JButton.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests JButton encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JButton;
+
+public final class javax_swing_JButton extends AbstractTest<JButton> {
+ public static void main(String[] args) {
+ new javax_swing_JButton().test(true);
+ }
+
+ protected JButton getObject() {
+ return new JButton("First");
+ }
+
+ protected JButton getAnotherObject() {
+ return new JButton("Second");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_JLayeredPane.java b/test/java/beans/XMLEncoder/javax_swing_JLayeredPane.java
new file mode 100644
index 0000000..caeac2f
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_JLayeredPane.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 5023552
+ * @summary Tests JLayeredPane encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+
+public final class javax_swing_JLayeredPane extends AbstractTest<JLayeredPane> {
+ public static void main(String[] args) {
+ new javax_swing_JLayeredPane().test(false); // TODO: could not encode with security manager
+ }
+
+ private static void init(JLayeredPane pane, int layer, int x, int y, int w, int h, Color color) {
+ JPanel panel = new JPanel();
+ panel.setBackground(color);
+ panel.setLocation(x, y);
+ panel.setSize(w, h);
+ pane.add(panel, new Integer(layer));
+ }
+
+ protected JLayeredPane getObject() {
+ JLayeredPane pane = new JLayeredPane();
+ init(pane, 0, 25, 25, 50, 50, Color.RED);
+ init(pane, 1, 10, 10, 50, 50, Color.BLUE);
+ init(pane, 2, 40, 40, 50, 50, Color.YELLOW);
+ pane.setSize(200, 200);
+ return pane;
+ }
+
+ protected JLayeredPane getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new JLayeredPane();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_JSplitPane.java b/test/java/beans/XMLEncoder/javax_swing_JSplitPane.java
new file mode 100644
index 0000000..f07c2d8
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_JSplitPane.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests JSplitPane encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JSplitPane;
+
+public final class javax_swing_JSplitPane extends AbstractTest<JSplitPane> {
+ public static void main(String[] args) {
+ new javax_swing_JSplitPane().test(true);
+ }
+
+ protected JSplitPane getObject() {
+ return new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+ }
+
+ protected JSplitPane getAnotherObject() {
+ return new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+ }
+
+ protected void validate(JSplitPane before, JSplitPane after) {
+ int orientation = after.getOrientation();
+ if (orientation != before.getOrientation())
+ throw new Error("Invalid orientation: " + orientation);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_JTree.java b/test/java/beans/XMLEncoder/javax_swing_JTree.java
new file mode 100644
index 0000000..636874c
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_JTree.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests JTree encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JTree;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+public final class javax_swing_JTree extends AbstractTest<JTree> {
+ public static void main(String[] args) {
+ new javax_swing_JTree().test(true);
+ }
+
+ protected JTree getObject() {
+ return new JTree(new MyModel());
+ }
+
+ protected JTree getAnotherObject() {
+ return new JTree();
+ }
+
+ protected void validate(JTree before, JTree after) {
+ Class type = after.getModel().getClass();
+ if (!type.equals(before.getModel().getClass()))
+ throw new Error("Invalid model: " + type);
+ }
+
+ public static final class MyModel implements TreeModel {
+ public Object getRoot() {
+ return null;
+ }
+
+ public Object getChild(Object parent, int index) {
+ return null;
+ }
+
+ public int getChildCount(Object parent) {
+ return 0;
+ }
+
+ public boolean isLeaf(Object node) {
+ return false;
+ }
+
+ public void valueForPathChanged(TreePath path, Object newValue) {
+ }
+
+ public int getIndexOfChild(Object parent, Object child) {
+ return 0;
+ }
+
+ public void addTreeModelListener(TreeModelListener listener) {
+ }
+
+ public void removeTreeModelListener(TreeModelListener listener) {
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_KeyStroke.java b/test/java/beans/XMLEncoder/javax_swing_KeyStroke.java
new file mode 100644
index 0000000..94bd113
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_KeyStroke.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6501431
+ * @summary Tests KeyStroke encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import javax.swing.KeyStroke;
+
+public final class javax_swing_KeyStroke extends AbstractTest<KeyStroke> {
+ public static void main(String[] args) {
+ new javax_swing_KeyStroke().test(true);
+ }
+
+ protected KeyStroke getObject() {
+ return KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.SHIFT_DOWN_MASK, true);
+ }
+
+ protected KeyStroke getAnotherObject() {
+ return KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_DOWN_MASK);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_OverlayLayout.java b/test/java/beans/XMLEncoder/javax_swing_OverlayLayout.java
new file mode 100644
index 0000000..53e2ea5
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_OverlayLayout.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6405175 6487891
+ * @summary Tests OverlayLayout encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JLabel;
+import javax.swing.OverlayLayout;
+
+public final class javax_swing_OverlayLayout extends AbstractTest<OverlayLayout> {
+ public static void main(String[] args) {
+ new javax_swing_OverlayLayout().test(true);
+ }
+
+ protected OverlayLayout getObject() {
+ return new OverlayLayout(new JLabel("TEST"));
+ }
+
+ protected OverlayLayout getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new OverlayLayout(new JPanel());
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java
new file mode 100644
index 0000000..d4df8e7
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_BevelBorder.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests BevelBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.border.BevelBorder;
+
+public final class javax_swing_border_BevelBorder extends AbstractTest<BevelBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_BevelBorder().test(true);
+ }
+
+ protected BevelBorder getObject() {
+ return new BevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
+ }
+
+ protected BevelBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new BevelBorder(BevelBorder.LOWERED);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java
new file mode 100644
index 0000000..87ae055
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_CompoundBorder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests CompoundBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.border.CompoundBorder;
+
+public final class javax_swing_border_CompoundBorder extends AbstractTest<CompoundBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_CompoundBorder().test(true);
+ }
+
+ protected CompoundBorder getObject() {
+ return new CompoundBorder(null, new CompoundBorder());
+ }
+
+ protected CompoundBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new CompoundBorder();
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java
new file mode 100644
index 0000000..514eb18
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_EmptyBorder.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests EmptyBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.border.EmptyBorder;
+
+public final class javax_swing_border_EmptyBorder extends AbstractTest<EmptyBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_EmptyBorder().test(true);
+ }
+
+ protected EmptyBorder getObject() {
+ return new EmptyBorder(1, 2, 3, 4);
+ }
+
+ protected EmptyBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new EmptyBorder(4, 3, 2, 1);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java
new file mode 100644
index 0000000..feda91b
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_EtchedBorder.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests EtchedBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.border.EtchedBorder;
+
+public final class javax_swing_border_EtchedBorder extends AbstractTest<EtchedBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_EtchedBorder().test(true);
+ }
+
+ protected EtchedBorder getObject() {
+ return new EtchedBorder(EtchedBorder.RAISED, Color.RED, Color.BLUE);
+ }
+
+ protected EtchedBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new EtchedBorder(EtchedBorder.LOWERED);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_LineBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_LineBorder.java
new file mode 100644
index 0000000..c44146d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_LineBorder.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests LineBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.border.LineBorder;
+
+public final class javax_swing_border_LineBorder extends AbstractTest<LineBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_LineBorder().test(true);
+ }
+
+ protected LineBorder getObject() {
+ return new LineBorder(Color.RED, 2, true);
+ }
+
+ protected LineBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new LineBorder(Color.WHITE);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java
new file mode 100644
index 0000000..ee8d8b5
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_MatteBorder.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062
+ * @summary Tests MatteBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.border.MatteBorder;
+
+public final class javax_swing_border_MatteBorder extends AbstractTest<MatteBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_MatteBorder().test(true);
+ }
+
+ protected MatteBorder getObject() {
+ return new MatteBorder(1, 2, 3, 4, Color.RED);
+ }
+
+ protected MatteBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new MatteBorder(4, 3, 2, 1, Color.BLACK);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java
new file mode 100644
index 0000000..b2f095d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_SoftBevelBorder.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests SoftBevelBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.border.BevelBorder;
+import javax.swing.border.SoftBevelBorder;
+
+public final class javax_swing_border_SoftBevelBorder extends AbstractTest<SoftBevelBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_SoftBevelBorder().test(true);
+ }
+
+ protected SoftBevelBorder getObject() {
+ return new SoftBevelBorder(BevelBorder.RAISED, Color.RED, Color.GREEN, Color.BLUE, Color.WHITE);
+ }
+
+ protected SoftBevelBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new SoftBevelBorder(BevelBorder.LOWERED);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java b/test/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java
new file mode 100644
index 0000000..e480635
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_border_TitledBorder.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests TitledBorder encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+public final class javax_swing_border_TitledBorder extends AbstractTest<TitledBorder> {
+ public static void main(String[] args) {
+ new javax_swing_border_TitledBorder().test(true);
+ }
+
+ protected TitledBorder getObject() {
+ return new TitledBorder(
+ new EmptyBorder(1, 2, 3, 4),
+ "TITLE",
+ TitledBorder.CENTER,
+ TitledBorder.ABOVE_TOP,
+ new Font("Arial", Font.ITALIC, 12),
+ Color.RED);
+ }
+
+ protected TitledBorder getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new TitledBorder("title");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java
new file mode 100644
index 0000000..637a9f6
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_BevelBorderUIResource.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests BevelBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.border.BevelBorder;
+import javax.swing.plaf.BorderUIResource.BevelBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_BevelBorderUIResource extends AbstractTest<BevelBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_BevelBorderUIResource().test(true);
+ }
+
+ protected BevelBorderUIResource getObject() {
+ return new BevelBorderUIResource(BevelBorder.RAISED);
+ }
+
+ protected BevelBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new BevelBorderUIResource(BevelBorder.LOWERED);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java
new file mode 100644
index 0000000..2b52bc1
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_CompoundBorderUIResource.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests CompoundBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.border.CompoundBorder;
+import javax.swing.plaf.BorderUIResource.CompoundBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_CompoundBorderUIResource extends AbstractTest<CompoundBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_CompoundBorderUIResource().test(true);
+ }
+
+ protected CompoundBorderUIResource getObject() {
+ return new CompoundBorderUIResource(null, new CompoundBorderUIResource(null, null));
+ }
+
+ protected CompoundBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new CompoundBorderUIResource(null, null);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java
new file mode 100644
index 0000000..a3fb532
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EmptyBorderUIResource.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests EmptyBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.plaf.BorderUIResource.EmptyBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_EmptyBorderUIResource extends AbstractTest<EmptyBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_EmptyBorderUIResource().test(true);
+ }
+
+ protected EmptyBorderUIResource getObject() {
+ return new EmptyBorderUIResource(1, 2, 3, 4);
+ }
+
+ protected EmptyBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new EmptyBorderUIResource(4, 3, 2, 1);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java
new file mode 100644
index 0000000..69ca189
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_EtchedBorderUIResource.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests EtchedBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.border.EtchedBorder;
+import javax.swing.plaf.BorderUIResource.EtchedBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_EtchedBorderUIResource extends AbstractTest<EtchedBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_EtchedBorderUIResource().test(true);
+ }
+
+ protected EtchedBorderUIResource getObject() {
+ return new EtchedBorderUIResource(EtchedBorder.RAISED);
+ }
+
+ protected EtchedBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new EtchedBorderUIResource(EtchedBorder.LOWERED);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java
new file mode 100644
index 0000000..f702d77
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_LineBorderUIResource.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests LineBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.plaf.BorderUIResource.LineBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_LineBorderUIResource extends AbstractTest<LineBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_LineBorderUIResource().test(true);
+ }
+
+ protected LineBorderUIResource getObject() {
+ return new LineBorderUIResource(Color.RED, 2);
+ }
+
+ protected LineBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new LineBorderUIResource(Color.BLACK);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java
new file mode 100644
index 0000000..acb271d
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_MatteBorderUIResource.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062
+ * @summary Tests MatteBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.plaf.BorderUIResource.MatteBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_MatteBorderUIResource extends AbstractTest<MatteBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_MatteBorderUIResource().test(true);
+ }
+
+ protected MatteBorderUIResource getObject() {
+ return new MatteBorderUIResource(1, 2, 3, 4, Color.RED);
+ }
+
+ protected MatteBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new MatteBorderUIResource(null);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java
new file mode 100644
index 0000000..0340f49
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_BorderUIResource_TitledBorderUIResource.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests TitledBorderUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+import javax.swing.plaf.BorderUIResource.TitledBorderUIResource;
+
+public final class javax_swing_plaf_BorderUIResource_TitledBorderUIResource extends AbstractTest<TitledBorderUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_BorderUIResource_TitledBorderUIResource().test(true);
+ }
+
+ protected TitledBorderUIResource getObject() {
+ return new TitledBorderUIResource(
+ new EmptyBorder(1, 2, 3, 4),
+ "TITLE",
+ TitledBorder.CENTER,
+ TitledBorder.ABOVE_TOP,
+ new Font("Serif", Font.ITALIC, 12),
+ Color.RED);
+ }
+
+ protected TitledBorderUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new TitledBorderUIResource("");
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java
new file mode 100644
index 0000000..31564de
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_ColorUIResource.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests ColorUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.plaf.ColorUIResource;
+
+public final class javax_swing_plaf_ColorUIResource extends AbstractTest<ColorUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_ColorUIResource().test(true);
+ }
+
+ protected ColorUIResource getObject() {
+ return new ColorUIResource(0x44, 0x22, 0x11);
+ }
+
+ protected ColorUIResource getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new ColorUIResource(Color.BLACK);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java b/test/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java
new file mode 100644
index 0000000..abb1cd3
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_plaf_FontUIResource.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 4951733 6402062
+ * @summary Tests FontUIResource encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Font;
+import java.awt.font.TextAttribute;
+import java.util.Collections;
+import javax.swing.plaf.FontUIResource;
+
+public final class javax_swing_plaf_FontUIResource extends AbstractTest<FontUIResource> {
+ public static void main(String[] args) {
+ new javax_swing_plaf_FontUIResource().test(true);
+ }
+
+ protected FontUIResource getObject() {
+ return new FontUIResource(
+ new Font(
+ Collections.singletonMap(
+ TextAttribute.STRIKETHROUGH,
+ TextAttribute.STRIKETHROUGH_ON)));
+ }
+
+ protected FontUIResource getAnotherObject() {
+ return new FontUIResource(null, Font.ITALIC, 11);
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java b/test/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java
new file mode 100644
index 0000000..36e8647
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_tree_DefaultTreeModel.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests DefaultTreeModel encoding
+ * @author Sergey Malenkov
+ */
+
+import java.util.Enumeration;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+
+public final class javax_swing_tree_DefaultTreeModel extends AbstractTest<DefaultTreeModel> {
+ public static void main(String[] args) {
+ new javax_swing_tree_DefaultTreeModel().test(true);
+ }
+
+ protected DefaultTreeModel getObject() {
+ return new DefaultTreeModel(new RootNode());
+ }
+
+ protected DefaultTreeModel getAnotherObject() {
+ return null; // TODO: could not update property
+ // return new DefaultTreeModel(null);
+ }
+
+ public static final class RootNode implements TreeNode {
+ public TreeNode getChildAt(int childIndex) {
+ return null;
+ }
+
+ public int getChildCount() {
+ return 0;
+ }
+
+ public TreeNode getParent() {
+ return null;
+ }
+
+ public int getIndex(TreeNode node) {
+ return 0;
+ }
+
+ public boolean getAllowsChildren() {
+ return false;
+ }
+
+ public boolean isLeaf() {
+ return false;
+ }
+
+ public Enumeration children() {
+ return null;
+ }
+ }
+}
diff --git a/test/java/beans/XMLEncoder/javax_swing_tree_TreePath.java b/test/java/beans/XMLEncoder/javax_swing_tree_TreePath.java
new file mode 100644
index 0000000..a056e22
--- /dev/null
+++ b/test/java/beans/XMLEncoder/javax_swing_tree_TreePath.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6402062 6487891
+ * @summary Tests TreePath encoding
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.tree.TreePath;
+
+public final class javax_swing_tree_TreePath extends AbstractTest<TreePath> {
+ public static void main(String[] args) {
+ new javax_swing_tree_TreePath().test(true);
+ }
+
+ protected TreePath getObject() {
+ return new TreePath("SinglePath");
+ }
+
+ protected TreePath getAnotherObject() {
+ return new TreePath(new String[] {"First", "Second"});
+ }
+}
diff --git a/test/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java b/test/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java
new file mode 100644
index 0000000..c7c9435
--- /dev/null
+++ b/test/java/beans/XMLEncoder/sun_swing_PrintColorUIResource.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6589532
+ * @summary Tests PrintColorUIResource value encoding
+ * @author Sergey Malenkov
+ */
+
+import java.awt.Color;
+import javax.swing.UIManager;
+import sun.swing.PrintColorUIResource;
+
+public final class sun_swing_PrintColorUIResource extends AbstractTest<Color> {
+ public static void main(String[] args) {
+ new sun_swing_PrintColorUIResource().test(true);
+ }
+
+ protected Color getObject() {
+ return UIManager.getColor("TitledBorder.titleColor");
+ }
+
+ protected Color getAnotherObject() {
+ return new PrintColorUIResource(0, Color.WHITE);
+ }
+
+ protected void validate(Color before, Color after) {
+ before.equals(after);
+ }
+}