Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 299af7a

Browse filesBrowse files
Claudenwslachiewicz
authored andcommitted
changes for RAT
1 parent de43144 commit 299af7a
Copy full SHA for 299af7a

File tree

Expand file treeCollapse file tree

3 files changed

+33
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+33
-2
lines changed

‎src/main/java/org/codehaus/plexus/util/MatchPattern.java

Copy file name to clipboardExpand all lines: src/main/java/org/codehaus/plexus/util/MatchPattern.java
+9-1Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ private MatchPattern(String source, String separator) {
5858
}
5959
}
6060

61+
/**
62+
* Gets the source pattern for this matchpattern.
63+
* @return the source string without Ant or Regex pattern markers.
64+
*/
65+
public String getSource() {
66+
return source;
67+
}
68+
6169
public boolean matchPath(String str, boolean isCaseSensitive) {
6270
if (regexPattern != null) {
6371
return str.matches(regexPattern);
@@ -99,7 +107,7 @@ public boolean startsWith(String string) {
99107
return source.startsWith(string);
100108
}
101109

102-
static String[] tokenizePathToString(String path, String separator) {
110+
public static String[] tokenizePathToString(String path, String separator) {
103111
List<String> ret = new ArrayList<String>();
104112
StringTokenizer st = new StringTokenizer(path, separator);
105113
while (st.hasMoreTokens()) {

‎src/main/java/org/codehaus/plexus/util/MatchPatterns.java

Copy file name to clipboardExpand all lines: src/main/java/org/codehaus/plexus/util/MatchPatterns.java
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ private MatchPatterns(MatchPattern[] patterns) {
1616
this.patterns = patterns;
1717
}
1818

19+
/**
20+
* Gets a list of enclosed MatchPattern sources.
21+
* @return A list of enclosed MatchPattern sources.
22+
*/
23+
public List<String> getSources() {
24+
List<String> sources = new ArrayList<>();
25+
for (MatchPattern pattern : patterns) {
26+
sources.add(pattern.getSource());
27+
}
28+
return sources;
29+
}
30+
1931
/**
2032
* <p>Checks these MatchPatterns against a specified string.</p>
2133
*

‎src/main/java/org/codehaus/plexus/util/SelectorUtils.java

Copy file name to clipboardExpand all lines: src/main/java/org/codehaus/plexus/util/SelectorUtils.java
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,17 @@ public static boolean matchPath(String pattern, String str, String separator, bo
243243
}
244244
}
245245

246+
public static String extractPattern(final String pattern, final String separator) {
247+
if (isRegexPrefixedPattern(pattern)) {
248+
return pattern.substring(REGEX_HANDLER_PREFIX.length(), pattern.length() - PATTERN_HANDLER_SUFFIX.length());
249+
} else {
250+
String localPattern = isAntPrefixedPattern(pattern)
251+
? pattern.substring(ANT_HANDLER_PREFIX.length(), pattern.length() - PATTERN_HANDLER_SUFFIX.length())
252+
: pattern;
253+
return toOSRelatedPath(localPattern, separator);
254+
}
255+
}
256+
246257
private static String toOSRelatedPath(String pattern, String separator) {
247258
if ("/".equals(separator)) {
248259
return pattern.replace("\\", separator);
@@ -253,7 +264,7 @@ private static String toOSRelatedPath(String pattern, String separator) {
253264
return pattern;
254265
}
255266

256-
static boolean isRegexPrefixedPattern(String pattern) {
267+
public static boolean isRegexPrefixedPattern(String pattern) {
257268
return pattern.length() > (REGEX_HANDLER_PREFIX.length() + PATTERN_HANDLER_SUFFIX.length() + 1)
258269
&& pattern.startsWith(REGEX_HANDLER_PREFIX)
259270
&& pattern.endsWith(PATTERN_HANDLER_SUFFIX);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.