Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4292742

NullPointerException with no stack trace

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b01
    • CPU:
      generic, x86, sparc
    • OS:
      generic, linux, solaris_2.6, solaris_9, windows_2000

      Backports

        Description

        Subject: minor buglet
        Date: Wed, 17 Nov 1999 17:44:17 PST
        From: Tom Rodriguez <###@###.###>
        Organization: Xerox PARC
        To: Steffen Grarup <###@###.###>

        Occasionally I get exceptions like this from hotspot:

        8 C:/projects # java test
        Exception in thread "main" java.lang.NullPointerException
                <<no stack trace available>>

        which should look like this:

        9 C:/projects # java -Xint test
        Exception in thread "main" java.lang.NullPointerException
                at java.lang.System.arraycopy(Native Method)
                at test.t(test.java:17)
                at test.main(test.java:10)

        It seems like once code is compiled you can't get accurate backtraces
        from System.arraycopy, which is quite annoying. This seems to be a bug
        only in the server VM. The client VM doesn't have this problem. Here's
        a test program for it. Just an FYI.

        tom

        public class test {
            static Object[] src = new Object[10];
            static Object[] dest1 = new Object[10];
            static Object[] dest2 = null;

            static int count = 100000;

            public static void main(String[] args) {
                t(false);
                t(true);
            }

            public static void t(boolean n) {
                for (int i = 0; i < count; i++) {
                    if (n && (i + 1 == count))
                        System.arraycopy(src, 0, dest2, 0, src.length);
                    else
                        System.arraycopy(src, 0, dest1, 0, src.length);
                }
            }
        }
        ==========================================================================

        This issue still happens with 1.4.1-beta-b12.

        The following messages are the result when we tried the above attached
        program with windows2000(SP2).

        M:\shares\no-trace-server>java test
        Exception in thread "main" java.lang.NullPointerException
                at java.lang.System.arraycopy(Native Method)
                at test.t(test.java:16)
                at test.main(test.java:10)

        M:\shares\no-trace-server>java -Xint test
        Exception in thread "main" java.lang.NullPointerException
                at java.lang.System.arraycopy(Native Method)
                at test.t(test.java:16)
                at test.main(test.java:10)

        M:\shares\no-trace-server>java -server test
        Exception in thread "main" java.lang.NullPointerException

        This is very inconvenient. Even if some error occurs, the licensee can not
        do anything.
        There might be the following opinion,
         "when debugging, use -client(default) first and debug all errors.
          After debugging, apply the application to he real system with -server
          option."
        However, the server VM is very different from the client VM.
        There is the error which happens only with server option.
        Against such error, they can not do anything....

        Please reconsider to add the trace feature to -sever option
        and look at their comment in "COMMENT"

        2002-05-22
        ==========================================================================

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jrose John Rose
                Reporter:
                sgrarupsunw Steffen Grarup (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: