You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Stephen Haberman <st...@chase3000.com> on 2002/09/11 04:47:47 UTC

[jelly] [patch] NullPointerException

I've been using Jelly HEAD with Maven HEAD and occasionally get a
NullPointerException when Maven tries to set a null attribute on some
Ant tag. I've attached what I think is a viable solution below.

If this isn't correct (I posted it before, but perhaps it just got lot
in the high volume), another solution would be great.

Thanks,
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	11 Sep
2002 02:45:16 -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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [jelly] [patch] NullPointerException

Posted by James Strachan <ja...@yahoo.co.uk>.
Patch applied, thanks again Stephen.

James
-------
http://radio.weblogs.com/0112098/
----- Original Message -----
From: "Stephen Haberman" <st...@chase3000.com>
To: <co...@jakarta.apache.org>
Sent: Wednesday, September 11, 2002 3:47 AM
Subject: [jelly] [patch] NullPointerException


> I've been using Jelly HEAD with Maven HEAD and occasionally get a
> NullPointerException when Maven tries to set a null attribute on some
> Ant tag. I've attached what I think is a viable solution below.
>
> If this isn't correct (I posted it before, but perhaps it just got lot
> in the high volume), another solution would be great.
>
> Thanks,
> 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 11 Sep
> 2002 02:45:16 -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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>