private static char getNormalizedHexChar(char c) throws MalformedPIDException { if (c >= '0' && c <= '9') { return c; } if (c >= 'A' && c <= 'F') { return c; } if (c >= 'a' && c <= 'f') { return Character.toUpperCase(c); } throw new MalformedPIDException("Bad hex-digit in PID object-id: " + c); }
private static char getNormalizedHexChar(char c) throws MalformedPIDException { if (c >= '0' && c <= '9') { return c; } if (c >= 'A' && c <= 'F') { return c; } if (c >= 'a' && c <= 'f') { return Character.toUpperCase(c); } throw new MalformedPIDException("Bad hex-digit in PID object-id: " + c); }
/** * Return the normalized form of the given pid string, or throw a * MalformedPIDException. * @param pidString * @return String normalized version of the pid * @throws MalformedPIDException */ public static String normalize(String pidString) throws MalformedPIDException { if (pidString == null) { throw new MalformedPIDException("PID is null."); } return normalize(pidString, 0, pidString.length()); }
/** * Return the normalized form of the given pid string, or throw a * MalformedPIDException. * @param pidString * @return String normalized version of the pid * @throws MalformedPIDException */ public static String normalize(String pidString) throws MalformedPIDException { if (pidString == null) { throw new MalformedPIDException("PID is null."); } return normalize(pidString, 0, pidString.length()); }
inObjectID = true; } else { throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '3" + c + "'."); throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i, i + 2) + "'."); throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i + 1) + "'."); throw new MalformedPIDException("PID namespace-id cannot contain '" + c + "' character."); out.append(new char[]{'%', h1, h2}); } else { throw new MalformedPIDException("PID object-id ended early: need at least 2 chars after '%'."); throw new MalformedPIDException("PID object-id cannot contain '" + c + "' character."); throw new MalformedPIDException("PID delimiter (:) is missing."); throw new MalformedPIDException("PID namespace-id cannot be empty."); throw new MalformedPIDException("PID object-id cannot be empty."); throw new MalformedPIDException("PID length exceeds " + MAX_LENGTH + ".");
inObjectID = true; } else { throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '3" + c + "'."); throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i, i + 2) + "'."); throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i + 1) + "'."); throw new MalformedPIDException("PID namespace-id cannot contain '" + c + "' character."); out.append(new char[]{'%', h1, h2}); } else { throw new MalformedPIDException("PID object-id ended early: need at least 2 chars after '%'."); throw new MalformedPIDException("PID object-id cannot contain '" + c + "' character."); throw new MalformedPIDException("PID delimiter (:) is missing."); throw new MalformedPIDException("PID namespace-id cannot be empty."); throw new MalformedPIDException("PID object-id cannot be empty."); throw new MalformedPIDException("PID length exceeds " + MAX_LENGTH + ".");