Skip to content
This repository was archived by the owner on May 28, 2018. It is now read-only.

Commit 461db69

Browse files
committed
Apply changes from Marek's final review patch to branch. Happy with changes.
1 parent db98401 commit 461db69

File tree

13 files changed

+764
-653
lines changed

13 files changed

+764
-653
lines changed

core-common/src/main/java/org/glassfish/jersey/uri/PathPattern.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
package org.glassfish.jersey.uri;
4141

4242
import java.util.Comparator;
43-
import java.util.regex.MatchResult;
4443

4544
/**
4645
* A path pattern that is a regular expression generated from a URI path
@@ -65,11 +64,11 @@ public final class PathPattern extends PatternWithGroups {
6564
* Path pattern matching the end of a URI path. Can be either empty {@code ""}
6665
* or contain a trailing slash {@code "/"}.
6766
*/
68-
public static final PathPattern END_OF_PATH_PATTERN = new PathPattern("", PathPattern.RightHandPath.capturingZeroSegments);
67+
public static final PathPattern END_OF_PATH_PATTERN = new PathPattern("", PathPattern.RightHandPath.capturingZeroSegments);
6968
/**
7069
* Path pattern matching the any URI path.
7170
*/
72-
public static final PathPattern OPEN_ROOT_PATH_PATTERN = new PathPattern("", RightHandPath.capturingZeroOrMoreSegments);
71+
public static final PathPattern OPEN_ROOT_PATH_PATTERN = new PathPattern("", RightHandPath.capturingZeroOrMoreSegments);
7372
/**
7473
* Path pattern comparator that defers to {@link UriTemplate#COMPARATOR comparing
7574
* the templates} associated with the patterns.
@@ -120,6 +119,7 @@ private String getRegex() {
120119
public static PathPattern asClosed(PathPattern pattern) {
121120
return new PathPattern(pattern.getTemplate().getTemplate(), RightHandPath.capturingZeroSegments);
122121
}
122+
123123
//
124124
private final UriTemplate template;
125125

@@ -133,7 +133,6 @@ private PathPattern() {
133133
* {@link RightHandPath#capturingZeroOrMoreSegments}.
134134
*
135135
* @param template the path template.
136-
*
137136
* @see #PathPattern(String, PathPattern.RightHandPath)
138137
*/
139138
public PathPattern(String template) {
@@ -145,7 +144,6 @@ public PathPattern(String template) {
145144
* {@link RightHandPath#capturingZeroOrMoreSegments}.
146145
*
147146
* @param template the path template
148-
*
149147
* @see #PathPattern(PathTemplate, PathPattern.RightHandPath)
150148
*/
151149
public PathPattern(PathTemplate template) {
@@ -159,7 +157,7 @@ public PathPattern(PathTemplate template) {
159157
* Create a path pattern and post fix with a right hand path pattern.
160158
*
161159
* @param template the path template.
162-
* @param rhpp the right hand path pattern postfix.
160+
* @param rhpp the right hand path pattern postfix.
163161
*/
164162
public PathPattern(String template, RightHandPath rhpp) {
165163
this(new PathTemplate(template), rhpp);
@@ -169,7 +167,7 @@ public PathPattern(String template, RightHandPath rhpp) {
169167
* Create a path pattern and post fix with a right hand path pattern.
170168
*
171169
* @param template the path template.
172-
* @param rhpp the right hand path pattern postfix.
170+
* @param rhpp the right hand path pattern postfix.
173171
*/
174172
public PathPattern(PathTemplate template, RightHandPath rhpp) {
175173
super(postfixWithCapturingGroup(template.getPattern().getRegex(), rhpp),
@@ -194,15 +192,15 @@ private static String postfixWithCapturingGroup(String regex, RightHandPath rhpp
194192
return regex + rhpp.getRegex();
195193
}
196194

197-
private static int[] addIndexForRightHandPathCapturingGroup(int numberOfGroups, int[] indexes) {
195+
private static int[] addIndexForRightHandPathCapturingGroup(int numberOfGroups, int[] indexes) {
198196
if (indexes.length == 0) {
199197
return indexes;
200198
}
201-
199+
202200
int[] cgIndexes = new int[indexes.length + 1];
203201
System.arraycopy(indexes, 0, cgIndexes, 0, indexes.length);
204202

205-
cgIndexes[indexes.length] = numberOfGroups +1;
203+
cgIndexes[indexes.length] = numberOfGroups + 1;
206204
return cgIndexes;
207205
}
208206
}

core-common/src/main/java/org/glassfish/jersey/uri/PatternWithGroups.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public PatternWithGroups(final String regex) throws PatternSyntaxException {
9797
/**
9898
* Construct a new pattern.
9999
*
100-
* @param regex the regular expression. If the expression is {@code null} or an empty string then the pattern will only
100+
* @param regex the regular expression. If the expression is {@code null} or an empty string then the pattern will
101+
* only
101102
* match
102103
* a {@code null} or empty string.
103104
* @param groupIndexes the array of group indexes to capturing groups.
@@ -351,7 +352,7 @@ public final boolean match(final CharSequence cs, final List<String> groupValues
351352
* @throws IllegalArgumentException if group values is {@code null}.
352353
*/
353354
public final boolean match(final CharSequence cs, final List<String> groupNames, final Map<String,
354-
String> groupValues) throws IllegalArgumentException {
355+
String> groupValues) throws IllegalArgumentException {
355356
if (groupValues == null) {
356357
throw new IllegalArgumentException();
357358
}
@@ -371,8 +372,7 @@ public final boolean match(final CharSequence cs, final List<String> groupNames,
371372

372373
// Assign the matched group values to group names
373374
groupValues.clear();
374-
375-
375+
376376
for (int i = 0; i < groupNames.size(); i++) {
377377
String name = groupNames.get(i);
378378
String currentValue = m.group((groupIndexes.length > 0) ? groupIndexes[i] : i + 1);

0 commit comments

Comments
 (0)