Kaydet (Commit) 7974269a authored tarafından Noel Grandin's avatar Noel Grandin

cid#1326733 Dm: Dubious method used

there is no point in re-decoding a Java String object, it is already
UTF-16

Change-Id: Iedc59d457422d32b306782f24cac9b6c2f6b04fe
üst ad280b67
......@@ -206,8 +206,10 @@ public class UnoUrl {
private static String decodeUTF8(String s)
throws com.sun.star.lang.IllegalArgumentException {
if (!s.contains("%")) {
return s;
}
try {
if (s.contains("%")) {
int length = s.length();
ByteBuffer bb = ByteBuffer.allocate(length);
for (int i = 0; i < length; i++) {
......@@ -234,12 +236,6 @@ public class UnoUrl {
byte[] bytes = new byte[bb.position()];
System.arraycopy(bb.array(), 0, bytes, 0, bytes.length);
return new String(bytes, "UTF-8");
} else {
return new String(s.getBytes(), "UTF-8");
}
} catch (UnsupportedEncodingException e) {
throw new com.sun.star.lang.IllegalArgumentException(e,
"Couldn't convert parameter string to UTF-8 string");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment