classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] FYI: Make detailed message of MissingResourceException more


From: Mark Wielaard
Subject: [cp-patches] FYI: Make detailed message of MissingResourceException more explicit
Date: Tue, 08 Feb 2005 12:05:42 +0100

Hi,

Although MissingResourceExceptions already have methods for getting the
key and bundle class name these are often not used when reporting errors
in programs. This patch adds them also explicitly to the detailed
message of the exception (as was already done in most other places that
throw a MissingResourceBundle).

2005-02-07  Mark Wielaard  <address@hidden>

       * java/util/ResourceBundle.java (getObject): Clarify
       MissingResourceException detailed message.
       (tryBundle(String,ClassLoader)): Likewise.

This helps debugging applications a lot.

Committed,

Mark
Index: java/util/ResourceBundle.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/ResourceBundle.java,v
retrieving revision 1.31
diff -u -r1.31 ResourceBundle.java
--- java/util/ResourceBundle.java       11 Jan 2005 09:44:32 -0000      1.31
+++ java/util/ResourceBundle.java       8 Feb 2005 10:58:59 -0000
@@ -173,9 +173,11 @@
         if (o != null)
           return o;
       }
- 
-    throw new MissingResourceException("Key not found", getClass().getName(),
-                                      key);
+
+    String className = getClass().getName();
+    throw new MissingResourceException("Key '" + key
+                                      + "'not found in Bundle: "
+                                      + className, className, key);
   }
 
   /**
@@ -491,7 +493,7 @@
        catch (IOException ex)
          {
            MissingResourceException mre = new MissingResourceException
-             ("Failed to load bundle", localizedName, "");
+             ("Failed to load bundle: " + localizedName, localizedName, "");
            mre.initCause(ex);
            throw mre;
          }

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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