commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Haberman" <steph...@chase3000.com>
Subject [jelly] [patch] ClassCastException in JellyPropsHandler
Date Tue, 27 Aug 2002 18:21:37 GMT
Hi,

I'm testing the new ant inheritance stuff with maven and some projects
I'm looking forward to using the functionality on and I ran into a bug
in the JellyPropsHandler. Not all things in the context are strings, so
after a null check, toString() is used instead of trying to cast as I
previously had been doing.

The diff is included below.

Thanks,
Stephen

Index: src/java/org/apache/commons/jelly/tags/ant/JellyPropsHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jell
y/tags/ant/JellyPropsHandler.java,v
retrieving revision 1.1
diff -u -r1.1 JellyPropsHandler.java
--- src/java/org/apache/commons/jelly/tags/ant/JellyPropsHandler.java
27 Aug 2002 14:04:29 -0000	1.1
+++ src/java/org/apache/commons/jelly/tags/ant/JellyPropsHandler.java
27 Aug 2002 18:18:29 -0000
@@ -100,7 +100,13 @@
         if (name == null) {
             return null;
         }
-        return (String) this.context.getVariable(name);
+        Object value = this.context.getVariable(name);
+        if (value == null) {
+            return null;
+        }
+        else {
+            return value.toString();
+        }
     }
 
     /** Retrieve all ant properties.



--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message