ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn Kruithof ...@kruithof.xs4all.nl>
Subject Re: svn commit: r739577 - /ant/core/trunk/src/main/org/apache/tools/ant/property/NullReturn.java
Date Sat, 31 Jan 2009 21:14:28 GMT
Doubted it, checked it and it returned NullPointerException.

D:\>type Test.java
public class Test
{
public static void main(String[] args)
{
System.out.println(String.valueOf(null));
}
}

D:\>java Test
Exception in thread "main" java.lang.NullPointerException
        at java.lang.String.<init>(Unknown Source)
        at java.lang.String.valueOf(Unknown Source)
        at Test.main(Test.java:6)

br Martijn

Matt Benson schreef:
> I always thought String.valueOf(null) returned "null".
>  Was I on crack?
>
> -Matt
>
> P.S.  Good to see you committing, Martijn...
>
> --- jkf@apache.org wrote:
>
>   
>> Author: jkf
>> Date: Sat Jan 31 17:10:50 2009
>> New Revision: 739577
>>
>> URL:
>> http://svn.apache.org/viewvc?rev=739577&view=rev
>> Log:
>> Original toString would always throw a NPE.
>>
>> Modified:
>>    
>>
>>     
> ant/core/trunk/src/main/org/apache/tools/ant/property/NullReturn.java
>   
>> Modified:
>>
>>     
> ant/core/trunk/src/main/org/apache/tools/ant/property/NullReturn.java
>   
>> URL:
>>
>>     
> http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/property/NullReturn.java?rev=739577&r1=739576&r2=739577&view=diff
>   
> ==============================================================================
>   
>> ---
>>
>>     
> ant/core/trunk/src/main/org/apache/tools/ant/property/NullReturn.java
>   
>> (original)
>> +++
>>
>>     
> ant/core/trunk/src/main/org/apache/tools/ant/property/NullReturn.java
>   
>> Sat Jan 31 17:10:50 2009
>> @@ -33,6 +33,6 @@
>>       * {@inheritDoc}
>>       */
>>      public String toString() {
>> -        return String.valueOf(null);
>> +        return "null";
>>      }
>>  }
>>
>>
>>
>>     
>
>
>
>       
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message