From f43cfce8f9591bbd9315c6965e909c8780446da5 Mon Sep 17 00:00:00 2001 From: idfx Date: Thu, 9 May 2002 13:43:31 +0000 Subject: [PATCH] i changed the exception-handling of the new producers and localizers to use the multex-api (MultiTierExceptionHandling) written by Christoph Knabe. Exceptions now extend multex.Exc and Error-Exceptions now extend multex.Failure ... more about that in a seperate mail --- source/mir/config/ConfigChecker.java | 12 +++---- source/mir/config/ConfigNode.java | 16 ++++----- source/mir/config/ConfigReader.java | 40 +++++++++++----------- source/mir/config/MirConfiguration.java | 2 +- .../exceptions/ConfigDefineNotKnownException.java | 2 +- .../{ConfigException.java => ConfigFailure.java} | 12 ++++--- .../ConfigInvalidPropertyTypeException.java | 2 +- .../exceptions/ConfigMissingPropertyException.java | 2 +- source/mir/producer/Producer.java | 2 +- source/mir/producer/ProducerException.java | 8 ----- source/mir/producer/ProducerFactory.java | 2 +- source/mir/producer/ProducerFailure.java | 10 ++++++ source/mircoders/global/ProducerEngine.java | 12 +++++-- .../mircoders/localizer/MirLocalizerException.java | 7 ++-- .../mircoders/localizer/MirLocalizerFailure.java | 9 +++++ .../localizer/MirProducerToolLocalizer.java | 2 +- .../basic/MirBasicProducerToolLocalizer.java | 4 +-- source/mircoders/producer/CompositeProducer.java | 2 +- .../producer/CompositeProducerFactory.java | 2 +- source/mircoders/producer/ContentProducer.java | 2 +- .../mircoders/producer/ContentProducerFactory.java | 4 +-- source/mircoders/producer/NullProducer.java | 2 +- source/mircoders/producer/OldProducerAdapter.java | 4 +-- source/mircoders/producer/ScriptCallProducer.java | 4 +-- .../producer/ScriptCallProducerFactory.java | 2 +- source/mircoders/producer/StartPageProducer.java | 2 +- .../producer/StartPageProducerFactory.java | 4 +-- source/mircoders/producer/StaticProducer.java | 2 +- .../mircoders/producer/StaticProducerFactory.java | 4 +-- .../producer/TopicStartPageProducerFactory.java | 4 +-- 30 files changed, 101 insertions(+), 81 deletions(-) rename source/mir/config/exceptions/{ConfigException.java => ConfigFailure.java} (54%) delete mode 100755 source/mir/producer/ProducerException.java create mode 100755 source/mir/producer/ProducerFailure.java create mode 100755 source/mircoders/localizer/MirLocalizerFailure.java diff --git a/source/mir/config/ConfigChecker.java b/source/mir/config/ConfigChecker.java index 70006bfd..bc5528da 100755 --- a/source/mir/config/ConfigChecker.java +++ b/source/mir/config/ConfigChecker.java @@ -25,7 +25,7 @@ public class ConfigChecker { rootNode = new Node(); } - public void check(ConfigNode aNode) throws ConfigException { + public void check(ConfigNode aNode) throws ConfigFailure { getRootNode().check(aNode); } @@ -63,7 +63,7 @@ public class ConfigChecker { addTypeConstraint(aPropertyName, aType); } - public void check(ConfigNode aNode) throws ConfigException { + public void check(ConfigNode aNode) throws ConfigFailure { Iterator iterator; iterator=constraints.iterator(); @@ -86,7 +86,7 @@ public class ConfigChecker { propertyName=aPropertyName; } - public void check(ConfigNode aNode) throws ConfigException { + public void check(ConfigNode aNode) throws ConfigFailure { }; } @@ -95,7 +95,7 @@ public class ConfigChecker { super(aPropertyName); } - public void check(ConfigNode aNode) throws ConfigException { + public void check(ConfigNode aNode) throws ConfigFailure { aNode.getRequiredStringProperty(propertyName); }; } @@ -109,7 +109,7 @@ public class ConfigChecker { type=aType; } - public void check(ConfigNode aNode) throws ConfigException { + public void check(ConfigNode aNode) throws ConfigFailure { switch(type) { case INTEGER: aNode.getOptionalIntegerProperty(propertyName, new Integer(0)); @@ -124,7 +124,7 @@ public class ConfigChecker { aNode.getOptionalBooleanProperty(propertyName, Boolean.FALSE); break; default: - throw new ConfigException("Invalid value for type in type constraint: "+new Integer(type).toString()); + throw new ConfigFailure("Invalid value for type in type constraint: "+new Integer(type).toString()); } } } diff --git a/source/mir/config/ConfigNode.java b/source/mir/config/ConfigNode.java index 868bccb5..a70aae0c 100755 --- a/source/mir/config/ConfigNode.java +++ b/source/mir/config/ConfigNode.java @@ -8,12 +8,12 @@ public interface ConfigNode { public String getLocationDescription(); public ConfigNode getSubNode(String aSubNodeName); - public Boolean getRequiredBooleanProperty(String aPropertyName) throws ConfigException; - public Integer getRequiredIntegerProperty(String aPropertyName) throws ConfigException; - public String getRequiredStringProperty(String aPropertyName) throws ConfigException; - public Double getRequiredDoubleProperty(String aPropertyName) throws ConfigException; - public Boolean getOptionalBooleanProperty(String aPropertyName, Boolean aDefaultValue) throws ConfigException; - public Integer getOptionalIntegerProperty(String aPropertyName, Integer aDefaultValue) throws ConfigException; - public String getOptionalStringProperty(String aPropertyName, String aDefaultValue) throws ConfigException; - public Double getOptionalDoubleProperty(String aPropertyName, Double aDefaultValue) throws ConfigException; + public Boolean getRequiredBooleanProperty(String aPropertyName) throws ConfigFailure; + public Integer getRequiredIntegerProperty(String aPropertyName) throws ConfigFailure; + public String getRequiredStringProperty(String aPropertyName) throws ConfigFailure; + public Double getRequiredDoubleProperty(String aPropertyName) throws ConfigFailure; + public Boolean getOptionalBooleanProperty(String aPropertyName, Boolean aDefaultValue) throws ConfigFailure; + public Integer getOptionalIntegerProperty(String aPropertyName, Integer aDefaultValue) throws ConfigFailure; + public String getOptionalStringProperty(String aPropertyName, String aDefaultValue) throws ConfigFailure; + public Double getOptionalDoubleProperty(String aPropertyName, Double aDefaultValue) throws ConfigFailure; } diff --git a/source/mir/config/ConfigReader.java b/source/mir/config/ConfigReader.java index 03ecd532..d0c0355a 100755 --- a/source/mir/config/ConfigReader.java +++ b/source/mir/config/ConfigReader.java @@ -26,7 +26,7 @@ public class ConfigReader { super(); }; - public void parseFile(String aFileName, ConfigNodeBuilder aRootNode) throws ConfigException { + public void parseFile(String aFileName, ConfigNodeBuilder aRootNode) throws ConfigFailure { try { SAXParserFactory parserFactory = SAXParserFactory.newInstance(); @@ -40,12 +40,12 @@ public class ConfigReader { handler.includeFile(aFileName); } catch (Throwable e) { - if (e instanceof SAXParseException && ((SAXParseException) e).getException() instanceof ConfigException) { - throw (ConfigException) ((SAXParseException) e).getException(); + if (e instanceof SAXParseException && ((SAXParseException) e).getException() instanceof ConfigFailure) { + throw (ConfigFailure) ((SAXParseException) e).getException(); } else { e.printStackTrace(); - throw new ConfigException( e.getMessage() ); + throw new ConfigFailure( e.getMessage() ); } } } @@ -78,7 +78,7 @@ public class ConfigReader { locator=aLocator; } - private void includeFile(String aFileName) throws ConfigException, SAXParseException, SAXException { + private void includeFile(String aFileName) throws ConfigFailure, SAXParseException, SAXException { File file; SAXParser parser; InputSource inputSource; @@ -93,7 +93,7 @@ public class ConfigReader { System.err.println("about to include "+file.getCanonicalPath()); if (includeFileStack.contains(file.getCanonicalPath())) { - throw new ConfigException("recursive inclusion of file "+file.getCanonicalPath(), getLocatorDescription(locator)); + throw new ConfigFailure("recursive inclusion of file "+file.getCanonicalPath(), getLocatorDescription(locator)); } parser=parserFactory.newSAXParser(); @@ -110,19 +110,19 @@ public class ConfigReader { } } catch (ParserConfigurationException e) { - throw new ConfigException("Internal exception while including \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator)); + throw new ConfigFailure("Internal exception while including \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator)); } catch (SAXParseException e) { throw e; } - catch (ConfigException e) { + catch (ConfigFailure e) { throw e; } catch (FileNotFoundException e) { - throw new ConfigException("Include file \""+aFileName+"\" not found: "+e.getMessage(), e, getLocatorDescription(locator)); + throw new ConfigFailure("Include file \""+aFileName+"\" not found: "+e.getMessage(), e, getLocatorDescription(locator)); } catch (IOException e) { - throw new ConfigException("unable to open include file \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator)); + throw new ConfigFailure("unable to open include file \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator)); } } @@ -132,18 +132,18 @@ public class ConfigReader { level++; try { if (builder==null) { - throw new ConfigException("define, include and property tags cannot have content", getLocatorDescription(locator)); + throw new ConfigFailure("define, include and property tags cannot have content", getLocatorDescription(locator)); } if (aQualifiedName.equals(propertyTagName)) { String name=anAttributes.getValue(propertyNameAttribute); String value=anAttributes.getValue(propertyValueAttribute); if (name==null) { - throw new ConfigException("property has no name attribute", getLocatorDescription(locator)); + throw new ConfigFailure("property has no name attribute", getLocatorDescription(locator)); } else if (value==null) { - throw new ConfigException("property \""+name+"\" has no value attribute", getLocatorDescription(locator)); + throw new ConfigFailure("property \""+name+"\" has no value attribute", getLocatorDescription(locator)); } builder.addProperty(name, definesManager.resolve(value, getLocatorDescription(locator)), value, getLocatorDescription(locator)); @@ -155,11 +155,11 @@ public class ConfigReader { String value=anAttributes.getValue(defineValueAttribute); if (name==null) { - throw new ConfigException("define has no name attribute", getLocatorDescription(locator)); + throw new ConfigFailure("define has no name attribute", getLocatorDescription(locator)); } else if (value==null) { - throw new ConfigException("define \""+name+"\" has no value attribute", getLocatorDescription(locator)); + throw new ConfigFailure("define \""+name+"\" has no value attribute", getLocatorDescription(locator)); } definesManager.addDefine(name, definesManager.resolve(value, getLocatorDescription(locator))); @@ -169,7 +169,7 @@ public class ConfigReader { String fileName=anAttributes.getValue(includeFileAttribute); if (fileName==null) { - throw new ConfigException("include has no file attribute", getLocatorDescription(locator)); + throw new ConfigFailure("include has no file attribute", getLocatorDescription(locator)); } includeFile(definesManager.resolve(fileName, getLocatorDescription(locator))); @@ -180,7 +180,7 @@ public class ConfigReader { builder=builder.makeSubNode(aQualifiedName, getLocatorDescription(locator)); } } - catch (ConfigException e) { + catch (ConfigFailure e) { throw new SAXParseException(e.getMessage(), locator, e); } } @@ -193,7 +193,7 @@ public class ConfigReader { public void characters(char[] aBuffer, int aStart, int anEnd) throws SAXParseException { String text = new String(aBuffer, aStart, anEnd).trim(); if ( text.length() > 0) { - throw new SAXParseException("Text not allowed", locator, new ConfigException("text not allowed", getLocatorDescription(locator))); + throw new SAXParseException("Text not allowed", locator, new ConfigFailure("text not allowed", getLocatorDescription(locator))); } } } @@ -209,7 +209,7 @@ public class ConfigReader { defines.put(aName, anExpression); } - public String resolve(String anExpression, String aLocation) throws ConfigException { + public String resolve(String anExpression, String aLocation) throws ConfigFailure { int previousPosition = 0; int position; int endOfNamePosition; @@ -239,7 +239,7 @@ public class ConfigReader { } } else { - throw new ConfigException("Missing }", aLocation); + throw new ConfigFailure("Missing }", aLocation); } } diff --git a/source/mir/config/MirConfiguration.java b/source/mir/config/MirConfiguration.java index 9885f024..53fa7f11 100755 --- a/source/mir/config/MirConfiguration.java +++ b/source/mir/config/MirConfiguration.java @@ -15,7 +15,7 @@ public class MirConfiguration { rootNode = aRootNode; } - public MirConfiguration(String aFileName) throws ConfigException { + public MirConfiguration(String aFileName) throws ConfigFailure { super(); rootNode = new ConfigSimpleNode(); diff --git a/source/mir/config/exceptions/ConfigDefineNotKnownException.java b/source/mir/config/exceptions/ConfigDefineNotKnownException.java index 21fce9c8..cc943808 100755 --- a/source/mir/config/exceptions/ConfigDefineNotKnownException.java +++ b/source/mir/config/exceptions/ConfigDefineNotKnownException.java @@ -1,6 +1,6 @@ package mir.config.exceptions; -public class ConfigDefineNotKnownException extends ConfigException { +public class ConfigDefineNotKnownException extends ConfigFailure { public ConfigDefineNotKnownException(String aMessage, String aLocation) { super (aMessage, aLocation); } diff --git a/source/mir/config/exceptions/ConfigException.java b/source/mir/config/exceptions/ConfigFailure.java similarity index 54% rename from source/mir/config/exceptions/ConfigException.java rename to source/mir/config/exceptions/ConfigFailure.java index f02c79f5..786fb939 100755 --- a/source/mir/config/exceptions/ConfigException.java +++ b/source/mir/config/exceptions/ConfigFailure.java @@ -1,23 +1,25 @@ package mir.config.exceptions; +import multex.Failure; + import java.io.*; -public class ConfigException extends Exception { +public class ConfigFailure extends Failure { private String locationDescription; private Throwable cause; - public ConfigException (String aMessage, Throwable aCause, String aLocationDescription) { - super ("Configuration error at "+aLocationDescription+": "+aMessage); + public ConfigFailure (String aMessage, Throwable aCause, String aLocationDescription) { + super ("Configuration error at "+aLocationDescription+": "+aMessage,aCause); locationDescription = aLocationDescription; cause = aCause; } - public ConfigException (String aMessage, String aLocationDescription) { + public ConfigFailure (String aMessage, String aLocationDescription) { this (aMessage, (Throwable) null, aLocationDescription); } - public ConfigException (String aMessage) { + public ConfigFailure (String aMessage) { this (aMessage, (Throwable) null, "?"); } } diff --git a/source/mir/config/exceptions/ConfigInvalidPropertyTypeException.java b/source/mir/config/exceptions/ConfigInvalidPropertyTypeException.java index 494227f4..b0c6869c 100755 --- a/source/mir/config/exceptions/ConfigInvalidPropertyTypeException.java +++ b/source/mir/config/exceptions/ConfigInvalidPropertyTypeException.java @@ -1,6 +1,6 @@ package mir.config.exceptions; -public class ConfigInvalidPropertyTypeException extends ConfigException { +public class ConfigInvalidPropertyTypeException extends ConfigFailure { public ConfigInvalidPropertyTypeException(String aMessage, String aLocation) { super (aMessage, aLocation); } diff --git a/source/mir/config/exceptions/ConfigMissingPropertyException.java b/source/mir/config/exceptions/ConfigMissingPropertyException.java index df19705a..f80e2330 100755 --- a/source/mir/config/exceptions/ConfigMissingPropertyException.java +++ b/source/mir/config/exceptions/ConfigMissingPropertyException.java @@ -1,6 +1,6 @@ package mir.config.exceptions; -public class ConfigMissingPropertyException extends ConfigException { +public class ConfigMissingPropertyException extends ConfigFailure { public ConfigMissingPropertyException(String aMessage, String aLocation) { super (aMessage, aLocation); } diff --git a/source/mir/producer/Producer.java b/source/mir/producer/Producer.java index be9415a0..ff57f36f 100755 --- a/source/mir/producer/Producer.java +++ b/source/mir/producer/Producer.java @@ -3,5 +3,5 @@ package mir.producer; import java.io.*; public interface Producer { - public void produce( PrintWriter aLogger ) throws ProducerException; + public void produce( PrintWriter aLogger ) throws ProducerFailure; } diff --git a/source/mir/producer/ProducerException.java b/source/mir/producer/ProducerException.java deleted file mode 100755 index 7c0cf11f..00000000 --- a/source/mir/producer/ProducerException.java +++ /dev/null @@ -1,8 +0,0 @@ -package mir.producer; - -public class ProducerException extends Exception { - - public ProducerException(Throwable cause) { - super(cause.getMessage()); - } -} \ No newline at end of file diff --git a/source/mir/producer/ProducerFactory.java b/source/mir/producer/ProducerFactory.java index 401c25e2..6cb01be5 100755 --- a/source/mir/producer/ProducerFactory.java +++ b/source/mir/producer/ProducerFactory.java @@ -3,7 +3,7 @@ package mir.producer; import java.util.*; public interface ProducerFactory { - public Producer makeProducer(String aVerb) throws ProducerException; + public Producer makeProducer(String aVerb) throws ProducerFailure; public Iterator verbs(); } diff --git a/source/mir/producer/ProducerFailure.java b/source/mir/producer/ProducerFailure.java new file mode 100755 index 00000000..580e1d02 --- /dev/null +++ b/source/mir/producer/ProducerFailure.java @@ -0,0 +1,10 @@ +package mir.producer; + +import multex.Failure; + +public class ProducerFailure extends Failure { + + public ProducerFailure(String msg,Throwable cause) { + super(msg,cause); + } +} \ No newline at end of file diff --git a/source/mircoders/global/ProducerEngine.java b/source/mircoders/global/ProducerEngine.java index 33ebb65a..b59a523d 100755 --- a/source/mircoders/global/ProducerEngine.java +++ b/source/mircoders/global/ProducerEngine.java @@ -4,6 +4,8 @@ import java.util.*; import java.io.*; import mir.producer.*; import mir.util.*; +import multex.Exc; +import multex.Failure; public class ProducerEngine { private Map producers; @@ -18,9 +20,8 @@ public class ProducerEngine { log = new PrintWriter(new FileWriter(new File("/tmp/producer.log"))); } catch (Exception e) { - throw new RuntimeException(e.getMessage()); + throw new ProducerEngineRuntimeExc("Creating PrintWriter log failed",e); } - queueThread = new Thread(new ProducerJobQueueThread()); queueThread.start(); } @@ -136,4 +137,11 @@ public class ProducerEngine { } } + + public static class ProducerEngineRuntimeExc extends Failure { + public ProducerEngineRuntimeExc(String msg, Exception cause){ + super(msg,cause); + } + } + } \ No newline at end of file diff --git a/source/mircoders/localizer/MirLocalizerException.java b/source/mircoders/localizer/MirLocalizerException.java index 9bb04db8..1bb82157 100755 --- a/source/mircoders/localizer/MirLocalizerException.java +++ b/source/mircoders/localizer/MirLocalizerException.java @@ -1,11 +1,10 @@ package mircoders.localizer; -public class MirLocalizerException extends Exception { +import multex.Exc; + +public class MirLocalizerException extends Exc { public MirLocalizerException(String aMessage) { super(aMessage); } - public MirLocalizerException(Throwable aCause) { - super(aCause.getMessage()); - } } \ No newline at end of file diff --git a/source/mircoders/localizer/MirLocalizerFailure.java b/source/mircoders/localizer/MirLocalizerFailure.java new file mode 100755 index 00000000..71a73eff --- /dev/null +++ b/source/mircoders/localizer/MirLocalizerFailure.java @@ -0,0 +1,9 @@ +package mircoders.localizer; + +import multex.Failure; + +public class MirLocalizerFailure extends Failure { + public MirLocalizerFailure(String msg, Throwable throwable) { + super(msg, throwable); + } +} diff --git a/source/mircoders/localizer/MirProducerToolLocalizer.java b/source/mircoders/localizer/MirProducerToolLocalizer.java index 5a1c44a4..a9bf8239 100755 --- a/source/mircoders/localizer/MirProducerToolLocalizer.java +++ b/source/mircoders/localizer/MirProducerToolLocalizer.java @@ -5,6 +5,6 @@ import java.io.*; public interface MirProducerToolLocalizer { public void initializeGenerationValueSet(Map aValueSet); - public PrintWriter openWriter(String anIdentifier) throws MirLocalizerException; + public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure; public void closeWriter(PrintWriter aWriter); } diff --git a/source/mircoders/localizer/basic/MirBasicProducerToolLocalizer.java b/source/mircoders/localizer/basic/MirBasicProducerToolLocalizer.java index 8a5eb8c1..406f0316 100755 --- a/source/mircoders/localizer/basic/MirBasicProducerToolLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicProducerToolLocalizer.java @@ -56,7 +56,7 @@ public class MirBasicProducerToolLocalizer implements MirProducerToolLocalizer { aValueSet.put("parentlist", parentList); }; - public PrintWriter openWriter(String anIdentifier) throws MirLocalizerException { + public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure { File file; File dir; @@ -74,7 +74,7 @@ public class MirBasicProducerToolLocalizer implements MirProducerToolLocalizer { ); } catch (Throwable t) { - throw new MirLocalizerException(t); + throw new MirLocalizerFailure("Failure while opening a PrintWriter",t); } }; diff --git a/source/mircoders/producer/CompositeProducer.java b/source/mircoders/producer/CompositeProducer.java index d444d160..9ce0c0d9 100755 --- a/source/mircoders/producer/CompositeProducer.java +++ b/source/mircoders/producer/CompositeProducer.java @@ -16,7 +16,7 @@ public class CompositeProducer implements mir.producer.Producer { producers.add(aProducer); } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { Iterator i; i=producers.iterator(); diff --git a/source/mircoders/producer/CompositeProducerFactory.java b/source/mircoders/producer/CompositeProducerFactory.java index 2ef4a273..5b1de140 100755 --- a/source/mircoders/producer/CompositeProducerFactory.java +++ b/source/mircoders/producer/CompositeProducerFactory.java @@ -36,7 +36,7 @@ public class CompositeProducerFactory implements ProducerFactory { } } - public mir.producer.Producer makeProducer(String aVerb) throws ProducerException { + public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { CompositeProducer result = new CompositeProducer(); Iterator i=factoriesForVerb(aVerb).iterator(); diff --git a/source/mircoders/producer/ContentProducer.java b/source/mircoders/producer/ContentProducer.java index 424fa717..09fbfa62 100755 --- a/source/mircoders/producer/ContentProducer.java +++ b/source/mircoders/producer/ContentProducer.java @@ -39,7 +39,7 @@ public class ContentProducer implements mir.producer.Producer { outputFileExpression = anOutputFileExpression; } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { EntityContent content; Map generationValues = new HashMap(); diff --git a/source/mircoders/producer/ContentProducerFactory.java b/source/mircoders/producer/ContentProducerFactory.java index 94b437f6..a4554883 100755 --- a/source/mircoders/producer/ContentProducerFactory.java +++ b/source/mircoders/producer/ContentProducerFactory.java @@ -23,7 +23,7 @@ public class ContentProducerFactory implements ProducerFactory { batchSize=aBatchSize; } - public mir.producer.Producer makeProducer(String aVerb) throws ProducerException { + public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { try { QueryBuilder queryBuilder = new QueryBuilder(); @@ -44,7 +44,7 @@ public class ContentProducerFactory implements ProducerFactory { outputFileNameExpression ); } catch (Exception e) { - throw new ProducerException(e); + throw new ProducerFailure("Creating Producer failed",e); } }; diff --git a/source/mircoders/producer/NullProducer.java b/source/mircoders/producer/NullProducer.java index 7ebb7682..3ddf1584 100755 --- a/source/mircoders/producer/NullProducer.java +++ b/source/mircoders/producer/NullProducer.java @@ -7,7 +7,7 @@ public class NullProducer implements mir.producer.Producer { public NullProducer() { } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { } } diff --git a/source/mircoders/producer/OldProducerAdapter.java b/source/mircoders/producer/OldProducerAdapter.java index d3a4742c..65656fc9 100755 --- a/source/mircoders/producer/OldProducerAdapter.java +++ b/source/mircoders/producer/OldProducerAdapter.java @@ -13,12 +13,12 @@ public class OldProducerAdapter implements mir.producer.Producer { forced = aForced; } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { try { oldProducer.handle( aLogger, null, forced.booleanValue(), false ); } catch (Throwable e) { - throw new ProducerException(e); + throw new ProducerFailure("Failure at handling old Producers",e); } } } \ No newline at end of file diff --git a/source/mircoders/producer/ScriptCallProducer.java b/source/mircoders/producer/ScriptCallProducer.java index e17087a6..8497f438 100755 --- a/source/mircoders/producer/ScriptCallProducer.java +++ b/source/mircoders/producer/ScriptCallProducer.java @@ -12,7 +12,7 @@ public class ScriptCallProducer implements mir.producer.Producer { script = aScript; } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { Process process; int returnValue; @@ -26,7 +26,7 @@ public class ScriptCallProducer implements mir.producer.Producer { catch (Throwable e) { aLogger.println("Exception has occurred: " + e.getMessage() + ":"); e.printStackTrace(aLogger); - throw new ProducerException(e); + throw new ProducerFailure("Executing script failed",e); } } } diff --git a/source/mircoders/producer/ScriptCallProducerFactory.java b/source/mircoders/producer/ScriptCallProducerFactory.java index b8ae7570..9f96b7a4 100755 --- a/source/mircoders/producer/ScriptCallProducerFactory.java +++ b/source/mircoders/producer/ScriptCallProducerFactory.java @@ -13,7 +13,7 @@ public class ScriptCallProducerFactory implements ProducerFactory { script=aScript; } - public mir.producer.Producer makeProducer(String aVerb) throws ProducerException { + public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { return new ScriptCallProducer(script); diff --git a/source/mircoders/producer/StartPageProducer.java b/source/mircoders/producer/StartPageProducer.java index 0602c5c1..3af126f0 100755 --- a/source/mircoders/producer/StartPageProducer.java +++ b/source/mircoders/producer/StartPageProducer.java @@ -47,7 +47,7 @@ public class StartPageProducer implements mir.producer.Producer { breakingNews = aBreakingNews; } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { Map generationValues = new HashMap(); Map dataMap = new HashMap(); diff --git a/source/mircoders/producer/StartPageProducerFactory.java b/source/mircoders/producer/StartPageProducerFactory.java index d4743388..6bea900e 100755 --- a/source/mircoders/producer/StartPageProducerFactory.java +++ b/source/mircoders/producer/StartPageProducerFactory.java @@ -28,7 +28,7 @@ public class StartPageProducerFactory implements ProducerFactory { } - public mir.producer.Producer makeProducer(String aVerb) throws ProducerException { + public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { try { ModuleContent contentModule = new ModuleContent(DatabaseContent.getInstance()); @@ -45,7 +45,7 @@ public class StartPageProducerFactory implements ProducerFactory { breakingModule.getBreakingNews()); } catch (Throwable e) { - throw new ProducerException(e); + throw new ProducerFailure("Creating StartPageProducer failed",e); } }; diff --git a/source/mircoders/producer/StaticProducer.java b/source/mircoders/producer/StaticProducer.java index 67ea4f7c..afdb8363 100755 --- a/source/mircoders/producer/StaticProducer.java +++ b/source/mircoders/producer/StaticProducer.java @@ -32,7 +32,7 @@ public class StaticProducer implements mir.producer.Producer { outputFile=anOutputFile; } - public void produce( PrintWriter aLogger ) throws ProducerException { + public void produce( PrintWriter aLogger ) throws ProducerFailure { Map generationValues = new HashMap(); Map dataMap = new HashMap(); diff --git a/source/mircoders/producer/StaticProducerFactory.java b/source/mircoders/producer/StaticProducerFactory.java index df703e1b..f5024cd7 100755 --- a/source/mircoders/producer/StaticProducerFactory.java +++ b/source/mircoders/producer/StaticProducerFactory.java @@ -19,12 +19,12 @@ public class StaticProducerFactory implements ProducerFactory { } - public mir.producer.Producer makeProducer(String aVerb) throws ProducerException { + public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { try { return new StaticProducer( generatorIdentifier, resourceBundle, outputFile ); } catch (Throwable e) { - throw new ProducerException(e); + throw new ProducerFailure("Creating StaticProducer failed",e); } }; diff --git a/source/mircoders/producer/TopicStartPageProducerFactory.java b/source/mircoders/producer/TopicStartPageProducerFactory.java index af9e4ebf..aee7267a 100755 --- a/source/mircoders/producer/TopicStartPageProducerFactory.java +++ b/source/mircoders/producer/TopicStartPageProducerFactory.java @@ -31,7 +31,7 @@ public class TopicStartPageProducerFactory implements ProducerFactory { } - public mir.producer.Producer makeProducer(String aVerb) throws ProducerException { + public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure { CompositeProducer result = new CompositeProducer(); Map values = new HashMap(); @@ -78,7 +78,7 @@ public class TopicStartPageProducerFactory implements ProducerFactory { } catch (Throwable e) { - throw new ProducerException(e); + throw new ProducerFailure("Creating TopicStartPageProducer failed",e); } }; -- 2.11.0