You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/06/14 17:40:05 UTC
svn commit: r547286 -
/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
Author: sebb
Date: Thu Jun 14 08:40:04 2007
New Revision: 547286
URL: http://svn.apache.org/viewvc?view=rev&rev=547286
Log:
Bug 42659 - BeanShellIAssertion: include error from interpreter in message in GUI
Modified:
jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
Modified: jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java?view=diff&rev=547286&r1=547285&r2=547286
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/core/org/apache/jmeter/util/BeanShellInterpreter.java Thu Jun 14 08:40:04 2007
@@ -150,77 +150,57 @@
}
}
- private Object bshInvoke(Method m, String s) throws JMeterException {
- return bshInvoke(m, s, true);
- }
-
- private Object bshInvoke(Method m, String s, boolean shouldLog) throws JMeterException {
- Object r = null;
- final String errorString = "Error invoking bsh method: ";
- try {
- r = m.invoke(bshInstance, new Object[] { s });
- } catch (IllegalArgumentException e) { // Programming error
- log.error(errorString + m.getName());
- throw new JMeterError(errorString + m.getName(), e);
- } catch (IllegalAccessException e) { // Also programming error
- log.error(errorString + m.getName());
- throw new JMeterError(errorString + m.getName(), e);
- } catch (InvocationTargetException e) { // Can occur at run-time
- // could be caused by the bsh Exceptions:
- // EvalError, ParseException or TargetError
- if (shouldLog) {
- Throwable cause = e.getCause();
- if (cause != null) {
- log.error(errorString + m.getName() + "\t" + cause.getLocalizedMessage());
- } else {
- log.error(errorString + m.getName());
- }
- }
- throw new JMeterException(errorString + m.getName(), e);
- }
- return r;
- }
-
- private Object bshInvoke(Method m, String s, Object o) throws JMeterException {
- Object r = null;
- try {
- r = m.invoke(bshInstance, new Object[] { s, o });
- } catch (IllegalArgumentException e) { // Programming error
- log.error("Error invoking bsh method " + m.getName() + "\n", e);
- throw new JMeterError("Error invoking bsh method " + m.getName(), e);
- } catch (IllegalAccessException e) { // Also programming error
- log.error("Error invoking bsh method " + m.getName() + "\n", e);
- throw new JMeterError("Error invoking bsh method " + m.getName(), e);
- } catch (InvocationTargetException e) { // Can occur at run-time
- // could be caused by the bsh Exceptions:
- // EvalError, ParseException or TargetError
- log.error("Error invoking bsh method " + m.getName() + "\n", e);
- throw new JMeterException("Error invoking bsh method " + m.getName(), e);
- }
- return r;
- }
+ private Object bshInvoke(Method m, Object[] o, boolean shouldLog) throws JMeterException {
+ Object r = null;
+ final String errorString = "Error invoking bsh method: ";
+ try {
+ r = m.invoke(bshInstance, o);
+ } catch (IllegalArgumentException e) { // Programming error
+ final String message = errorString + m.getName();
+ log.error(message);
+ throw new JMeterError(message, e);
+ } catch (IllegalAccessException e) { // Also programming error
+ final String message = errorString + m.getName();
+ log.error(message);
+ throw new JMeterError(message, e);
+ } catch (InvocationTargetException e) { // Can occur at run-time
+ // could be caused by the bsh Exceptions:
+ // EvalError, ParseException or TargetError
+ String message = errorString + m.getName();
+ Throwable cause = e.getCause();
+ if (cause != null) {
+ message += "\t" + cause.getLocalizedMessage();
+ }
+
+ if (shouldLog) {
+ log.error(message);
+ }
+ throw new JMeterException(message, e);
+ }
+ return r;
+ }
public Object eval(String s) throws JMeterException {
- return bshInvoke(bshEval, s);
+ return bshInvoke(bshEval, new Object[] { s }, true);
}
public Object evalNoLog(String s) throws JMeterException {
- return bshInvoke(bshEval, s, false);
+ return bshInvoke(bshEval, new Object[] { s }, false);
}
public Object set(String s, Object o) throws JMeterException {
- return bshInvoke(bshSet, s, o);
+ return bshInvoke(bshSet, new Object[] { s, o }, true);
}
public Object set(String s, boolean b) throws JMeterException {
- return bshInvoke(bshSet, s, Boolean.valueOf(b));
+ return bshInvoke(bshSet, new Object[] { s, Boolean.valueOf(b) }, true);
}
public Object source(String s) throws JMeterException {
- return bshInvoke(bshSource, s);
+ return bshInvoke(bshSource, new Object[] { s }, true);
}
public Object get(String s) throws JMeterException {
- return bshInvoke(bshGet, s);
+ return bshInvoke(bshGet, new Object[] { s }, true);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org