jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1413844 - in /jmeter/trunk/src/core/org/apache/jmeter/testbeans: BeanInfoSupport.java gui/GenericTestBeanCustomizer.java
Date Mon, 26 Nov 2012 21:10:15 GMT
Author: pmouawad
Date: Mon Nov 26 21:10:14 2012
New Revision: 1413844

URL: http://svn.apache.org/viewvc?rev=1413844&view=rev
Log:
Simplify now we are using Java 6

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java
    jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java?rev=1413844&r1=1413843&r2=1413844&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java Mon Nov 26 21:10:14
2012
@@ -115,10 +115,10 @@ public abstract class BeanInfoSupport ex
             // Store the resource bundle as an attribute of the BeanDescriptor:
             getBeanDescriptor().setValue(RESOURCE_BUNDLE, resourceBundle);
             // Localize the bean name
-            try {
+            if (resourceBundle.containsKey("displayName")) { // $NON-NLS-1$
                 getBeanDescriptor().setDisplayName(resourceBundle.getString("displayName"));
// $NON-NLS-1$
-            } catch (MissingResourceException e) {
-                log.debug("Localized display name not available for bean " + beanClass);
+            } else {
+                log.debug("Localized display name not available for bean " + beanClass);
                   
             }
             // Localize the property names and descriptions:
             PropertyDescriptor[] properties = getPropertyDescriptors();

Modified: jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java?rev=1413844&r1=1413843&r2=1413844&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java Mon
Nov 26 21:10:14 2012
@@ -29,7 +29,6 @@ import java.text.MessageFormat;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Map;
-import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
 import javax.swing.BorderFactory;
@@ -436,6 +435,7 @@ public class GenericTestBeanCustomizer e
      * @param map must be an instance of Map<String, Object>
      */
     @SuppressWarnings("unchecked")
+    @Override
     public void setObject(Object map) {
         propertyMap = (Map<String, Object>) map;
 
@@ -618,13 +618,14 @@ public class GenericTestBeanCustomizer e
      * Obtain a group's display name
      */
     private String groupDisplayName(String group) {
-        try {
-            ResourceBundle b = (ResourceBundle) beanInfo.getBeanDescriptor().getValue(RESOURCE_BUNDLE);
-            if (b == null) {
-                return group;
-            }
-            return b.getString(group + ".displayName");
-        } catch (MissingResourceException e) {
+        ResourceBundle b = (ResourceBundle) beanInfo.getBeanDescriptor().getValue(RESOURCE_BUNDLE);
+        if (b == null) {
+            return group;
+        }
+        String key = new StringBuilder(group).append(".displayName").toString();
+        if (b.containsKey(key)) {
+            return b.getString(key);
+        } else {
             return group;
         }
     }
@@ -640,6 +641,7 @@ public class GenericTestBeanCustomizer e
             this.beanInfo = beanInfo;
         }
 
+        @Override
         public int compare(PropertyDescriptor d1, PropertyDescriptor d2) {
             int result;
 



Mime
View raw message