List of usage examples for java.io NotSerializableException getMessage
public String getMessage()
From source file:io.smartspaces.scheduling.quartz.orientdb.internal.util.SerialUtils.java
private static String rethrowEnhanced(JobDataMap jobDataMap, NotSerializableException e) throws NotSerializableException { final String key = getKeyOfNonSerializableStringMapEntry(jobDataMap.getWrappedMap()); throw new NotSerializableException(String.format(SERIALIZE_MESSAGE_FORMAT, key, e.getMessage())); }
From source file:com.novemberain.quartz.mongodb.MongoDBJobStore.java
protected void jobDataMapFromString(JobDataMap jobDataMap, String clob) throws IOException { try {//from ww w .ja v a2 s . c o m byte[] bytes = Base64.decodeBase64(clob); Map<String, ?> map = (Map<String, ?>) stringMapFromBytes(bytes); jobDataMap.putAll(map); jobDataMap.clearDirtyFlag(); } catch (NotSerializableException e) { throw new NotSerializableException("Unable to serialize JobDataMap for insertion into " + "database because the value of property '" + getKeyOfNonSerializableStringMapEntry(jobDataMap.getWrappedMap()) + "' is not serializable: " + e.getMessage()); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:com.novemberain.quartz.mongodb.MongoDBJobStore.java
protected String jobDataToString(JobDataMap jobDataMap) throws IOException { try {/* www .ja v a 2 s .c om*/ byte[] bytes = stringMapToBytes(jobDataMap.getWrappedMap()); return Base64.encodeBase64String(bytes); } catch (NotSerializableException e) { throw new NotSerializableException("Unable to serialize JobDataMap for insertion into " + "database because the value of property '" + getKeyOfNonSerializableStringMapEntry(jobDataMap.getWrappedMap()).toString() + "' is not serializable: " + e.getMessage()); } }
From source file:org.apache.axis2.clustering.tribes.ChannelSender.java
public synchronized void sendToGroup(ClusteringCommand msg, MembershipManager membershipManager, int additionalOptions) throws ClusteringFault { if (channel == null) { return;/* w w w . j av a2 s . c om*/ } Member[] members = membershipManager.getMembers(); // Keep retrying, since at the point of trying to send the msg, a member may leave the group // causing a view change. All nodes in a view should get the msg if (members.length > 0) { try { if (synchronizeAllMembers) { channel.send(members, toByteMessage(msg), Channel.SEND_OPTIONS_USE_ACK | Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_BYTE_MESSAGE | TribesConstants.MSG_ORDER_OPTION | TribesConstants.AT_MOST_ONCE_OPTION | additionalOptions); } else { channel.send(members, toByteMessage(msg), Channel.SEND_OPTIONS_ASYNCHRONOUS | TribesConstants.MSG_ORDER_OPTION | Channel.SEND_OPTIONS_BYTE_MESSAGE | TribesConstants.AT_MOST_ONCE_OPTION | additionalOptions); } if (log.isDebugEnabled()) { log.debug("Sent " + msg + " to group"); } } catch (NotSerializableException e) { String message = "Could not send command message " + msg + " to group since it is not serializable."; log.error(message, e); throw new ClusteringFault(message, e); } catch (ChannelException e) { log.error("Could not send message to some members", e); ChannelException.FaultyMember[] faultyMembers = e.getFaultyMembers(); for (ChannelException.FaultyMember faultyMember : faultyMembers) { Member member = faultyMember.getMember(); log.error("Member " + TribesUtil.getName(member) + " is faulty", faultyMember.getCause()); } } catch (Exception e) { String message = "Error sending command message : " + msg + ". Reason " + e.getMessage(); log.warn(message, e); } } }
From source file:org.apache.axis2.clustering.tribes.ChannelSender.java
public void sendToMember(ClusteringCommand cmd, Member member) throws ClusteringFault { try {//from w ww. j av a 2s.co m if (member.isReady()) { channel.send(new Member[] { member }, toByteMessage(cmd), Channel.SEND_OPTIONS_USE_ACK | Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_BYTE_MESSAGE | TribesConstants.MSG_ORDER_OPTION | TribesConstants.AT_MOST_ONCE_OPTION); if (log.isDebugEnabled()) { log.debug("Sent " + cmd + " to " + TribesUtil.getName(member)); } } } catch (NotSerializableException e) { String message = "Could not send command message to " + TribesUtil.getName(member) + " since it is not serializable."; log.error(message, e); throw new ClusteringFault(message, e); } catch (ChannelException e) { log.error("Could not send message to " + TribesUtil.getName(member)); ChannelException.FaultyMember[] faultyMembers = e.getFaultyMembers(); log.error("Member " + TribesUtil.getName(member) + " is faulty", faultyMembers[0].getCause()); } catch (Exception e) { String message = "Could not send message to " + TribesUtil.getName(member) + ". Reason " + e.getMessage(); log.warn(message, e); } }
From source file:org.cruk.genologics.api.jaxb.SerializationTest.java
private void fetchMarshalAndSerialize(Class<?> entityClass) throws Throwable { final String className = ClassUtils.getShortClassName(entityClass); XmlRootElement rootElementAnno = entityClass.getAnnotation(XmlRootElement.class); if (rootElementAnno == null) { fail(className + " has no XmlRootElement annotation"); }/*from w w w .j a va 2 s . c o m*/ File exampleFile = new File(exampleDirectory, className.toLowerCase() + ".xml"); Object unmarshalled = marshaller.unmarshal(new StreamSource(new FileReader(exampleFile))); // In the case where the simple serialisation test for the exception // hasn't got the unmarshalling aspect around it. // See JaxbUnmarshallingAspect. if (unmarshalled instanceof JAXBElement<?>) { unmarshalled = ((JAXBElement<?>) unmarshalled).getValue(); } ByteArrayOutputStream bstream = new ByteArrayOutputStream(65536); try { ObjectOutputStream ostream = new ObjectOutputStream(bstream); ostream.writeObject(unmarshalled); ostream.close(); } catch (NotSerializableException e) { fail(e.getMessage() + " is not serializable."); } ObjectInputStream istream = new ObjectInputStream(new ByteArrayInputStream(bstream.toByteArray())); Object deserialized = istream.readObject(); compareObjects(unmarshalled, deserialized); }
From source file:org.mule.message.ExceptionMessage.java
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject();// ww w . j a v a 2s .c om try { out.writeObject(exception); } catch (NotSerializableException e) { logger.warn("Exception " + exception.getClass().getName() + " is not serializable and will be lost when sending ExceptionMessage over the wire: " + e.getMessage()); } try { out.writeObject(payload); } catch (NotSerializableException e) { logger.warn("Payload " + payload.getClass().getName() + " is not serializable and will be lost when sending ExceptionMessage over the wire: " + e.getMessage()); } }
From source file:org.quartz.impl.jdbcjobstore.StdJDBCDelegate.java
/** * <p>//from ww w . j a v a 2 s. c om * Remove the transient data from and then create a serialized <code>java.util.ByteArrayOutputStream</code> * version of a <code>{@link org.quartz.JobDataMap}</code>. * </p> * * @param data * the JobDataMap to serialize * @return the serialized ByteArrayOutputStream * @throws IOException * if serialization causes an error */ protected ByteArrayOutputStream serializeJobData(JobDataMap data) throws IOException { if (canUseProperties()) { return serializeProperties(data); } try { return serializeObject(data); } catch (NotSerializableException e) { throw new NotSerializableException("Unable to serialize JobDataMap for insertion into " + "database because the value of property '" + getKeyOfNonSerializableValue(data) + "' is not serializable: " + e.getMessage()); } }
From source file:org.quartz.impl.jdbcjobstore.StdJDBCDelegateTest.java
public void testSerializeJobData() throws IOException { StdJDBCDelegate delegate = new StdJDBCDelegate(LogFactory.getLog(getClass()), "QRTZ_", "INSTANCE"); JobDataMap jdm = new JobDataMap(); delegate.serializeJobData(jdm).close(); jdm.clear();/*from ww w .ja va 2 s. com*/ jdm.put("key", "value"); jdm.put("key2", null); delegate.serializeJobData(jdm).close(); jdm.clear(); jdm.put("key1", "value"); jdm.put("key2", null); jdm.put("key3", new Object()); try { delegate.serializeJobData(jdm); fail(); } catch (NotSerializableException e) { assertTrue(e.getMessage().indexOf("key3") >= 0); } }