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

System.gc() with JIT causes NullPointerException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.6
    • vm-legacy



      Name: paC48320 Date: 04/03/98


      System.gc() with JIT invocation causes java.lnag.NullPointerException.
      This doesn't occur when java runs with the -nojit option or commenting
      out System.gc() line without the -nojit option. The exception
      message is as follows:
      java.lang.NullPointerException
              at sun.io.ByteToCharSJIS.<init>(Compiled Code)
              at sun.io.ByteToCharConverter.getConverter(Compiled Code)
              at test.convert(Compiled Code)
              at test.<init>(test.java:11)
              at test.main(test.java:3)
       
      Following program demonstrates the problem.
       
      public class test {
        public static void main(String argv[]) {
          test t = new test();
        }
       
        test() {
          String sjis = "SJIS code";
          System.gc(); // Removing this line works.
          String aa = convert(sjis);
          System.out.println("aa="+aa);
          String bb = convert(sjis);
          System.out.println("bb="+bb);
        }
       
        String convert(String sjis) {
          try {
            return new String(sjis.getBytes("8859_1"),
                              System.getProperty("file.encoding"));
          } catch(Exception e) {
            e.printStackTrace();
          }
          return null;
        }
      }
      (Review ID: 27738)
      ======================================================================

            dviswanasunw Deepa Viswanathan (Inactive)
            pallenba Peter Allenbach (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: