@Test public void testInvalidCharset() { assertFalse(CharsetUtils.isSupported(" utf-8")); assertFalse(CharsetUtils.isSupported("my charset name")); assertFalse(CharsetUtils.isSupported("charset1; charset2")); assertFalse(CharsetUtils.isSupported(null)); assertFalse(CharsetUtils.isSupported("")); }
public static boolean isSupported(String charsetName) { try { if (isSupportedICU != null && ((Boolean) isSupportedICU.invoke(null, charsetName)).booleanValue()) { return true; } return Charset.isSupported(charsetName); } catch (IllegalCharsetNameException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (Exception e) { return false; } }
CharsetUtils { public static boolean isSupported(String charsetName) { try { if (isSupportedICU != null && ((Boolean) isSupportedICU.invoke(null, charsetName)).booleanValue()) { return true; } return Charset.isSupported(charsetName); } catch (IllegalCharsetNameException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (Exception e) { return false; } } }
CharsetUtils { public static boolean isSupported(String charsetName) { try { if (isSupportedICU != null && ((Boolean) isSupportedICU.invoke(null, charsetName)).booleanValue()) { return true; } return Charset.isSupported(charsetName); } catch (IllegalCharsetNameException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (Exception e) { return false; } }  }
CharsetUtils { public static boolean isSupported(String charsetName) { try { if (isSupportedICU != null && ((Boolean) isSupportedICU.invoke(null, charsetName)).booleanValue()) { return true; } return Charset.isSupported(charsetName); } catch (IllegalCharsetNameException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (Exception e) { return false; } }  static boolean isSupported(String charsetName); static String clean(String charsetName); static Charset forName(String name); }
CharsetUtils { public static boolean isSupported(String charsetName) { try { if (isSupportedICU != null && ((Boolean) isSupportedICU.invoke(null, charsetName)).booleanValue()) { return true; } return Charset.isSupported(charsetName); } catch (IllegalCharsetNameException e) { return false; } catch (IllegalArgumentException e) { return false; } catch (Exception e) { return false; } }  static boolean isSupported(String charsetName); static String clean(String charsetName); static Charset forName(String name);  }