commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r377901 - /jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
Date Wed, 15 Feb 2006 00:04:55 GMT
Author: dion
Date: Tue Feb 14 16:04:54 2006
New Revision: 377901

URL: http://svn.apache.org/viewcvs?rev=377901&view=rev
Log:
Fix narrowing of Doubles and Floats which was NPE'ing.

Modified:
    jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java

Modified: jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java?rev=377901&r1=377900&r2=377901&view=diff
==============================================================================
--- jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
(original)
+++ jakarta/commons/proper/jexl/trunk/src/java/org/apache/commons/jexl/parser/ASTMethod.java
Tue Feb 14 16:04:54 2006
@@ -98,19 +98,15 @@
     private Number narrow(Number original)
     {
     	if (original == null) return null;
-    	Number result = null;
+    	Number result = original;
     	if (original instanceof Double || original instanceof Float)
     	{
-    		double value = result.doubleValue();
+    		double value = original.doubleValue();
     		if (value <= Float.MAX_VALUE && value >= Float.MIN_VALUE)
     		{
     			result = new Float(result.floatValue());
     		}
-    		else
-    		{
-    			// it was a double
-    			result = original;
-    		}
+   			// else it was already a double
     	}
     	else
     	{
@@ -128,10 +124,7 @@
 	        {
 	        	result = new Integer((int)value);
 	        }
-	        else
-	        {
-	        	result = original;
-	        }
+   			// else it was already a long
     	}
         return result;
     }



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


Mime
View raw message