[Swift-commit] r6646 - in branches/release-0.94/src/org/griphyn/vdl: karajan/lib mapping

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Jul 13 03:32:59 CDT 2013


Author: hategan
Date: 2013-07-13 03:32:37 -0500 (Sat, 13 Jul 2013)
New Revision: 6646

Added:
   branches/release-0.94/src/org/griphyn/vdl/mapping/NotCompositeException.java
Modified:
   branches/release-0.94/src/org/griphyn/vdl/karajan/lib/New.java
   branches/release-0.94/src/org/griphyn/vdl/mapping/AbstractDataNode.java
   branches/release-0.94/src/org/griphyn/vdl/mapping/RootDataNode.java
Log:
ported fix for bug 1038 from trunk

Modified: branches/release-0.94/src/org/griphyn/vdl/karajan/lib/New.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/karajan/lib/New.java	2013-07-13 04:16:23 UTC (rev 6645)
+++ branches/release-0.94/src/org/griphyn/vdl/karajan/lib/New.java	2013-07-13 08:32:37 UTC (rev 6646)
@@ -231,4 +231,9 @@
             sb.append(v);
         }
     }
+
+    @Override
+    public String getTextualName() {
+        return "Variable declaration";
+    }
 }

Modified: branches/release-0.94/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2013-07-13 04:16:23 UTC (rev 6645)
+++ branches/release-0.94/src/org/griphyn/vdl/mapping/AbstractDataNode.java	2013-07-13 08:32:37 UTC (rev 6646)
@@ -332,6 +332,10 @@
             throw new RuntimeException("Cannot write to closed handle: " + this + " (" + key + ")");
         }
         
+        if (!getType().isComposite()) {
+            throw new NotCompositeException(this);
+        }
+        
         return addHandle(key, newNode(getChildField(key)));
     }
     

Copied: branches/release-0.94/src/org/griphyn/vdl/mapping/NotCompositeException.java (from rev 6645, trunk/src/org/griphyn/vdl/mapping/NotCompositeException.java)
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/mapping/NotCompositeException.java	                        (rev 0)
+++ branches/release-0.94/src/org/griphyn/vdl/mapping/NotCompositeException.java	2013-07-13 08:32:37 UTC (rev 6646)
@@ -0,0 +1,27 @@
+//----------------------------------------------------------------------
+//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 Jul 12, 2013
+ */
+package org.griphyn.vdl.mapping;
+
+public class NotCompositeException extends RuntimeException {
+    private AbstractDataNode node;
+
+    public NotCompositeException(AbstractDataNode node) {
+        this.node = node;
+    }
+
+    @Override
+    public String getMessage() {
+        return "Type '" + node.getType() + "' is not a composite type.";
+    }
+    
+    public AbstractDataNode getDataNode() {
+        return node;
+    }
+}

Modified: branches/release-0.94/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/mapping/RootDataNode.java	2013-07-13 04:16:23 UTC (rev 6645)
+++ branches/release-0.94/src/org/griphyn/vdl/mapping/RootDataNode.java	2013-07-13 08:32:37 UTC (rev 6646)
@@ -179,6 +179,11 @@
                 throw new IllegalStateException("Structure of mapped data is " +
                         "incompatible with the mapped variable type: " + e.getMessage());
             }
+            catch (NotCompositeException e) {
+                throw new IllegalStateException("Cannot map multiple files to variable '" + 
+                    e.getDataNode().getDisplayableName() + "' of non composite type '" + 
+                    e.getDataNode().getType() + "'");
+            }
         }
         root.closeDeep();
         if (!any && tracer.isEnabled()) {




More information about the Swift-commit mailing list