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/entity/proxy/AgentProxy.java | 100 +++++++++++---------- .../java/com/c2kernel/entity/proxy/ItemProxy.java | 81 +++++++++-------- .../c2kernel/entity/proxy/MemberSubscription.java | 6 +- .../entity/proxy/ProxyClientConnection.java | 6 +- .../com/c2kernel/entity/proxy/ProxyManager.java | 14 +-- .../com/c2kernel/entity/proxy/ProxyMessage.java | 10 +-- .../entity/proxy/ProxyServerConnection.java | 4 +- 7 files changed, 114 insertions(+), 107 deletions(-) (limited to 'src/main/java/com/c2kernel/entity/proxy') diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index 10a8f02..7e6b3e4 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -24,10 +24,11 @@ import java.util.Date; import java.util.Iterator; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.InvalidTransitionException; -import com.c2kernel.common.ObjectAlreadyExistsException; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.InvalidCollectionModification; +import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidTransition; +import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.Agent; import com.c2kernel.entity.AgentHelper; @@ -68,7 +69,7 @@ public class AgentProxy extends ItemProxy **************************************************************************/ protected AgentProxy( org.omg.CORBA.Object ior, AgentPath agentPath) - throws ObjectNotFoundException + throws ObjectNotFound { super(ior, agentPath); mAgentPath = agentPath; @@ -83,12 +84,12 @@ public class AgentProxy extends ItemProxy } @Override - public Agent narrow() throws ObjectNotFoundException + public Agent narrow() throws ObjectNotFound { try { return AgentHelper.narrow(mIOR); } catch (org.omg.CORBA.BAD_PARAM ex) { } - throw new ObjectNotFoundException("CORBA Object was not an Agent, or the server is down."); + throw new ObjectNotFound("CORBA Object was not an Agent, or the server is down."); } /** @@ -97,21 +98,22 @@ public class AgentProxy extends ItemProxy * * @param job * @throws AccessRightsException - * @throws InvalidDataException - * @throws InvalidTransitionException - * @throws ObjectNotFoundException + * @throws InvalidData + * @throws InvalidTransition + * @throws ObjectNotFound * @throws PersistencyException - * @throws ObjectAlreadyExistsException + * @throws ObjectAlreadyExists * @throws ScriptErrorException + * @throws InvalidCollectionModification */ public String execute(Job job) throws AccessRightsException, - InvalidDataException, - InvalidTransitionException, - ObjectNotFoundException, + InvalidData, + InvalidTransition, + ObjectNotFound, PersistencyException, - ObjectAlreadyExistsException, - ScriptErrorException + ObjectAlreadyExists, + ScriptErrorException, InvalidCollectionModification { ItemProxy item = Gateway.getProxyManager().getProxy(job.getItemPath()); OutcomeValidator validator = null; @@ -128,12 +130,12 @@ public class AgentProxy extends ItemProxy Schema schema = LocalObjectLoader.getSchema(schemaName, schemaVersion); if (schema == null) - throw new InvalidDataException("Job references outcome type "+schemaName+" version "+schemaVersion+" that does not exist in this centre.", ""); + throw new InvalidData("Job references outcome type "+schemaName+" version "+schemaVersion+" that does not exist in this centre."); try { validator = OutcomeValidator.getValidator(schema); } catch (Exception e) { - throw new InvalidDataException("Could not create validator: "+e.getMessage(), ""); + throw new InvalidData("Could not create validator: "+e.getMessage()); } } @@ -147,7 +149,7 @@ public class AgentProxy extends ItemProxy String error = validator.validate(job.getOutcomeString()); if (error.length() > 0) { Logger.error("Outcome not valid: \n " + error); - throw new InvalidDataException(error, ""); + throw new InvalidData(error); } } @@ -162,7 +164,7 @@ public class AgentProxy extends ItemProxy Logger.warning("Script errors: "+errorString); } catch (ScriptingEngineException ex) { Logger.error(ex); - throw new InvalidDataException(ex.getMessage(), ""); + throw new InvalidData(ex.getMessage()); } } @@ -170,7 +172,7 @@ public class AgentProxy extends ItemProxy Logger.msg(3, "AgentProxy - validating outcome"); String error = validator.validate(job.getOutcomeString()); if (error.length() > 0) - throw new InvalidDataException(error, ""); + throw new InvalidData(error); } job.setAgentPath(mAgentPath); @@ -192,18 +194,18 @@ public class AgentProxy extends ItemProxy public String execute(ItemProxy item, String predefStep, C2KLocalObject obj) throws AccessRightsException, - InvalidDataException, - InvalidTransitionException, - ObjectNotFoundException, + InvalidData, + InvalidTransition, + ObjectNotFound, PersistencyException, - ObjectAlreadyExistsException + ObjectAlreadyExists, InvalidCollectionModification { String param; try { param = marshall(obj); } catch (Exception ex) { Logger.error(ex); - throw new InvalidDataException("Error on marshall", ""); + throw new InvalidData("Error on marshall"); } return execute(item, predefStep, param); } @@ -220,19 +222,20 @@ public class AgentProxy extends ItemProxy * @return The outcome after processing. May have been altered by the step. * * @throws AccessRightsException The agent was not allowed to execute this step - * @throws InvalidDataException The parameters supplied were incorrect - * @throws InvalidTransitionException The step wasn't available - * @throws ObjectNotFoundException Thrown by some steps that try to locate additional objects + * @throws InvalidData The parameters supplied were incorrect + * @throws InvalidTransition The step wasn't available + * @throws ObjectNotFound Thrown by some steps that try to locate additional objects * @throws PersistencyException Problem writing or reading the database - * @throws ObjectAlreadyExistsException Thrown by steps that create additional object + * @throws ObjectAlreadyExists Thrown by steps that create additional object + * @throws InvalidCollectionModification */ public String execute(ItemProxy item, String predefStep, String[] params) throws AccessRightsException, - InvalidDataException, - InvalidTransitionException, - ObjectNotFoundException, + InvalidData, + InvalidTransition, + ObjectNotFound, PersistencyException, - ObjectAlreadyExistsException + ObjectAlreadyExists, InvalidCollectionModification { String schemaName = PredefinedStep.getPredefStepSchemaName(predefStep); String param; @@ -254,20 +257,21 @@ public class AgentProxy extends ItemProxy * @param param * @return * @throws AccessRightsException - * @throws InvalidDataException - * @throws InvalidTransitionException - * @throws ObjectNotFoundException + * @throws InvalidData + * @throws InvalidTransition + * @throws ObjectNotFound * @throws PersistencyException - * @throws ObjectAlreadyExistsException + * @throws ObjectAlreadyExists + * @throws InvalidCollectionModification */ public String execute(ItemProxy item, String predefStep, String param) throws AccessRightsException, - InvalidDataException, - InvalidTransitionException, - ObjectNotFoundException, + InvalidData, + InvalidTransition, + ObjectNotFound, PersistencyException, - ObjectAlreadyExistsException + ObjectAlreadyExists, InvalidCollectionModification { return execute(item, predefStep, new String[] {param }); } @@ -282,24 +286,24 @@ public class AgentProxy extends ItemProxy } /** Let scripts resolve items */ - public ItemProxy searchItem(String name) throws ObjectNotFoundException { + public ItemProxy searchItem(String name) throws ObjectNotFound { Iterator results = Gateway.getLookup().search(new DomainPath(""),name); Path returnPath = null; if (!results.hasNext()) - throw new ObjectNotFoundException(name, ""); + throw new ObjectNotFound(name); while(results.hasNext()) { Path nextMatch = results.next(); if (returnPath != null && nextMatch.getUUID() != null && !returnPath.getUUID().equals(nextMatch.getUUID())) - throw new ObjectNotFoundException("Too many items with that name"); + throw new ObjectNotFound("Too many items with that name"); returnPath = nextMatch; } return Gateway.getProxyManager().getProxy(returnPath); } - public ItemProxy getItem(String itemPath) throws ObjectNotFoundException { + public ItemProxy getItem(String itemPath) throws ObjectNotFound { return (getItem(new DomainPath(itemPath))); } @@ -308,11 +312,11 @@ public class AgentProxy extends ItemProxy return mAgentPath; } - public ItemProxy getItem(Path itemPath) throws ObjectNotFoundException { + public ItemProxy getItem(Path itemPath) throws ObjectNotFound { return Gateway.getProxyManager().getProxy(itemPath); } - public ItemProxy getItemByUUID(String uuid) throws ObjectNotFoundException, InvalidItemPathException { + public ItemProxy getItemByUUID(String uuid) throws ObjectNotFound, InvalidItemPathException { return Gateway.getProxyManager().getProxy(new ItemPath(uuid)); } } diff --git a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java index 503e408..f5b0be7 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java @@ -32,10 +32,11 @@ import org.exolab.castor.xml.ValidationException; import com.c2kernel.collection.Collection; import com.c2kernel.collection.CollectionArrayList; import com.c2kernel.common.AccessRightsException; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.InvalidTransitionException; -import com.c2kernel.common.ObjectAlreadyExistsException; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.InvalidCollectionModification; +import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidTransition; +import com.c2kernel.common.ObjectAlreadyExists; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.Item; @@ -47,7 +48,6 @@ import com.c2kernel.lifecycle.instance.Workflow; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.ItemPath; import com.c2kernel.persistency.ClusterStorage; -import com.c2kernel.persistency.ClusterStorageException; import com.c2kernel.persistency.outcome.Viewpoint; import com.c2kernel.process.Gateway; import com.c2kernel.property.Property; @@ -89,18 +89,18 @@ public class ItemProxy return mItemPath; } - protected Item getItem() throws ObjectNotFoundException { + protected Item getItem() throws ObjectNotFound { if (mItem == null) mItem = narrow(); return mItem; } - public Item narrow() throws ObjectNotFoundException + public Item narrow() throws ObjectNotFound { try { return ItemHelper.narrow(mIOR); } catch (org.omg.CORBA.BAD_PARAM ex) { } - throw new ObjectNotFoundException("CORBA Object was not an Item, or the server is down."); + throw new ObjectNotFound("CORBA Object was not an Item, or the server is down."); } public void initialise( AgentPath agentId, @@ -108,11 +108,11 @@ public class ItemProxy CompositeActivity workflow, CollectionArrayList colls ) - throws AccessRightsException, InvalidDataException, PersistencyException, ObjectNotFoundException, MarshalException, ValidationException, IOException, MappingException + throws AccessRightsException, InvalidData, PersistencyException, ObjectNotFound, MarshalException, ValidationException, IOException, MappingException, InvalidCollectionModification { Logger.msg(7, "ItemProxy::initialise - started"); CastorXMLUtility xml = Gateway.getMarshaller(); - if (itemProps == null) throw new InvalidDataException("No initial properties supplied"); + if (itemProps == null) throw new InvalidData("No initial properties supplied"); String propString = xml.marshall(itemProps); String wfString = ""; if (workflow != null) wfString = xml.marshall(workflow); @@ -124,7 +124,7 @@ public class ItemProxy public void setProperty(AgentProxy agent, String name, String value) throws AccessRightsException, - PersistencyException, InvalidDataException + PersistencyException, InvalidData { String[] params = new String[2]; params[0] = name; @@ -135,34 +135,37 @@ public class ItemProxy throw (e); } catch (PersistencyException e) { throw (e); - } catch (InvalidDataException e) { + } catch (InvalidData e) { throw (e); } catch (Exception e) { Logger.error(e); - throw new PersistencyException("Could not store property", ""); + throw new PersistencyException("Could not store property"); } } - /************************************************************************** + + /** + * @throws InvalidCollectionModification * **************************************************************************/ public String requestAction( Job thisJob ) throws AccessRightsException, - InvalidTransitionException, - ObjectNotFoundException, - InvalidDataException, + InvalidTransition, + ObjectNotFound, + InvalidData, PersistencyException, - ObjectAlreadyExistsException + ObjectAlreadyExists, + InvalidCollectionModification { String outcome = thisJob.getOutcomeString(); // check fields that should have been filled in if (outcome==null) if (thisJob.isOutcomeRequired()) - throw new InvalidDataException("Outcome is required.", ""); + throw new InvalidData("Outcome is required."); else outcome=""; if (thisJob.getAgentPath() == null) - throw new InvalidDataException("No Agent specified.", ""); + throw new InvalidData("No Agent specified."); Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName()); return getItem().requestAction (thisJob.getAgentPath().getSystemKey(), thisJob.getStepPath(), @@ -174,7 +177,7 @@ public class ItemProxy **************************************************************************/ private ArrayList getJobList(AgentPath agentPath, boolean filter) throws AccessRightsException, - ObjectNotFoundException, + ObjectNotFound, PersistencyException { JobArrayList thisJobList; @@ -184,14 +187,14 @@ public class ItemProxy } catch (Exception e) { Logger.error(e); - throw new PersistencyException("Exception::ItemProxy::getJobList() - Cannot unmarshall the jobs", null); + throw new PersistencyException("Exception::ItemProxy::getJobList() - Cannot unmarshall the jobs"); } return thisJobList.list; } public ArrayList getJobList(AgentProxy agent) throws AccessRightsException, - ObjectNotFoundException, + ObjectNotFound, PersistencyException { return getJobList(agent.getPath(), true); @@ -199,7 +202,7 @@ public class ItemProxy private Job getJobByName(String actName, AgentPath agent) throws AccessRightsException, - ObjectNotFoundException, + ObjectNotFound, PersistencyException { ArrayList jobList = getJobList(agent, true); @@ -211,21 +214,21 @@ public class ItemProxy } - public Collection getCollection(String collName) throws ObjectNotFoundException { + public Collection getCollection(String collName) throws ObjectNotFound { return (Collection)getObject(ClusterStorage.COLLECTION+"/"+collName+"/last"); } - public Workflow getWorkflow() throws ObjectNotFoundException { + public Workflow getWorkflow() throws ObjectNotFound { return (Workflow)getObject(ClusterStorage.LIFECYCLE+"/workflow"); } - public Viewpoint getViewpoint(String schemaName, String viewName) throws ObjectNotFoundException { + public Viewpoint getViewpoint(String schemaName, String viewName) throws ObjectNotFound { return (Viewpoint)getObject(ClusterStorage.VIEWPOINT+"/"+schemaName+"/"+viewName); } public Job getJobByName(String actName, AgentProxy agent) throws AccessRightsException, - ObjectNotFoundException, + ObjectNotFound, PersistencyException { return getJobByName(actName, agent.getPath()); } @@ -245,7 +248,7 @@ public class ItemProxy * **************************************************************************/ public String queryData( String path ) - throws ObjectNotFoundException + throws ObjectNotFound { try { @@ -263,7 +266,7 @@ public class ItemProxy } C2KLocalObject target = Gateway.getStorage().get(mItemPath, path, null); return Gateway.getMarshaller().marshall(target); - } catch (ObjectNotFoundException e) { + } catch (ObjectNotFound e) { throw e; } catch (Exception e) { Logger.error(e); @@ -271,11 +274,11 @@ public class ItemProxy } } - public String[] getContents( String path ) throws ObjectNotFoundException { + public String[] getContents( String path ) throws ObjectNotFound { try { return Gateway.getStorage().getClusterContents(mItemPath, path.substring(0, path.length())); - } catch (ClusterStorageException e) { - throw new ObjectNotFoundException(e.toString()); + } catch (PersistencyException e) { + throw new ObjectNotFound(e.toString()); } } @@ -284,24 +287,24 @@ public class ItemProxy * **************************************************************************/ public C2KLocalObject getObject( String xpath ) - throws ObjectNotFoundException + throws ObjectNotFound { // load from storage, falling back to proxy loader if not found in others try { return Gateway.getStorage().get( mItemPath, xpath , null); } - catch( ClusterStorageException ex ) + catch( PersistencyException ex ) { Logger.msg(4, "Exception loading object :"+mItemPath+"/"+xpath); - throw new ObjectNotFoundException( ex.toString() ); + throw new ObjectNotFound( ex.toString() ); } } public String getProperty( String name ) - throws ObjectNotFoundException + throws ObjectNotFound { Logger.msg(5, "Get property "+name+" from item "+mItemPath); Property prop = (Property)getObject("Property/"+name); @@ -311,7 +314,7 @@ public class ItemProxy } catch (NullPointerException ex) { - throw new ObjectNotFoundException(); + throw new ObjectNotFound(); } } @@ -319,7 +322,7 @@ public class ItemProxy { try { return getProperty("Name"); - } catch (ObjectNotFoundException ex) { + } catch (ObjectNotFound ex) { return null; } } diff --git a/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java b/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java index 60e5233..5e063ed 100644 --- a/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java +++ b/src/main/java/com/c2kernel/entity/proxy/MemberSubscription.java @@ -23,7 +23,7 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.utils.Logger; @@ -70,7 +70,7 @@ public class MemberSubscription implements Runnable { newMember = (C)subject.getObject(interest+"/"+newChild); contents.remove(newChild); observer.add(newMember); - } catch (ObjectNotFoundException ex) { + } catch (ObjectNotFound ex) { observer.control(ERROR, "Listed member "+newChild+" was not found."); } catch (ClassCastException ex) { Logger.error(ex); @@ -117,7 +117,7 @@ public class MemberSubscription implements Runnable { Logger.msg(4, "Adding "+path); contents.add(name); observer.add(newMember); - } catch (ObjectNotFoundException e) { + } catch (ObjectNotFound e) { Logger.error("Member Subscription: could not load "+path); Logger.error(e); } diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java b/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java index 4aff44b..02dc665 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyClientConnection.java @@ -30,7 +30,7 @@ import java.net.SocketException; import java.util.ArrayList; import java.util.Iterator; -import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidData; import com.c2kernel.lookup.ItemPath; import com.c2kernel.process.Gateway; import com.c2kernel.utils.Logger; @@ -110,7 +110,7 @@ public class ProxyClientConnection implements SocketHandler { thisMessage = new ProxyMessage(input); processMessage(thisMessage); } catch (InterruptedIOException ex) { //timeout - } catch (InvalidDataException ex) { // invalid proxy message + } catch (InvalidData ex) { // invalid proxy message Logger.error("ProxyClientConnection "+thisClientId+" - Invalid proxy message: "+input); } @@ -123,7 +123,7 @@ public class ProxyClientConnection implements SocketHandler { Logger.msg(1, "ProxyClientConnection "+thisClientId+" closed."); } - private void processMessage(ProxyMessage message) throws InvalidDataException { + private void processMessage(ProxyMessage message) throws InvalidData { // proxy disconnection if (message.getPath().equals(ProxyMessage.BYEPATH)) { diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java b/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java index aa38ea8..8824951 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyManager.java @@ -25,8 +25,8 @@ import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.Iterator; -import com.c2kernel.common.InvalidDataException; -import com.c2kernel.common.ObjectNotFoundException; +import com.c2kernel.common.InvalidData; +import com.c2kernel.common.ObjectNotFound; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.ItemPath; @@ -103,7 +103,7 @@ public class ProxyManager } } - protected void processMessage(ProxyMessage thisMessage) throws InvalidDataException { + protected void processMessage(ProxyMessage thisMessage) throws InvalidData { if (Logger.doLog(9)) Logger.msg(9, thisMessage.toString()); if (thisMessage.getPath().equals(ProxyMessage.PINGPATH)) // ping response @@ -166,7 +166,7 @@ public class ProxyManager **************************************************************************/ private ItemProxy createProxy( org.omg.CORBA.Object ior, ItemPath itemPath) - throws ObjectNotFoundException + throws ObjectNotFound { ItemProxy newProxy = null; @@ -201,7 +201,7 @@ public class ProxyManager **************************************************************************/ private ItemProxy getProxy( org.omg.CORBA.Object ior, ItemPath itemPath) - throws ObjectNotFoundException + throws ObjectNotFound { synchronized(proxyPool) { @@ -224,7 +224,7 @@ public class ProxyManager * Proxy from Alias **************************************************************************/ public ItemProxy getProxy( Path path ) - throws ObjectNotFoundException + throws ObjectNotFound { ItemPath itemPath; if (path instanceof ItemPath) itemPath = (ItemPath)path; @@ -236,7 +236,7 @@ public class ProxyManager } public AgentProxy getAgentProxy( AgentPath path ) - throws ObjectNotFoundException + throws ObjectNotFound { return (AgentProxy) getProxy(path); } diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java b/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java index 5aabf7e..fc69992 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyMessage.java @@ -23,7 +23,7 @@ package com.c2kernel.entity.proxy; import java.io.IOException; import java.net.DatagramPacket; -import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidData; import com.c2kernel.lookup.InvalidItemPathException; import com.c2kernel.lookup.ItemPath; @@ -65,17 +65,17 @@ public class ProxyMessage { setState(state); } - public ProxyMessage(String line) throws InvalidDataException, IOException { + public ProxyMessage(String line) throws InvalidData, IOException { if (line == null) throw new IOException("Null proxy message"); String[] tok = line.split(":"); if (tok.length != 2) - throw new InvalidDataException("String '"+line+"' does not constitute a valid proxy message.", ""); + throw new InvalidData("String '"+line+"' does not constitute a valid proxy message."); if (tok[0].length() > 0 && !tok[0].equals("tree")) { try { itemPath = new ItemPath(tok[0]); } catch (InvalidItemPathException e) { - throw new InvalidDataException("Item in proxy message "+line+" was not valid"); + throw new InvalidData("Item in proxy message "+line+" was not valid"); } } path = tok[1]; @@ -85,7 +85,7 @@ public class ProxyMessage { } } - public ProxyMessage(DatagramPacket packet) throws InvalidDataException, IOException { + public ProxyMessage(DatagramPacket packet) throws InvalidData, IOException { this(new String(packet.getData())); } diff --git a/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java b/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java index 25a7216..edcbd44 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java +++ b/src/main/java/com/c2kernel/entity/proxy/ProxyServerConnection.java @@ -27,7 +27,7 @@ import java.io.InterruptedIOException; import java.io.PrintWriter; import java.net.Socket; -import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.InvalidData; import com.c2kernel.utils.Logger; @@ -76,7 +76,7 @@ public class ProxyServerConnection extends Thread manager.processMessage(thisMessage); } catch (InterruptedIOException ex) { // timeout - send a ping sendMessage(ProxyMessage.pingMessage); - } catch (InvalidDataException ex) { // invalid proxy message + } catch (InvalidData ex) { // invalid proxy message if (input != null) Logger.error("EntityProxyManager - Invalid proxy message: "+input); } -- cgit v1.2.3