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. --- .../com/c2kernel/persistency/outcome/Outcome.java | 28 +++++++++++----------- .../persistency/outcome/OutcomeInitiator.java | 4 ++-- .../persistency/outcome/OutcomeValidator.java | 12 +++++----- .../c2kernel/persistency/outcome/Viewpoint.java | 12 +++++----- 4 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/main/java/com/c2kernel/persistency/outcome') 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