aboutsummaryrefslogtreecommitdiffstats
path: root/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java
blob: 08f0fc0505c4df2a8b232ee29599dde64b36146e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package org.onap.ccsdk.sli.core.utils;
import java.util.regex.Pattern;

public class PathValidator {
    public static boolean isValidXmlPath(String path) {
        Pattern allowList = Pattern.compile("[-.\\w/\\/]+\\.xml$");
        return (allowList.matcher(path).matches());
    }
    public static boolean isValidPropertiesPath(String path) {
        Pattern allowList = Pattern.compile("[-.\\w/\\/]+\\.properties$");
        return (allowList.matcher(path).matches());
    }
    public static boolean isValidFilePath(String path) {
        Pattern allowList = Pattern.compile("[-.\\w/\\/]+$");
        return (allowList.matcher(path).matches());
    }
}