You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2014/02/28 23:53:29 UTC

svn commit: r1573105 - in /jmeter/trunk: src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java xdocs/changes.xml

Author: pmouawad
Date: Fri Feb 28 22:53:29 2014
New Revision: 1573105

URL: http://svn.apache.org/r1573105
Log:
Bug 56198 - JMSSampler : NullPointerException is thrown when log level is DEBUG and JNDI underlying implementation of JMS provider does not comply with Context.getEnvironment contract
Bugzilla Id: 56198

Modified:
    jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java?rev=1573105&r1=1573104&r2=1573105&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java (original)
+++ jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/JMSSampler.java Fri Feb 28 22:53:29 2014
@@ -429,13 +429,19 @@ public class JMSSampler extends Abstract
     }
 
     private void printEnvironment(Context context) throws NamingException {
-        Hashtable<?,?> env = context.getEnvironment();
-        LOGGER.debug("Initial Context Properties");
-        @SuppressWarnings("unchecked")
-        Enumeration<String> keys = (Enumeration<String>) env.keys();
-        while (keys.hasMoreElements()) {
-            String key = keys.nextElement();
-            LOGGER.debug(key + "=" + env.get(key));
+        try {
+            Hashtable<?,?> env = context.getEnvironment();
+            if(env != null) {
+                LOGGER.debug("Initial Context Properties");
+                for (Map.Entry<?, ?> entry : env.entrySet()) {
+                    LOGGER.debug(entry.getKey() + "=" + entry.getValue());
+                }
+            } else {
+                LOGGER.warn("context.getEnvironment() returned null (should not happen according to javadoc but non compliant implementation can return this)");
+            }
+        } catch (javax.naming.OperationNotSupportedException ex) {
+            // Some JNDI implementation can return this
+            LOGGER.warn("context.getEnvironment() not supported by implementation ");
         }
     }
 

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1573105&r1=1573104&r2=1573105&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Feb 28 22:53:29 2014
@@ -130,6 +130,7 @@ A workaround is to use a Java 7 update 4
 <ul>
 <li><bugzilla>55977</bugzilla> - JDBC pook keepalive flooding</li>
 <li><bugzilla>55999</bugzilla> - Scroll bar on jms point-to-point sampler does not work when content exceeds display</li>
+<li><bugzilla>56198</bugzilla> - JMSSampler : NullPointerException is thrown when log level is DEBUG and JNDI underlying implementation of JMS provider does not comply with Context.getEnvironment contract</li>
 </ul>
 
 <h3>Controllers</h3>