[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Wed Sep 10 20:04:03 UTC 2008
gordonp
Wed Sep 10 16:04:02 EDT 2008
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client
In directory dev.open-bio.org:/tmp/cvs-serv27650/src/main/org/biomoby/client
Modified Files:
MobyRequest.java
Log Message:
MobyRequest's setSecondaries throws exceptions now if the parameters are blank or overwrite primary params with the same name
moby-live/Java/src/main/org/biomoby/client MobyRequest.java,1.37,1.38
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2008/01/26 17:54:59 1.37
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/MobyRequest.java 2008/09/10 20:04:02 1.38
@@ -230,8 +230,10 @@
* in this object. This is covenient if you are running 100 seqs through BLAST and only want to set
* the parameters once. If you instead want to set secondary input differently for all primary inputs, you'll
* need to create a custom MobyContentInstance as input to setInput().
+ *
+ * @throws MobyException if a parameter name is blank, or overrides a primary parameter
*/
- public void setSecondaryInput(MobyDataSecondaryInstance[] secondaryData){
+ public void setSecondaryInput(MobyDataSecondaryInstance[] secondaryData) throws MobyException{
Iterator queryNames = inputData.keySet().iterator();
// For each query
@@ -239,7 +241,15 @@
MobyDataJob queryParams = inputData.get(queryNames.next());
// Set all the secondary params (overwrites any old ones)
for(int i = 0; i < secondaryData.length; i++){
- queryParams.put(secondaryData[i].getName(), secondaryData[i]);
+ String secName = secondaryData[i].getName();
+ if(secName == null || secName.length() == 0){
+ throw new MobyException("A secondary parameter cannot have a blank name (array index " + i + ")");
+ }
+ if(queryParams.containsKey(secName) && queryParams.get(secName) instanceof MobyPrimaryData){
+ throw new MobyException("A secondary parameter cannot override an existing primary parameter " +
+ "with the same name (" + secName + ")");
+ }
+ queryParams.put(secName, secondaryData[i]);
}
}
}
More information about the MOBY-guts
mailing list