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

java.util.Properties class can't be applicable to characters other than ascii.

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      Properties.load method read one byte and convert it into unicode character.
      There are some character encoding to support some languange which
      consist of more than one byte. But the load method can be only applicable
      to ascii character. It is hardcoded. We can't use this class for localization
      like messages handling.

      The following are the point of problem in the Properties class.

          public synchronized void load(InputStream in) throws IOException {
              in = Runtime.getRuntime().getLocalizedInputStream(in); <--- I guess this method
                                                                                                             became a obsolete one
                                                                                                             in 1.1

              int ch = in.read(); <--- read one byte.
              while (true) {
                  switch (ch) { <--- deal with the read byte as unicode.
                    case -1:
                      return;

                    case '#':
                    case '!':
                      do {
                          ch = in.read();
                      } while ((ch >= 0) && (ch != '\n') && (ch != '\r'));
                      continue;

                    case '\n':
                    case '\r':
                    case ' ':
                    case '\t':
                      ch = in.read();
                      continue;

                    .....................

        Attachments

          Activity

            People

            Assignee:
            bcbeck Brian Beck (Inactive)
            Reporter:
            kuno Koji Uno
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: