This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Integer.getInteger patch for null argument


Hi,

The following fixes one more Mauve failure.
(Just 13 unexpected failures to go! *)

2002-04-14  Mark Wielaard <mark@klomp.org>

  * java/lang/Integer.java (getInteger(String,Integer): Return def when
  nm is null or the empty String.

This is already fixed in Classpath so we will get it in 3.2 when we
merge the primitive wrapper classes after the 3.1 release.

OK for the branch?

Cheers,

Mark

*) That is on i686-pc-linux-gnu and only because we compile from
byte-code, not directly from source->native. When using Mauve as one big
source->native linked binary there are just 4 unexpected failures (with
2 new Float failures which don't appear when compiling from byte-code).
But on powerpc-unknown-linux-gnu there are a lot more failures mostly
Long, Double, Math and Integer tests.
Index: java/lang/Integer.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/Integer.java,v
retrieving revision 1.13.2.1
diff -u -r1.13.2.1 Integer.java
--- java/lang/Integer.java	1 Apr 2002 19:11:16 -0000	1.13.2.1
+++ java/lang/Integer.java	15 Apr 2002 19:54:48 -0000
@@ -183,11 +183,13 @@
    */
   public static Integer getInteger(String nm, Integer def)
   {
-    String val = System.getProperty(nm);
-    if (val == null) return def;
+    if (nm == null || "".equals(nm))
+      return def;
+    nm = System.getProperty(nm);
+    if (nm == null) return def;
     try
       {
-      return decode(val);
+	return decode(nm);
       }
     catch (NumberFormatException e)
       {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]