Package org.jruby

Examples of org.jruby.NativeException


        try {
            //call throwException via JRuby
            JavaEmbedUtils.invokeMethod(runtime, wrappedThrower, "throwException", new Object[] { }, Object.class);
        } catch(final RaiseException e) {
            exceptionThrown = true;
            final NativeException ne = (NativeException) e.getException();
            final ExpectedException ee = (ExpectedException) ne.getCause();
            assertEquals("The unpacked exception we receive should be the one we threw.",
                         ExceptionThrower.expectedException,ee);
        } finally {
            assertTrue("Java Exception should have been thrown and wrapped as a RaiseException",exceptionThrown);
        }
View Full Code Here


        try {
            //call throwException via JRuby
            JavaEmbedUtils.invokeMethod(runtime, wrappedThrower, "throwException", new Object[] { }, Object.class);
        } catch(final RaiseException e) {
            exceptionThrown = true;
            final NativeException ne = (NativeException) e.getException();
            final ExpectedException ee = (ExpectedException) ne.getCause();
            assertEquals("The unpacked exception we receive should be the one we threw.",
                         ExceptionThrower.expectedException,ee);
        } finally {
            assertTrue("Java Exception should have been thrown and wrapped as a RaiseException",exceptionThrown);
        }
View Full Code Here

    public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause) {
        return createNativeRaiseException(runtime, cause, null);
    }

    public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target) {
        NativeException nativeException = new NativeException(runtime, runtime.getClass(NativeException.CLASS_NAME), cause);
        if (!runtime.getDebug().isTrue()) {
            nativeException.trimStackTrace(target);
        }
        return new RaiseException(cause, nativeException);
    }
View Full Code Here

    public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause) {
        return createNativeRaiseException(runtime, cause, null);
    }

    public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target) {
        NativeException nativeException = new NativeException(runtime, runtime.getNativeException(), cause);

        // FIXME: someday, add back filtering of reflection/handle methods between JRuby and target

        return new RaiseException(cause, nativeException);
    }
View Full Code Here

            if (RuntimeHelpers.isJavaExceptionHandled(throwable, exceptions, context).isTrue()) {
                IRubyObject exceptionObj;

                if (exceptions.length == 1 && exceptions[0] == runtime.getNativeException()) {
                    // wrap Throwable in a NativeException object
                    exceptionObj = new NativeException(runtime, runtime.getNativeException(), throwable);
                    ((NativeException)exceptionObj).prepareIntegratedBacktrace(context, throwable.getStackTrace());
                } else {
                    // wrap as normal JI object
                    exceptionObj = JavaUtil.convertJavaToUsableRubyObject(runtime, throwable);
                }
View Full Code Here

    public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause) {
        return createNativeRaiseException(runtime, cause, null);
    }

    public static RaiseException createNativeRaiseException(Ruby runtime, Throwable cause, Member target) {
        NativeException nativeException = new NativeException(runtime, runtime.getNativeException(), cause);

        // FIXME: someday, add back filtering of reflection/handle methods between JRuby and target

        return new RaiseException(cause, nativeException);
    }
View Full Code Here

        }
    }

    private static RaiseException newNativeException(final Ruby runtime, final Throwable cause) {
        RubyClass nativeClass = runtime.getClass(NativeException.CLASS_NAME);
        NativeException nativeException = new NativeException(runtime, nativeClass, cause);
        return new RaiseException(cause, nativeException);
    }
View Full Code Here

TOP

Related Classes of org.jruby.NativeException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.