jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1294527 - /jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
Date Tue, 28 Feb 2012 08:53:23 GMT
Author: pmouawad
Date: Tue Feb 28 08:53:22 2012
New Revision: 1294527

URL: http://svn.apache.org/viewvc?rev=1294527&view=rev
Log:
Avoid NPE when defaultVal is also null (13 times at JMeter startup)

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java?rev=1294527&r1=1294526&r2=1294527&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Tue Feb 28 08:53:22 2012
@@ -832,9 +832,12 @@ public class JMeterUtils implements Unit
      * @return The PropDefault value
      */
     public static String getPropDefault(String propName, String defaultVal) {
-        String ans;
+        String ans = defaultVal;
         try {
-            ans = appProperties.getProperty(propName, defaultVal).trim();
+            String value = appProperties.getProperty(propName, defaultVal);
+            if(value != null) {
+                ans = value.trim();
+            }
         } catch (Exception e) {
             ans = defaultVal;
         }



Mime
View raw message