You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2016/09/09 20:20:37 UTC

wicket git commit: WICKET-6241 CheckingObjectOutputStream should track the original instance, before writeReplace()

Repository: wicket
Updated Branches:
  refs/heads/wicket-7.x c1906e684 -> 3798d0fc3


WICKET-6241 CheckingObjectOutputStream should track the original instance, before writeReplace()


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/3798d0fc
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/3798d0fc
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/3798d0fc

Branch: refs/heads/wicket-7.x
Commit: 3798d0fc3f42c7d2b8b3e8f691d59cf2f4fb0c05
Parents: c1906e6
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Sep 9 22:20:07 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Sep 9 22:20:07 2016 +0200

----------------------------------------------------------------------
 .../checker/CheckingObjectOutputStream.java     | 21 +++++---------------
 1 file changed, 5 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/3798d0fc/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/CheckingObjectOutputStream.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/CheckingObjectOutputStream.java b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/CheckingObjectOutputStream.java
index 6eef7d9..4978c0e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/CheckingObjectOutputStream.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/CheckingObjectOutputStream.java
@@ -343,11 +343,7 @@ public class CheckingObjectOutputStream extends ObjectOutputStream
 
 	private void internalCheck(Object obj)
 	{
-		if (obj == null)
-		{
-			return;
-		}
-
+		final Object original = obj;
 		Class<?> cls = obj.getClass();
 		nameStack.add(simpleName);
 		traceStack.add(new TraceSlot(obj, fieldDescription));
@@ -390,7 +386,7 @@ public class CheckingObjectOutputStream extends ObjectOutputStream
 		}
 		else if (cls.isArray())
 		{
-			checked.put(obj, null);
+			checked.put(original, null);
 			Class<?> ccl = cls.getComponentType();
 			if (!(ccl.isPrimitive()))
 			{
@@ -448,22 +444,15 @@ public class CheckingObjectOutputStream extends ObjectOutputStream
 			{
 				try
 				{
-					writeObjectMethod = cls.getDeclaredMethod("writeObject",
-							new Class[] { java.io.ObjectOutputStream.class });
+					writeObjectMethod = cls.getDeclaredMethod("writeObject", java.io.ObjectOutputStream.class);
 				}
-				catch (SecurityException e)
+				catch (SecurityException | NoSuchMethodException e)
 				{
 					// we can't access / set accessible to true
 					writeObjectMethodMissing.add(cls);
 				}
-				catch (NoSuchMethodException e)
-				{
-					// cls doesn't have that method
-					writeObjectMethodMissing.add(cls);
-				}
 			}
 
-			final Object original = obj;
 			if (writeObjectMethod != null)
 			{
 				class InterceptingObjectOutputStream extends ObjectOutputStream
@@ -537,7 +526,7 @@ public class CheckingObjectOutputStream extends ObjectOutputStream
 					{
 						throw new RuntimeException(e);
 					}
-					checked.put(obj, null);
+					checked.put(original, null);
 					checkFields(obj, slotDesc);
 				}
 			}