java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java
branchv_0
changeset 34 9335cf31c0f2
parent 30 b7ea47b2d4ca
child 104 245f1b88a3e6
     1.1 --- a/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java	Sun Dec 22 22:02:44 2013 +0100
     1.2 +++ b/java/sql-dk/src/info/globalcode/sql/dk/configuration/FormatterDefinition.java	Sun Dec 22 23:31:55 2013 +0100
     1.3 @@ -21,6 +21,7 @@
     1.4  import info.globalcode.sql.dk.DKException;
     1.5  import info.globalcode.sql.dk.formatting.Formatter;
     1.6  import info.globalcode.sql.dk.formatting.FormatterContext;
     1.7 +import info.globalcode.sql.dk.formatting.FormatterException;
     1.8  import java.lang.reflect.Constructor;
     1.9  import java.lang.reflect.InvocationTargetException;
    1.10  import javax.xml.bind.annotation.XmlElement;
    1.11 @@ -76,7 +77,7 @@
    1.12  	 * @return
    1.13  	 * @throws DKException
    1.14  	 */
    1.15 -	public Formatter getInstance(FormatterContext context) throws DKException {
    1.16 +	public Formatter getInstance(FormatterContext context) throws FormatterException {
    1.17  		try {
    1.18  			Constructor constructor = Class.forName(className).getConstructor(context.getClass());
    1.19  
    1.20 @@ -84,14 +85,14 @@
    1.21  			if (instance instanceof Formatter) {
    1.22  				return (Formatter) instance;
    1.23  			} else {
    1.24 -				throw new DKException("Formatter " + instance + " does not implement the " + Formatter.class.getName() + " interface");
    1.25 +				throw new FormatterException("Formatter " + instance + " does not implement the " + Formatter.class.getName() + " interface");
    1.26  			}
    1.27  		} catch (ClassNotFoundException e) {
    1.28 -			throw new DKException("No formatter class with name: " + className, e);
    1.29 +			throw new FormatterException("No formatter class with name: " + className, e);
    1.30  		} catch (NoSuchMethodException e) {
    1.31 -			throw new DKException("Formatter class with no valid constructor: " + className, e);
    1.32 +			throw new FormatterException("Formatter class with no valid constructor: " + className, e);
    1.33  		} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
    1.34 -			throw new DKException("Formatter's constructor caused an error: " + className, e);
    1.35 +			throw new FormatterException("Formatter's constructor caused an error: " + className, e);
    1.36  		}
    1.37  	}
    1.38  }