You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by sebb <se...@gmail.com> on 2014/03/24 14:36:44 UTC

Re: svn commit: r1580502 - /jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java

On 23 March 2014 14:10,  <pm...@apache.org> wrote:
> Author: pmouawad
> Date: Sun Mar 23 14:10:47 2014
> New Revision: 1580502
>
> URL: http://svn.apache.org/r1580502
> Log:
> Bug 55623 - Invalid/unexpected configuration values should not be silently ignored
> Bugzilla Id: 55623
>
> 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=1580502&r1=1580501&r2=1580502&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/util/JMeterUtils.java Sun Mar 23 14:10:47 2014
> @@ -775,6 +775,7 @@ public class JMeterUtils implements Unit
>              ans = (Integer.valueOf(appProperties.getProperty(propName, Integer.toString(defaultVal)).trim()))
>                      .intValue();
>          } catch (Exception e) {
> +            log.warn("Unexpected value set for int property:'"+propName+"', defaulting to:"+defaultVal);
>              ans = defaultVal;
>          }
>          return ans;
> @@ -801,6 +802,7 @@ public class JMeterUtils implements Unit
>                  ans = ((Integer.valueOf(strVal)).intValue() == 1);
>              }
>          } catch (Exception e) {
> +            log.warn("Unexpected value set for boolean property:'"+propName+"', defaulting to:"+defaultVal);
>              ans = defaultVal;
>          }
>          return ans;
> @@ -820,6 +822,7 @@ public class JMeterUtils implements Unit
>          try {
>              ans = (Long.valueOf(appProperties.getProperty(propName, Long.toString(defaultVal)).trim())).longValue();
>          } catch (Exception e) {
> +            log.warn("Unexpected value set for long property:'"+propName+"', defaulting to:"+defaultVal);
>              ans = defaultVal;
>          }
>          return ans;
> @@ -836,12 +839,14 @@ public class JMeterUtils implements Unit
>       */
>      public static String getPropDefault(String propName, String defaultVal) {
>          String ans = defaultVal;
> -        try {
> +        try
> +        {

Spurious change; JMeter normally starts blocks on the same line as the keyword.
Not a big problem, but something to avoid if poss.

>              String value = appProperties.getProperty(propName, defaultVal);
>              if(value != null) {
>                  ans = value.trim();
>              }
>          } catch (Exception e) {
> +            // TODO Can this happen ?

We'll never know unless it is logged ...

>              ans = defaultVal;
>          }
>          return ans;
> @@ -859,6 +864,7 @@ public class JMeterUtils implements Unit
>          try {
>              ans = appProperties.getProperty(propName);
>          } catch (Exception e) {
> +            // TODO Can this happen ?

Needs to be logged as well ...

>              ans = null;
>          }
>          return ans;
> @@ -1045,7 +1051,7 @@ public class JMeterUtils implements Unit
>                      titleMsg,
>                      JOptionPane.ERROR_MESSAGE);
>          } catch (HeadlessException e) {
> -                log.warn("reportErrorToUser(\"" + errorMsg + "\") caused", e);
> +            log.warn("reportErrorToUser(\"" + errorMsg + "\") caused", e);
>          }
>      }
>
>
>