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. --- src/main/java/com/c2kernel/entity/CorbaServer.java | 30 +++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/CorbaServer.java') diff --git a/src/main/java/com/c2kernel/entity/CorbaServer.java b/src/main/java/com/c2kernel/entity/CorbaServer.java index f2b2316..76637c6 100644 --- a/src/main/java/com/c2kernel/entity/CorbaServer.java +++ b/src/main/java/com/c2kernel/entity/CorbaServer.java @@ -27,10 +27,10 @@ import org.omg.PortableServer.POAManager; import org.omg.PortableServer.Servant; import org.omg.PortableServer.POAManagerPackage.AdapterInactive; -import com.c2kernel.common.CannotManageException; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.ObjectAlreadyExistsException; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.CannotManage; +import com.c2kernel.common.InvalidData; +import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.entity.agent.ActiveEntity; import com.c2kernel.entity.agent.ActiveLocator; import com.c2kernel.lookup.AgentPath; @@ -57,7 +57,7 @@ public class CorbaServer { private POA mAgentPOA; private POAManager mPOAManager; - public CorbaServer() throws InvalidDataException { + public CorbaServer() throws InvalidData { mItemCache = new SoftCache(50); // init POA @@ -66,7 +66,7 @@ public class CorbaServer { mPOAManager.activate(); } catch (Exception ex) { Logger.error(ex); - throw new InvalidDataException("Error initialising POA", ""); + throw new InvalidData("Error initialising POA"); } new Thread(new Runnable() { @@ -136,11 +136,11 @@ public class CorbaServer { /************************************************************************** * Returns a CORBA servant for a pre-existing entity - * @throws ObjectNotFoundException + * @throws ObjectNotFound **************************************************************************/ - public TraceableEntity getItem(ItemPath itemPath) throws ObjectNotFoundException { + public TraceableEntity getItem(ItemPath itemPath) throws ObjectNotFound { Servant item = null; - if (!itemPath.exists()) throw new ObjectNotFoundException(itemPath+" does not exist", ""); + if (!itemPath.exists()) throw new ObjectNotFound(itemPath+" does not exist"); synchronized (mItemCache) { item = mItemCache.get(itemPath); if (item == null) { @@ -155,9 +155,9 @@ public class CorbaServer { /************************************************************************** * Returns a CORBA servant for a pre-existing entity **************************************************************************/ - public ActiveEntity getAgent(AgentPath agentPath) throws InvalidAgentPathException, ObjectNotFoundException { + public ActiveEntity getAgent(AgentPath agentPath) throws InvalidAgentPathException, ObjectNotFound { Servant agent = null; - if (!agentPath.exists()) throw new ObjectNotFoundException(agentPath+" does not exist", ""); + if (!agentPath.exists()) throw new ObjectNotFound(agentPath+" does not exist"); synchronized (mItemCache) { agent = mItemCache.get(agentPath); if (agent == null) { @@ -175,9 +175,9 @@ public class CorbaServer { * @param itemPath * @return */ - public TraceableEntity createItem(ItemPath itemPath) throws CannotManageException, ObjectAlreadyExistsException { + public TraceableEntity createItem(ItemPath itemPath) throws CannotManage, ObjectAlreadyExists { - if (itemPath.exists()) throw new ObjectAlreadyExistsException(); + if (itemPath.exists()) throw new ObjectAlreadyExists(); org.omg.CORBA.Object obj = mItemPOA.create_reference_with_id(itemPath.getOID(), ItemHelper.id()); itemPath.setIOR(obj); TraceableEntity item = new TraceableEntity(itemPath, mItemPOA); @@ -187,8 +187,8 @@ public class CorbaServer { return item; } - public ActiveEntity createAgent(AgentPath agentPath) throws CannotManageException, ObjectAlreadyExistsException { - if (agentPath.exists()) throw new ObjectAlreadyExistsException(); + public ActiveEntity createAgent(AgentPath agentPath) throws CannotManage, ObjectAlreadyExists { + if (agentPath.exists()) throw new ObjectAlreadyExists(); org.omg.CORBA.Object obj = mAgentPOA.create_reference_with_id(agentPath.getOID(), AgentHelper.id()); agentPath.setIOR(obj); ActiveEntity agent; -- cgit v1.2.3