Skip to content

Commit

Permalink
Merge pull request #17 from stuartrowe/master
Browse files Browse the repository at this point in the history
JENKINS-29943: Check for empty param values
  • Loading branch information
p4paul committed Aug 19, 2015
2 parents 2ad1c6a + 9dba27b commit 796ace0
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 796ace0

Please sign in to comment.