use of java.beans.XMLDecoder in project jdk8u_jdk by JetBrains.
the class AbstractTest method test.
/**
* This is entry point to start testing.
*
* @param security use {@code true} to start
* second pass in secure context
*/
final void test(boolean security) {
// NON-NLS: the field name
byte[] array = getFieldValue("XML").getBytes();
ByteArrayInputStream input = new ByteArrayInputStream(array);
XMLDecoder decoder = new XMLDecoder(input);
decoder.setExceptionListener(this);
validate(decoder);
try {
throw new Error("unexpected object" + decoder.readObject());
} catch (ArrayIndexOutOfBoundsException exception) {
// expected exception
}
decoder.close();
if (security) {
System.setSecurityManager(new SecurityManager());
test(false);
}
}
use of java.beans.XMLDecoder in project jdk8u_jdk by JetBrains.
the class AbstractTest method test.
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);
}
use of java.beans.XMLDecoder in project jdk8u_jdk by JetBrains.
the class AbstractTest method readObject.
private Object readObject(byte[] array) {
ByteArrayInputStream input = new ByteArrayInputStream(array);
XMLDecoder decoder = new XMLDecoder(input);
decoder.setExceptionListener(this);
initialize(decoder);
Object object = decoder.readObject();
decoder.close();
return object;
}
use of java.beans.XMLDecoder in project jdk8u_jdk by JetBrains.
the class Test4822050 method parse.
private void parse() {
XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(this.buffer));
decoder.readObject();
decoder.close();
}
use of java.beans.XMLDecoder in project jdk8u_jdk by JetBrains.
the class Test6338070 method main.
public static void main(String[] args) {
Test6338070 test = new Test6338070();
InputStream stream = new ByteArrayInputStream(DATA.getBytes());
new XMLDecoder(stream, test).close();
if (test.message == null) {
throw new Error("owner's method is not called");
}
}
Aggregations