Skip to content

Commit

Permalink
[FIXED JENKINS-25849] Do not log if parsing a blank string to int fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sschuberth committed May 7, 2015
1 parent b2da484 commit e7bab51
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/hudson/plugins/plot/Plot.java
Expand Up @@ -356,7 +356,7 @@ public String getNumBuilds() {
*/
private void setRightBuildNum(StaplerRequest req) {
String build = req.getParameter("rightbuildnum");
if (build == null) {
if (StringUtils.isBlank(build)) {
rightBuildNum = Integer.MAX_VALUE;
} else {
try {
Expand Down Expand Up @@ -634,13 +634,20 @@ public String toString() {
url = record[4];
dataset.setValue(value, url, series, xlabel);
}

String urlNumBuilds = getURLNumBuilds();
int numBuilds;
try {
numBuilds = Integer.parseInt(getURLNumBuilds());
} catch (NumberFormatException nfe) {
LOGGER.log(Level.SEVERE, "Exception converting to integer", nfe);
if (StringUtils.isBlank(urlNumBuilds)) {
numBuilds = Integer.MAX_VALUE;
} else {
try {
numBuilds = Integer.parseInt(urlNumBuilds);
} catch (NumberFormatException nfe) {
LOGGER.log(Level.SEVERE, "Exception converting to integer", nfe);
numBuilds = Integer.MAX_VALUE;
}
}

dataset.clipDataset(numBuilds);
plot = createChart(dataset);
CategoryPlot categoryPlot = (CategoryPlot) plot.getPlot();
Expand Down

0 comments on commit e7bab51

Please sign in to comment.