Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JENKINS-29943: Check for empty param values
Adding an isEmpty() check after expanding the value of the
populateLabel, since a parameter value may be empty.
  • Loading branch information
stuartrowe committed Aug 14, 2015
1 parent 5f936ad commit 9dba27b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/org/jenkinsci/plugins/p4/tasks/CheckoutTask.java
Expand Up @@ -142,12 +142,14 @@ private Object getBuildChange(Workspace workspace) {
String populateLabel = populate.getPin();
if (populateLabel != null && !populateLabel.isEmpty()) {
// Expand label with environment vars if one was defined
populateLabel = expand.format(populateLabel, false);
try {
// if build is a change-number passed as a label
build = Integer.parseInt(populateLabel);
} catch (NumberFormatException e) {
build = populateLabel;
String expandedPopulateLabel = expand.format(populateLabel, false);
if(!expandedPopulateLabel.isEmpty()) {
try {
// if build is a change-number passed as a label
build = Integer.parseInt(expandedPopulateLabel);
} catch (NumberFormatException e) {
build = expandedPopulateLabel;
}
}
}

Expand Down

0 comments on commit 9dba27b

Please sign in to comment.