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
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
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
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
}\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
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
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
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
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
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
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
}\r
}\r
else {\r
- throw new ConfigException("Missing }", aLocation);\r
+ throw new ConfigFailure("Missing }", aLocation);\r
}\r
\r
}\r