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

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Thu Sep 16 15:14:27 CDT 2010


Author: hategan
Date: 2010-09-16 15:14:27 -0500 (Thu, 16 Sep 2010)
New Revision: 3626

Modified:
   trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
Log:
use proper test instead of class cast exception to determine if a value is of a primitive type

Modified: trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java	2010-09-14 19:05:58 UTC (rev 3625)
+++ trunk/src/org/griphyn/vdl/karajan/lib/VDLFunction.java	2010-09-16 20:14:27 UTC (rev 3626)
@@ -84,16 +84,15 @@
 		if (value != null) {
 			final VariableArguments vret = ArgUtil.getVariableReturn(stack);
 			if (value.getClass().isArray()) {
-				try {
+				if (value.getClass().getComponentType().isPrimitive()) {
+					vret.append(value);
+				}
+				else {
 					Object[] array = (Object[]) value;
 					for (int i = 0; i < array.length; i++) {
 						vret.append(array[i]);
 					}
 				}
-				catch (ClassCastException e) {
-					// array of primitives; return as is
-					vret.append(value);
-				}
 			}
 			else {
 				vret.append(value);




More information about the Swift-commit mailing list