[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Apr 13 01:56:12 UTC 2007


gordonp
Thu Apr 12 21:56:12 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data
In directory dev.open-bio.org:/tmp/cvs-serv916/src/main/org/biomoby/shared/data

Modified Files:
	MobyDataComposite.java 
Log Message:
More data type error checking
moby-live/Java/src/main/org/biomoby/shared/data MobyDataComposite.java,1.13,1.14
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java	2007/04/08 17:29:29	1.13
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataComposite.java	2007/04/13 01:56:12	1.14
@@ -393,10 +393,22 @@
 	}
 
 	MobyRelationship relationship = getDataType().getChild(fieldName);
+	if(relationship == null){
+	    relationship = MobyDataType.getDataType(getDataType().getName()).getChild(fieldName);
+	    if(relationship == null){
+		String memberNames = "";
+		for(MobyRelationship rel: getDataType().getChildren()){
+		    memberNames += " "+rel.getName();
+		}
+		throw new IllegalArgumentException("The member '" + fieldName + "' for object '"+ getName() +
+						   "' does not exist in the Moby ontology definition for "+
+						   getDataType().getName() + ", valid member names are:" + memberNames);
+	    }
+	}
 	MobyDataType childDataType = MobyDataType.getDataType(relationship.getDataTypeName());
 	if(!value.getDataType().inheritsFrom(childDataType)){
 	    // Incompatible types
-	    throw new IllegalArgumentException("The object member '" + fieldName + "' for object '"+ getName() +
+	    throw new IllegalArgumentException("The member '" + fieldName + "' for object '"+ getName() +
 					       "' does not inherit from the required data type " +
 					       "(found data type " + value.getDataType().getName()+
 					       ", but require subclass of " + 




More information about the MOBY-guts mailing list