Navigation Menu

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>
  • Loading branch information
oleg-nenashev committed Sep 28, 2014
1 parent b6a15f5 commit 7c4f6b7
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 @@ -160,7 +160,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
public boolean equals(Object obj) {
Expand All @@ -171,12 +172,13 @@ public boolean equals(Object obj) {
if (getClass() != obj.getClass())
return false;
FileParameterValue other = (FileParameterValue) obj;
if (location == null) {
if (other.location != null)
return false;
} else if (!location.equals(other.location))
return false;
return true;

if (location == null && other.location == null)
return true; // Consider null parameters as equal

//TODO: check fingerprints or checksums to improve the behavior
// Return false even if files are equal
return false;
}

@Override
Expand Down

0 comments on commit 7c4f6b7

Please sign in to comment.