diff options
author | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-12 22:56:51 +0100 |
---|---|---|
committer | Magdalena Grodzińska <mag.grodzinska@gmail.com> | 2020-01-12 22:56:51 +0100 |
commit | f6ada2aae355781e5e16534d3d2e7959cbac69c4 (patch) | |
tree | cd3a2a039fa6ca93e286a584a7c7774b5f24e23c /src/main/java | |
parent | a813ba681dc3fe4853da14ee6d1e61c495f79104 (diff) |
Separate query utils
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java b/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java new file mode 100644 index 0000000..6ec62f4 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/querysigner/QueryUtils.java @@ -0,0 +1,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"); + } + } +} |