JAL-715 need to URLencode constant values when serializing them to ensure URL string...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 30 Aug 2011 10:21:28 +0000 (11:21 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 30 Aug 2011 10:21:28 +0000 (11:21 +0100)
src/jalview/ws/rest/params/JobConstant.java

index fddfd3b..64bb45f 100644 (file)
@@ -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;
   }