From fff888cc822f235dde8ebdd01152c626e85a12b2 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Sun, 28 Sep 2014 18:11:57 +0400 Subject: [PATCH] [FIXED JENKINS-19017] - FileParameter - Handle non-null file parameters 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 (cherry picked from commit 7c4f6b7ef433f4a3d85707096f9e5f8b366f232a) --- .../java/hudson/model/FileParameterValue.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/hudson/model/FileParameterValue.java b/core/src/main/java/hudson/model/FileParameterValue.java index c9303fabe552..6669895bc4d6 100644 --- a/core/src/main/java/hudson/model/FileParameterValue.java +++ b/core/src/main/java/hudson/model/FileParameterValue.java @@ -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 JENKINS-19017 issue (wrong merge of builds in the queue). */ @Override public boolean equals(Object obj) { @@ -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