public Object revert(Object o, final ProcessDefinition processDefinition) { ByteArray byteArray = (ByteArray) o; InputStream memoryStream = new ByteArrayInputStream(byteArray.getBytes()); try { ObjectInputStream objectStream = new CustomLoaderObjectInputStream(memoryStream, JbpmConfiguration.getProcessClassLoader(processDefinition)); return objectStream.readObject(); } catch (IOException e) { throw new JbpmException("failed to deserialize object", e); } catch (ClassNotFoundException e) { throw new JbpmException("serialized class not found", e); } } }
public Object revert(Object o, final ProcessDefinition processDefinition) { ByteArray byteArray = (ByteArray) o; if( byteArray.getBytes().length > 0 ) { InputStream memoryStream = new ByteArrayInputStream(byteArray.getBytes()); try { ObjectInputStream objectStream = new CustomLoaderObjectInputStream(memoryStream, JbpmConfiguration.getProcessClassLoader(processDefinition)); return objectStream.readObject(); } catch (IOException e) { throw new JbpmException("failed to deserialize object", e); } catch (ClassNotFoundException e) { throw new JbpmException("serialized class not found", e); } } else { return null; } } }