diff options
author | Alexander Kurtakov | 2016-07-08 09:01:43 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2016-07-08 09:01:43 +0000 |
commit | dfbf925d5d364bcd5f5a7d841b44fe0860bef3db (patch) | |
tree | 0dd3cf2d276285606e3449272d27db319183ed3f /org.eclipse.help | |
parent | 2ef1e5d654acfaf55187ee45921a2270695b6142 (diff) | |
download | eclipse.platform.ua-dfbf925d5d364bcd5f5a7d841b44fe0860bef3db.tar.gz eclipse.platform.ua-dfbf925d5d364bcd5f5a7d841b44fe0860bef3db.tar.xz eclipse.platform.ua-dfbf925d5d364bcd5f5a7d841b44fe0860bef3db.zip |
Bug 497548 - Make use of StandardCharsetsI20160708-1700
All the various places defining and using different UTF-8 charset name
constants is too error prone. Let's stick to StandardCharsets.UTF-8
which even saves the string lookup too.
Change-Id: Idcb356d0293cd2d0d0148de4e1f2e131584d09c4
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'org.eclipse.help')
-rw-r--r-- | org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java b/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java index 03a505ee2..7d4a4ad6d 100644 --- a/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java +++ b/org.eclipse.help/src/org/eclipse/help/internal/util/URLCoder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,32 +11,20 @@ package org.eclipse.help.internal.util; import java.io.ByteArrayOutputStream; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; public class URLCoder { public static String encode(String s) { - try { - return urlEncode(s.getBytes("UTF8"), true); //$NON-NLS-1$ - } catch (UnsupportedEncodingException uee) { - return null; - } + return urlEncode(s.getBytes(StandardCharsets.UTF_8), true); } public static String compactEncode(String s) { - try { - return urlEncode(s.getBytes("UTF8"), false); //$NON-NLS-1$ - } catch (UnsupportedEncodingException uee) { - return null; - } + return urlEncode(s.getBytes(StandardCharsets.UTF_8), false); } public static String decode(String s) { - try { - return new String(urlDecode(s), "UTF8"); //$NON-NLS-1$ - } catch (UnsupportedEncodingException uee) { - return null; - } + return new String(urlDecode(s), StandardCharsets.UTF_8); } private static String urlEncode(byte[] data, boolean encodeAllCharacters) { |