/** * Constructor for a customized message with extension. * * @param message * String * @param extension * String */ public SerialisationFailedEvent(String message, String extension) { super(message, extension); super.desc = "An error during ONDEX object serialisation occurred."; this.setLog4jLevel(Level.ERROR); }
/** * Returns a byte array serialisation of this class. * * @return byte[] */ public byte[] serialise(long sid) { try { // create a byte output stream ByteArrayOutputStream baos = new ByteArrayOutputStream(100); // object output stream for serialisation DataOutputStream dos = new DataOutputStream( new BufferedOutputStream(baos)); dos.writeLong(sid); dos.writeInt(conceptId); dos.writeUTF(name); dos.writeBoolean(isPreferred); dos.flush(); byte[] retVal = baos.toByteArray(); // make sure streams are closed dos.close(); baos.close(); return retVal; } catch (IOException ioe) { ONDEXEventHandler.getEventHandlerForSID(getSID()) .fireEventOccurred( new SerialisationFailedEvent(ioe.getMessage(), "[ConceptName - serialise]")); throw new StorageException(ioe.getMessage()); } }
ONDEXEventHandler.getEventHandlerForSID(getSID()) .fireEventOccurred( new SerialisationFailedEvent(ioe.getMessage(), "[BerkeleyRelationKey - serialise]")); return null;
} catch (IOException ioe) { ONDEXEventHandler.getEventHandlerForSID(sid).fireEventOccurred( new SerialisationFailedEvent(ioe.getMessage(), "[SerialiseMetaDataFactory - serialise]")); throw new StorageException(ioe.getMessage());