return doDeserialize( in, "attributes" );
}
private <T> T doDeserialize( final byte[] in, final String name ) {
// getLogger().info( "Loading serialized:\n" + new String( in ) );
XMLObjectReader reader = null;
try {
final ByteArrayInputStream bis = new ByteArrayInputStream( in );
reader = XMLObjectReader.newInstance( bis );
final XMLReferenceResolver xmlReferenceResolver = new XMLReferenceResolver();
xmlReferenceResolver.setIdentifierAttribute( REFERENCE_ATTRIBUTE_ID );
xmlReferenceResolver.setReferenceAttribute( REFERENCE_ATTRIBUTE_REF_ID );
reader.setReferenceResolver( xmlReferenceResolver );
reader.setBinding( _xmlBinding );
if ( !reader.hasNext() ) {
throw new IllegalStateException( "reader has no input" );
}
return reader.<T> read( name );
} catch ( final RuntimeException e ) {
LOG.warn( "Caught Exception decoding "+ in.length +" bytes of data", e );
throw new TranscoderDeserializationException(e);
} catch ( final XMLStreamException e ) {
LOG.warn( "Caught Exception decoding "+ in.length +" bytes of data", e );