Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-19017] - FileParameter - Handle non-null file paramete…
…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
public boolean equals(Object obj) {
Expand All @@ -173,12 +174,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 fff888c

Please sign in to comment.