Skip to content
Permalink
Browse files
Use Pattern.quote() for compiled split patterns
  • Loading branch information
ngmr committed May 28, 2015
1 parent 5aad681 commit 84e3770f74c89ab652e742c8fca89cd139319b4f
Showing 1 changed file with 3 additions and 4 deletions.
@@ -96,8 +96,8 @@ private static Class<?> toClass(final QueryImpl query) {
return result;
}

private static final Pattern dotPattern = Pattern.compile("\\.");
private static final Pattern slashPattern = Pattern.compile("/");
private static final Pattern dotPattern = Pattern.compile(Pattern.quote("."));
private static final Pattern slashPattern = Pattern.compile(Pattern.quote("/"));

private static String toClassName(QueryImpl query) {
final String repid = query.repid;
@@ -143,8 +143,7 @@ private static String idlToClassName(final String repid) {
String[] elems = dotPattern.split(prefix);
Collections.reverse(Arrays.asList(elems)); //reverses the order in the underlying array - i.e. 'elems'
for (String elem: elems) {
sb.append(fixName(elem));
sb.append('.');
sb.append(fixName(elem)).append('.');
}

s = s.substring(firstSlash + 1);

0 comments on commit 84e3770

Please sign in to comment.