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

certain escape characters are not recognized by InterOperableNamingImpl.encode()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • other-libs
    • None
    • beta
    • generic
    • generic
    • Not verified



      Name: dm26566 Date: 08/23/2000


      The logic in the method encode() of InterOperableNamingImpl is
      flawed: it will not recognize the =, +, -, _, ~ and * characters:

         else if((c == ';') || (c == '/') || (c == '?')
         || (c == ':') || (c == '@') || (c == '&') || (c == '=')
         && (c == '+') || (c == '$') || (c == ';') || (c == '-')
         && (c == '_') || (c == '.') || (c == '!') || (c == '~')
         && (c == '*') || (c == ' ') || (c == '(') || (c == ')') )

      The "&&"'s should be "||"'s.

      Here is a test program that shows the error of the logic:

      public class test {
          public static void main(String[] args) {
              char c;
              char[] cValues = { ';', '/', '?', ':', '@', '&', '=', '+', '$', ';',
      '-', '_', '.', '!', '~', '*', ' ', '(', ')', };

              for (int i=0; i<cValues.length; i++) {
                  c = cValues[i];
                  if((c == ';') || (c == '/') || (c == '?')
                     || (c == ':') || (c == '@') || (c == '&') || (c == '=')
                     && (c == '+') || (c == '$') || (c == ';') || (c == '-')
                     && (c == '_') || (c == '.') || (c == '!') || (c == '~')
                     && (c == '*') || (c == ' ') || (c == '(') || (c == ')') ) {
                      System.out.println("success: " + c);
                  } else {
                      System.out.println("failure: " + c);
                  }
              }
          }
      }

      And here are the results:

      C:\TEMP>java test
      success: ;
      success: /
      success: ?
      success: :
      success: @
      success: &
      failure: =
      failure: +
      success: $
      success: ;
      failure: -
      failure: _
      success: .
      success: !
      failure: ~
      failure: *
      success:
      success: (
      success: )

      The second "if" never runs for values of
       '=' or '+' because c cannot equal both = and +
       '-' or '_' because c cannot equal both _ and -
       '~' or '*' because c cannot equal both ~ and *
      =====================================================================
      *******************************************************************************

      ###@###.### 2001-09-24

      Fix Verified OK
      - using build:rip_int-1_0-fcs-bin-b63-solsparc-18_sep_2001
      - by inspecting code at: com/sun/corba/se/internal/CosNaming/InterOperableNamingImpl.java

      *******************************************************************************

            hputtaswsunw Hemanth Puttaswamy (Inactive)
            dmcduffisunw Dale Mcduffie (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: