[Swift-commit] r3159 - in trunk/src/org/griphyn/vdl/mapping: . file

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Oct 14 00:03:07 CDT 2009


Author: hategan
Date: 2009-10-14 00:03:06 -0500 (Wed, 14 Oct 2009)
New Revision: 3159

Modified:
   trunk/src/org/griphyn/vdl/mapping/MappingParam.java
   trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java
Log:
complain when mapped data is passed as the source parameter to the regexp mapper; as it is now, it's very unlikely that the user wants to transform some obscure representation of the data handle instead of the filename'


Modified: trunk/src/org/griphyn/vdl/mapping/MappingParam.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/MappingParam.java	2009-10-14 04:53:36 UTC (rev 3158)
+++ trunk/src/org/griphyn/vdl/mapping/MappingParam.java	2009-10-14 05:03:06 UTC (rev 3159)
@@ -144,6 +144,10 @@
 	}
 
 	public String toString() {
-		return "mapping parameter "+name;
+		return "mapping parameter " + name;
 	}
+
+    public String getName() {
+        return name;
+    }
 }

Modified: trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java	2009-10-14 04:53:36 UTC (rev 3158)
+++ trunk/src/org/griphyn/vdl/mapping/file/RegularExpressionMapper.java	2009-10-14 05:03:06 UTC (rev 3159)
@@ -10,6 +10,7 @@
 
 import org.griphyn.vdl.mapping.AbsFile;
 import org.griphyn.vdl.mapping.AbstractMapper;
+import org.griphyn.vdl.mapping.DSHandle;
 import org.griphyn.vdl.mapping.MappingParam;
 import org.griphyn.vdl.mapping.Path;
 import org.griphyn.vdl.mapping.PhysicalFormat;
@@ -38,6 +39,11 @@
 	}
 
 	public PhysicalFormat map(Path path) {
+	    if (PARAM_MATCH.getRawValue(this) instanceof DSHandle) {
+	        DSHandle h = (DSHandle) PARAM_MATCH.getRawValue(this);
+	        throw new IllegalArgumentException("Non-primitive value specified for " + 
+	            PARAM_MATCH.getName() + "; maybe you meant @filename(" + h.getPathFromRoot() + ")?");
+	    }
 		String match = PARAM_MATCH.getStringValue(this);
 		String source = PARAM_SOURCE.getStringValue(this);
 		String transform = PARAM_TRANSFORM.getStringValue(this);




More information about the Swift-commit mailing list