Revision: 4143
          http://vexi.svn.sourceforge.net/vexi/?rev=4143&view=rev
Author:   mkpg2
Date:     2011-05-18 16:24:59 +0000 (Wed, 18 May 2011)

Log Message:
-----------
Fix. Validate constructor argument. (Accepting null created an invalid 
JSDecimal object).

Modified Paths:
--------------
    trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp

Modified: trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp
===================================================================
--- trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp    
2011-05-18 16:22:23 UTC (rev 4142)
+++ trunk/org.vexi-library.js/src/main/jpp/org/ibex/js/JSDecimal.jpp    
2011-05-18 16:24:59 UTC (rev 4143)
@@ -76,7 +76,9 @@
         }
         
         public JS new_(JS[] args) throws JSExn {
-            BigDecimal arg = cast(JSU.expectArg(args,0));
+            JS argJS = JSU.expectArg(args,0); 
+            BigDecimal arg = cast(argJS);
+            if(arg==null) throw new JSExn("Invalid argument: 
"+JSU.toString(argJS));
             return new JSDecimal(arg);
         }
         
@@ -141,6 +143,7 @@
     final BigDecimal decimal;
     private JSDecimal(BigDecimal decimal) {
         this.decimal = decimal;
+        if(decimal==null) throw new NullPointerException();
     }
 
     public String coerceToString() { return decimal.toPlainString(); }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to