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

Package.get{Specification{Vendor, Version} always returns null

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.4.2
    • core-libs
    • x86
    • windows_xp

    Description



      Name: rmT116609 Date: 10/13/2003


      FULL PRODUCT VERSION :
      $ java -version
      java version "1.4.2_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
      Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)

      FULL OS VERSION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The Package object is supposed to return the version string derived from the manifest with the getImplementationVersion but return null even for system packages such as java.lang.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached test code derived from a java techtip - http://developer.java.sun.com/developer/TechTips/1999/tt0414.html#tip2 - but printing out the spec version string.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      $ java -cp target/utils-0.1-dev-test.jar com.mcrl.util.loadclass java.lang.String
      package java.lang
      1.4
      ACTUAL -
      $ java -cp classes loadclass java.lang.String
      package java.lang
      null

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class loadclass {
        public static void main(String args[]) {
          // check argument
          if (args.length != 1) {
            System.err.println("missing classname");
            System.exit(1);
          }

          // load class
          Class c = null;
          try {
            c = Class.forName(args[0]);
          }
          catch (ClassNotFoundException e) {
            System.err.println(e);
            System.exit(1);
          }

          // retrieve and check package information
          Package pkg = c.getPackage();
          if (pkg == null) {
            System.out.println("No version information");
          }
          else {
            System.out.println(pkg);
            System.out.println(pkg.getSpecificationVersion());
          }
        }
      }
      ---------- END SOURCE ----------

      Release Regression From : 1.4.1_05
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 215485)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              iris Iris Clark
              rmandalasunw Ranjith Mandala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: