jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1476768 - in /jmeter/trunk: src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java xdocs/changes.xml
Date Sun, 28 Apr 2013 13:55:44 GMT
Author: pmouawad
Date: Sun Apr 28 13:55:43 2013
New Revision: 1476768

URL: http://svn.apache.org/r1476768
Log:
Bug 54896 - JUnit sampler gives only “failed to create an instance of the class” message
with constructor problems
Bugzilla Id: 54896

Modified:
    jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java?rev=1476768&r1=1476767&r2=1476768&view=diff
==============================================================================
--- jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java (original)
+++ jmeter/trunk/src/junit/org/apache/jmeter/protocol/java/sampler/JUnitSampler.java Sun Apr
28 13:55:43 2013
@@ -459,7 +459,10 @@ public class JUnitSampler extends Abstra
             // we should log a warning, but allow the test to keep running
             sresult.setSuccessful(false);
             // this should be externalized to the properties
-            sresult.setResponseMessage("failed to create an instance of the class");
+            sresult.setResponseMessage("Failed to create an instance of the class:"+getClassname()
+                    +", reasons may be missing both empty constructor and one " 
+                    + "String constructor or failure to instanciate constructor," 
+                    + " check warning messages in jmeter log file");
             sresult.setResponseCode(getErrorCode());
         }
         return sresult;
@@ -504,7 +507,7 @@ public class JUnitSampler extends Abstra
                         strCon = null;
                     }
                 } catch (NoSuchMethodException e) {
-                    log.info("String constructor:: " + e.getMessage());
+                    log.info("Trying to find constructor with one String parameter returned
error: " + e.getMessage());
                 }
                 try {
                     con = theclazz.getDeclaredConstructor(new Class[0]);
@@ -512,7 +515,7 @@ public class JUnitSampler extends Abstra
                         params = new Object[]{};
                     }
                 } catch (NoSuchMethodException e) {
-                    log.info("Empty constructor:: " + e.getMessage());
+                    log.info("Trying to find empty constructor returned error: " + e.getMessage());
                 }
                 try {
                     // if the string constructor is not null, we use it.
@@ -522,13 +525,15 @@ public class JUnitSampler extends Abstra
                         testclass = strCon.newInstance(strParams);
                     } else if (con != null){
                         testclass = con.newInstance(params);
+                    } else {
+                        log.error("No empty constructor nor string constructor found for
class:"+theclazz);
                     }
                 } catch (InvocationTargetException e) {
-                    log.warn(e.getMessage());
+                    log.error("Error instanciating class:"+theclazz+":"+e.getMessage(), e);
                 } catch (InstantiationException e) {
-                    log.info(e.getMessage());
+                    log.error("Error instanciating class:"+theclazz+":"+e.getMessage(), e);
                 } catch (IllegalAccessException e) {
-                    log.info(e.getMessage());
+                    log.error("Error instanciating class:"+theclazz+":"+e.getMessage(), e);
                 }
             }
         }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1476768&r1=1476767&r2=1476768&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Apr 28 13:55:43 2013
@@ -141,7 +141,7 @@ It was therefore necessary to change the
 <li><bugzilla>54504</bugzilla> - Resource string not found: [clipboard_node_read_error]</li>
 <li><bugzilla>54538</bugzilla> - GUI: context menu is too big</li>
 <li><bugzilla>54847</bugzilla> - Cut &amp; Paste is broken with tree
multi-selection</li>
-<li><bugzilla>54870</bugzilla> - Tree D&D may lost leaf nodes (affected
nightly build)</li>
+<li><bugzilla>54870</bugzilla> - Tree D&amp;D may lost leaf nodes (affected
nightly build)</li>
 </ul>
 
 <!-- =================== Improvements =================== -->
@@ -157,6 +157,7 @@ It was therefore necessary to change the
 <li><bugzilla>54788</bugzilla> - JMS Point-to-Point Sampler - GUI enhancements
to increase readability and ease of use</li>
 <li><bugzilla>54798</bugzilla> - Using subject from EML-file for SMTP Sampler</li>
 <li><bugzilla>54759</bugzilla> - SSLPeerUnverifiedException using HTTPS
, property documented</li>
+<li><bugzilla>54896</bugzilla> - JUnit sampler gives only “failed
to create an instance of the class” message with constructor problems</li>
 </ul>
 
 <h3>Controllers</h3>



Mime
View raw message