File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,6 +156,10 @@ JavaObject::~JavaObject() {
156156
157157 POP_LOCAL_JAVA_FRAME ();
158158
159+ if (result->IsNativeError ()) {
160+ return ThrowException (result);
161+ }
162+
159163 return scope.Close (result);
160164}
161165
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public Test() {}
1818 public static String staticMethod () { return "staticMethod called" ; }
1919 public static int staticMethod (int i ) { return i + 1 ; }
2020 public static void staticMethodThrows (Exception ex ) throws Exception { throw ex ; }
21- public static void staticMethodThrowsNew ( ) throws Exception { throw new Exception ( "my exception" ) ; }
21+ public void methodThrows ( Exception ex ) throws Exception { throw ex ; }
2222
2323 public static int staticMethodOverload (String a ) { return 1 ; }
2424 public static int staticMethodOverload (int a ) { return 2 ; }
Original file line number Diff line number Diff line change @@ -117,9 +117,11 @@ exports['Java - Call Static Method'] = nodeunit.testCase({
117117 test . done ( ) ;
118118 } ,
119119
120- "callStaticMethodSync exception thrown from method (new exception)" : function ( test ) {
120+ "callMethodSync exception thrown from method" : function ( test ) {
121+ var ex = java . newInstanceSync ( "java.lang.Exception" , "my exception" ) ;
122+ var myTest = java . newInstanceSync ( "Test" ) ;
121123 try {
122- java . callStaticMethodSync ( "Test" , "staticMethodThrowsNew" ) ;
124+ myTest . methodThrowsSync ( ex ) ;
123125 test . fail ( "should throw" ) ;
124126 } catch ( err ) {
125127 test . ok ( err . toString ( ) . match ( / m y e x c e p t i o n / ) ) ;
You can’t perform that action at this time.
0 commit comments