Java Code Examples for java.beans.XMLDecoder#setExceptionListener()

The following examples show how to use java.beans.XMLDecoder#setExceptionListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractTest.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 2
Source File: AbstractTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 3
Source File: AbstractTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 4
Source File: AbstractTest.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 5
Source File: AbstractTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 6
Source File: AbstractTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 7
Source File: AbstractTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 8
Source File: AbstractTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 9
Source File: AbstractTest.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 10
Source File: AbstractTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 11
Source File: AbstractTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 12
Source File: AbstractTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * This is entry point to start testing.
 *
 * @param security  use {@code true} to start
 *                  second pass in secure context
 */
final void test(boolean security) {
    byte[] array = getFieldValue("XML").getBytes(); // NON-NLS: the field name
    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);
    }
}
 
Example 13
Source File: AbstractTest.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 14
Source File: AbstractTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 15
Source File: AbstractTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 16
Source File: AbstractTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 17
Source File: AbstractTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 18
Source File: AbstractTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 19
Source File: AbstractTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example 20
Source File: AbstractTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
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;
}