From 904a0026e189d1a8daba4b86c020d0a7b5f70b0d Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 29 Aug 2011 14:38:38 +1000 Subject: [PATCH] 353192 Better warning for classes of wrong type --- .../main/java/org/eclipse/jetty/xml/XmlConfiguration.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java index f70138b8192..c14e8046964 100644 --- a/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java +++ b/jetty-xml/src/main/java/org/eclipse/jetty/xml/XmlConfiguration.java @@ -310,7 +310,10 @@ public class XmlConfiguration // Check the class of the object Class oClass = (Class)nodeClass(_config); if (oClass != null && !oClass.isInstance(obj)) - throw new IllegalArgumentException("Object is not of type " + oClass); + { + String loaders = (oClass.getClassLoader()==obj.getClass().getClassLoader())?"":"Object Class and type Class are from different loaders."; + throw new IllegalArgumentException("Object of class '"+obj.getClass().getCanonicalName()+"' is not of type '" + oClass.getCanonicalName()+"'. "+loaders); + } configure(obj,_config,0); return obj; }