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 2020/06/01 15:30:38 UTC

[wicket] branch master updated: WICKET-6796 Report the component path when failing to set a new object to a read only model

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new c67feb1  WICKET-6796 Report the component path when failing to set a new object to a read only model
c67feb1 is described below

commit c67feb10c074a107019cea1f4f481daea2e51e63
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Mon Jun 1 18:29:57 2020 +0300

    WICKET-6796 Report the component path when failing to set a new object to a read only model
---
 wicket-core/src/main/java/org/apache/wicket/Component.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java
index ef9dc41..d72f24e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -3014,7 +3014,14 @@ public abstract class Component
 		if (!getModelComparator().compare(this, object))
 		{
 			modelChanging();
-			model.setObject(object);
+			try
+			{
+				model.setObject(object);
+			}
+			catch (UnsupportedOperationException uox)
+			{
+				throw new WicketRuntimeException("You need to use writeable IModel for component " + getPageRelativePath(), uox);
+			}
 			modelChanged();
 		}