jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From orlikow...@apache.org
Subject cvs commit: jakarta-bsf/src/org/apache/bsf/engines/jython JythonEngine.java
Date Mon, 26 Apr 2004 17:57:29 GMT
orlikowski    2004/04/26 10:57:29

  Modified:    src/org/apache/bsf/engines/jython JythonEngine.java
  Log:
  
  
  Revision  Changes    Path
  1.6       +29 -20    jakarta-bsf/src/org/apache/bsf/engines/jython/JythonEngine.java
  
  Index: JythonEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bsf/src/org/apache/bsf/engines/jython/JythonEngine.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JythonEngine.java	26 Apr 2004 17:42:33 -0000	1.5
  +++ JythonEngine.java	26 Apr 2004 17:57:29 -0000	1.6
  @@ -81,26 +81,35 @@
      * call the named method of the given object.
      */
     public Object call (Object object, String method, Object[] args) 
  -														throws BSFException {
  -	
  -	PyObject[] pyargs = Py.EmptyObjects;
  -	if (args != null) {
  -	  pyargs = new PyObject[args.length];
  -	  for (int i = 0; i < pyargs.length; i++)
  -		pyargs[i] = Py.java2py(args[i]);
  -	}
  -
  -	if (object != null) {
  -	  PyObject o = Py.java2py(object);
  -	  return unwrap(o.invoke(method, pyargs));
  -	}
  -	PyObject m = interp.get(method);
  -	if (m == null)
  -		m = interp.eval(method);
  -	if (m != null) {
  -	return unwrap(m.__call__(pyargs));
  -	}
  -	return null;
  +      throws BSFException {
  +
  +      try {
  +          PyObject[] pyargs = Py.EmptyObjects;
  +
  +          if (args != null) {
  +              pyargs = new PyObject[args.length];
  +              for (int i = 0; i < pyargs.length; i++)
  +                  pyargs[i] = Py.java2py(args[i]);
  +          }
  +
  +          if (object != null) {
  +              PyObject o = Py.java2py(object);
  +              return unwrap(o.invoke(method, pyargs));
  +          }
  +
  +          PyObject m = interp.get(method);
  +
  +          if (m == null)
  +              m = interp.eval(method);
  +          if (m != null) {
  +              return unwrap(m.__call__(pyargs));
  +          }
  +
  +          return null;
  +      } catch (PyException e) {
  +          throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
  +                                  "exception from Jython:\n" + e, e);
  +      }
     }
   
     /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org


Mime
View raw message