kirklund commented on a change in pull request #7121:
URL: https://github.com/apache/geode/pull/7121#discussion_r751785110



##########
File path: 
geode-junit/src/main/java/org/apache/geode/codeAnalysis/AnalyzeSerializablesTestBase.java
##########
@@ -339,22 +351,23 @@ protected void serializeObject(Object object, 
BufferDataOutputStream outputStrea
 
   private void serializeAndDeserializeSanctionedObject(Object object) throws 
Exception {
     BufferDataOutputStream outputStream = new 
BufferDataOutputStream(KnownVersion.CURRENT);
+
     try {
       serializeObject(object, outputStream);
     } catch (RemoteException e) {
-      fail(object.getClass().getName() +
-          " is a java.rmi.server.RemoteObject which is not supported by 
AnalyzeSerializables", e);
-    } catch (IOException e) {
-      // some classes, such as BackupLock, are Serializable because the extend 
something
-      // like ReentrantLock but we never serialize them & it doesn't work to 
try to do so
-      throw new AssertionError("Not Serializable: " + 
object.getClass().getName(), e);
+      // java.rmi.server.RemoteObject which is not supported by 
AnalyzeSerializables
+    } catch (Exception e) {
+      errorCollector.addError(
+          new AssertionError("Not Serializable: " + 
object.getClass().getName(), e));
     }
+
     try {
       deserializeObject(outputStream);
     } catch (CancelException e) {
       // PDX classes fish for a PDXRegistry and find that there is no cache
-    } catch (InvalidClassException e) {
-      fail("I was unable to deserialize " + object.getClass().getName(), e);
+    } catch (Exception e) {
+      errorCollector.addError(
+          new AssertionError("I was unable to deserialize " + 
object.getClass().getName(), e));

Review comment:
       I changed this line from `throw new AssertionError` to 
`errorCollector.addError(new AssertionError)`. Probably not a big deal since 
it's a test, but I can change this. I was holding off from doing much more work 
on these TestBase classes, but I'd like to rework them in the near future.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to