Пример #1
0
 /**
  * An exception message formatter used when an exception is thrown by the post-deserialization
  * mechanism.
  *
  * @param exc The exception thrown by the underlying code.
  * @return A new ConversionException with <code>e</code> nested.
  */
 private ConversionException failDeserialize(Exception exc) {
   StringBuffer buffer = new StringBuffer();
   buffer.append("An exception of type ");
   buffer.append(exc.getClass().getName());
   buffer.append(" was thrown by an object while it was being deserialized.");
   return new ConversionException(buffer.toString(), exc);
 }
Пример #2
0
 /**
  * Formats the error message.
  *
  * @param rootClassName Name of the class of the root of the object graph that caused the
  *     exception.
  * @param currentClassName Name of the class that actually caused the exception.
  * @return A formatted error string.
  */
 private static String makeMessage(String rootClassName, String currentClassName) {
   StringBuffer buffer = new StringBuffer();
   buffer.append("Could not serialize an object of type ");
   buffer.append(currentClassName);
   buffer.append(" while serializing a root object of type ");
   buffer.append(rootClassName);
   return buffer.toString();
 }