i changed the exception-handling of the new producers and localizers to use the multe...
[mir.git] / source / mir / config / ConfigReader.java
index 03ecd53..d0c0355 100755 (executable)
@@ -26,7 +26,7 @@ public class ConfigReader {
     super();\r
   };\r
 \r
-  public void parseFile(String aFileName, ConfigNodeBuilder aRootNode) throws ConfigException {\r
+  public void parseFile(String aFileName, ConfigNodeBuilder aRootNode) throws ConfigFailure {\r
 \r
     try {\r
       SAXParserFactory parserFactory = SAXParserFactory.newInstance();\r
@@ -40,12 +40,12 @@ public class ConfigReader {
       handler.includeFile(aFileName);\r
     }\r
     catch (Throwable e) {\r
-      if (e instanceof SAXParseException && ((SAXParseException) e).getException() instanceof ConfigException) {\r
-        throw (ConfigException) ((SAXParseException) e).getException();\r
+      if (e instanceof SAXParseException && ((SAXParseException) e).getException() instanceof ConfigFailure) {\r
+        throw (ConfigFailure) ((SAXParseException) e).getException();\r
       }\r
       else {\r
         e.printStackTrace();\r
-        throw new ConfigException( e.getMessage() );\r
+        throw new ConfigFailure( e.getMessage() );\r
       }\r
     }\r
   }\r
@@ -78,7 +78,7 @@ public class ConfigReader {
       locator=aLocator;\r
     }\r
 \r
-    private void includeFile(String aFileName) throws ConfigException, SAXParseException, SAXException {\r
+    private void includeFile(String aFileName) throws ConfigFailure, SAXParseException, SAXException {\r
       File file;\r
       SAXParser parser;\r
       InputSource inputSource;\r
@@ -93,7 +93,7 @@ public class ConfigReader {
         System.err.println("about to include "+file.getCanonicalPath());\r
 \r
         if (includeFileStack.contains(file.getCanonicalPath())) {\r
-          throw new ConfigException("recursive inclusion of file "+file.getCanonicalPath(), getLocatorDescription(locator));\r
+          throw new ConfigFailure("recursive inclusion of file "+file.getCanonicalPath(), getLocatorDescription(locator));\r
         }\r
 \r
         parser=parserFactory.newSAXParser();\r
@@ -110,19 +110,19 @@ public class ConfigReader {
         }\r
       }\r
       catch (ParserConfigurationException e) {\r
-        throw new ConfigException("Internal exception while including \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
+        throw new ConfigFailure("Internal exception while including \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
       }\r
       catch (SAXParseException e) {\r
         throw e;\r
       }\r
-      catch (ConfigException e) {\r
+      catch (ConfigFailure e) {\r
         throw e;\r
       }\r
       catch (FileNotFoundException e) {\r
-        throw new ConfigException("Include file \""+aFileName+"\" not found: "+e.getMessage(), e, getLocatorDescription(locator));\r
+        throw new ConfigFailure("Include file \""+aFileName+"\" not found: "+e.getMessage(), e, getLocatorDescription(locator));\r
       }\r
       catch (IOException e) {\r
-        throw new ConfigException("unable to open include file \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
+        throw new ConfigFailure("unable to open include file \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
       }\r
 \r
     }\r
@@ -132,18 +132,18 @@ public class ConfigReader {
       level++;\r
       try {\r
         if (builder==null) {\r
-          throw new ConfigException("define, include and property tags cannot have content", getLocatorDescription(locator));\r
+          throw new ConfigFailure("define, include and property tags cannot have content", getLocatorDescription(locator));\r
         }\r
         if (aQualifiedName.equals(propertyTagName)) {\r
           String name=anAttributes.getValue(propertyNameAttribute);\r
           String value=anAttributes.getValue(propertyValueAttribute);\r
 \r
           if (name==null) {\r
-            throw new ConfigException("property has no name attribute", getLocatorDescription(locator));\r
+            throw new ConfigFailure("property has no name attribute", getLocatorDescription(locator));\r
           }\r
           else\r
           if (value==null) {\r
-            throw new ConfigException("property \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
+            throw new ConfigFailure("property \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
           }\r
 \r
           builder.addProperty(name, definesManager.resolve(value, getLocatorDescription(locator)), value, getLocatorDescription(locator));\r
@@ -155,11 +155,11 @@ public class ConfigReader {
           String value=anAttributes.getValue(defineValueAttribute);\r
 \r
           if (name==null) {\r
-            throw new ConfigException("define has no name attribute", getLocatorDescription(locator));\r
+            throw new ConfigFailure("define has no name attribute", getLocatorDescription(locator));\r
           }\r
           else\r
           if (value==null) {\r
-            throw new ConfigException("define \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
+            throw new ConfigFailure("define \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
           }\r
 \r
           definesManager.addDefine(name, definesManager.resolve(value, getLocatorDescription(locator)));\r
@@ -169,7 +169,7 @@ public class ConfigReader {
           String fileName=anAttributes.getValue(includeFileAttribute);\r
 \r
           if (fileName==null) {\r
-            throw new ConfigException("include has no file attribute", getLocatorDescription(locator));\r
+            throw new ConfigFailure("include has no file attribute", getLocatorDescription(locator));\r
           }\r
 \r
           includeFile(definesManager.resolve(fileName, getLocatorDescription(locator)));\r
@@ -180,7 +180,7 @@ public class ConfigReader {
           builder=builder.makeSubNode(aQualifiedName, getLocatorDescription(locator));\r
         }\r
       }\r
-      catch (ConfigException e) {\r
+      catch (ConfigFailure e) {\r
         throw new SAXParseException(e.getMessage(), locator, e);\r
       }\r
     }\r
@@ -193,7 +193,7 @@ public class ConfigReader {
     public void characters(char[] aBuffer, int aStart, int anEnd) throws SAXParseException {\r
       String text = new String(aBuffer, aStart, anEnd).trim();\r
       if ( text.length() > 0) {\r
-        throw new SAXParseException("Text not allowed", locator, new ConfigException("text not allowed", getLocatorDescription(locator)));\r
+        throw new SAXParseException("Text not allowed", locator, new ConfigFailure("text not allowed", getLocatorDescription(locator)));\r
       }\r
     }\r
   }\r
@@ -209,7 +209,7 @@ public class ConfigReader {
       defines.put(aName, anExpression);\r
     }\r
 \r
-    public String resolve(String anExpression, String aLocation) throws ConfigException {\r
+    public String resolve(String anExpression, String aLocation) throws ConfigFailure {\r
       int previousPosition = 0;\r
       int position;\r
       int endOfNamePosition;\r
@@ -239,7 +239,7 @@ public class ConfigReader {
               }\r
             }\r
             else {\r
-                throw new ConfigException("Missing }", aLocation);\r
+                throw new ConfigFailure("Missing }", aLocation);\r
             }\r
 \r
           }\r