package org.eclipse.jgit.util;
import java.io.UnsupportedEncodingException;
+import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.Arrays;
e += 4;
}
- try {
- return new String(outBuff, 0, e, UTF_8);
- } catch (UnsupportedEncodingException uue) {
- return new String(outBuff, 0, e);
- }
+ return new String(outBuff, 0, e, StandardCharsets.UTF_8);
}
/**
* @return the decoded data
*/
public static byte[] decode(String s) {
- byte[] bytes;
- try {
- bytes = s.getBytes(UTF_8);
- } catch (UnsupportedEncodingException uee) {
- bytes = s.getBytes();
- }
+ byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
return decode(bytes, 0, bytes.length);
}
}