Skip to content

Commit

Permalink
Merge pull request #217 from oleg-nenashev/findbugs-cleanup/ClassFilt…
Browse files Browse the repository at this point in the history
…er-dead-store

[JENKINS-37566] - Get rid of the dead store in RegExpClassFilter#add()
  • Loading branch information
oleg-nenashev committed Nov 12, 2017
2 parents 02fc0a8 + 1d3b294 commit 239f635
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/hudson/remoting/ClassFilter.java
Expand Up @@ -217,12 +217,13 @@ void add(String pattern) throws ClassFilterException {
// this is a simple startsWith test, no need to slow things down with a regex
blacklistPatterns.add(pattern.substring(3, pattern.length() - 4));
} else {
final Pattern regex;
try {
Pattern regex = Pattern.compile(pattern);
regex = Pattern.compile(pattern);
} catch (PatternSyntaxException ex) {
throw new ClassFilterException("Cannot add RegExp class filter", ex);
}
blacklistPatterns.add(Pattern.compile(pattern));
blacklistPatterns.add(regex);
}
}

Expand Down

0 comments on commit 239f635

Please sign in to comment.