jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1624851 - /jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
Date Sun, 14 Sep 2014 14:08:20 GMT
Author: pmouawad
Date: Sun Sep 14 14:08:19 2014
New Revision: 1624851

URL: http://svn.apache.org/r1624851
Log:
Bug 56975 - Error when opening JTL(XML) file (that saves sub samplers results) due to TreeMarshaller$CircularReferenceException:
Recursive reference to parent object
Adding more infos when error occurs (UbikLoadPack patch)
Bugzilla Id: 56975

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java

Modified: jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java?rev=1624851&r1=1624850&r2=1624851&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/save/SaveService.java Sun Sep 14 14:08:19 2014
@@ -33,8 +33,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.jmeter.reporters.ResultCollectorHelper;
 import org.apache.jmeter.samplers.SampleEvent;
+import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.testelement.TestElement;
 import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jmeter.util.NameUpdater;
@@ -356,11 +358,28 @@ public class SaveService {
         dh.put(SAMPLE_EVENT_OBJECT, evt);
         // This is effectively the same as saver.toXML(Object, Writer) except we get to provide
the DataHolder
         // Don't know why there is no method for this in the XStream class
-        JTLSAVER.marshal(evt.getResult(), new XppDriver().createWriter(writer), dh);
+        try {
+            JTLSAVER.marshal(evt.getResult(), new XppDriver().createWriter(writer), dh);
+        } catch(RuntimeException e) {
+            throw new IllegalArgumentException("Failed marshalling:"+(evt.getResult() !=
null ? showDebuggingInfo(evt.getResult()) : "null"), e);
+        }
         writer.write('\n');
     }
 
     /**
+     * 
+     * @param result SampleResult
+     * @return String debugging information
+     */
+    private static String showDebuggingInfo(SampleResult result) {
+        try {
+            return "class:"+result.getClass()+",content:"+ToStringBuilder.reflectionToString(result);
+        } catch(Exception e) {
+            return "Exception occured creating debug from event, message:"+e.getMessage();
+        }
+    }
+
+    /**
      * @param elem test element
      * @param writer output stream which must be created using {@link #getFileEncoding(String)}
      */



Mime
View raw message