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] NPE in AntTag
Date Sun, 01 Sep 2002 20:35:50 GMT
Running maven's site:deploy the other day resulted in setAttribute being
called with a value of null, hence the toString() would cause a NPE. I'm
guessing a little bit here, but I would think Ant would convert all
nulls and what not to just blank strings, so I added a check for that
and the site:deploy is working fine.

- Stephen

Index: src/java/org/apache/commons/jelly/tags/ant/AntTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/jelly/src/java/org/apache/commons/jell
y/tags/ant/AntTag.java,v
retrieving revision 1.9
diff -u -r1.9 AntTag.java
--- src/java/org/apache/commons/jelly/tags/ant/AntTag.java	28 Aug
2002 15:29:53 -0000	1.9
+++ src/java/org/apache/commons/jelly/tags/ant/AntTag.java	1 Sep
2002 20:31:45 -0000
@@ -313,11 +313,12 @@
     }
 
     public void setAttribute(String name,
-                             Object value) 
-    {
-        super.setAttribute( name,
-                            value.toString() );
-                            
+                             Object value) {
+        if (value == null) {
+            value = "";
+        }
+
+        super.setAttribute( name, value.toString() );
     }
 
     public void setBeanProperty(Object object, String name, Object
value) throws Exception {


--
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