From fa7806a71c291c7ef539231e7e22a0ca642b2139 Mon Sep 17 00:00:00 2001
From: gmantele <gmantele@ari.uni-heidelberg.de>
Date: Fri, 12 Dec 2014 20:12:21 +0100
Subject: [PATCH] [TAP] Fix bug with the UPLOAD parameter: on any job parameter
 modification (with a 2nd http request), the UPLOAD parameter was deleted

---
 src/tap/parameters/DALIUpload.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/tap/parameters/DALIUpload.java b/src/tap/parameters/DALIUpload.java
index 3356510..71694b8 100644
--- a/src/tap/parameters/DALIUpload.java
+++ b/src/tap/parameters/DALIUpload.java
@@ -323,9 +323,9 @@ public class DALIUpload {
 						uploads.add(upl);
 						if (!upl.isByReference())
 							usedFiles.add(upl.file.paramName);
-
-						// CASE String: it must be parsed and transformed into a DALIUpload item which will be then added inside the list:
-					}else if (value instanceof String)
+					}
+					// CASE String: it must be parsed and transformed into a DALIUpload item which will be then added inside the list:
+					else if (value instanceof String)
 						fetchDALIUploads(uploads, usedFiles, (String)value, requestParams, allowTAPSyntax, fileManager);
 
 					// CASE Array: 
@@ -382,7 +382,8 @@ public class DALIUpload {
 		}
 
 		// 3. Re-add a new "UPLOAD" parameter gathering all extracted DALI Uploads:
-		requestParams.put("UPLOAD", uploads.toArray(new DALIUpload[uploads.size()]));
+		if (uploads.size() > 0)
+			requestParams.put("UPLOAD", uploads.toArray(new DALIUpload[uploads.size()]));
 
 		return uploads;
 	}
-- 
GitLab