Skip to content
Permalink
Browse files
Merge pull request #2023 from pjanouse/JENKINS-32852
[FIXED JENKINS-32852] Fixed possible ArrayIndexOutOfBoundsException
  • Loading branch information
olivergondza committed Feb 19, 2016
2 parents 90d7479 + 0f89ef4 commit 721d323e75ce4b1e65d3ba6875dc124b1bdba698
Showing with 11 additions and 3 deletions.
  1. +11 −3 core/src/main/java/hudson/model/Fingerprint.java
@@ -694,16 +694,24 @@ public static RangeSet fromString(String list, boolean skipError) {
try {
if(s.contains("-")) {
String[] tokens = Util.tokenize(s,"-");
rs.ranges.add(new Range(Integer.parseInt(tokens[0]),Integer.parseInt(tokens[1])+1));
if (tokens.length == 2) {
rs.ranges.add(new Range(Integer.parseInt(tokens[0]), Integer.parseInt(tokens[1]) + 1));
} else {
if (!skipError) {
throw new IllegalArgumentException(
String.format("Unable to parse %s, expected string with a range M-N", list));
}
// ignore malformed text like "1-10-50"
}
} else {
int n = Integer.parseInt(s);
rs.ranges.add(new Range(n,n+1));
}
} catch (NumberFormatException e) {
if (!skipError)
throw new IllegalArgumentException("Unable to parse "+list);
throw new IllegalArgumentException(
String.format("Unable to parse %s, expected number", list));
// ignore malformed text

}
}
return rs;

0 comments on commit 721d323

Please sign in to comment.