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 2017/03/13 22:13:38 UTC
[4/4] wicket git commit: WICKET-6334 Use a fresh instance of
JavaSerializer without custom IObjectCheckers (only SerializationChecker) to
clone or calculate the size of an object
WICKET-6334 Use a fresh instance of JavaSerializer without custom IObjectCheckers (only SerializationChecker) to clone or calculate the size of an object
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/56b19109
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/56b19109
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/56b19109
Branch: refs/heads/master
Commit: 56b19109fae08a64090f9cf3e5980a4dd82af67b
Parents: 0b29a9a
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Mon Mar 13 23:06:48 2017 +0100
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Mon Mar 13 23:13:21 2017 +0100
----------------------------------------------------------------------
.../apache/wicket/core/util/lang/WicketObjects.java | 16 +++++++++++-----
.../WicketComponentTreeTestPage_ExpectedResult.html | 4 ++--
2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/56b19109/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 0f4564c..88f8167 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
@@ -120,15 +120,18 @@ public class WicketObjects
return 0;
}
- ISerializer serializer;
+ ISerializer serializer = null;
if (Application.exists())
{
serializer = Application.get().getFrameworkSettings().getSerializer();
}
- else
+
+ if (serializer == null || serializer instanceof JavaSerializer)
{
+ // WICKET-6334 create a new instance of JavaSerializer that doesn't use custom IObjectCheckers
serializer = new JavaSerializer(SerializingObjectSizeOfStrategy.class.getName());
}
+
byte[] serialized = serializer.serialize(object);
int size = -1;
if (serialized != null)
@@ -300,15 +303,18 @@ public class WicketObjects
}
else
{
- ISerializer serializer;
+ ISerializer serializer = null;
if (Application.exists())
{
serializer = Application.get().getFrameworkSettings().getSerializer();
}
- else
+
+ if (serializer == null || serializer instanceof JavaSerializer)
{
- serializer = new JavaSerializer(WicketObjects.class.getName());
+ // WICKET-6334 create a new instance of JavaSerializer that doesn't use custom IObjectCheckers
+ serializer = new JavaSerializer(SerializingObjectSizeOfStrategy.class.getName());
}
+
byte[] serialized = serializer.serialize(object);
if (serialized == null)
{
http://git-wip-us.apache.org/repos/asf/wicket/blob/56b19109/wicket-core/src/test/java/org/apache/wicket/markup/html/debug/WicketComponentTreeTestPage_ExpectedResult.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/debug/WicketComponentTreeTestPage_ExpectedResult.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/debug/WicketComponentTreeTestPage_ExpectedResult.html
index 5e0e9b7..62a6dc4 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/debug/WicketComponentTreeTestPage_ExpectedResult.html
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/debug/WicketComponentTreeTestPage_ExpectedResult.html
@@ -35,14 +35,14 @@
<td valign="top" align="left"><span wicket:id="row">1</span>   </td>
<td valign="top" align="left"><span wicket:id="path">label1</span>   </td>
<td valign="top" align="center"><span wicket:id="renderDuration">n/a</span>   </td>
- <td valign="top" align="left" nowrap="nowrap"><span wicket:id="size">459 bytes</span>   </td>
+ <td valign="top" align="left" nowrap="nowrap"><span wicket:id="size">477 bytes</span>   </td>
<td valign="top" align="left"><span wicket:id="type">org.apache.wicket.markup.html.basic.Label</span>   </td>
<td valign="top" align="left"><span wicket:id="model">test1</span>   </td>
</tr><tr wicket:id="components">
<td valign="top" align="left"><span wicket:id="row">2</span>   </td>
<td valign="top" align="left"><span wicket:id="path">label2</span>   </td>
<td valign="top" align="center"><span wicket:id="renderDuration">n/a</span>   </td>
- <td valign="top" align="left" nowrap="nowrap"><span wicket:id="size">460 bytes</span>   </td>
+ <td valign="top" align="left" nowrap="nowrap"><span wicket:id="size">478 bytes</span>   </td>
<td valign="top" align="left"><span wicket:id="type">org.apache.wicket.markup.html.basic.Label</span>   </td>
<td valign="top" align="left"><span wicket:id="model">test22</span>   </td>
</tr>