From b68ea0f2b12c4c5189c5fc7c182a1b242dc63579 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 3 Oct 2014 23:18:47 +0200 Subject: Rolled back the renaming of existing exceptions. --- .../persistency/ClusterStorageManager.java | 6 ++--- .../java/com/c2kernel/persistency/ProxyLoader.java | 4 ++-- .../java/com/c2kernel/persistency/RemoteMap.java | 4 ++-- .../c2kernel/persistency/TransactionManager.java | 4 ++-- .../com/c2kernel/persistency/outcome/Outcome.java | 28 +++++++++++----------- .../persistency/outcome/OutcomeInitiator.java | 4 ++-- .../persistency/outcome/OutcomeValidator.java | 12 +++++----- .../c2kernel/persistency/outcome/Viewpoint.java | 12 +++++----- 8 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/main/java/com/c2kernel/persistency') diff --git a/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java b/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java index baabb19..cc64d5a 100644 --- a/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java +++ b/src/main/java/com/c2kernel/persistency/ClusterStorageManager.java @@ -27,7 +27,7 @@ import java.util.Iterator; import java.util.Map; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.agent.JobList; @@ -207,7 +207,7 @@ public class ClusterStorageManager { } /** Internal get method. Retrieves clusters from ClusterStorages & maintains the memory cache */ - public C2KLocalObject get(ItemPath itemPath, String path) throws PersistencyException, ObjectNotFound { + public C2KLocalObject get(ItemPath itemPath, String path) throws PersistencyException, ObjectNotFoundException { C2KLocalObject result = null; // check cache first Map sysKeyMemCache = null; @@ -277,7 +277,7 @@ public class ClusterStorageManager { "/" + path + ": " + e.getMessage()); } } - throw new ObjectNotFound("ClusterStorageManager.get() - Path " + path + " not found in " + itemPath); + throw new ObjectNotFoundException("ClusterStorageManager.get() - Path " + path + " not found in " + itemPath); } /** Internal put method. Creates or overwrites a cluster in all writers. Used when committing transactions. */ diff --git a/src/main/java/com/c2kernel/persistency/ProxyLoader.java b/src/main/java/com/c2kernel/persistency/ProxyLoader.java index f8704e3..88b6f03 100644 --- a/src/main/java/com/c2kernel/persistency/ProxyLoader.java +++ b/src/main/java/com/c2kernel/persistency/ProxyLoader.java @@ -22,7 +22,7 @@ package com.c2kernel.persistency; import java.util.HashMap; import java.util.StringTokenizer; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.AgentHelper; import com.c2kernel.entity.C2KLocalObject; @@ -84,7 +84,7 @@ public class ProxyLoader extends ClusterStorage { else return (C2KLocalObject)Gateway.getMarshaller().unmarshall(queryData); } - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { return null; } catch (Exception e) { Logger.error(e); diff --git a/src/main/java/com/c2kernel/persistency/RemoteMap.java b/src/main/java/com/c2kernel/persistency/RemoteMap.java index b1a1e51..d23551a 100644 --- a/src/main/java/com/c2kernel/persistency/RemoteMap.java +++ b/src/main/java/com/c2kernel/persistency/RemoteMap.java @@ -27,7 +27,7 @@ import java.util.Iterator; import java.util.Set; import java.util.TreeMap; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.proxy.ItemProxy; @@ -225,7 +225,7 @@ public class RemoteMap extends TreeMap impl return value; } catch (PersistencyException e) { Logger.error(e); - } catch (ObjectNotFound e) { + } catch (ObjectNotFoundException e) { Logger.error(e); } } diff --git a/src/main/java/com/c2kernel/persistency/TransactionManager.java b/src/main/java/com/c2kernel/persistency/TransactionManager.java index 792709a..4fc3f8c 100644 --- a/src/main/java/com/c2kernel/persistency/TransactionManager.java +++ b/src/main/java/com/c2kernel/persistency/TransactionManager.java @@ -23,7 +23,7 @@ package com.c2kernel.persistency; import java.util.ArrayList; import java.util.HashMap; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.agent.JobList; @@ -73,7 +73,7 @@ public class TransactionManager { */ public C2KLocalObject get(ItemPath itemPath, String path, Object locker) throws PersistencyException, - ObjectNotFound { + ObjectNotFoundException { if (path.startsWith("/") && path.length() > 1) path = path.substring(1); // deal out top level remote maps, if transactions aren't needed diff --git a/src/main/java/com/c2kernel/persistency/outcome/Outcome.java b/src/main/java/com/c2kernel/persistency/outcome/Outcome.java index ac2d970..e039476 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/Outcome.java +++ b/src/main/java/com/c2kernel/persistency/outcome/Outcome.java @@ -40,8 +40,8 @@ import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.LSSerializer; import org.xml.sax.InputSource; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.persistency.ClusterStorage; @@ -144,10 +144,10 @@ public class Outcome implements C2KLocalObject { mData = null; } - public String getFieldByXPath(String xpath) throws XPathExpressionException, InvalidData { + public String getFieldByXPath(String xpath) throws XPathExpressionException, InvalidDataException { Node field = getNodeByXPath(xpath); if (field == null) - throw new InvalidData(xpath); + throw new InvalidDataException(xpath); else if (field.getNodeType()==Node.TEXT_NODE || field.getNodeType()==Node.CDATA_SECTION_NODE) return field.getNodeValue(); @@ -155,28 +155,28 @@ public class Outcome implements C2KLocalObject { else if (field.getNodeType()==Node.ELEMENT_NODE) { NodeList fieldChildren = field.getChildNodes(); if (fieldChildren.getLength() == 0) - throw new InvalidData("No child node for element"); + throw new InvalidDataException("No child node for element"); else if (fieldChildren.getLength() == 1) { Node child = fieldChildren.item(0); if (child.getNodeType()==Node.TEXT_NODE || child.getNodeType()==Node.CDATA_SECTION_NODE) return child.getNodeValue(); else - throw new InvalidData("Can't get data from child node of type "+child.getNodeName()); + throw new InvalidDataException("Can't get data from child node of type "+child.getNodeName()); } else - throw new InvalidData("Element "+xpath+" has too many children"); + throw new InvalidDataException("Element "+xpath+" has too many children"); } else if (field.getNodeType()==Node.ATTRIBUTE_NODE) return field.getNodeValue(); else - throw new InvalidData("Don't know what to do with node "+field.getNodeName()); + throw new InvalidDataException("Don't know what to do with node "+field.getNodeName()); } - public void setFieldByXPath(String xpath, String data) throws XPathExpressionException, InvalidData { + public void setFieldByXPath(String xpath, String data) throws XPathExpressionException, InvalidDataException { Node field = getNodeByXPath(xpath); if (field == null) - throw new InvalidData(xpath); + throw new InvalidDataException(xpath); else if (field.getNodeType()==Node.ELEMENT_NODE) { NodeList fieldChildren = field.getChildNodes(); @@ -191,16 +191,16 @@ public class Outcome implements C2KLocalObject { child.setNodeValue(data); break; default: - throw new InvalidData("Can't set child node of type "+child.getNodeName()); + throw new InvalidDataException("Can't set child node of type "+child.getNodeName()); } } else - throw new InvalidData("Element "+xpath+" has too many children"); + throw new InvalidDataException("Element "+xpath+" has too many children"); } else if (field.getNodeType()==Node.ATTRIBUTE_NODE) field.setNodeValue(data); else - throw new InvalidData("Don't know what to do with node "+field.getNodeName()); + throw new InvalidDataException("Don't know what to do with node "+field.getNodeName()); } @@ -211,7 +211,7 @@ public class Outcome implements C2KLocalObject { return mData; } - public Schema getSchema() throws ObjectNotFound { + public Schema getSchema() throws ObjectNotFoundException { return LocalObjectLoader.getSchema(mSchemaType, mSchemaVersion); } diff --git a/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java b/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java index 2c4427e..e152df9 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java +++ b/src/main/java/com/c2kernel/persistency/outcome/OutcomeInitiator.java @@ -20,11 +20,11 @@ */ package com.c2kernel.persistency.outcome; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.entity.agent.Job; public interface OutcomeInitiator { - public String initOutcome(Job job) throws InvalidData; + public String initOutcome(Job job) throws InvalidDataException; } diff --git a/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java b/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java index d89f7e7..80af535 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java +++ b/src/main/java/com/c2kernel/persistency/outcome/OutcomeValidator.java @@ -38,7 +38,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; -import com.c2kernel.common.InvalidData; +import com.c2kernel.common.InvalidDataException; import com.c2kernel.utils.Logger; /************************************************************************** @@ -69,7 +69,7 @@ public class OutcomeValidator implements ErrorHandler, XMLErrorHandler { XMLGrammarPoolImpl schemaGrammarPool = new XMLGrammarPoolImpl(1); SymbolTable sym = new SymbolTable(); - public static OutcomeValidator getValidator(Schema schema) throws InvalidData { + public static OutcomeValidator getValidator(Schema schema) throws InvalidDataException { if (schema.docType.equals("Schema") && schema.docVersion==0) @@ -82,11 +82,11 @@ public class OutcomeValidator implements ErrorHandler, XMLErrorHandler { errors = new StringBuffer(); } - public OutcomeValidator(Schema schema) throws InvalidData { + public OutcomeValidator(Schema schema) throws InvalidDataException { this.schema = schema; if (schema.docType.equals("Schema")) - throw new InvalidData("Use SchemaValidator to validate schema"); + throw new InvalidDataException("Use SchemaValidator to validate schema"); errors = new StringBuffer(); Logger.msg(5, "Parsing "+schema.docType+" version "+schema.docVersion+". "+schema.schema.length()+" chars"); @@ -103,11 +103,11 @@ public class OutcomeValidator implements ErrorHandler, XMLErrorHandler { try { preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA, new XMLInputSource(null, null, null, new StringReader(schema.schema), null)); } catch (IOException ex) { - throw new InvalidData("Error parsing schema: "+ex.getMessage()); + throw new InvalidDataException("Error parsing schema: "+ex.getMessage()); } if (errors.length() > 0) { - throw new InvalidData("Schema error: \n"+errors.toString()); + throw new InvalidDataException("Schema error: \n"+errors.toString()); } } diff --git a/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java b/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java index 151bf65..4ef0109 100644 --- a/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java +++ b/src/main/java/com/c2kernel/persistency/outcome/Viewpoint.java @@ -20,8 +20,8 @@ */ package com.c2kernel.persistency.outcome; -import com.c2kernel.common.InvalidData; -import com.c2kernel.common.ObjectNotFound; +import com.c2kernel.common.InvalidDataException; +import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.common.PersistencyException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.events.Event; @@ -70,8 +70,8 @@ public class Viewpoint implements C2KLocalObject { this.eventId = eventId; } - public Outcome getOutcome() throws ObjectNotFound, PersistencyException { - if (eventId == NONE) throw new ObjectNotFound("No last eventId defined"); + public Outcome getOutcome() throws ObjectNotFoundException, PersistencyException { + if (eventId == NONE) throw new ObjectNotFoundException("No last eventId defined"); Outcome retVal = (Outcome)Gateway.getStorage().get(itemPath, ClusterStorage.OUTCOME+"/"+schemaName+"/"+schemaVersion+"/"+eventId, null); return retVal; } @@ -194,10 +194,10 @@ public class Viewpoint implements C2KLocalObject { * @return GDataRecord */ public Event getEvent() - throws InvalidData, PersistencyException, ObjectNotFound + throws InvalidDataException, PersistencyException, ObjectNotFoundException { if (eventId == NONE) - throw new InvalidData("No last eventId defined"); + throw new InvalidDataException("No last eventId defined"); return (Event)Gateway.getStorage().get(itemPath, ClusterStorage.HISTORY+"/"+eventId, null); } -- cgit v1.2.3