[Swift-commit] r7889 - trunk/src/org/griphyn/vdl/karajan/lib/swiftscript

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Thu May 29 23:19:02 CDT 2014


Author: hategan
Date: 2014-05-29 23:19:02 -0500 (Thu, 29 May 2014)
New Revision: 7889

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileName.java
Log:
throw a nice exception when filename() is called with primitive data as an argument

Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileName.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileName.java	2014-05-30 04:18:38 UTC (rev 7888)
+++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/FileName.java	2014-05-30 04:19:02 UTC (rev 7889)
@@ -17,6 +17,7 @@
 
 package org.griphyn.vdl.karajan.lib.swiftscript;
 
+import k.rt.ExecutionException;
 import k.rt.Stack;
 
 import org.globus.cog.karajan.analyzer.ArgRef;
@@ -37,7 +38,10 @@
 
     @Override
 	public Object function(Stack stack) {
-        AbstractDataNode var = this.var.getValue(stack); 
+        AbstractDataNode var = this.var.getValue(stack);
+        if (var.getType().isPrimitive()) {
+            throw new ExecutionException(this, "Cannot invoke filename() on a primitive value (" + var + ")");
+        }
 		String s = argList(filename(var), true);
 		DSHandle result = NodeFactory.newRoot(Field.GENERIC_STRING, s);
 		if (PROVENANCE_ENABLED) {




More information about the Swift-commit mailing list