sebb        2005/04/20 17:03:17

  Modified:    src/core/org/apache/jmeter/util BeanShellInterpreter.java
  Log:
  Second arg can be null - so don't use this to decide if parameter exists
  
  Revision  Changes    Path
  1.3       +26 -16    
jakarta-jmeter/src/core/org/apache/jmeter/util/BeanShellInterpreter.java
  
  Index: BeanShellInterpreter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/util/BeanShellInterpreter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BeanShellInterpreter.java 18 Mar 2005 15:26:55 -0000      1.2
  +++ BeanShellInterpreter.java 21 Apr 2005 00:03:17 -0000      1.3
  @@ -128,18 +128,31 @@
                }
        }
        
  +     private Object bshInvoke(Method m, String s) throws JMeterException
  +     {
  +             Object r=null;
  +             try {
  +                     r = m.invoke(bshInstance, new Object[] {s});
  +             } 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, String s, Object o) throws 
JMeterException
        {
                Object r=null;
                try {
  -                     if (o == null)
  -                     {
  -                             r = m.invoke(bshInstance, new Object[] {s});
  -                     }
  -                     else
  -                     {
  -                         r = m.invoke(bshInstance, new Object[] {s, o});
  -                     }
  +                 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);
  @@ -156,7 +169,7 @@
        }
   
        public Object eval(String s) throws JMeterException{
  -             return bshInvoke(bshEval,s, null);
  +             return bshInvoke(bshEval,s);
        }
        public Object set(String s, Object o) throws JMeterException{
                return bshInvoke(bshSet,s, o);
  @@ -165,13 +178,10 @@
                return bshInvoke(bshSet,s, b ? Boolean.TRUE : 
Boolean.FALSE);//JDK1.4 Boolean.vaueof
        }
        public Object source(String s) throws JMeterException{
  -             return bshInvoke(bshSource,s, null);
  +             return bshInvoke(bshSource,s);
        }
   
        public Object get(String s) throws JMeterException{
  -             return bshInvoke(bshGet,s,null);
  +             return bshInvoke(bshGet,s);
        }
  -     // These don't vary between executes, so can be done once TODO is this 
true?
  -//   bshInvoke(bshSet,"log",log); //$NON-NLS-1$
  -//   ;
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to