Java Code Examples for java.io.InvalidObjectException#initCause()

The following examples show how to use java.io.InvalidObjectException#initCause() . 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: URL.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 2
Source File: URL.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL:  " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 3
Source File: URL.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 4
Source File: URL.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL:  " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 5
Source File: URL.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 6
Source File: URL.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 7
Source File: URL.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 8
Source File: URL.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 9
Source File: URL.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private URL fabricateNewURL()
            throws InvalidObjectException {
    // create URL string from deserialized object
    URL replacementURL = null;
    String urlString = tempState.reconstituteUrlString();

    try {
        replacementURL = new URL(urlString);
    } catch (MalformedURLException mEx) {
        resetState();
        InvalidObjectException invoEx = new InvalidObjectException(
                "Malformed URL: " + urlString);
        invoEx.initCause(mEx);
        throw invoEx;
    }
    replacementURL.setSerializedHashCode(tempState.getHashCode());
    resetState();
    return replacementURL;
}
 
Example 10
Source File: MappedMXBeanType.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
Object toJavaTypeData(Object data)
    throws OpenDataException, InvalidObjectException {

    try {
        return Enum.valueOf(enumClass, (String) data);
    } catch (IllegalArgumentException e) {
        // missing enum constants
        final InvalidObjectException ioe =
            new InvalidObjectException("Enum constant named " +
            (String) data + " is missing");
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 11
Source File: MappedMXBeanType.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public Object toJavaTypeData(Object data)
    throws OpenDataException, InvalidObjectException {

    try {
        return Enum.valueOf(enumClass, (String) data);
    } catch (IllegalArgumentException e) {
        // missing enum constants
        final InvalidObjectException ioe =
            new InvalidObjectException("Enum constant named " +
            (String) data + " is missing");
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 12
Source File: MappedMXBeanType.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
Object toJavaTypeData(Object data)
    throws OpenDataException, InvalidObjectException {

    try {
        return Enum.valueOf(enumClass, (String) data);
    } catch (IllegalArgumentException e) {
        // missing enum constants
        final InvalidObjectException ioe =
            new InvalidObjectException("Enum constant named " +
            (String) data + " is missing");
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 13
Source File: MappedMXBeanType.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
Object toJavaTypeData(Object data)
    throws OpenDataException, InvalidObjectException {

    try {
        return Enum.valueOf(enumClass, (String) data);
    } catch (IllegalArgumentException e) {
        // missing enum constants
        final InvalidObjectException ioe =
            new InvalidObjectException("Enum constant named " +
            (String) data + " is missing");
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 14
Source File: ImmutableCollections.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
  * Creates and returns an immutable collection from this proxy class.
  * The instance returned is created as if by calling one of the
  * static factory methods for
  * <a href="List.html#unmodifiable">List</a>,
  * <a href="Map.html#unmodifiable">Map</a>, or
  * <a href="Set.html#unmodifiable">Set</a>.
  * This proxy class is the serial form for all immutable collection instances,
  * regardless of implementation type. This is necessary to ensure that the
  * existence of any particular implementation type is kept out of the
  * serialized form.
  *
  * @return a collection created from this proxy object
  * @throws InvalidObjectException if the tag value is illegal or if an exception
  *         is thrown during creation of the collection
  * @throws ObjectStreamException if another serialization error has occurred
  * @since 9
  */
@java.io.Serial
 private Object readResolve() throws ObjectStreamException {
     try {
         if (array == null) {
             throw new InvalidObjectException("null array");
         }

         // use low order 8 bits to indicate "kind"
         // ignore high order 24 bits
         switch (tag & 0xff) {
             case IMM_LIST:
                 return List.of(array);
             case IMM_SET:
                 return Set.of(array);
             case IMM_MAP:
                 if (array.length == 0) {
                     return ImmutableCollections.MapN.EMPTY_MAP;
                 } else if (array.length == 2) {
                     return new ImmutableCollections.Map1<>(array[0], array[1]);
                 } else {
                     return new ImmutableCollections.MapN<>(array);
                 }
             default:
                 throw new InvalidObjectException(String.format("invalid flags 0x%x", tag));
         }
     } catch (NullPointerException|IllegalArgumentException ex) {
         InvalidObjectException ioe = new InvalidObjectException("invalid object");
         ioe.initCause(ex);
         throw ioe;
     }
 }
 
Example 15
Source File: MappedMXBeanType.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
Object toJavaTypeData(Object data)
    throws OpenDataException, InvalidObjectException {

    try {
        return Enum.valueOf(enumClass, (String) data);
    } catch (IllegalArgumentException e) {
        // missing enum constants
        final InvalidObjectException ioe =
            new InvalidObjectException("Enum constant named " +
            (String) data + " is missing");
        ioe.initCause(e);
        throw ioe;
    }
}
 
Example 16
Source File: LocalPartitionMapper.java    From component-runtime with Apache License 2.0 5 votes vote down vote up
Object readResolve() throws ObjectStreamException {
    try {
        return new LocalPartitionMapper(component, name, plugin, loadDelegate());
    } catch (final IOException | ClassNotFoundException e) {
        final InvalidObjectException invalidObjectException = new InvalidObjectException(e.getMessage());
        invalidObjectException.initCause(e);
        throw invalidObjectException;
    }
}
 
Example 17
Source File: PartitionMapperImpl.java    From component-runtime with Apache License 2.0 5 votes vote down vote up
Object readResolve() throws ObjectStreamException {
    try {
        return new PartitionMapperImpl(component, name, input, plugin, stream, loadDelegate());
    } catch (final IOException | ClassNotFoundException e) {
        final InvalidObjectException invalidObjectException = new InvalidObjectException(e.getMessage());
        invalidObjectException.initCause(e);
        throw invalidObjectException;
    }
}
 
Example 18
Source File: StreamingInputImpl.java    From component-runtime with Apache License 2.0 5 votes vote down vote up
protected Object readResolve() throws ObjectStreamException {
    try {
        return new StreamingInputImpl(component, name, plugin, loadDelegate(), retryConfiguration);
    } catch (final IOException | ClassNotFoundException e) {
        final InvalidObjectException invalidObjectException = new InvalidObjectException(e.getMessage());
        invalidObjectException.initCause(e);
        throw invalidObjectException;
    }
}
 
Example 19
Source File: InputImpl.java    From component-runtime with Apache License 2.0 5 votes vote down vote up
protected Object readResolve() throws ObjectStreamException {
    try {
        return new InputImpl(component, name, plugin, loadDelegate());
    } catch (final IOException | ClassNotFoundException e) {
        final InvalidObjectException invalidObjectException = new InvalidObjectException(e.getMessage());
        invalidObjectException.initCause(e);
        throw invalidObjectException;
    }
}
 
Example 20
Source File: ImmutableCollections.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates and returns an immutable collection from this proxy class.
 * The instance returned is created as if by calling one of the
 * static factory methods for
 * <a href="List.html#immutable">List</a>,
 * <a href="Map.html#immutable">Map</a>, or
 * <a href="Set.html#immutable">Set</a>.
 * This proxy class is the serial form for all immutable collection instances,
 * regardless of implementation type. This is necessary to ensure that the
 * existence of any particular implementation type is kept out of the
 * serialized form.
 *
 * @return a collection created from this proxy object
 * @throws InvalidObjectException if the tag value is illegal or if an exception
 *         is thrown during creation of the collection
 * @throws ObjectStreamException if another serialization error has occurred
 * @since 9
 */
private Object readResolve() throws ObjectStreamException {
    try {
        if (array == null) {
            throw new InvalidObjectException("null array");
        }

        // use low order 8 bits to indicate "kind"
        // ignore high order 24 bits
        switch (tag & 0xff) {
            case IMM_LIST:
                return List.of(array);
            case IMM_SET:
                return Set.of(array);
            case IMM_MAP:
                if (array.length == 0) {
                    return ImmutableCollections.Map0.instance();
                } else if (array.length == 2) {
                    return new ImmutableCollections.Map1<>(array[0], array[1]);
                } else {
                    return new ImmutableCollections.MapN<>(array);
                }
            default:
                throw new InvalidObjectException(String.format("invalid flags 0x%x", tag));
        }
    } catch (NullPointerException|IllegalArgumentException ex) {
        InvalidObjectException ioe = new InvalidObjectException("invalid object");
        ioe.initCause(ex);
        throw ioe;
    }
}