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

Package.isCompatibleWith(String) doesn't check for correct dotted form

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.2.0, 1.2.2
    • Fix Version/s: 1.4.2
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Verified

      Description



      Name: mgC56079 Date: 04/08/99



      The javadoc for Package class and Package.isCompatibleWith method says:
       * Specification version numbers use a "Dewey Decimal"
       * syntax that consists of positive decimal integers
       * separated by periods ".", for example, "2.0" or "1.2.3.4.5.6.7".
       * This allows an extensible number to be used to
       * represent major, minor, micro, etc versions.
       * The version number must begin with a number. <p>

       <skip>

       * @exception NumberFormatException if the desired or current version
       * is not of the correct dotted form.

      However, the method doesn't throw a NumberFormatException if the dotted form is incorrect.

      -----Here is a test------------
      public class PackageTest {

          public static void main(String args[]) {
              Package p = Object.class.getPackage();
              System.out.println(p.isCompatibleWith(""));
              System.out.println(p.isCompatibleWith("0...."));
              System.out.println(p.isCompatibleWith("2.-2"));
              System.out.println("Failed");
          }

      }
      ------Sample run (JDK 1.2.2)-------------
      % java PackageTest
      true
      true
      false
      Failed

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            iris Iris Clark
            Reporter:
            gorsunw Gor Gor (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: