re base code
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / common / util / ValidationUtils.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.common.util;
22
23 import com.google.common.base.CharMatcher;
24 import org.apache.commons.lang3.StringEscapeUtils;
25 import org.apache.commons.lang3.StringUtils;
26 import org.apache.commons.lang3.math.NumberUtils;
27 import org.apache.commons.lang3.text.WordUtils;
28 import org.apache.commons.validator.routines.UrlValidator;
29 import org.jsoup.Jsoup;
30 import org.jsoup.helper.StringUtil;
31 import org.jsoup.safety.Whitelist;
32
33 import java.util.*;
34 import java.util.regex.Pattern;
35
36 public class ValidationUtils {
37         public final static Integer COMPONENT_NAME_MAX_LENGTH = 1024;
38         public final static Pattern COMPONENT_NAME_PATTERN = Pattern
39                         .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (COMPONENT_NAME_MAX_LENGTH-1) + "}$");
40         public final static Integer ADDITIONAL_INFORMATION_KEY_MAX_LENGTH = 50;
41         public final static Pattern ADDITIONAL_INFORMATION_KEY_PATTERN = Pattern
42                         .compile("^[\\w\\s\\.\\-\\_]{1," + COMPONENT_NAME_MAX_LENGTH + "}$");
43         public final static Integer RSI_NAME_MAX_LENGTH = 1024;
44         public final static Pattern RSI_NAME_PATTERN = Pattern
45                         .compile("^[\\w \\s\\.\\-\\_\\:\\+]{1," + RSI_NAME_MAX_LENGTH + "}$");
46         public final static Integer COMMENT_MAX_LENGTH = 256;
47
48         public final static Integer ICON_MAX_LENGTH = 25;
49         public final static Pattern ICON_PATTERN = Pattern.compile("^[\\w\\-]{1," + ICON_MAX_LENGTH + "}$");
50         public final static Integer PROJECT_CODE_MAX_LEGTH = 50;
51         public final static Pattern PROJECT_CODE_PATTERN = Pattern.compile("^[\\s\\w_.-]{5,50}$");
52
53         // USER_ID format : aannnX (where a=a-z or A-Z, n=0-9, and X=a-z,A-Z, or 0-9)
54         public final static Integer CONNTACT_ID_MAX_LENGTH = 50;
55 //      public final static Pattern CONTACT_ID_PATTERN = Pattern
56 //                      .compile("[mM]{1}[0-9]{5}|[a-zA-Z]{2}[0-9]{4}|[a-zA-Z]{2}[0-9]{3}[a-zA-Z]{1}");
57         public final static Pattern CONTACT_ID_PATTERN = Pattern.compile("^[\\s\\w_.-]{1,50}$");
58         public final static Pattern OCTET_PATTERN = Pattern.compile("%[a-fA-F0-9]{2}");
59         public final static Pattern NONE_UTF8_PATTERN = Pattern.compile("[^\\x00-\\x7F]+");
60         public final static Pattern URL_INVALIDE_PATTERN = Pattern.compile("[,#?&@$<>~^`\\\\\\[\\]{}|\")(*!+=;%]+");// ,#?&@$<>~^`\\[]{}|")(*!
61
62         public final static Pattern ENGLISH_PATTERN = Pattern.compile("^[\\p{Graph}\\x20]+$");
63         public final static Integer COMPONENT_DESCRIPTION_MAX_LENGTH = 1024;
64         public final static Integer SERVICE_TYPE_MAX_LENGTH = 400;
65         public final static Integer SERVICE_ROLE_MAX_LENGTH = 400;
66
67         public final static Integer TAG_MAX_LENGTH = 1024;
68         public final static Integer TAG_LIST_MAX_LENGTH = 1024;
69         public final static Integer VENDOR_NAME_MAX_LENGTH = 60;
70         public final static Pattern VENDOR_NAME_PATTERN = Pattern
71                         .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
72         public final static Integer VENDOR_RELEASE_MAX_LENGTH = 25;
73         public final static Pattern VENDOR_RELEASE_PATTERN = Pattern
74                         .compile("^[\\x20-\\x21\\x23-\\x29\\x2B-\\x2E\\x30-\\x39\\x3B\\x3D\\x40-\\x5B\\x5D-\\x7B\\x7D-\\xFF]+$");
75         public final static Integer RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH = 65;
76
77         public final static Pattern CLEAN_FILENAME_PATTERN = Pattern.compile("[\\x00-\\x1f\\x80-\\x9f\\x5c/<?>\\*:|\"/]+");
78
79         public final static Pattern DASH_PATTERN = Pattern.compile("[-]+");
80         public final static Pattern UNDERSCORE_PATTERN = Pattern.compile("[_]+");
81         public final static Pattern PLUS_PATTERN = Pattern.compile("[+]+");
82         public final static Pattern SPACE_PATTERN = Pattern.compile("[ ]+");
83         public final static Pattern AMP_PATTERN = Pattern.compile("[&]+");
84         public final static Pattern DOT_PATTERN = Pattern.compile("[\\.]+");
85         public final static Pattern APOST_PATTERN = Pattern.compile("[']+");
86         public final static Pattern HASHTAG_PATTERN = Pattern.compile("[#]+");
87         public final static Pattern EQUAL_PATTERN = Pattern.compile("[=]+");
88         public final static Pattern COLON_PATTERN = Pattern.compile("[:]+");
89         public final static Pattern AT_PATTERN = Pattern.compile("[@]+");
90         public final static Pattern AND_PATTERN = Pattern.compile(" [aA][Nn][Dd] ");
91         public final static Set<String> CATEGORY_CONJUNCTIONS = new HashSet<>(
92             Arrays.asList("of", "to", "for", "as", "a", "an", "the"));
93
94         public final static Pattern COST_PATTERN = Pattern.compile("^[0-9]{1,5}\\.[0-9]{1,3}$");
95         public final static Pattern ARTIFACT_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9 \\-+]+$");
96         public final static Integer ARTIFACT_LABEL_LENGTH = 255;
97         public final static Pattern ARTIFACT_DISPLAY_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
98         public final static Pattern CATEGORY_LABEL_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9 &\\.'#=:@_\\-+]+$");
99         public final static Integer CATEGORY_LABEL_MIN_LENGTH = 4;
100         public final static Integer CATEGORY_LABEL_MAX_LENGTH = 25;
101
102         public final static Pattern COMPONENT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_]+");
103         public final static Pattern COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
104         public final static Pattern PRODUCT_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-\\_&=#@':\\[\\]\\+]+");
105         public final static Integer CONSUMER_NAME_MAX_LENGTH = 255;
106         // public final static Pattern CONSUMER_NAME_PATTERN =
107         // Pattern.compile("^[\\w]{1}?[\\w\\.\\-]{0," + CONSUMER_NAME_MAX_LENGTH +
108         // "}?$");
109         public final static Pattern CONSUMER_NAME_PATTERN = Pattern.compile("^[\\w]+[\\w\\.\\-]*$");
110         public final static Integer CONSUMER_SALT_LENGTH = 32;
111         public final static Integer CONSUMER_PASSWORD_LENGTH = 64;
112         public final static Pattern CONSUMER_PASS_SALT_PATTERN = Pattern.compile("^[a-z0-9]+$");
113         public final static Pattern FLOAT_PATTERN = Pattern.compile("^[\\d]+[\\.]{1}[\\d]+$");
114         public final static Pattern CERTIFIED_VERSION_PATTERN = Pattern.compile("^[1-9][0-9]*\\.0$");
115         public final static Pattern MINOR_VERSION_PATTERN = Pattern.compile("^0\\.[1-9][0-9]*$");
116         public final static Pattern TAGS_PATTERN = Pattern.compile("<[^><]*>");
117
118         public final static Integer ARTIFACT_NAME_LENGTH = 255;
119         public final static Integer API_URL_LENGTH = 100;
120         public final static Integer ARTIFACT_DESCRIPTION_MAX_LENGTH = 256;
121
122         public final static Integer PRODUCT_FULL_NAME_MIN_LENGTH = 4;
123         public final static Integer PRODUCT_FULL_NAME_MAX_LENGTH = 100;
124         public static final Integer FORWARDING_PATH_NAME_MAX_LENGTH = 100;
125         public final static Pattern FORWARDING_PATH_NAME_PATTERN = Pattern.compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (FORWARDING_PATH_NAME_MAX_LENGTH-1) + "}$");
126         
127         public final static Integer POLICY_MAX_LENGTH = 1024;
128         public final static Pattern POLICY_NAME_PATTERN = Pattern
129                         .compile("^[\\w][\\w \\.\\-\\_\\:\\+]{0," + (POLICY_MAX_LENGTH-1) + "}$");
130
131         public static boolean validateArtifactLabel(String label) {
132                 return ARTIFACT_LABEL_PATTERN.matcher(label).matches();
133         }
134         
135         public static boolean validateArtifactDisplayName(String displayName) {
136                 return ARTIFACT_DISPLAY_NAME_PATTERN.matcher(displayName).matches();
137         }
138
139         public static boolean validateCategoryDisplayNameFormat(String label) {
140                 boolean res = true;
141                 if (label != null) {
142                         label = label.trim();
143                         res = CATEGORY_LABEL_PATTERN.matcher(label).matches();
144                 }
145                 return res;
146         }
147
148         public static String normalizeCategoryName4Display(String str) {
149                 if (str != null) {
150                         str = str.trim();
151                         str = DASH_PATTERN.matcher(str).replaceAll("-");
152                         str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
153                         str = AMP_PATTERN.matcher(str).replaceAll("&");
154                         str = PLUS_PATTERN.matcher(str).replaceAll("+");
155                         str = DOT_PATTERN.matcher(str).replaceAll(".");
156                         str = APOST_PATTERN.matcher(str).replaceAll("'");
157                         str = HASHTAG_PATTERN.matcher(str).replaceAll("#");
158                         str = EQUAL_PATTERN.matcher(str).replaceAll("=");
159                         str = COLON_PATTERN.matcher(str).replaceAll(":");
160                         str = AT_PATTERN.matcher(str).replaceAll("@");
161                         str = normaliseWhitespace(str);
162                         str = AND_PATTERN.matcher(str).replaceAll(" & ");
163
164                         // Case normalizing
165                         StringBuilder sb = new StringBuilder();
166                         String[] split = str.split(" ");
167                         for (int i = 0; i < split.length; i++) {
168                                 String splitted = split[i];
169                                 String lowerCase = splitted.toLowerCase();
170                                 // BANK OF AMERICA --> BANK of AMERICA ("of" is lowercased), but
171                                 // OF BANK OF AMERICA --> OF BANK of AMERICA (first "OF" is not
172                                 // lowercased because it's first word)
173                                 // Agreed with Ella, 26/11/15
174                                 if ((i > 0) && CATEGORY_CONJUNCTIONS.contains(lowerCase)) {
175                                         sb.append(lowerCase);
176                                 } else {
177                                         sb.append(WordUtils.capitalize(splitted));
178                                 }
179                                 sb.append(" ");
180                         }
181                         str = sb.toString().trim();
182                 }
183                 return str;
184         }
185
186         public static String normalizeCategoryName4Uniqueness(String str) {
187                 return str.toLowerCase();
188         }
189
190         public static boolean validateCategoryDisplayNameLength(String label) {
191                 return (label != null && label.length() >= CATEGORY_LABEL_MIN_LENGTH
192                                 && label.length() <= CATEGORY_LABEL_MAX_LENGTH);
193         }
194
195         public static boolean validateProductFullNameLength(String fullName) {
196                 return (fullName != null && fullName.length() >= PRODUCT_FULL_NAME_MIN_LENGTH
197                                 && fullName.length() <= PRODUCT_FULL_NAME_MAX_LENGTH);
198         }
199
200         public static boolean validateArtifactLabelLength(String label) {
201                 return label.length() > 0 && label.length() <= ARTIFACT_LABEL_LENGTH;
202         }
203
204         public static boolean validateResourceInstanceNameLength(String resourceInstanceName) {
205                 return resourceInstanceName.length() <= RSI_NAME_MAX_LENGTH;
206         }
207
208         public static boolean validateResourceInstanceName(String resourceInstanceName) {
209                 return RSI_NAME_PATTERN.matcher(resourceInstanceName).matches();
210         }
211
212         public static boolean validateUrlLength(String url) {
213                 return url.length() <= API_URL_LENGTH;
214         }
215
216         public static boolean validateArtifactNameLength(String artifactName) {
217                 return (artifactName.length() <= ARTIFACT_NAME_LENGTH && artifactName.length() > 0);
218         }
219
220         public static boolean validateComponentNamePattern(String componentName) {
221                 return COMPONENT_NAME_PATTERN.matcher(componentName).matches();
222         }
223
224         public static boolean validateComponentNameLength(String componentName) {
225                 return componentName.length() <= COMPONENT_NAME_MAX_LENGTH;
226         }
227
228         public static boolean validateIcon(String icon) {
229                 return ICON_PATTERN.matcher(icon).matches();
230         }
231
232         public static boolean validateIconLength(String icon) {
233                 return icon.length() <= ICON_MAX_LENGTH;
234         }
235
236         public static boolean validateProjectCode(String projectCode) {
237                 return PROJECT_CODE_PATTERN.matcher(projectCode).matches();
238         }
239
240         public static boolean validateProjectCodeLegth(String projectCode) {
241                 return projectCode.length() <= PROJECT_CODE_MAX_LEGTH;
242         }
243
244         public static boolean validateContactId(String contactId) {
245                 return CONTACT_ID_PATTERN.matcher(contactId).matches();
246         }
247
248         public static boolean validateCost(String cost) {
249                 return COST_PATTERN.matcher(cost).matches();
250         }
251
252         public static String removeHtmlTags(String str) {
253                 return Jsoup.clean(str, Whitelist.none());
254         }
255
256         public static String removeAllTags(String htmlText) {
257
258         return TAGS_PATTERN.matcher(htmlText).replaceAll("").trim();
259         }
260
261         public static String normaliseWhitespace(String str) {
262                 return StringUtil.normaliseWhitespace(str);
263         }
264
265         public static String stripOctets(String str) {
266                 return OCTET_PATTERN.matcher(str).replaceAll("");
267         }
268
269         public static String removeNoneUtf8Chars(String input) {
270                 return NONE_UTF8_PATTERN.matcher(input).replaceAll("");
271         }
272
273         public static boolean validateIsEnglish(String input) {
274                 return ENGLISH_PATTERN.matcher(input).matches();
275         }
276
277         public static boolean validateIsAscii(String input) {
278
279         return CharMatcher.ASCII.matchesAllOf(input);
280         }
281
282         public static String convertHtmlTagsToEntities(String input) {
283                 return StringEscapeUtils.escapeHtml4(input);
284         }
285
286         public static List<String> removeDuplicateFromList(List<String> list) {
287                 Set<String> hs = new LinkedHashSet<>(list);
288                 list.clear();
289                 list.addAll(hs);
290                 return list;
291
292         }
293
294         public static boolean validateTagLength(String tag) {
295                 if (tag != null) {
296                         return tag.length() <= TAG_MAX_LENGTH;
297                 }
298                 return false;
299         }
300
301         public static boolean validateTagListLength(int tagListLength) {
302                 return tagListLength <= TAG_LIST_MAX_LENGTH;
303         }
304
305         public static boolean validateDescriptionLength(String description) {
306                 return description.length() <= COMPONENT_DESCRIPTION_MAX_LENGTH;
307         }
308
309         public static boolean validateStringNotEmpty(String value) {
310                 if ((value == null) || (value.isEmpty())) {
311                         return false;
312                 }
313                 return true;
314         }
315
316         public static boolean validateListNotEmpty(List<?> list) {
317                 if ((list == null) || (list.isEmpty())) {
318                         return false;
319                 }
320                 return true;
321         }
322
323         public static boolean validateVendorName(String vendorName) {
324                 return VENDOR_NAME_PATTERN.matcher(vendorName).matches();
325         }
326
327         public static boolean validateVendorNameLength(String vendorName) {
328                 return vendorName.length() <= VENDOR_NAME_MAX_LENGTH;
329         }
330
331         public static boolean validateResourceVendorModelNumberLength(String resourceVendorModelNumber) {
332                 return resourceVendorModelNumber.length() <= RESOURCE_VENDOR_MODEL_NUMBER_MAX_LENGTH;
333         }
334         
335         public static boolean validateVendorRelease(String vendorRelease) {
336                 return VENDOR_RELEASE_PATTERN.matcher(vendorRelease).matches();
337         }
338
339         public static boolean validateVendorReleaseLength(String vendorRelease) {
340                 return vendorRelease.length() <= VENDOR_RELEASE_MAX_LENGTH;
341         }
342         
343         public static boolean validateServiceTypeLength(String serviceType) {
344                 return serviceType.length() <= SERVICE_TYPE_MAX_LENGTH;
345         }
346         
347         public static boolean validateServiceRoleLength(String serviceRole) {
348                 return serviceRole.length() <= SERVICE_ROLE_MAX_LENGTH;
349         }
350
351
352
353         public static boolean hasBeenCertified(String version) {
354                 return NumberUtils.toDouble(version) >= 1;
355         }
356
357         public static String normaliseComponentName(String name) {
358                 String[] split = splitComponentName(name);
359                 StringBuffer sb = new StringBuffer();
360                 for (String splitElement : split) {
361                         sb.append(splitElement);
362                 }
363                 return sb.toString();
364
365         }
366
367         public static String normalizeComponentInstanceName(String name) {
368                 String[] split = splitComponentInstanceName(name);
369                 StringBuffer sb = new StringBuffer();
370                 for (String splitElement : split) {
371                         sb.append(splitElement);
372                 }
373                 return sb.toString();
374
375         }
376
377         private static String[] splitComponentName(String name) {
378                 String normalizedName = name.toLowerCase();
379                 normalizedName = COMPONENT_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
380         return normalizedName.split(" ");
381         }
382
383         private static String[] splitComponentInstanceName(String name) {
384                 String normalizedName = name.toLowerCase();
385                 normalizedName = COMPONENT_INCTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
386         return normalizedName.split(" ");
387         }
388
389         public static String convertToSystemName(String name) {
390                 String[] split = splitComponentName(name);
391                 StringBuffer sb = new StringBuffer();
392                 for (String splitElement : split) {
393                         String capitalize = WordUtils.capitalize(splitElement);
394                         sb.append(capitalize);
395                 }
396                 return sb.toString();
397         }
398
399         public static String normalizeFileName(String filename) {
400                 // String[] split = filename.split(Pattern.quote(File.separator));
401                 // String name = "";
402                 //
403                 // name = split[split.length - 1];
404                 return cleanFileName(filename);
405
406         }
407
408         private static String cleanFileName(String str) {
409                 str = CLEAN_FILENAME_PATTERN.matcher(str).replaceAll("");
410                 str = normaliseWhitespace(str);
411                 str = SPACE_PATTERN.matcher(str).replaceAll("-");
412                 str = DASH_PATTERN.matcher(str).replaceAll("-");
413                 str = StringUtils.strip(str, "-_ .");
414
415                 return str;
416         }
417
418         public static boolean validateUrl(String url) {
419
420                 UrlValidator urlValidator = new UrlValidator();
421                 if (!urlValidator.isValid(url)) {
422                         return false;
423                 }
424                 if (NONE_UTF8_PATTERN.matcher(url).find()) {
425                         return false;
426                 }
427
428                 if (URL_INVALIDE_PATTERN.matcher(url).find()) {
429                         return false;
430                 }
431                 return true;
432
433         }
434
435         public static String cleanArtifactDisplayName(String strIn) {
436                 String str = DASH_PATTERN.matcher(strIn).replaceAll("-");
437                 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
438                 str = PLUS_PATTERN.matcher(str).replaceAll("+");
439                 str = normaliseWhitespace(str);
440                 str = str.trim();
441                 // str = str.replaceAll(" ", "");
442
443                 return str;
444         }
445
446         public static String normalizeArtifactLabel(String strIn) {
447
448                 String str = DASH_PATTERN.matcher(strIn).replaceAll("");
449                 str = UNDERSCORE_PATTERN.matcher(str).replaceAll("");
450                 str = PLUS_PATTERN.matcher(str).replaceAll("");
451                 str = SPACE_PATTERN.matcher(str).replaceAll("");
452                 str = DOT_PATTERN.matcher(str).replaceAll("");
453                 str = str.toLowerCase();
454
455                 return str;
456         }
457
458         public static boolean validateAdditionalInformationKeyName(String str) {
459                 return ADDITIONAL_INFORMATION_KEY_PATTERN.matcher(str).matches();
460         }
461
462         public static String normalizeAdditionalInformation(String str) {
463                 if (str != null) {
464                         str = DASH_PATTERN.matcher(str).replaceAll("-");
465                         str = UNDERSCORE_PATTERN.matcher(str).replaceAll("_");
466                         str = normaliseWhitespace(str);
467                 }
468                 return str;
469         }
470
471         public static boolean validateLength(String str, int length) {
472                 if (str == null) {
473                         return true;
474                 }
475                 return str.length() <= length;
476         }
477
478         public static boolean validateConsumerName(String consumerName) {
479                 return CONSUMER_NAME_PATTERN.matcher(consumerName).matches();
480         }
481
482         public static boolean isUTF8Str(String str) {
483                 if (NONE_UTF8_PATTERN.matcher(str).find()) {
484                         return false;
485                 }
486                 return true;
487         }
488
489         public static boolean validateConsumerPassSalt(String consumerSalt) {
490                 return CONSUMER_PASS_SALT_PATTERN.matcher(consumerSalt).matches();
491         }
492
493         public static boolean isFloatNumber(String number) {
494                 return FLOAT_PATTERN.matcher(number).matches();
495         }
496
497         public static boolean validateCertifiedVersion(String version) {
498                 return (version != null && CERTIFIED_VERSION_PATTERN.matcher(version).matches());
499         }
500
501         public static boolean validateMinorVersion(String version) {
502                 return (version != null && MINOR_VERSION_PATTERN.matcher(version).matches());
503         }
504
505         public static String normaliseProductName(String name) {
506                 String[] split = splitComponentName(PRODUCT_NAME_DELIMETER_PATTERN, name);
507                 StringBuffer sb = new StringBuffer();
508                 for (String splitElement : split) {
509                         sb.append(splitElement);
510                 }
511                 return sb.toString();
512
513         }
514
515         private static String[] splitComponentName(Pattern pattern, String name) {
516                 String normalizedName = name.toLowerCase();
517                 normalizedName = pattern.matcher(normalizedName).replaceAll(" ");
518         return normalizedName.split(" ");
519         }
520
521         public static String removeHtmlTagsOnly(String htmlText) {
522         return HtmlCleaner.stripHtml(htmlText, false);
523         }
524
525         public static boolean validateForwardingPathNamePattern(String forwardingPathName) {
526                 return FORWARDING_PATH_NAME_PATTERN.matcher(forwardingPathName).matches();
527         }
528 }