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

Unicode escape in package name isn't processed properly

    XMLWordPrintable

Details

    • generic, x86, sparc
    • generic, solaris_2.6, windows_nt

    Description



      Name: ###@###.### Date: 09/03/96


      Java language specification (#7.2.1 Storing Packages in a File System) says:

      "A package name component or class name might contain a character that
      cannot correctly appear in a host file system's ordinary directory
      name, such as a Unicode character on a system that allows only ASCII
      characters in file names. As a convention, the character can be escaped
      by using, say, the @ character followed by four hexadecimal digits
      giving the numeric value of the character, as in the \\uxxxx escape
      (3.3), so that the package name:

      children.activities.crafts.papierM\\u00e2ch\\u00e9

      which can also be written using full Unicode as:

      children.activities.crafts.papierMâché

      might be mapped to the directory name:

      children/activities/crafts/papierM@00e2ch@00e9

      If the @ character is not a valid character in a file name for some
      given host file system, then some other character that is not valid in
      a Java identifier could be used instead."

      The example below is compiled successfully and pkgs008.class is placed to the directory

      javasoft/sqe/tests/lang/pkgs007/pkgs00701é

      while fully qualified class name in pkgs00701.class is

      javasoft/sqe/tests/lang/pkgs007/pkgs00701é/pkgs00701

      So the compiled class cannot be found for execution:

      >javac -d . pkgs00701.java
      > java javasoft.sqe.tests.lang.pkgs007.pkgs00701é.pkgs00701
      Can't find class javasoft.sqe.tests.lang.pkgs007.pkgs00701é.pkgs00701
      >

      -----------------------pkgs00701.java---------------------------
      //File: @(#)pkgs00701.java 1.3 96/08/20
      //Copyright 08/20/96 Sun Microsystems, Inc. All Rights Reserved
       
      package javasoft.sqe.tests.lang.pkgs007.pkgs00701\\u00e9;
       
      import java.io.PrintStream;

      public class pkgs00701 {
        public static void main(String argv[]) {
           System.exit(run(argv,System.out));
        }
        public static int run(String argv[],PrintStream out) {
           int r = 6;
           if ( r != 6 ) {
              out.println("not pass");
              return 2;
           }
           return 0;
        }
      }
      -------------------------------------------------------------

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

      The following example also fails:

      //File: @(#)pkgs00702.java 1.5 96/11/15
      //Copyright 11/15/96 Sun Microsystems, Inc. All Rights Reserved
       
      package javasoft.sqe.tests.lang.pkgs007.pkgs00702;
       
      import java.io.PrintStream;

      public class pkgs00702 {
        public static void main(String argv[]) {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
           try {
             Class.forName ("javasoft.sqe.tests.lang.pkgs007.pkgs00702\u0099.pkgs00702a");
           }
           catch (Exception e) {
             out.println (e);
             out.println ("failed");
             return 2/*STATUS_FAILED*/;
           }
           return 0/*STATUS_PASSED*/;
        }
      }

      //File: @(#)pkgs00702a.java 1.1 96/11/15
      //Copyright 11/15/96 Sun Microsystems, Inc. All Rights Reserved
       
      package javasoft.sqe.tests.lang.pkgs007.pkgs00702\u0099;
       
      import java.io.PrintStream;

      public class pkgs00702a {
        static int r = 4;
        public static int get() {
           return r;
        }
      }

      william.maddox@Eng 2000-01-07

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              leosunw Leo Leo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: