From 482b98e869d07802310e249d09d784c63f9a86b6 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 19 Sep 2014 15:40:50 +0200 Subject: Introduced static method ItemPath.fromUUIDString and made the UUID constructor protected to better handle ItemPath and AgentPath construction with String UUIDs, throwing the right exceptions. --- .../java/com/c2kernel/entity/imports/ImportAggregation.java | 10 +++++----- .../java/com/c2kernel/entity/imports/ImportDependency.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/imports') diff --git a/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java b/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java index 2f19452..2d8f0a2 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportAggregation.java @@ -1,12 +1,12 @@ package com.c2kernel.entity.imports; import java.util.ArrayList; -import java.util.UUID; import com.c2kernel.collection.MembershipException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.graph.model.GraphPoint; import com.c2kernel.lookup.DomainPath; +import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.property.PropertyDescription; import com.c2kernel.property.PropertyDescriptionList; @@ -36,8 +36,8 @@ public class ImportAggregation implements java.io.Serializable { if (thisMem.itemDescriptionPath != null && thisMem.itemDescriptionPath.length()>0) { ItemPath itemPath; try { - itemPath = new ItemPath(UUID.fromString(thisMem.itemDescriptionPath)); - } catch (IllegalArgumentException ex) { + itemPath = ItemPath.fromUUIDString(thisMem.itemDescriptionPath); + } catch (InvalidItemPathException ex) { itemPath = new DomainPath(thisMem.itemDescriptionPath).getItemPath(); } PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(itemPath); @@ -50,8 +50,8 @@ public class ImportAggregation implements java.io.Serializable { if (thisMem.itemPath != null && thisMem.itemPath.length()>0) { ItemPath itemPath; try { - itemPath = new ItemPath(UUID.fromString(thisMem.itemPath)); - } catch (IllegalArgumentException ex) { + itemPath = ItemPath.fromUUIDString(thisMem.itemPath); + } catch (InvalidItemPathException ex) { itemPath = new DomainPath(thisMem.itemPath).getItemPath(); } if (itemPath == null) diff --git a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java index a43f6e3..87e6b11 100644 --- a/src/main/java/com/c2kernel/entity/imports/ImportDependency.java +++ b/src/main/java/com/c2kernel/entity/imports/ImportDependency.java @@ -1,11 +1,11 @@ package com.c2kernel.entity.imports; import java.util.ArrayList; -import java.util.UUID; import com.c2kernel.collection.MembershipException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.lookup.DomainPath; +import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; import com.c2kernel.property.PropertyDescription; import com.c2kernel.property.PropertyDescriptionList; @@ -58,8 +58,8 @@ public class ImportDependency implements java.io.Serializable { for (ImportDependencyMember thisMem : dependencyMemberList) { ItemPath itemPath; try { - itemPath = new ItemPath(UUID.fromString(thisMem.itemPath)); - } catch (IllegalArgumentException ex) { + itemPath = ItemPath.fromUUIDString(thisMem.itemPath); + } catch (InvalidItemPathException ex) { itemPath = new DomainPath(thisMem.itemPath).getItemPath(); } -- cgit v1.2.3