URLDecoder fails with certain input with merlin build 46 on Solaris. Its throwing java.lang.IllegalArgumentException with certain input. Same test passed with jdk1.3.
How to reproduce the problem:
1. Take the following code.
public class EncodeDecode {
public static void main(String[] args) {
String str = "aslf alsf alsdjf";
if(args.length > 0)
str=args[0];
String encStr = URLEncoder.encode(str);
System.out.println("Encode string " + encStr);
String decStr = URLDecoder.decode(encStr);
System.out.println("Decoded String " + decStr);
}
}
2. Execute as shown below.
java EncodeDecode 'asdf @$'
or
java EncodeDecode fdadf@$
On execution as shown above output will be like this:
% java EncodeDecode fds@$
Encode string fds%40%24
Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder: Incomplete trailing escape (%) pattern
at java.net.URLDecoder.decode(URLDecoder.java:150)
at java.net.URLDecoder.decode(URLDecoder.java:72)
at EncodeDecode.main(EncodeDecode.java:21)
Other Information:
1. Its passed with jdk1.3 on solaris 8.