From c57d2fe42586bac5fc57460574347a6f07b58328 Mon Sep 17 00:00:00 2001 From: gmantele <gmantele@ari.uni-heidelberg.de> Date: Wed, 8 Jul 2015 18:38:08 +0200 Subject: [PATCH] [UWS] Minor modification: display array parameters properly in the log output. For that the function UWSToolBox.getParamsMap(...) had to be modified. --- buildUWS.xml | 2 +- src/uws/UWSToolBox.java | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/buildUWS.xml b/buildUWS.xml index d6ddd7f..2f1a9fb 100644 --- a/buildUWS.xml +++ b/buildUWS.xml @@ -2,7 +2,7 @@ <!DOCTYPE project> <project name="uws" basedir="." default="buildLib"> - <property name="version" value="4.1" /> + <property name="version" value="4.2" /> <property name="srcDir" value="src" /> <property name="libDir" value="lib" /> diff --git a/src/uws/UWSToolBox.java b/src/uws/UWSToolBox.java index 34bb155..e622c56 100644 --- a/src/uws/UWSToolBox.java +++ b/src/uws/UWSToolBox.java @@ -26,6 +26,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; +import java.lang.reflect.Array; import java.net.MalformedURLException; import java.net.URL; import java.net.URLDecoder; @@ -54,7 +55,7 @@ import uws.service.request.UploadFile; * Some useful functions for the managing of a UWS service. * * @author Grégory Mantelet (CDS;ARI) - * @version 4.1 (04/2015) + * @version 4.2 (07/2015) */ public class UWSToolBox { @@ -148,8 +149,20 @@ public class UWSToolBox { // Transform the map of Objects into a map of Strings: for(Map.Entry<String,Object> e : params.entrySet()){ - if (e.getValue() != null) - map.put(e.getKey(), e.getValue().toString()); + if (e.getValue() != null){ + if (e.getValue().getClass().isArray()){ + StringBuffer str = new StringBuffer(); + Object array = e.getValue(); + int length = Array.getLength(array); + for(int i = 0; i < length; i++){ + if (i > 0) + str.append(';'); + str.append(Array.get(array, i)); + } + map.put(e.getKey(), str.toString()); + }else + map.put(e.getKey(), e.getValue().toString()); + } } // Return the fetched map: -- GitLab