public void testNonSerializable() throws Exception {
   try {
     marshaller.objectToByteBuffer(new Object());
   } catch (NotSerializableException e) {
     log.info("Log exception for output format verification", e);
     TraceInformation inf = (TraceInformation) e.getCause();
     assert inf.toString().contains("in object java.lang.Object@");
   }
 }
 public void testNestedNonSerializable() throws Exception {
   PutKeyValueCommand cmd =
       new PutKeyValueCommand("k", new Object(), false, null, 0, 0, Collections.<Flag>emptySet());
   try {
     marshaller.objectToByteBuffer(cmd);
   } catch (NotSerializableException e) {
     log.info("Log exception for output format verification", e);
     TraceInformation inf = (TraceInformation) e.getCause();
     assert inf.toString().contains("in object java.lang.Object@");
     assert inf.toString().contains("in object org.infinispan.commands.write.PutKeyValueCommand@");
   }
 }
 public void testErrorUnmarshalling() throws Exception {
   Pojo pojo = new PojoWhichFailsOnUnmarshalling();
   byte[] bytes = marshaller.objectToByteBuffer(pojo);
   try {
     marshaller.objectFromByteBuffer(bytes);
   } catch (IOException e) {
     log.info("Log exception for output format verification", e);
     TraceInformation inf = (TraceInformation) e.getCause();
     assert inf.toString()
         .contains(
             "in object of type org.infinispan.marshall.VersionAwareMarshallerTest$PojoWhichFailsOnUnmarshalling");
   }
 }
    @Override
    public void handleUnmarshallingException(Throwable problem, Class<?> subjectClass) {
      if (log.isDebugEnabled()) {
        StringBuilder builder = new StringBuilder();
        ClassLoader cl = subjectClass.getClassLoader();
        builder.append("classloader hierarchy:");
        ClassLoader parent = cl;
        while (parent != null) {
          if (parent.equals(cl)) {
            builder.append("\n\t\t-> type classloader = ").append(parent);
          } else {
            builder.append("\n\t\t-> parent classloader = ").append(parent);
          }
          URL[] urls = getClassLoaderURLs(parent);

          if (urls != null) {
            for (URL u : urls) builder.append("\n\t\t->...").append(u);
          }

          parent = parent.getParent();
        }
        TraceInformation.addUserInformation(problem, builder.toString());
      }
    }
 @Override
 public void handleMarshallingException(Throwable problem, Object subject) {
   if (log.isDebugEnabled()) {
     TraceInformation.addUserInformation(problem, "toString = " + subject.toString());
   }
 }