提交 721d323e 编写于 作者: O Oliver Gondža

Merge pull request #2023 from pjanouse/JENKINS-32852

[FIXED JENKINS-32852] Fixed possible ArrayIndexOutOfBoundsException
...@@ -694,16 +694,24 @@ public class Fingerprint implements ModelObject, Saveable { ...@@ -694,16 +694,24 @@ public class Fingerprint implements ModelObject, Saveable {
try { try {
if(s.contains("-")) { if(s.contains("-")) {
String[] tokens = Util.tokenize(s,"-"); 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 { } else {
int n = Integer.parseInt(s); int n = Integer.parseInt(s);
rs.ranges.add(new Range(n,n+1)); rs.ranges.add(new Range(n,n+1));
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
if (!skipError) if (!skipError)
throw new IllegalArgumentException("Unable to parse "+list); throw new IllegalArgumentException(
String.format("Unable to parse %s, expected number", list));
// ignore malformed text // ignore malformed text
} }
} }
return rs; return rs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册