cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript JavaScriptInterpreter.java
Date Fri, 28 Feb 2003 03:23:35 GMT
pier        2003/02/27 19:23:34

  Modified:    src/java/org/apache/cocoon/components/flow/javascript
                        JavaScriptInterpreter.java
  Log:
  Unwrap JavaScriptException to display a stacktrace when some Java native
  code is called from a continuation script.
  
  Revision  Changes    Path
  1.20      +15 -4     xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptInterpreter.java
  
  Index: JavaScriptInterpreter.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/flow/javascript/JavaScriptInterpreter.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JavaScriptInterpreter.java	26 Feb 2003 13:28:19 -0000	1.19
  +++ JavaScriptInterpreter.java	28 Feb 2003 03:23:34 -0000	1.20
  @@ -607,12 +607,23 @@
   
       try {
         ((Function)handleContFunction).call(context, kScope, kScope, args);
  -    }
  -    catch (final Exception ex) {
  +    } catch (JavaScriptException ex) {
  +      Object value = ex.getValue();
  +      while (value instanceof Wrapper) {
  +        value = ((Wrapper)value).unwrap();
  +      }
  +      if (value instanceof Exception) {
  +        Exception e = (Exception)value;
  +        e.printStackTrace();
  +        throw e;
  +      } else if (value instanceof Error) {
  +        throw (Error)value;
  +      }
  +      throw ex;
  +    } catch (Exception ex) {
         ex.printStackTrace();
         throw ex;
  -    }
  -    finally {
  +    } finally {
         Context.exit();
       }
     }
  
  
  

Mime
View raw message