-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
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
*******************************************************************************