m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java
blob: 6ec62f4b1eb00e9bb98526a1cd97beb7202d6e50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package pl.edu.mimuw.cloudatlas.querysigner;

import java.rmi.RemoteException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class QueryUtils {

    public static void validateQueryName(String queryName) throws RemoteException {
        Pattern queryNamePattern = Pattern.compile("&[a-zA-Z][\\w_]*");
        Matcher matcher = queryNamePattern.matcher(queryName);
        if (!matcher.matches()) {
            throw new RemoteException("Invalid query identifier");
        }
    }
}