Author: fschumacher
Date: Thu Sep  6 17:07:59 2018
New Revision: 1840238

URL: http://svn.apache.org/viewvc?rev=1840238&view=rev
Log:
Use the wrapped exception for error message on file load for StreamException

When a user opens a test plan that is no xml at all, a StreamException
gets thrown. This exception can have an empty message. That will lead
to an error dialog that has no text at all. In that case we try to work
around this by using the wrapped exception as the source for the error
message.

Bugzilla Id: 62683

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/gui/action/Load.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Load.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Load.java?rev=1840238&r1=1840237&r2=1840238&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Load.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Load.java Thu Sep  6 
17:07:59 2018
@@ -44,6 +44,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.thoughtworks.xstream.converters.ConversionException;
+import com.thoughtworks.xstream.io.StreamException;
 
 /**
  * Handles the Open (load a new file) and Merge commands.
@@ -144,6 +145,12 @@ public class Load extends AbstractAction
                 JMeterUtils.reportErrorToUser(SaveService.CEtoString(ex));
             } catch (IOException ex) {
                 reportError("Error reading file. {}", ex, false);
+            } catch (StreamException ex) {
+                Throwable exceptionToDisplay = ex;
+                if ("".equals(ex.getMessage()) && ex.getCause() != null) {
+                    exceptionToDisplay = ex.getCause();
+                }
+                reportError("Error in XML format. {}", exceptionToDisplay, 
false);
             } catch (Exception ex) {
                 reportError("Unexpected error. {}", ex, true);
             }

Modified: jmeter/trunk/xdocs/changes.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1840238&r1=1840237&r2=1840238&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Thu Sep  6 17:07:59 2018
@@ -277,6 +277,7 @@ this behaviour, set <code>httpclient.res
   <li><bug>62463</bug>Fix usage of ports, when 
<code>client.rmi.localport</code> is set for distributed runs.</li>
   <li><bug>62545</bug>Don't use a colon as part of the "tab" string when 
indenting JSON in RenderAsJSON.</li>
   <li>Part of <bug>62637</bug> Avoid Integer overrun when dealing with very 
large values in <code>TimerService#adjustDelay</code></li>
+  <li><bug>62683</bug>Error dialog has no text when user opens completely 
invalid test plan.</li>
 </ul>
 
  <!--  =================== Thanks =================== -->


Reply via email to