classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Exception message clarification


From: Guilhem Lavaux
Subject: [cp-patches] Exception message clarification
Date: Thu, 20 Oct 2005 21:30:21 +0200
User-agent: Mozilla Thunderbird 1.0.2 (X11/20050322)

Hi,

Here are some patches that were useful while debugging applications with kaffe (or debugging kaffe either). I think that we are never too verbose for some exceptions so this patch adds some verbosity to them.

ChangeLog entry:

2005-10-20  Guilhem Lavaux  <address@hidden>

        * java/lang/Thread.java
        (sleep): Better exception message.

        * java/security/AccessControlContext.java
        (checkPermission): Likewise.

        * java/util/ResourceBundle.java
        (getBundle): Likewise.

        * java/util/SimpleTimeZone.java
        (setStartRule): Added some documentation.

Index: java/lang/Thread.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Thread.java,v
retrieving revision 1.15
diff -u -r1.15 Thread.java
--- java/lang/Thread.java       13 Sep 2005 22:19:15 -0000      1.15
+++ java/lang/Thread.java       20 Oct 2005 19:24:35 -0000
@@ -813,8 +813,11 @@
   {
 
     // Check parameters
-    if (ms < 0 || ns < 0 || ns > 999999)
-      throw new IllegalArgumentException();
+    if (ms < 0 )
+      throw new IllegalArgumentException("Negative milliseconds: " + ms);
+
+    if (ns < 0 || ns > 999999)
+      throw new IllegalArgumentException("Nanoseconds ouf of range: " + ns);
 
     // Really sleep
     VMThread.sleep(ms, ns);
Index: java/security/AccessControlContext.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/AccessControlContext.java,v
retrieving revision 1.12
diff -u -r1.12 AccessControlContext.java
--- java/security/AccessControlContext.java     26 Sep 2005 01:06:46 -0000      
1.12
+++ java/security/AccessControlContext.java     20 Oct 2005 19:24:35 -0000
@@ -128,10 +128,20 @@
   public void checkPermission(Permission perm) throws AccessControlException
   {
     if (protectionDomains.length == 0)
-      throw new AccessControlException ("permission not granted");
+      throw new AccessControlException ("permission " 
+                                       + perm 
+                                       + " not granted: no protection 
domains");
+
     for (int i = 0; i < protectionDomains.length; i++)
-      if (!protectionDomains[i].implies(perm))
-        throw new AccessControlException ("permission not granted");
+      {
+       final ProtectionDomain domain = protectionDomains[i];
+       if (!domain.implies(perm))
+         throw new AccessControlException ("permission " 
+                                           + perm 
+                                           + " not granted: " 
+                                           + domain 
+                                           + " does not imply it.");
+      }
   }
 
   /**
Index: java/util/ResourceBundle.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/ResourceBundle.java,v
retrieving revision 1.35
diff -u -r1.35 ResourceBundle.java
--- java/util/ResourceBundle.java       13 Sep 2005 22:19:15 -0000      1.35
+++ java/util/ResourceBundle.java       20 Oct 2005 19:24:35 -0000
@@ -419,7 +419,11 @@
          }
       }
 
-    throw new MissingResourceException("Bundle " + baseName + " not found",
+    throw new MissingResourceException("Bundle " + baseName 
+                                      + " not found for locale "
+                                      + locale
+                                      + " by classloader "
+                                      + classLoader,
                                       baseName, "");
   }
 
Index: java/util/SimpleTimeZone.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/SimpleTimeZone.java,v
retrieving revision 1.28
diff -u -r1.28 SimpleTimeZone.java
--- java/util/SimpleTimeZone.java       13 Sep 2005 22:19:15 -0000      1.28
+++ java/util/SimpleTimeZone.java       20 Oct 2005 19:24:35 -0000
@@ -468,6 +468,7 @@
    * @param dayOfWeek The day of week where daylight savings start.
    * @param time The time in milliseconds standard time where daylight
    * savings start.
+   * @exception IllegalArgumentException if parameters are out of range.
    * @see SimpleTimeZone
    */
   public void setStartRule(int month, int day, int dayOfWeek, int time)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]