URLDecoder.decode(String s, Stirng enc) is throwing java.nio.BufferOverflowException exception when it is called as follows
String encString = URLEncoder.encode("asdf @ $ adf", "UTF-16BE");
String decString= URLDecoder.decode(encString, "UTF-16BE");
This exception is coming with merlin build 46 on Solaris.
Exception :
java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:367)
at java.nio.HeapCharBuffer.put(HeapCharBuffer.java:69)
at java.nio.CharBuffer.put(CharBuffer.java:766)
at java.nio.CharBuffer.put(CharBuffer.java:790)
at java.nio.CharsetDecoder.decode(CharsetDecoder.java:292)
at java.lang.StringCoding$CharsetSD.decode(StringCoding.java:159)
at java.lang.StringCoding.decode(StringCoding.java:189)
at java.lang.String.<init>(String.java:326)
at java.net.URLDecoder.decode(URLDecoder.java:153)
at EncodeDecode.performEncodeDecodeTests(EncodeDecode.java:104)
at EncodeDecode.main(EncodeDecode.java:58)
How to reproduce this:
1. Take the attached EncodeDecode.java and EncodeDecode.data files.
2. Execute as :
java EncodeDecode -f data/EncodeDecode.data -d
Other Information:
Particularly this exception is coming when input string to encoder is one of these:
"asdf $ $ asdf"
"asdf @@ $$$ asdjflkad"