private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if (id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if (nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if (id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if (!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }
private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if(id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if(nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if(id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if(!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }
private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if (id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if (nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if (id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if (!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }
private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if (id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if (nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if (id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if (!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }
private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if (id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if (nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if (id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if (!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }
private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if(id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if(nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if(id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if(!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }
private static void checkId(String id, String idName) throws IllegalArgumentException, NullPointerException { if (id == null) throw new NullPointerException(idName + " is null."); if(id.length() == 0) throw new IllegalArgumentException(idName + " is empty."); byte[] nameBytes; try { nameBytes = id.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never happens, "UTF-8" must always be supported throw new IllegalStateException(e.getMessage()); } if(nameBytes.length > MAX_ID_LENGTH) throw new IllegalArgumentException(idName + " is too long " + "(over " + MAX_ID_LENGTH + " bytes in UTF-8 encoding)."); if(id.equals(".") || id.equals("..")) throw new IllegalArgumentException(idName + " is invalid."); if(!containsValidChars(id)) throw new IllegalArgumentException(idName + " contains invalid characters."); }