[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Wed Feb 27 15:23:56 UTC 2008


gordonp
Wed Feb 27 10:23:56 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services
In directory dev.open-bio.org:/tmp/cvs-serv9927/src/main/ca/ucalgary/services

Modified Files:
	CGIService.java 
Log Message:
Fallback to finding the CGI as a resource if not a URL (mainly for testing purposes)
moby-live/Java/src/main/ca/ucalgary/services CGIService.java,1.5,1.6
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/CGIService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/CGIService.java	2008/02/14 06:16:12	1.5
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/services/CGIService.java	2008/02/27 15:23:56	1.6
@@ -169,9 +169,13 @@
 	try{
 	    remoteFormURL = new URL(remoteFormURLString);
 	} catch(Exception e){
-	    throw new Exception("The configuration parameter '" + remoteFormURLString +
-				"' (value '" + remoteFormURLString + 
-				"') was not parseable as a URL");
+            // Fallback to finding it as a resource
+            remoteFormURL = getClass().getClassLoader().getResource(remoteFormURLString);
+            if(remoteFormURL == null){
+	      throw new Exception("The configuration parameter '" + remoteFormURLString +
+	    			  "' (value '" + remoteFormURLString + 
+				  "') was not parseable as a URL");
+            }
 	}
 
 	try{
@@ -251,7 +255,7 @@
 	int i = 0;
 	for(Map.Entry<String,byte[]> formField: dataInstances.entrySet()){
 	    data[i++] = new NameValuePair(formField.getKey(), 
-					  new String(formField.getValue()));
+					  formField.getValue() == null ? "" : new String(formField.getValue()));
 	}
 	return data;
     }




More information about the MOBY-guts mailing list