From 275d0bbf555c8917be82ce4cc21eb4cabb00f4c5 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 17:30:41 +0200 Subject: Huge exception overhaul: Merged ClusterStorageException with PersistencyException. Replaced MembershipException with InvalidCollectionModification CORBA Exception. Made all predef steps throw more accurate exceptions when they go wrong, and let more exceptions bubble through from underneath. --- .../java/com/c2kernel/collection/DependencyMember.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/main/java/com/c2kernel/collection/DependencyMember.java') diff --git a/src/main/java/com/c2kernel/collection/DependencyMember.java b/src/main/java/com/c2kernel/collection/DependencyMember.java index 6f86ecd..502894f 100644 --- a/src/main/java/com/c2kernel/collection/DependencyMember.java +++ b/src/main/java/com/c2kernel/collection/DependencyMember.java @@ -22,7 +22,8 @@ package com.c2kernel.collection; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.InvalidCollectionModification; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; @@ -105,11 +106,11 @@ public class DependencyMember implements CollectionMember } @Override - public void assignItem(ItemPath itemPath) throws MembershipException + public void assignItem(ItemPath itemPath) throws InvalidCollectionModification { if (itemPath != null) { if (mClassProps == null || getProperties() == null) - throw new MembershipException("ClassProps not yet set. Cannot check membership validity."); + throw new InvalidCollectionModification("ClassProps not yet set. Cannot check membership validity."); //for each mandatory prop check if its in the member property and has the matching value StringTokenizer sub = new StringTokenizer(mClassProps, ","); @@ -120,14 +121,14 @@ public class DependencyMember implements CollectionMember String memberValue = (String)getProperties().get(aClassProp); Property ItemProperty = (Property)Gateway.getStorage().get(itemPath, ClusterStorage.PROPERTY+"/"+aClassProp, null); if (ItemProperty == null) - throw new MembershipException("Property "+aClassProp+ " does not exist for item " + itemPath ); + throw new InvalidCollectionModification("Property "+aClassProp+ " does not exist for item " + itemPath ); if (!ItemProperty.getValue().equalsIgnoreCase(memberValue)) - throw new MembershipException("DependencyMember::checkProperty() Values of mandatory prop "+aClassProp+" do not match " + ItemProperty.getValue()+"!="+memberValue); + throw new InvalidCollectionModification("DependencyMember::checkProperty() Values of mandatory prop "+aClassProp+" do not match " + ItemProperty.getValue()+"!="+memberValue); } catch (Exception ex) { Logger.error(ex); - throw new MembershipException("Error checking properties"); + throw new InvalidCollectionModification("Error checking properties"); } } } @@ -143,13 +144,13 @@ public class DependencyMember implements CollectionMember } @Override - public ItemProxy resolveItem() throws ObjectNotFoundException { + public ItemProxy resolveItem() throws ObjectNotFound { if (mItem == null && mItemPath != null) mItem = Gateway.getProxyManager().getProxy(mItemPath); return mItem; } - public void setChildUUID(String uuid) throws MembershipException, InvalidItemPathException { + public void setChildUUID(String uuid) throws InvalidCollectionModification, InvalidItemPathException { mItemPath = new ItemPath(uuid); } -- cgit v1.2.3