org.hibernate.type.SerializationException Java Examples

The following examples show how to use org.hibernate.type.SerializationException. 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: J2CacheMessageLogger_$logger.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public final void unableToDeserializeCache(final String arg0, final SerializationException arg1) {
    super.log.logf(FQCN, (org.jboss.logging.Logger.Level.WARN), null, unableToDeserializeCache$str(), arg0, arg1);
}
 
Example #2
Source File: J2CacheMessageLogger_$logger.java    From J2Cache with Apache License 2.0 4 votes vote down vote up
public final void unableToDeserializeCache(String arg0, SerializationException arg1) {
    super.log.logf(FQCN, Logger.Level.WARN, (Throwable)null, this.unableToDeserializeCache$str(), arg0, arg1);
}
 
Example #3
Source File: CoreMessageLogger.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@LogMessage(level = WARN)
@Message(value = "Could not deserialize cache file: %s : %s", id = 307)
void unableToDeserializeCache(
		String path,
		SerializationException error);
 
Example #4
Source File: CacheableFileXmlSource.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private <T> T readSerFile() throws SerializationException, FileNotFoundException {
	log.readingCachedMappings( serFile );
	return SerializationHelper.deserialize( new FileInputStream( serFile ) );
}
 
Example #5
Source File: SerializationHelper.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * <p>Deep clone an <code>Object</code> using serialization.</p>
 * <p/>
 * <p>This is many times slower than writing clone methods by hand
 * on all objects in your object graph. However, for complex object
 * graphs, or for those that don't support deep cloning this can
 * be a simple alternative implementation. Of course all the objects
 * must be <code>Serializable</code>.</p>
 *
 * @param object the <code>Serializable</code> object to clone
 *
 * @return the cloned object
 *
 * @throws SerializationException (runtime) if the serialization fails
 */
public static Object clone(Serializable object) throws SerializationException {
	LOG.trace( "Starting clone through serialization" );
	if ( object == null ) {
		return null;
	}
	return deserialize( serialize( object ), object.getClass().getClassLoader() );
}
 
Example #6
Source File: SerializationHelper.java    From cacheonix-core with GNU Lesser General Public License v2.1 3 votes vote down vote up
/**
 * <p>Deserializes a single <code>Object</code> from an array of bytes.</p>
 *
 * @param objectData  the serialized object, must not be null
 * @return the deserialized object
 * @throws IllegalArgumentException if <code>objectData</code> is <code>null</code>
 * @throws SerializationException (runtime) if the serialization fails
 */
public static Object deserialize(byte[] objectData) throws SerializationException {
    if (objectData == null) {
        throw new IllegalArgumentException("The byte[] must not be null");
    }
    ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
    return deserialize(bais);
}
 
