From 3ca9cf3aa73c3f36403de4b3a5353450970c183e Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 30 Aug 2011 11:21:28 +0100 Subject: [PATCH] JAL-715 need to URLencode constant values when serializing them to ensure URL string is valid --- src/jalview/ws/rest/params/JobConstant.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jalview/ws/rest/params/JobConstant.java b/src/jalview/ws/rest/params/JobConstant.java index fddfd3b..64bb45f 100644 --- a/src/jalview/ws/rest/params/JobConstant.java +++ b/src/jalview/ws/rest/params/JobConstant.java @@ -6,6 +6,7 @@ import jalview.ws.rest.NoValidInputDataException; import jalview.ws.rest.RestJob; import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; @@ -49,7 +50,13 @@ public class JobConstant extends InputType if (value!=null && value.length()>0) { - prm.add(value); + try { + prm.add(URLEncoder.encode(value,"UTF-8")); + } catch (UnsupportedEncodingException ex) + { + throw new Error("Couldn't encode '"+value+"' as UTF-8.",ex); + + } } return prm; } -- 1.7.10.2