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/04/22 23:16:04 UTC
wicket git commit: WICKET-6151 DebugBar/PageSizeDebugPanel throws
NullPointerException (need wrapper exception with more detail)
Repository: wicket
Updated Branches:
refs/heads/master b9a1ae901 -> 69f2d0ad9
WICKET-6151 DebugBar/PageSizeDebugPanel throws NullPointerException (need wrapper exception with more detail)
Throw an exception if the result of serializing an object is null.
Passing null to deserialization will lead to NullPointerException without details of the problematic object
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/69f2d0ad
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/69f2d0ad
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/69f2d0ad
Branch: refs/heads/master
Commit: 69f2d0ad9820e8ada6907ff1fa8138c89970713c
Parents: b9a1ae9
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri Apr 22 23:14:33 2016 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri Apr 22 23:14:33 2016 +0200
----------------------------------------------------------------------
.../java/org/apache/wicket/core/util/lang/WicketObjects.java | 5 +++++
.../java/org/apache/wicket/serialize/java/JavaSerializer.java | 6 +-----
2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/69f2d0ad/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java
index 728b036..0f4564c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/WicketObjects.java
@@ -310,6 +310,11 @@ public class WicketObjects
serializer = new JavaSerializer(WicketObjects.class.getName());
}
byte[] serialized = serializer.serialize(object);
+ if (serialized == null)
+ {
+ throw new IllegalStateException("A problem occurred while serializing an object. " +
+ "Please check the earlier logs for more details. Problematic object: " + object);
+ }
Object deserialized = serializer.deserialize(serialized);
return (T) deserialized;
}
http://git-wip-us.apache.org/repos/asf/wicket/blob/69f2d0ad/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java b/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java
index b670564..1ca239b 100644
--- a/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java
+++ b/wicket-core/src/main/java/org/apache/wicket/serialize/java/JavaSerializer.java
@@ -134,14 +134,10 @@ public class JavaSerializer implements ISerializer
}
}
}
- catch (ClassNotFoundException cnfx)
+ catch (ClassNotFoundException | IOException cnfx)
{
throw new RuntimeException("Could not deserialize object from byte[]", cnfx);
}
- catch (IOException iox)
- {
- throw new RuntimeException("Could not deserialize object from byte[]", iox);
- }
finally
{
ThreadContext.restore(old);