throw new SerializationException( "could not deserialize", e ); throw new SerializationException( "could not deserialize", e ); throw new SerializationException( "could not deserialize", e );
throw new SerializationException( "could not serialize", ex );
@Override public Serializable disassemble(Object value) throws HibernateException { Object deepCopy = deepCopy(value); if (!(deepCopy instanceof Serializable)) { throw new SerializationException(String.format("%s is not serializable class", value), null); } return (Serializable) deepCopy; }
public Serializable disassemble(Object value) throws HibernateException { final Serializable result; if (value == null) { result = null; } else { final Object deepCopy = deepCopy(value); if (!(deepCopy instanceof Serializable)) { throw new SerializationException(String.format("deepCopy of %s is not serializable", value), null); } result = (Serializable) deepCopy; } return result; }
@Override public Serializable disassemble(Object value) throws HibernateException { Object deepCopy = deepCopy(value); if (!(deepCopy instanceof Serializable)) { throw new SerializationException(String.format("%s is not serializable class", value), null); } return (Serializable) deepCopy; }
/** * Disassembles the object in preparation for serialization. * See {@link org.hibernate.usertype.UserType#disassemble(java.lang.Object)}. * <p> * Expects {@link #deepCopy(Object)} to return a {@code Serializable}. * <strong>Subtypes whose {@code deepCopy} implementation returns a * non-serializable object must override this method.</strong> */ @Override public Serializable disassemble(Object value) throws HibernateException { // also safe for mutable objects Object deepCopy = deepCopy(value); if (!(deepCopy instanceof Serializable)) { throw new SerializationException( String.format("deepCopy of %s is not serializable", value), null); } return (Serializable) deepCopy; }
private static byte[] serializeActionQueue(ActionQueue actionQueue) { ByteArrayOutputStream baos = new ByteArrayOutputStream( 512 ); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream( baos ); actionQueue.serialize( oos ); } catch (IOException ex) { throw new SerializationException( "could not serialize action queue", ex ); } finally { if ( oos != null ) { try { oos.close(); } catch( IOException ex ) { //ignore } } } return baos.toByteArray(); }
private static byte[] serializePersistenceContext(StatefulPersistenceContext pc) { ByteArrayOutputStream baos = new ByteArrayOutputStream( 512 ); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream( baos ); ( pc ).serialize( oos ); } catch (IOException ex) { throw new SerializationException( "could not serialize persistence context", ex ); } finally { if ( oos != null ) { try { oos.close(); } catch( IOException ignore ) { //ignore } } } return baos.toByteArray(); }
private static byte[] serializePersistenceContext(StatefulPersistenceContext pc) { ByteArrayOutputStream baos = new ByteArrayOutputStream( 512 ); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream( baos ); ( pc ).serialize( oos ); } catch (IOException ex) { throw new SerializationException( "could not serialize persistence context", ex ); } finally { if ( oos != null ) { try { oos.close(); } catch( IOException ignore ) { //ignore } } } return baos.toByteArray(); }
private static byte[] serializeActionQueue(ActionQueue actionQueue) { ByteArrayOutputStream baos = new ByteArrayOutputStream( 512 ); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream( baos ); actionQueue.serialize( oos ); } catch (IOException ex) { throw new SerializationException( "could not serialize action queue", ex ); } finally { if ( oos != null ) { try { oos.close(); } catch( IOException ex ) { //ignore } } } return baos.toByteArray(); }
throw new SerializationException("could not serialize", ex);
private void replacePersistenceContext(StatefulPersistenceContext persistenceContextNew) { if ( persistenceContextNew.getSession() != null ) { throw new IllegalStateException( "new persistence context is already connected to a session " ); } persistenceContext.clear(); ObjectInputStream ois = null; try { ois = new ObjectInputStream( new ByteArrayInputStream( serializePersistenceContext( persistenceContextNew ) ) ); this.persistenceContext = StatefulPersistenceContext.deserialize( ois, this ); } catch (IOException ex) { throw new SerializationException( "could not deserialize the persistence context", ex ); } catch (ClassNotFoundException ex) { throw new SerializationException( "could not deserialize the persistence context", ex ); } finally { try { if (ois != null) ois.close(); } catch (IOException ignore) { } } }
private void replaceActionQueue(ActionQueue actionQueueNew) { if ( actionQueue.hasAnyQueuedActions() ) { throw new IllegalStateException( "cannot replace an ActionQueue with queued actions " ); } actionQueue.clear(); ObjectInputStream ois = null; try { ois = new ObjectInputStream( new ByteArrayInputStream( serializeActionQueue( actionQueueNew ) ) ); actionQueue = ActionQueue.deserialize( ois, this ); } catch (IOException ex) { throw new SerializationException( "could not deserialize the action queue", ex ); } catch (ClassNotFoundException ex) { throw new SerializationException( "could not deserialize the action queue", ex ); } finally { try { if (ois != null) ois.close(); } catch (IOException ignore) { } } }
throw new SerializationException("could not serialize", ex);
private void replacePersistenceContext(StatefulPersistenceContext persistenceContextNew) { if ( persistenceContextNew.getSession() != null ) { throw new IllegalStateException( "new persistence context is already connected to a session " ); } persistenceContext.clear(); ObjectInputStream ois = null; try { ois = new ObjectInputStream( new ByteArrayInputStream( serializePersistenceContext( persistenceContextNew ) ) ); this.persistenceContext = StatefulPersistenceContext.deserialize( ois, this ); } catch (IOException ex) { throw new SerializationException( "could not deserialize the persistence context", ex ); } catch (ClassNotFoundException ex) { throw new SerializationException( "could not deserialize the persistence context", ex ); } finally { try { if (ois != null) ois.close(); } catch (IOException ignore) { } } }
private void replaceActionQueue(ActionQueue actionQueueNew) { if ( actionQueue.hasAnyQueuedActions() ) { throw new IllegalStateException( "cannot replace an ActionQueue with queued actions " ); } actionQueue.clear(); ObjectInputStream ois = null; try { ois = new ObjectInputStream( new ByteArrayInputStream( serializeActionQueue( actionQueueNew ) ) ); actionQueue = ActionQueue.deserialize( ois, this ); } catch (IOException ex) { throw new SerializationException( "could not deserialize the action queue", ex ); } catch (ClassNotFoundException ex) { throw new SerializationException( "could not deserialize the action queue", ex ); } finally { try { if (ois != null) ois.close(); } catch (IOException ignore) { } } }
throw new SerializationException( "could not deserialize", e ); throw new SerializationException( "could not deserialize", e ); throw new SerializationException( "could not deserialize", e );
throw new SerializationException( "could not deserialize", e ); throw new SerializationException( "could not deserialize", e ); throw new SerializationException( "could not deserialize", e );
throw new SerializationException("could not deserialize", ex); throw new SerializationException("could not deserialize", ex);
throw new SerializationException("could not deserialize", ex); throw new SerializationException("could not deserialize", ex);