2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.openecomp.sdc.common.util;
22 import com.google.common.base.CharMatcher;
23 import java.util.Arrays;
24 import java.util.HashSet;
25 import java.util.LinkedHashSet;
26 import java.util.List;
28 import java.util.regex.Pattern;
29 import org.apache.commons.collections.CollectionUtils;
30 import org.apache.commons.lang3.StringUtils;
31 import org.apache.commons.lang3.math.NumberUtils;
32 import org.apache.commons.text.StringEscapeUtils;
33 import org.apache.commons.text.WordUtils;
34 import org.apache.commons.validator.routines.UrlValidator;
35 import org.jsoup.Jsoup;
36 import org.jsoup.safety.Safelist;
38 public class ValidationUtils {
40 public static final Integer COMPONENT_NAME_MAX_LENGTH = 1024;
41 public static final Pattern COMPONENT_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH - 1) + "}$");
42 public static final Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
43 public static final Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern.compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
44 public static final Integer RSI_NAME_MAX_LENGTH = 1024;
45 public static final Pattern RSI_NAME_PATTERN = Pattern.compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
46 public static final Integer COMMENT_MAX_LENGTH = 256;
47 public static final Integer ICON_MAX_LENGTH = 25;
48 public static final Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
49 public static final Integer PROJECT_CODE_MAX_LEGTH = 50;
50 public static final Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
51 // USER_ID format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
52 public static final Integer CONNTACT_ID_MAX_LENGTH = 50;
53 public static final Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
54 public static final Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
55 public static final Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
56 public static final Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");// ,#?&@$<>~^`\\[]{}|")(*!
57 public static final Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
58 public static final Pattern COMMENT_PATTERN = Pattern.compile("^[\\u0000-\\u00BF]{1,1024}$");
59 public static final Pattern SERVICE_METADATA_PATTERN = Pattern
60 .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]{1,256}");
61 public static final Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
62 public static final Integer SERVICE_TYPE_MAX_LENGTH = 256;
63 public static final Integer SERVICE_ROLE_MAX_LENGTH = 256;
64 public static final Integer SERVICE_FUNCTION_MAX_LENGTH = 256;
65 public static final Integer SERVICE_NAMING_POLICY_MAX_SIZE = 100;
66 public static final Integer TAG_MAX_LENGTH = 1024;
67 public static final Integer TAG_LIST_MAX_LENGTH = 1024;
68 public static final Integer VENDOR_NAME_MAX_LENGTH = 60;
69 public static final Pattern VENDOR_NAME_PATTERN = Pattern
70 .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
71 public static final Integer VENDOR_RELEASE_MAX_LENGTH = 25;
72 public static final Pattern VENDOR_RELEASE_PATTERN = Pattern
73 .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
74 public static final Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65;
75 public static final Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
76 public static final Pattern YANG_MODULE_3GPP_PATTERN = Pattern.compile("^(_3gpp).*$");
77 public static final Pattern DASH_PATTERN = Pattern.compile("[-]+");
78 public static final Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+");
79 public static final Pattern PLUS_PATTERN = Pattern.compile("[+]+");
80 public static final Pattern SPACE_PATTERN = Pattern.compile("[ ]+");
81 public static final Pattern AMP_PATTERN = Pattern.compile("[&]+");
82 public static final Pattern DOT_PATTERN = Pattern.compile("[\\.]+");
83 public static final Pattern APOST_PATTERN = Pattern.compile("[']+");
84 public static final Pattern HASHTAG_PATTERN = Pattern.compile("[#]+");
85 public static final Pattern EQUAL_PATTERN = Pattern.compile("[=]+");
86 public static final Pattern COLON_PATTERN = Pattern.compile("[:]+");
87 public static final Pattern AT_PATTERN = Pattern.compile("[@]+");
88 public static final Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
89 public static final Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
90 public static final Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-@+]+$");
91 public static final Integer ARTIFACT_LABEL_LENGTH = 255;
92 public static final Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
93 public static final Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
94 public static final Integer CATEGORY_LABEL_MIN_LENGTH = 3;
95 public static final Integer CATEGORY_LABEL_MAX_LENGTH = 25;
96 public static final Pattern COMPONENT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_]+");
97 public static final Pattern COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
98 public static final Pattern PRODUCT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_&=#@':\\[\\]\\+]+");
99 public static final Integer CONSUMER_NAME_MAX_LENGTH = 255;
100 public static final Pattern CONSUMER_NAME_PATTERN = Pattern.compile("^[\\w]+[\\w\\.\\-]*$");
101 public static final Integer CONSUMER_SALT_LENGTH = 32;
102 public static final Integer CONSUMER_PASSWORD_LENGTH = 64;
103 public static final Pattern CONSUMER_PASS_SALT_PATTERN = Pattern.compile("^[a-z0-9]+$");
104 public static final Pattern FLOAT_PATTERN = Pattern.compile("^[\\d]+[\\.]{1}[\\d]+$");
105 public static final Pattern CERTIFIED_VERSION_PATTERN = Pattern.compile("^[1-9][0-9]*\\.0$");
106 public static final Pattern MINOR_VERSION_PATTERN = Pattern.compile("^0\\.[1-9][0-9]*$");
107 public static final Pattern TAGS_PATTERN = Pattern.compile("<[^><]*>");
108 public static final Pattern TAG_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,1024}$");
109 public static final Integer ARTIFACT_NAME_LENGTH = 255;
110 public static final Integer API_URL_LENGTH = 100;
111 public static final Integer ARTIFACT_DESCRIPTION_MAX_LENGTH = 256;
112 public static final Integer PRODUCT_FULL_NAME_MIN_LENGTH = 4;
113 public static final Integer PRODUCT_FULL_NAME_MAX_LENGTH = 100;
114 public static final Integer FORWARDING_PATH_NAME_MAX_LENGTH = 100;
115 public static final Pattern FORWARDING_PATH_NAME_PATTERN = Pattern
116 .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (FORWARDING_PATH_NAME_MAX_LENGTH - 1) + "}$");
117 public static final Integer POLICY_MAX_LENGTH = 1024;
118 public static final Pattern POLICY_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (POLICY_MAX_LENGTH - 1) + "}$");
119 private static final Set<String> CATEGORY_CONJUNCTIONS = new HashSet<>(Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
121 private ValidationUtils() {
124 public static boolean validateArtifactLabel(String label) {
125 return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
128 public static boolean validateArtifactDisplayName(String displayName) {
129 return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
132 public static String cleanUpText(String text) {
133 text = removeNoneUtf8Chars(text);
134 text = normaliseWhitespace(text);
135 text = stripOctets(text);
136 text = removeHtmlTagsOnly(text);
140 public static boolean validateTagPattern(String tag) {
141 return TAG_PATTERN.matcher(tag).matches();
144 public static boolean validateServiceMetadata(String metadataField) {
145 return SERVICE_METADATA_PATTERN.matcher(metadataField).matches();
148 public static boolean validateCommentPattern(String comment) {
149 return COMMENT_PATTERN.matcher(comment).matches();
152 public static boolean validateCategoryDisplayNameFormat(String label) {
155 label = label.trim();
156 res = CATEGORY_LABEL_PATTERN.matcher(label).matches();
161 public static String normalizeCategoryName4Display(String str) {
164 str = DASH_PATTERN.matcher(str).replaceAll("-");
165 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
166 str = AMP_PATTERN.matcher(str).replaceAll("&");
167 str = PLUS_PATTERN.matcher(str).replaceAll("+");
168 str = DOT_PATTERN.matcher(str).replaceAll(".");
169 str = APOST_PATTERN.matcher(str).replaceAll("'");
170 str = HASHTAG_PATTERN.matcher(str).replaceAll("#");
171 str = EQUAL_PATTERN.matcher(str).replaceAll("=");
172 str = COLON_PATTERN.matcher(str).replaceAll(":");
173 str = AT_PATTERN.matcher(str).replaceAll("@");
174 str = normaliseWhitespace(str);
175 str = AND_PATTERN.matcher(str).replaceAll(" & ");
177 StringBuilder sb = new StringBuilder();
178 String[] split = str.split(" ");
179 for (int i = 0; i < split.length; i++) {
180 String splitted = split[i];
181 String lowerCase = splitted.toLowerCase();
182 // BANK OF AMERICA --> BANK of AMERICA ("of" is lowercased), but
184 // OF BANK OF AMERICA --> OF BANK of AMERICA (first "OF" is not
186 // lowercased because it's first word)
188 // Agreed with Ella, 26/11/15
189 if ((i > 0) && CATEGORY_CONJUNCTIONS.contains(lowerCase)) {
190 sb.append(lowerCase);
192 sb.append(WordUtils.capitalize(splitted));
196 str = sb.toString().trim();
201 public static String normalizeCategoryName4Uniqueness(String str) {
202 return str.toLowerCase();
205 public static boolean validateCategoryDisplayNameLength(String label) {
206 return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
209 public static boolean validateProductFullNameLength(String fullName) {
210 return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
213 public static boolean validateArtifactLabelLength(String label) {
214 return label.length() > 0 && label.length() <= ARTIFACT_LABEL_LENGTH;
217 public static boolean validateResourceInstanceNameLength(String resourceInstanceName) {
218 return StringUtils.isEmpty(resourceInstanceName) || resourceInstanceName.length() <= RSI_NAME_MAX_LENGTH;
221 public static boolean validateResourceInstanceName(String resourceInstanceName) {
222 return RSI_NAME_PATTERN.matcher(resourceInstanceName).matches();
225 public static boolean validateUrlLength(String url) {
226 return StringUtils.isEmpty(url) || url.length() <= API_URL_LENGTH;
229 public static boolean validateArtifactNameLength(String artifactName) {
230 return (artifactName.length() <= ARTIFACT_NAME_LENGTH && artifactName.length() > 0);
233 public static boolean validateComponentNamePattern(String componentName) {
234 return COMPONENT_NAME_PATTERN.matcher(componentName).matches();
237 public static boolean validateComponentNameLength(String componentName) {
238 return StringUtils.isEmpty(componentName) || componentName.length() <= COMPONENT_NAME_MAX_LENGTH;
241 public static boolean validateIcon(String icon) {
242 return ICON_PATTERN.matcher(icon).matches();
245 public static boolean validateIconLength(String icon) {
246 return StringUtils.isEmpty(icon) || icon.length() <= ICON_MAX_LENGTH;
249 public static boolean validateProjectCode(String projectCode) {
250 return PROJECT_CODE_PATTERN.matcher(projectCode).matches();
253 public static boolean validateProjectCodeLegth(String projectCode) {
254 return StringUtils.isEmpty(projectCode) || projectCode.length() <= PROJECT_CODE_MAX_LEGTH;
257 public static boolean validateContactId(String contactId) {
258 return CONTACT_ID_PATTERN.matcher(contactId).matches();
261 public static boolean validateCost(String cost) {
262 return COST_PATTERN.matcher(cost).matches();
265 public static String removeHtmlTags(String str) {
266 return Jsoup.clean(str, Safelist.none());
269 public static String removeAllTags(String htmlText) {
270 return TAGS_PATTERN.matcher(htmlText).replaceAll("").trim();
273 public static String normaliseWhitespace(String str) {
274 StringBuilder sb = new StringBuilder(str.length());
275 appendNormalisedWhitespace(sb, str, false);
276 return sb.toString();
279 private static void appendNormalisedWhitespace(StringBuilder accum, String string, boolean stripLeading) {
280 boolean lastWasWhite = false;
281 boolean reachedNonWhite = false;
282 int len = string.length();
284 for (int i = 0; i < len; i += Character.charCount(c)) {
285 c = string.codePointAt(i);
286 if (isWhitespace(c)) {
287 if ((stripLeading && !reachedNonWhite) || lastWasWhite) {
293 accum.appendCodePoint(c);
294 lastWasWhite = false;
295 reachedNonWhite = true;
300 private static boolean isWhitespace(int c) {
304 public static String stripOctets(String str) {
305 return OCTET_PATTERN.matcher(str).replaceAll("");
308 public static String removeNoneUtf8Chars(String input) {
309 return NONE_UTF8_PATTERN.matcher(input).replaceAll("");
312 public static boolean validateIsEnglish(String input) {
313 return ENGLISH_PATTERN.matcher(input).matches();
316 public static boolean validateIsAscii(String input) {
317 return CharMatcher.ascii().matchesAllOf(input);
320 public static String convertHtmlTagsToEntities(String input) {
321 return StringEscapeUtils.escapeHtml4(input);
324 public static List<String> removeDuplicateFromList(List<String> list) {
325 Set<String> hs = new LinkedHashSet<>(list);
331 public static boolean validateTagLength(String tag) {
333 return tag.length() <= TAG_MAX_LENGTH;
338 public static boolean validateTagListLength(int tagListLength) {
339 return tagListLength <= TAG_LIST_MAX_LENGTH;
342 public static boolean validateDescriptionLength(String description) {
343 return StringUtils.isEmpty(description) || description.length() <= COMPONENT_DESCRIPTION_MAX_LENGTH;
346 public static boolean validateListNotEmpty(List<?> list) {
347 if ((list == null) || (list.isEmpty())) {
353 public static boolean validateVendorName(String vendorName) {
354 return VENDOR_NAME_PATTERN.matcher(vendorName).matches();
357 public static boolean validateVendorNameLength(String vendorName) {
358 return StringUtils.isEmpty(vendorName) || vendorName.length() <= VENDOR_NAME_MAX_LENGTH;
361 public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) {
362 return StringUtils.isEmpty(resourceVendorModelNumber) || resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH;
365 public static boolean validateVendorRelease(String vendorRelease) {
366 return StringUtils.isEmpty(vendorRelease) || VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches();
369 public static boolean validateVendorReleaseLength(String vendorRelease) {
370 return StringUtils.isEmpty(vendorRelease) || vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH;
373 public static boolean validateServiceTypeLength(String serviceType) {
374 return StringUtils.isEmpty(serviceType) || serviceType.length() <= SERVICE_TYPE_MAX_LENGTH;
377 public static boolean validateServiceRoleLength(String serviceRole) {
378 return StringUtils.isEmpty(serviceRole) || serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH;
381 public static boolean validateServiceFunctionLength(String serviceFunction) {
382 return StringUtils.isEmpty(serviceFunction) || serviceFunction.length() <= SERVICE_FUNCTION_MAX_LENGTH;
385 public static boolean validateServiceNamingPolicyLength(String namingPolicy) {
386 return StringUtils.isEmpty(namingPolicy) || namingPolicy.length() <= SERVICE_NAMING_POLICY_MAX_SIZE;
389 public static boolean hasBeenCertified(String version) {
390 return NumberUtils.toDouble(version) >= 1;
393 public static String normaliseComponentName(String name) {
394 String[] split = splitComponentName(name);
395 StringBuilder sb = new StringBuilder();
396 for (String splitElement : split) {
397 sb.append(splitElement);
399 return sb.toString();
402 public static String normalizeComponentInstanceName(String name) {
403 String[] split = splitComponentInstanceName(name);
404 StringBuilder sb = new StringBuilder();
405 for (String splitElement : split) {
406 sb.append(splitElement);
408 return sb.toString();
411 private static String[] splitComponentName(String name) {
412 String normalizedName = name.toLowerCase();
413 normalizedName = COMPONENT_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
414 return normalizedName.split(" ");
417 private static String[] splitComponentInstanceName(String name) {
418 String normalizedName = name.toLowerCase();
419 normalizedName = COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
420 return normalizedName.split(" ");
423 public static String convertToSystemName(String name) {
424 String[] split = splitComponentName(name);
425 StringBuilder sb = new StringBuilder();
426 for (String splitElement : split) {
427 String capitalize = WordUtils.capitalize(splitElement);
428 sb.append(capitalize);
430 return sb.toString();
433 public static String normalizeFileName(String filename) {
434 return cleanFileName(filename);
437 private static String cleanFileName(String str) {
438 str = CLEAN_FILENAME_PATTERN.matcher(str).replaceAll("");
439 str = normaliseWhitespace(str);
440 str = SPACE_PATTERN.matcher(str).replaceAll("-");
441 str = DASH_PATTERN.matcher(str).replaceAll("-");
442 if (!YANG_MODULE_3GPP_PATTERN.matcher(str).matches()) {
443 str = StringUtils.strip(str, "-_ .");
448 public static boolean validateUrl(String url) {
449 UrlValidator urlValidator = new UrlValidator();
450 if (!urlValidator.isValid(url)) {
453 if (NONE_UTF8_PATTERN.matcher(url).find()) {
456 if (URL_INVALIDE_PATTERN.matcher(url).find()) {
462 public static String cleanArtifactDisplayName(String strIn) {
463 String str = DASH_PATTERN.matcher(strIn).replaceAll("-");
464 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
465 str = PLUS_PATTERN.matcher(str).replaceAll("+");
466 str = normaliseWhitespace(str);
471 public static String normalizeArtifactLabel(String strIn) {
472 String str = DASH_PATTERN.matcher(strIn).replaceAll("");
473 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
474 str = PLUS_PATTERN.matcher(str).replaceAll("");
475 str = SPACE_PATTERN.matcher(str).replaceAll("");
476 str = DOT_PATTERN.matcher(str).replaceAll("");
477 str = str.toLowerCase();
481 public static boolean validateAdditionalInformationKeyName(String str) {
482 return ADDITIONAL_INFORMATION_KEY_PATTERN.matcher(str).matches();
485 public static String normalizeAdditionalInformation(String str) {
487 str = DASH_PATTERN.matcher(str).replaceAll("-");
488 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
489 str = normaliseWhitespace(str);
494 public static boolean validateLength(String str, int length) {
498 return str.length() <= length;
501 public static boolean validateConsumerName(String consumerName) {
502 return CONSUMER_NAME_PATTERN.matcher(consumerName).matches();
505 public static boolean isUTF8Str(String str) {
506 if (NONE_UTF8_PATTERN.matcher(str).find()) {
512 public static boolean validateConsumerPassSalt(String consumerSalt) {
513 return CONSUMER_PASS_SALT_PATTERN.matcher(consumerSalt).matches();
516 public static boolean isFloatNumber(String number) {
517 return FLOAT_PATTERN.matcher(number).matches();
520 public static boolean validateCertifiedVersion(String version) {
521 return (version != null && CERTIFIED_VERSION_PATTERN.matcher(version).matches());
524 public static boolean validateMinorVersion(String version) {
525 return (version != null && MINOR_VERSION_PATTERN.matcher(version).matches());
528 public static boolean validateCategoryIconNotEmpty(List<String> categoryIcons) {
529 return CollectionUtils.isEmpty(categoryIcons);
532 public static String normaliseProductName(String name) {
533 String[] split = splitComponentName(PRODUCT_NAME_DELIMETER_PATTERN, name);
534 StringBuilder sb = new StringBuilder();
535 for (String splitElement : split) {
536 sb.append(splitElement);
538 return sb.toString();
541 private static String[] splitComponentName(Pattern pattern, String name) {
542 String normalizedName = name.toLowerCase();
543 normalizedName = pattern.matcher(normalizedName).replaceAll(" ");
544 return normalizedName.split(" ");
547 public static String removeHtmlTagsOnly(String htmlText) {
548 return HtmlCleaner.stripHtml(htmlText, false);
551 public static boolean validateForwardingPathNamePattern(String forwardingPathName) {
552 return FORWARDING_PATH_NAME_PATTERN.matcher(forwardingPathName).matches();
555 public static String sanitizeInputString(String input) {
556 if (StringUtils.isNotEmpty(input)) {
557 input = ValidationUtils.removeNoneUtf8Chars(input);
558 input = ValidationUtils.removeHtmlTags(input);
559 input = ValidationUtils.normaliseWhitespace(input);
560 input = ValidationUtils.stripOctets(input);