Skip to content

Commit

Permalink
[FIXED JENKINS-19017] - FileParameter - Handle non-null file paramete…
Browse files Browse the repository at this point in the history
…rs as different values

The change prevents the issue when Jenkins merges builds with different files coming from one source (It may happen!).

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
(cherry picked from commit 7c4f6b7)
  • Loading branch information
oleg-nenashev authored and olivergondza committed Nov 7, 2014
1 parent b73bb3d commit fff888c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions core/src/main/java/hudson/model/FileParameterValue.java
Expand Up @@ -162,7 +162,8 @@ public int hashCode() {
} }


/** /**
* In practice this will always be false, since location should be unique. * Compares file parameters (existing files will be considered as different).
* Function has been modified in order to avoid <a href="https://issues.jenkins-ci.org/browse/JENKINS-19017">JENKINS-19017</a> issue (wrong merge of builds in the queue).
*/ */
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
Expand All @@ -173,12 +174,13 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
FileParameterValue other = (FileParameterValue) obj; FileParameterValue other = (FileParameterValue) obj;
if (location == null) {
if (other.location != null) if (location == null && other.location == null)
return false; return true; // Consider null parameters as equal
} else if (!location.equals(other.location))
return false; //TODO: check fingerprints or checksums to improve the behavior
return true; // Return false even if files are equal
return false;
} }


@Override @Override
Expand Down

0 comments on commit fff888c

Please sign in to comment.