From: Mathieu Baudier Date: Thu, 19 May 2011 17:09:08 +0000 (+0000) Subject: Fix unregistered attribute X-Git-Tag: argeo-slc-2.1.7~949 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=615e659f0f733763ada90e5989899bee5e5a57d6;p=gpl%2Fargeo-slc.git Fix unregistered attribute git-svn-id: https://svn.argeo.org/slc/trunk@4526 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java index b940f7401..8e0960751 100644 --- a/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java +++ b/runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java @@ -74,6 +74,10 @@ public class DefaultExecutionFlowDescriptorConverter implements ExecutionSpecAttribute attribute = executionSpec .getAttributes().get(key); + if (attribute == null) + throw new SlcException("No spec attribute defined for '" + + key + "'"); + if (attribute.getIsFrozen()) continue values; @@ -130,7 +134,7 @@ public class DefaultExecutionFlowDescriptorConverter implements throw new UnsupportedException("Ref value type", refValue.getType()); } - }else{ + } else { convertedValues.put(key, value); } } diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java index 854368929..f2fc60213 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrExecutionModulesListener.java @@ -242,8 +242,6 @@ public class JcrExecutionModulesListener implements ExecutionModulesListener, // values for (String attr : efd.getValues().keySet()) { - if (log.isDebugEnabled()) - log.debug(attr + "=" + efd.getValues().get(attr)); ExecutionSpecAttribute esa = executionSpec.getAttributes() .get(attr); if (esa instanceof PrimitiveSpecAttribute) { diff --git a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrProcessThread.java b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrProcessThread.java index 26e3737b0..1c97322bd 100644 --- a/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrProcessThread.java +++ b/runtime/org.argeo.slc.support.jcr/src/main/java/org/argeo/slc/jcr/execution/JcrProcessThread.java @@ -87,20 +87,6 @@ public class JcrProcessThread extends ProcessThread implements SlcNames { .getString(); Object value = PrimitiveUtils.convert(type, valueStr); values.put(attrName, value); - // Property prop = flowNode.getNode(attrName).getProperty( - // SLC_VALUE); - // // yes, this could be a switch... (patches welcome) - // if (prop.getType() == PropertyType.STRING) - // values.put(attrName, prop.getString()); - // else if (prop.getType() == PropertyType.LONG) - // values.put(attrName, prop.getLong()); - // else if (prop.getType() == PropertyType.DOUBLE) - // values.put(attrName, prop.getDouble()); - // else if (prop.getType() == PropertyType.BOOLEAN) - // values.put(attrName, prop.getBoolean()); - // else - // throw new SlcException("Unsupported value type " - // + PropertyType.nameFromValue(prop.getType())); } else { ExecutionSpecAttribute attr = attrs.get(attrName); Object value = attr.getValue(); @@ -128,14 +114,15 @@ public class JcrProcessThread extends ProcessThread implements SlcNames { .isNodeType(SlcTypes.SLC_PRIMITIVE_SPEC_ATTRIBUTE)) { String type = specAttrNode.getProperty(SLC_TYPE) .getString(); + Object value = null; if (specAttrNode.hasProperty(SLC_VALUE)) { String valueStr = specAttrNode.getProperty(SLC_VALUE) .getString(); - Object value = PrimitiveUtils.convert(type, valueStr); - PrimitiveSpecAttribute specAttr = new PrimitiveSpecAttribute( - type, value); - attrs.put(specAttrNode.getName(), specAttr); + value = PrimitiveUtils.convert(type, valueStr); } + PrimitiveSpecAttribute specAttr = new PrimitiveSpecAttribute( + type, value); + attrs.put(specAttrNode.getName(), specAttr); } }