WICKET-6560 log class of non serializable

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

Branch: refs/heads/wicket-8.x
Commit: 48468a1b00773ac945f212adf8563063f6b4e31d
Parents: cb74db1
Author: Sven Meier <svenme...@apache.org>
Authored: Mon Jun 11 23:09:41 2018 +0200
Committer: Sven Meier <svenme...@apache.org>
Committed: Tue Jun 12 19:52:30 2018 +0200

----------------------------------------------------------------------
 .../java/org/apache/wicket/model/ChainingModel.java   |  4 ++--
 .../org/apache/wicket/model/ChainingModelTest.java    | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/48468a1b/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java 
b/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
index 4b65b76..5d5a7fa 100644
--- a/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/model/ChainingModel.java
@@ -50,8 +50,8 @@ public class ChainingModel<T> implements IChainingModel<T>
                                        + "page instance as the model object 
and 'session.attribute' as the path.");
                } else if (modelObject != null && (modelObject instanceof 
Serializable == false))
                {
-                       LOG.warn("It is not a good idea to reference a 
non-serializable instance "
-                                       + "in models directly as it may lead to 
serialization problems.");
+                       LOG.warn("It is not a good idea to reference 
non-serializable {} "
+                                       + "in a model directly as it may lead 
to serialization problems.", modelObject.getClass());
                }
 
                target = modelObject;

http://git-wip-us.apache.org/repos/asf/wicket/blob/48468a1b/wicket-core/src/test/java/org/apache/wicket/model/ChainingModelTest.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/model/ChainingModelTest.java 
b/wicket-core/src/test/java/org/apache/wicket/model/ChainingModelTest.java
index 6b64d44..3239136 100644
--- a/wicket-core/src/test/java/org/apache/wicket/model/ChainingModelTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/model/ChainingModelTest.java
@@ -16,10 +16,19 @@
  */
 package org.apache.wicket.model;
 
+import static org.hamcrest.core.StringContains.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
+import java.io.StringWriter;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.WriterAppender;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -39,6 +48,11 @@ public class ChainingModelTest
        }
        
        @Test
+       public void testNonSerializable() {
+               new ChainingModel<>(Thread.currentThread());
+       }
+       
+       @Test
        public void testDetachable() {
                class TestDetachable implements IDetachable
                {

Reply via email to