jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1747805 - in /jmeter/trunk: src/components/org/apache/jmeter/control/IncludeController.java xdocs/changes.xml
Date Fri, 10 Jun 2016 21:43:59 GMT
Author: pmouawad
Date: Fri Jun 10 21:43:59 2016
New Revision: 1747805

URL: http://svn.apache.org/viewvc?rev=1747805&view=rev
Log:
Bug 59351 - Improve log/error/message for IncludeController
#resolve #202
Bugzilla Id: 59351

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java?rev=1747805&r1=1747804&r2=1747805&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/control/IncludeController.java Fri Jun 10
21:43:59 2016
@@ -121,8 +121,8 @@ public class IncludeController extends G
         final String includePath = getIncludePath();
         HashTree tree = null;
         if (includePath != null && includePath.length() > 0) {
+            String fileName=prefix+includePath;
             try {
-                String fileName=prefix+includePath;
                 File file = new File(fileName);
                 final String absolutePath = file.getAbsolutePath();
                 log.info("loadIncludedElements -- try to load included module: "+absolutePath);
@@ -130,8 +130,10 @@ public class IncludeController extends G
                     log.info("loadIncludedElements -failed for: "+absolutePath);
                     file = new File(FileServer.getFileServer().getBaseDir(), includePath);
                     log.info("loadIncludedElements -Attempting to read it from: " + file.getAbsolutePath());
-                    if(!file.exists()){
-                        log.error("loadIncludedElements -failed for: " + file.getAbsolutePath());
+                    if(!file.canRead() || !file.isFile()){
+                        log.error("Include Controller \""
+                                + this.getName()+"\" can't load \"" 
+                                + fileName+"\" - see log for details");
                         throw new IOException("loadIncludedElements -failed for: " + absolutePath
+
                                 " and " + file.getAbsolutePath());
                     }
@@ -144,23 +146,22 @@ public class IncludeController extends G
                 return tree;
             } catch (NoClassDefFoundError ex) // Allow for missing optional jars
             {
-                String msg = ex.getMessage();
-                if (msg == null) {
-                    msg = "Missing jar file - see log for details";
-                }
-                log.warn("Missing jar file", ex);
-                JMeterUtils.reportErrorToUser(msg);
+                String msg = "Including file \""+ fileName 
+                            + "\" failed for Include Controller \""+ this.getName()
+                            +"\", missing jar file";
+                log.warn(msg, ex);
+                JMeterUtils.reportErrorToUser(msg+" - see log for details");
             } catch (FileNotFoundException ex) {
-                String msg = ex.getMessage();
-                JMeterUtils.reportErrorToUser(msg);
-                log.warn(msg);
+                String msg = "File \""+ fileName 
+                        + "\" not found for Include Controller \""+ this.getName()+"\"";
+                JMeterUtils.reportErrorToUser(msg+" - see log for details");
+                log.warn(msg, ex);
             } catch (Exception ex) {
-                String msg = ex.getMessage();
-                if (msg == null) {
-                    msg = "Unexpected error - see log for details";
-                }
-                JMeterUtils.reportErrorToUser(msg);
-                log.warn("Unexpected error", ex);
+                String msg = "Including file \"" + fileName 
+                            + "\" failed for Include Controller \"" + this.getName()
+                            +"\", unexpected error";
+                JMeterUtils.reportErrorToUser(msg+" - see log for details");
+                log.warn(msg, ex);
             }
         }
         return tree;

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1747805&r1=1747804&r2=1747805&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Jun 10 21:43:59 2016
@@ -88,6 +88,7 @@ Summary
 
 <h3>Controllers</h3>
 <ul>
+    <li><bug>59351</bug>Improve log/error/message for IncludeController.
Partly contributed by Antonio Gomes Rodrigues (ra0077 at gmail.com)</li>
 </ul>
 
 <h3>Listeners</h3>
@@ -162,6 +163,7 @@ Summary
 </p>
 <ul>
 <li>Felix Draxler (felix.draxler at sap.com)</li>
+<li>Antonio Gomes Rodrigues (ra0077 at gmail.com)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter. <br/>
 For this release we want to give special thanks to the following reporters for the clear
reports and tests made after our fixes:</p>



Mime
View raw message