diff options
Diffstat (limited to 'src/main/java/com/c2kernel/utils')
| -rw-r--r-- | src/main/java/com/c2kernel/utils/LocalObjectLoader.java | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java index f0d8928..503e951 100644 --- a/src/main/java/com/c2kernel/utils/LocalObjectLoader.java +++ b/src/main/java/com/c2kernel/utils/LocalObjectLoader.java @@ -1,5 +1,5 @@ package com.c2kernel.utils;
-
+ import java.util.Iterator;
import com.c2kernel.common.InvalidDataException;
@@ -24,28 +24,15 @@ public class LocalObjectLoader { {
DomainPath defRoot = new DomainPath(root);
Iterator<Path> e = Gateway.getLookup().search(defRoot, name);
- ItemProxy defProxy = null; int currentLayer = -1;
- while (e.hasNext()) {
+ if (e.hasNext()) {
DomainPath defPath = (DomainPath)e.next();
- ItemProxy thisProxy = Gateway.getProxyManager().getProxy(defPath);
- int thisLayer;
- try {
- String thisLayerProp = thisProxy.getProperty("Layer");
- thisLayer = Integer.parseInt(thisLayerProp);
- } catch (Exception ex) {
- thisLayer = 0;
- }
- if (thisLayer > currentLayer) {
- currentLayer = thisLayer;
- defProxy = thisProxy;
- }
- else if (thisLayer == currentLayer) {
- throw new ObjectNotFoundException("Duplicate definition for "+name+" in "+root+" found in Layer "+thisLayer, "");
- }
+ if (e.hasNext()) throw new ObjectNotFoundException("Too many matches for "+name+" in "+root, "");
+ return Gateway.getProxyManager().getProxy(defPath);
}
- if (defProxy == null)
+ else {
throw new ObjectNotFoundException("No match for "+name+" in "+root, "");
- return defProxy;
+ }
+ }
static public String getScript(String scriptName, int scriptVersion) throws ObjectNotFoundException {
|