Example #7
Source File: Configuration.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <b>INTENDED FOR TESTSUITE USE ONLY!</b>
 * <p/>
 * Much like {@link #addCacheableFile(File)} except that here we will fail immediately if
 * the cache version cannot be found or used for whatever reason
 *
 * @param xmlFile The xml file, not the bin!
 *
 * @return The dom "deserialized" from the cached file.
 *
 * @throws SerializationException Indicates a problem deserializing the cached dom tree
 * @throws FileNotFoundException Indicates that the cached file was not found or was not usable.
 */
public Configuration addCacheableFileStrictly(File xmlFile) throws SerializationException, FileNotFoundException {
	metadataSources.addCacheableFileStrictly( xmlFile );
	return this;
}
 
Example #8
Source File: SerializationHelper.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <p>Serializes an <code>Object</code> to a byte array for
 * storage/serialization.</p>
 *
 * @param obj the object to serialize to bytes
 *
 * @return a byte[] with the converted Serializable
 *
 * @throws SerializationException (runtime) if the serialization fails
 */
public static byte[] serialize(Serializable obj) throws SerializationException {
	ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream( 512 );
	serialize( obj, byteArrayOutputStream );
	return byteArrayOutputStream.toByteArray();
}
 
Example #9
Source File: SerializationHelper.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Deserializes an object from the specified stream using the Thread Context
 * ClassLoader (TCCL).
 * <p/>
 * Delegates to {@link #doDeserialize}
 *
 * @param inputStream the serialized object input stream, must not be null
 *
 * @return the deserialized object
 *
 * @throws IllegalArgumentException if <code>inputStream</code> is <code>null</code>
 * @throws SerializationException (runtime) if the serialization fails
 */
public static <T> T deserialize(InputStream inputStream) throws SerializationException {
	return doDeserialize( inputStream, defaultClassLoader(), hibernateClassLoader(), null );
}
 
Example #10
Source File: SerializationHelper.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Deserializes an object from the specified stream using the Thread Context
 * ClassLoader (TCCL).  If there is no TCCL set, the classloader of the calling
 * class is used.
 * <p/>
 * The stream will be closed once the object is read. This avoids the need
 * for a finally clause, and maybe also exception handling, in the application
 * code.
 * <p/>
 * The stream passed in is not buffered internally within this method.  This is
 * the responsibility of the caller, if desired.
 *
 * @param inputStream the serialized object input stream, must not be null
 * @param loader The classloader to use
 *
 * @return the deserialized object
 *
 * @throws IllegalArgumentException if <code>inputStream</code> is <code>null</code>
 * @throws SerializationException (runtime) if the serialization fails
 */
public static Object deserialize(InputStream inputStream, ClassLoader loader) throws SerializationException {
	return doDeserialize( inputStream, loader, defaultClassLoader(), hibernateClassLoader() );
}
 
Example #11
Source File: SerializationHelper.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Deserializes an object from an array of bytes using the Thread Context
 * ClassLoader (TCCL).  If there is no TCCL set, the classloader of the calling
 * class is used.
 * <p/>
 * Delegates to {@link #deserialize(byte[], ClassLoader)}
 *
 * @param objectData the serialized object, must not be null
 *
 * @return the deserialized object
 *
 * @throws IllegalArgumentException if <code>objectData</code> is <code>null</code>
 * @throws SerializationException (runtime) if the serialization fails
 */
public static Object deserialize(byte[] objectData) throws SerializationException {
	return doDeserialize( wrap( objectData ), defaultClassLoader(), hibernateClassLoader(), null );
}
 
Example #12
Source File: SerializationHelper.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Deserializes an object from an array of bytes.
 * <p/>
 * Delegates to {@link #deserialize(java.io.InputStream, ClassLoader)} using a
 * {@link ByteArrayInputStream} to wrap the array.
 *
 * @param objectData the serialized object, must not be null
 * @param loader The classloader to use
 *
 * @return the deserialized object
 *
 * @throws IllegalArgumentException if <code>objectData</code> is <code>null</code>
 * @throws SerializationException (runtime) if the serialization fails
 */
public static Object deserialize(byte[] objectData, ClassLoader loader) throws SerializationException {
	return doDeserialize( wrap( objectData ), loader, defaultClassLoader(), hibernateClassLoader() );
}
 
Example #13
Source File: MetadataSources.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * <b>INTENDED FOR TESTSUITE USE ONLY!</b>
 * <p/>
 * Much like {@link #addCacheableFile(java.io.File)} except that here we will fail immediately if
 * the cache version cannot be found or used for whatever reason
 *
 * @param file The xml file, not the bin!
 *
 * @return The dom "deserialized" from the cached file.
 *
 * @throws org.hibernate.type.SerializationException Indicates a problem deserializing the cached dom tree
 * @throws java.io.FileNotFoundException Indicates that the cached file was not found or was not usable.
 */
public MetadataSources addCacheableFileStrictly(File file) throws SerializationException, FileNotFoundException {
	final Origin origin = new Origin( SourceType.FILE, file.getAbsolutePath() );
	xmlBindings.add( new CacheableFileXmlSource( origin, file, true ).doBind( getXmlMappingBinderAccess().getMappingBinder() ) );
	return this;
}
 
Example #14
Source File: SerializationHelper.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * <p>Deep clone an <code>Object</code> using serialization.</p>
 *
 * <p>This is many times slower than writing clone methods by hand
 * on all objects in your object graph. However, for complex object
 * graphs, or for those that don't support deep cloning this can
 * be a simple alternative implementation. Of course all the objects
 * must be <code>Serializable</code>.</p>
 *
 * @param object  the <code>Serializable</code> object to clone
 * @return the cloned object
 * @throws SerializationException (runtime) if the serialization fails
 */
public static Object clone(Serializable object) throws SerializationException {
 log.trace("Starting clone through serialization");
    return deserialize( serialize(object) );
}
 
Example #15
Source File: SerializationHelper.java    From cacheonix-core with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * <p>Serializes an <code>Object</code> to a byte array for
 * storage/serialization.</p>
 *
 * @param obj  the object to serialize to bytes
 * @return a byte[] with the converted Serializable
 * @throws SerializationException (runtime) if the serialization fails
 */
public static byte[] serialize(Serializable obj) throws SerializationException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
    serialize(obj, baos);
    return baos.toByteArray();
}