Author: sebb
Date: Fri Aug 10 03:58:21 2007
New Revision: 564544

URL: http://svn.apache.org/viewvc?view=rev&rev=564544
Log:
Fix NPE caused by incorrect change of clear() to clearData()
Clarified code by using testStarted() rather than clear() to initialise 
accumulator.

Modified:
    
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/reporters/Summariser.java

Modified: 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/reporters/Summariser.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/reporters/Summariser.java?view=diff&rev=564544&r1=564543&r2=564544
==============================================================================
--- 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/reporters/Summariser.java
 (original)
+++ 
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/reporters/Summariser.java
 Fri Aug 10 03:58:21 2007
@@ -96,33 +96,10 @@
                setName(name);
        }
 
-       /*
-        * This is called once for each occurrence in the test plan, before the
-        * start of the test. The super.clear() method clears the name (and all
-        * other properties), so it is called last.
-        */
-       public void clearData() {
-               // System.out.println("-- "+me+this.getName()+"
-               // "+Thread.currentThread().getName());
-
-               myName = this.getName();
-
-               // Hashtable is synchronised, but there could be more than one 
Summariser
-               // with the same name, so we need to synch.
-               synchronized (accumulators) {
-                       Totals tots = (Totals) accumulators.get(myName);
-                       if (tots != null) {// This can be null (before first 
sample)
-                               tots.clear();
-                       } else {
-                               // System.out.println("Creating totals for 
"+myName);
-                               tots = new Totals();
-                               accumulators.put(myName, tots);
-                       }
-               }
-
-               super.clear();
+       public void clearData(){
+               // not used
        }
-
+       
        /*
         * Contains the items needed to collect stats for a summariser
         * 
@@ -312,7 +289,7 @@
         * @see org.apache.jmeter.testelement.TestListener#testStarted()
         */
        public void testStarted() {
-               // not used
+               testStarted("local");
        }
 
        /*
@@ -331,7 +308,20 @@
         * @see 
org.apache.jmeter.testelement.TestListener#testStarted(java.lang.String)
         */
        public void testStarted(String host) {
-               // not used
+               myName = this.getName();
+
+               // Hashtable is synchronised, but there could be more than one 
Summariser
+               // with the same name, so we need to synchronise.
+               synchronized (accumulators) {
+                       Totals tots = (Totals) accumulators.get(myName);
+                       if (tots != null) {// This can be null (before first 
sample)
+                               tots.clear();
+                       } else {
+                               // System.out.println("Creating totals for 
"+myName);
+                               tots = new Totals();
+                               accumulators.put(myName, tots);
+                       }
+               }
        }
 
        /*



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

Reply via email to