@Test public void testValidIdString() { String begin = "/a/really/co"; String end = "ol/path"; assertTrue("Invalid path when no extra character inserted.", StringValidateEncodeUtils.validIdString(begin + end)); assertTrue("Invalid path when [Latin small letter eth] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\u00F0' + end)); assertTrue("Valid path when [java.io.File.pathSeparatorChar] character inserted.", StringValidateEncodeUtils.validIdString(begin + File.pathSeparatorChar + end)); assertTrue("Valid path when [ampersand] character inserted.", StringValidateEncodeUtils.validIdString(begin + '&' + end)); assertTrue("Valid path when [less than] character inserted.", StringValidateEncodeUtils.validIdString(begin + '<' + end)); assertTrue("Valid path when [greater than] character inserted.", StringValidateEncodeUtils.validIdString(begin + '>' + end)); assertTrue("Valid path when [backslash] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\\' + end)); assertTrue("Valid path when [up directory path] string inserted.", StringValidateEncodeUtils.validIdString(begin + "/../" + end)); assertFalse("Valid path when [space] character inserted.", StringValidateEncodeUtils.validIdString(begin + ' ' + end)); assertFalse("Valid path when [line feed] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\n' + end)); assertFalse("Valid path when [carriage return] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\r' + end)); assertFalse("Valid path when [tab] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\t' + end)); assertFalse("Valid path when [line separator] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\u2028' + end)); assertFalse("Valid path when [paragraph separator] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\u2029' + end)); assertFalse("Valid string when [bell] character inserted.", StringValidateEncodeUtils.validIdString(begin + '\u0007' + end)); }
public static boolean validIdString(String id) { if (id == null) return false; Matcher m = INVALID_CHARACTERS_FOR_ID_STRING_PATTERN.matcher(id); return !(m.find() || !validSingleLineString(id)); }
StringValidateEncodeUtils { public static boolean validIdString(String id) { if (id == null) return false; Matcher m = INVALID_CHARACTERS_FOR_ID_STRING_PATTERN.matcher(id); return !(m.find() || !validSingleLineString(id)); } }
StringValidateEncodeUtils { public static boolean validIdString(String id) { if (id == null) return false; Matcher m = INVALID_CHARACTERS_FOR_ID_STRING_PATTERN.matcher(id); return !(m.find() || !validSingleLineString(id)); } private  StringValidateEncodeUtils(); }
StringValidateEncodeUtils { public static boolean validIdString(String id) { if (id == null) return false; Matcher m = INVALID_CHARACTERS_FOR_ID_STRING_PATTERN.matcher(id); return !(m.find() || !validSingleLineString(id)); } private  StringValidateEncodeUtils(); static boolean validSingleLineString(String singleLineString); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validPath(String path); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validFilePath(String path); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validUriString(String uri); static boolean validIdString(String id); static boolean containsAngleBracketCharacters(String string); static boolean containsAmpersandCharacters(String string); static boolean containsBackslashCharacters(String string); static boolean validDecimalNumber(String number); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validBooleanString(String boolString); static boolean validAlphanumericString(String alphNumString); static boolean validAlphanumericStringConstrainedSet(String alphNumString, String[] constrainedSet,
      boolean ignoreCase); @SuppressWarnings({"UnnecessaryContinue"}) static boolean descendOnlyFilePath(String path); static boolean validPercentHexOctetsString(String percentHexOctetsString); static String unicodeCodePoint2PercentHexString(int codePoint, String charsetName); }
StringValidateEncodeUtils { public static boolean validIdString(String id) { if (id == null) return false; Matcher m = INVALID_CHARACTERS_FOR_ID_STRING_PATTERN.matcher(id); return !(m.find() || !validSingleLineString(id)); } private  StringValidateEncodeUtils(); static boolean validSingleLineString(String singleLineString); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validPath(String path); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validFilePath(String path); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validUriString(String uri); static boolean validIdString(String id); static boolean containsAngleBracketCharacters(String string); static boolean containsAmpersandCharacters(String string); static boolean containsBackslashCharacters(String string); static boolean validDecimalNumber(String number); @SuppressWarnings({"SimplifiableIfStatement"}) static boolean validBooleanString(String boolString); static boolean validAlphanumericString(String alphNumString); static boolean validAlphanumericStringConstrainedSet(String alphNumString, String[] constrainedSet,
      boolean ignoreCase); @SuppressWarnings({"UnnecessaryContinue"}) static boolean descendOnlyFilePath(String path); static boolean validPercentHexOctetsString(String percentHexOctetsString); static String unicodeCodePoint2PercentHexString(int codePoint, String charsetName); final static String CHARACTER_ENCODING_UTF_8; }