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

VerifyError with java/io/PrintStream println()

XMLWordPrintable

    • b66
    • 8
    • generic
    • generic

      FULL PRODUCT VERSION :
      $ java -version
      java version "1.8.0_74"
      Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      mac os x 10.9.5
      uname -a
      Darwin 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      macbook pro 15-inch, Early 2011
      processor: 2.3 Ghz Intel Core i7
      memory: 8 GB 1333 MHz DDR3

      A DESCRIPTION OF THE PROBLEM :
      Receiving exception java.lang.VerifyError. I've included a simple program that causes the Exception on my mac. I've run it on my linux box and it works fine.

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      The code worked on Mac OS X 10.6.8 with Java 1.6 although I cant remember the exact version number, I just selected one of the Java 1.6 entries from the drop down above.
      current output from java -version:

      java version "1.8.0_74"
      Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      javac TestVerifyError.java
      java TestVerifyError

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The output from the compiled program should be:
       
      No Data Found
      ACTUAL -
      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.VerifyError: Bad local variable type
      Exception Details:
        Location:
          TestVerifyError.main([Ljava/lang/String;)V @36: aload_1
        Reason:
          Type top (current frame, locals[1]) is not assignable to reference type
        Current Frame:
          bci: @36
          flags: { }
          locals: { '[Ljava/lang/String;', top, '[Ljava/lang/String;', 'java/io/PrintStream' }
          stack: { 'java/io/PrintStream' }
        Bytecode:
          0x0000000: 04bd 0002 4d2c 0301 53bb 0003 59b2 0004
          0x0000010: 0412 05b7 0006 4e2d 2c03 32c6 0009 2c03
          0x0000020: 32a7 0004 2bb6 0007 a700 213a 04bb 0009
          0x0000030: 59bb 000a 59b7 000b 120c b600 0d19 04b6
          0x0000040: 000e b600 0fb7 0010 bfb1
        Exception Handler Table:
          bci [9, 40] => handler: 43
        Stackmap Table:
          full_frame(@36,{Object[#26],Top,Object[#26],Object[#27]},{Object[#27]})
          full_frame(@37,{Object[#26],Top,Object[#26],Object[#27]},{Object[#27],Object[#28]})
          full_frame(@43,{Object[#26],Top,Object[#26]},{Object[#29]})
          append_frame(@73,Object[#27])

      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
      at java.lang.Class.getMethod0(Class.java:3018)
      at java.lang.Class.getMethod(Class.java:1784)
      at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Error: A JNI error has occurred, please check your installation and try again
      Exception in thread "main" java.lang.VerifyError: Bad local variable type
      Exception Details:
        Location:
          TestVerifyError.main([Ljava/lang/String;)V @36: aload_1
        Reason:
          Type top (current frame, locals[1]) is not assignable to reference type
        Current Frame:
          bci: @36
          flags: { }
          locals: { '[Ljava/lang/String;', top, '[Ljava/lang/String;', 'java/io/PrintStream' }
          stack: { 'java/io/PrintStream' }
        Bytecode:
          0x0000000: 04bd 0002 4d2c 0301 53bb 0003 59b2 0004
          0x0000010: 0412 05b7 0006 4e2d 2c03 32c6 0009 2c03
          0x0000020: 32a7 0004 2bb6 0007 a700 213a 04bb 0009
          0x0000030: 59bb 000a 59b7 000b 120c b600 0d19 04b6
          0x0000040: 000e b600 0fb7 0010 bfb1
        Exception Handler Table:
          bci [9, 40] => handler: 43
        Stackmap Table:
          full_frame(@36,{Object[#26],Top,Object[#26],Object[#27]},{Object[#27]})
          full_frame(@37,{Object[#26],Top,Object[#26],Object[#27]},{Object[#27],Object[#28]})
          full_frame(@43,{Object[#26],Top,Object[#26]},{Object[#29]})
          append_frame(@73,Object[#27])

      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
      at java.lang.Class.getMethod0(Class.java:3018)
      at java.lang.Class.getMethod(Class.java:1784)
      at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.PrintStream;


      public class TestVerifyError {

        public static void main( String argv[] ){

          final String ndf = "No Data Found";
          final String displayText[] = new String[1];
          final PrintStream out;
          displayText[0] = null;

          try {
              out = new PrintStream( System.out, true, "UTF-8" );
              // out.println();
              out.println((displayText[0] != null) ? displayText[0] : ndf);
          }
          catch ( java.io.UnsupportedEncodingException e ){
              throw new RuntimeException(
                  "error creating UTF-8 print stream. " + e );
          }
        }
      }
      ---------- END SOURCE ----------

            rpatil Ramanand Patil (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: