Skip to content

Commit

Permalink
Reduce difference due to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEWaite committed Jan 21, 2024
1 parent c6650e1 commit 02e1fb3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/main/java/hudson/plugins/copyartifact/CopyArtifact.java
Original file line number Diff line number Diff line change
Expand Up @@ -376,29 +376,27 @@ public boolean getIncludeBuildNumberInTargetPath() {
}

private boolean upgradeIfNecessary(AbstractProject<?,?> job) throws IOException {
int i;

if (isUpgradeNeeded()) {
Jenkins jenkins = Jenkins.getInstanceOrNull();
if (jenkins == null) {
LOGGER.log(Level.SEVERE, "Upgrading copyartifact is required for {0} but Jenkins instance is unavailable", job.getDisplayName());

Check warning on line 382 in src/main/java/hudson/plugins/copyartifact/CopyArtifact.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 382 is not covered by tests
return false;
}


int i;
if (projectName != null) {

Check warning on line 387 in src/main/java/hudson/plugins/copyartifact/CopyArtifact.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 387 is only partially covered, one branch is missing
i = projectName.lastIndexOf('/');
} else {
throw new IllegalArgumentException("projectName cannot be null");

Check warning on line 390 in src/main/java/hudson/plugins/copyartifact/CopyArtifact.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 390 is not covered by tests
}

if (i != -1 && projectName.indexOf('=', i) != -1 && /* not matrix */jenkins.getItem(projectName, job.getParent(), Job.class) == null) {
project = projectName.substring(0, i);
parameters = projectName.substring(i + 1);
} else {
project = projectName;
parameters = null;
}

LOGGER.log(Level.INFO, "Split {0} into {1} with parameters {2}", new Object[] {projectName, project, parameters});
projectName = null;
job.save();
Expand All @@ -407,7 +405,6 @@ private boolean upgradeIfNecessary(AbstractProject<?,?> job) throws IOException
return false;
}
}


private boolean isUpgradeNeeded() {
return projectName != null;
Expand Down

0 comments on commit 02e1fb3

Please sign in to comment.