org.apache.commons.lang3.exception.CloneFailedException Java Examples

The following examples show how to use org.apache.commons.lang3.exception.CloneFailedException. 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: KryoSerializer.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private ExecutionConfig.SerializableSerializer<? extends Serializer<?>> deepCopySerializer(
	ExecutionConfig.SerializableSerializer<? extends Serializer<?>> original) {
	try {
		return InstantiationUtil.clone(original, Thread.currentThread().getContextClassLoader());
	} catch (IOException | ClassNotFoundException ex) {
		throw new CloneFailedException(
			"Could not clone serializer instance of class " + original.getClass(),
			ex);
	}
}
 
Example #2
Source File: KryoSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
private ExecutionConfig.SerializableSerializer<? extends Serializer<?>> deepCopySerializer(
	ExecutionConfig.SerializableSerializer<? extends Serializer<?>> original) {
	try {
		return InstantiationUtil.clone(original, Thread.currentThread().getContextClassLoader());
	} catch (IOException | ClassNotFoundException ex) {
		throw new CloneFailedException(
			"Could not clone serializer instance of class " + original.getClass(),
			ex);
	}
}
 
Example #3
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#clone(Object)} with an uncloneable object.
 */
public void testCloneOfUncloneable() {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.clone(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        assertEquals(NoSuchMethodException.class, e.getCause().getClass());
    }
}
 
Example #4
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#cloneIfPossible(Object)} with an uncloneable object.
 */
public void testPossibleCloneOfUncloneable() {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.cloneIfPossible(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        assertEquals(NoSuchMethodException.class, e.getCause().getClass());
    }
}
 
Example #5
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#clone(Object)} with an uncloneable object.
 */
@Test(expected = NoSuchMethodException.class)
public void testCloneOfUncloneable() throws Throwable {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.clone(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        throw e.getCause();
    }
}
 
Example #6
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#cloneIfPossible(Object)} with an uncloneable object.
 */
@Test(expected = NoSuchMethodException.class)
public void testPossibleCloneOfUncloneable() throws Throwable {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.cloneIfPossible(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        throw e.getCause();
    }
}
 
Example #7
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#clone(Object)} with an uncloneable object.
 */
@Test(expected = NoSuchMethodException.class)
public void testCloneOfUncloneable() throws Throwable {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.clone(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        throw e.getCause();
    }
}
 
Example #8
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#cloneIfPossible(Object)} with an uncloneable object.
 */
@Test(expected = NoSuchMethodException.class)
public void testPossibleCloneOfUncloneable() throws Throwable {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.cloneIfPossible(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        throw e.getCause();
    }
}
 
Example #9
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#clone(Object)} with an uncloneable object.
 */
@Test(expected = NoSuchMethodException.class)
public void testCloneOfUncloneable() throws Throwable {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.clone(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        throw e.getCause();
    }
}
 
Example #10
Source File: ObjectUtilsTest.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests {@link ObjectUtils#cloneIfPossible(Object)} with an uncloneable object.
 */
@Test(expected = NoSuchMethodException.class)
public void testPossibleCloneOfUncloneable() throws Throwable {
    final UncloneableString string = new UncloneableString("apache");
    try {
        ObjectUtils.cloneIfPossible(string);
        fail("Thrown " + CloneFailedException.class.getName() + " expected");
    } catch (final CloneFailedException e) {
        throw e.getCause();
    }
}
 
Example #11
Source File: KryoSerializer.java    From flink with Apache License 2.0 5 votes vote down vote up
private ExecutionConfig.SerializableSerializer<? extends Serializer<?>> deepCopySerializer(
	ExecutionConfig.SerializableSerializer<? extends Serializer<?>> original) {
	try {
		return InstantiationUtil.clone(original, Thread.currentThread().getContextClassLoader());
	} catch (IOException | ClassNotFoundException ex) {
		throw new CloneFailedException(
			"Could not clone serializer instance of class " + original.getClass(),
			ex);
	}
}