harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory Shimansky (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4873) [drlvm][exception] NullPointerException causes SIGSEGV
Date Thu, 04 Oct 2007 12:09:52 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532400
] 

Gregory Shimansky commented on HARMONY-4873:
--------------------------------------------

I wrote another test that shows the cause of the bug. When a hardware exception is thrown,
and has to be caught by a native frame, the current implementation on linux doesn't exit from
signal context. In the following test exception has to be caught by native code of reflection
implementation:

import java.lang.reflect.*;

public class Test {
    private void func() {
        String s = null;
        s.length();
    }

    public static void main(String args[]) throws IllegalAccessException {
        Class cl = Test.class;
        Method m;
        try {
            m = Test.class.getDeclaredMethod("func");
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
            return;
        }
        Test o = new Test();

        try {
            m.invoke(o);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }

        try {
            m.invoke(o);
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}


> [drlvm][exception] NullPointerException causes SIGSEGV
> ------------------------------------------------------
>
>                 Key: HARMONY-4873
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4873
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Debian Linux IA32
>            Reporter: Alexei Zakharov
>
> The following innocent test causes segmentation fault if executed on DRLVM. However,
it passes ok on RI and J9.
> Test113.java
> ---
> import java.io.*;
> public class Test113 {
>    static class A implements Serializable {
>        private final byte[] encoding = null;
>        protected A() {}
>        protected Object writeReplace() {
>            return new String(encoding.clone());
>        }
>    }
>    public static void main(String argv[]) throws Exception {
>        ByteArrayOutputStream out = new ByteArrayOutputStream();
>        ObjectOutputStream oos = new ObjectOutputStream(out);
>        A a = new A();
>        for (int i = 0; i < 2; i++) {
>           try {
>               System.out.println("ITERATION " + i);
>               oos.writeObject(a);
>           } catch (NullPointerException e) {
>               System.out.println("NPE catched");
>           }
>        }
>        System.out.println("PASS");
>    }
> }
> ---

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message