khammond    01/09/24 23:00:44

  Modified:    src/org/apache/jmeter/util JMeterUtils.java
  Log:
  When retrieving a resource string and the key cannot be found, catch the 
MissingResourceException and return an empty String.  Also, report the error to the 
console.
  
  Revision  Changes    Path
  1.13      +19 -2     jakarta-jmeter/src/org/apache/jmeter/util/JMeterUtils.java
  
  Index: JMeterUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jmeter/src/org/apache/jmeter/util/JMeterUtils.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JMeterUtils.java  2001/09/24 12:02:27     1.12
  +++ JMeterUtils.java  2001/09/25 06:00:44     1.13
  @@ -80,7 +80,7 @@
    *
    *@author     <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
    *@created    June 28, 2001
  - *@version    $Revision: 1.12 $ $Date: 2001/09/24 12:02:27 $
  + *@version    $Revision: 1.13 $ $Date: 2001/09/25 06:00:44 $
    */
   
   public class JMeterUtils
  @@ -123,9 +123,26 @@
                return p;
        }
   
  +     /**
  +      *  Gets the resource string for this key.
  +      *  @param key the key in the resource file
  +      *  @return the resource string if the key is found; otherwise, return an 
empty string
  +      */
        public static String getResString(String key)
        {
  -             return RESOURCES.getString(key);
  +             String resString = null;
  +
  +             try
  +             {
  +                     resString = RESOURCES.getString(key);
  +             }
  +             catch (MissingResourceException mre)
  +             {
  +                     System.out.println("ERROR! Resource string not found: [" + key 
+ "]");
  +                     resString = "";
  +             }
  +
  +             return resString;
        }
   
        /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to