[Swift-commit] r6487 - branches/faster/src/org/griphyn/vdl/mapping

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Mon Apr 29 19:26:26 CDT 2013


Author: hategan
Date: 2013-04-29 19:26:26 -0500 (Mon, 29 Apr 2013)
New Revision: 6487

Added:
   branches/faster/src/org/griphyn/vdl/mapping/MissingDataException.java
Modified:
   branches/faster/src/org/griphyn/vdl/mapping/AbstractDataNode.java
Log:
better error message when a mapped piece of data is closed but has no value

Modified: branches/faster/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2013-04-29 22:31:09 UTC (rev 6486)
+++ branches/faster/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2013-04-30 00:26:26 UTC (rev 6487)
@@ -708,9 +708,12 @@
             if (parent != null && parent.getType().isArray()) {
                 throw new IndexOutOfBoundsException("Invalid index [" + field.getId() + "] for " + parent.getFullName());
             }
-            else {
+            else if (getType().isPrimitive()) {
                 throw new RuntimeException(getFullName() + " has no value");
             }
+            else {
+                throw new MissingDataException(this, getMapper().map(getPathFromRoot()));
+            }
         }
     }
 

Added: branches/faster/src/org/griphyn/vdl/mapping/MissingDataException.java
===================================================================
--- branches/faster/src/org/griphyn/vdl/mapping/MissingDataException.java	                        (rev 0)
+++ branches/faster/src/org/griphyn/vdl/mapping/MissingDataException.java	2013-04-30 00:26:26 UTC (rev 6487)
@@ -0,0 +1,16 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Apr 16, 2013
+ */
+package org.griphyn.vdl.mapping;
+
+public class MissingDataException extends RuntimeException {
+    public MissingDataException(AbstractDataNode n, PhysicalFormat pf) {
+        super("Data not found for " + n.getFullName() + ": " + pf);
+    }
+}




More information about the Swift-commit mailing list