[Minor] Clean up code
This commit is contained in:
parent
601ff098fc
commit
413d9b5eed
|
@ -41,10 +41,10 @@ import li.strolch.utils.helper.XmlHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* This is the default Strolch {@link PolicyHandler} which implements {@link PolicyDefVisitor}. This {@link
|
* This is the default Strolch {@link PolicyHandler} which implements {@link PolicyDefVisitor}. This
|
||||||
* PolicyHandler} parses a policy configuration file to handle the look-up of {@link KeyPolicyDef}
|
* {@link PolicyHandler} parses a policy configuration file to handle the look-up of {@link KeyPolicyDef}
|
||||||
* </p>
|
* </p>
|
||||||
*
|
* <p>
|
||||||
* This {@link StrolchComponent} uses two configuration properties:
|
* This {@link StrolchComponent} uses two configuration properties:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link #PROP_READ_POLICY_FILE} - Default is false. If false then no configuration file is read. Useful if all
|
* <li>{@link #PROP_READ_POLICY_FILE} - Default is false. If false then no configuration file is read. Useful if all
|
||||||
|
@ -117,9 +117,9 @@ public class DefaultPolicyHandler extends StrolchComponent implements PolicyHand
|
||||||
return constructor.newInstance(tx);
|
return constructor.newInstance(tx);
|
||||||
return constructor.newInstance(tx);
|
return constructor.newInstance(tx);
|
||||||
|
|
||||||
|
} catch (StrolchPolicyException e) {
|
||||||
|
throw e;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof StrolchPolicyException)
|
|
||||||
throw (StrolchPolicyException) e;
|
|
||||||
throw new StrolchPolicyException(
|
throw new StrolchPolicyException(
|
||||||
MessageFormat.format("Failed to instantiate policy {0} due to {1}", policyDef, e.getMessage()), e);
|
MessageFormat.format("Failed to instantiate policy {0} due to {1}", policyDef, e.getMessage()), e);
|
||||||
}
|
}
|
||||||
|
@ -208,8 +208,8 @@ public class DefaultPolicyHandler extends StrolchComponent implements PolicyHand
|
||||||
if (!StrolchPolicy.class.isAssignableFrom(implClass)) {
|
if (!StrolchPolicy.class.isAssignableFrom(implClass)) {
|
||||||
throw new StrolchPolicyException(
|
throw new StrolchPolicyException(
|
||||||
"Invalid " + StrolchPolicyFileParser.POLICY + " configuration for Type=" + type
|
"Invalid " + StrolchPolicyFileParser.POLICY + " configuration for Type=" + type
|
||||||
+ " Key=" + key + " as " + className + " is not a " + StrolchPolicy.class
|
+ " Key=" + key + " as " + className + " is not a "
|
||||||
.getName());
|
+ StrolchPolicy.class.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// assert is assignable to API class
|
// assert is assignable to API class
|
||||||
|
@ -220,8 +220,8 @@ public class DefaultPolicyHandler extends StrolchComponent implements PolicyHand
|
||||||
}
|
}
|
||||||
|
|
||||||
// and assert is not abstract
|
// and assert is not abstract
|
||||||
if (Modifier.isAbstract(implClass.getModifiers()) || Modifier
|
if (Modifier.isAbstract(implClass.getModifiers()) || Modifier.isInterface(
|
||||||
.isInterface(implClass.getModifiers()))
|
implClass.getModifiers()))
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Invalid " + StrolchPolicyFileParser.POLICY + " configuration for Type=" + type
|
"Invalid " + StrolchPolicyFileParser.POLICY + " configuration for Type=" + type
|
||||||
+ " Key=" + key + " as " + className + " is abstract or an interface!");
|
+ " Key=" + key + " as " + className + " is abstract or an interface!");
|
||||||
|
@ -236,8 +236,8 @@ public class DefaultPolicyHandler extends StrolchComponent implements PolicyHand
|
||||||
+ " as constructor (StrolchTransaction) or (ComponentContainer, StrolchTransaction) does not exist!");
|
+ " as constructor (StrolchTransaction) or (ComponentContainer, StrolchTransaction) does not exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Modifier.isAbstract(constructor.getModifiers()) || Modifier
|
if (Modifier.isAbstract(constructor.getModifiers()) || Modifier.isInterface(
|
||||||
.isInterface(constructor.getModifiers()))
|
constructor.getModifiers()))
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Invalid " + StrolchPolicyFileParser.POLICY + " configuration for Type=" + type
|
"Invalid " + StrolchPolicyFileParser.POLICY + " configuration for Type=" + type
|
||||||
+ " Key=" + key + " as constructor is abstract or an interface!");
|
+ " Key=" + key + " as constructor is abstract or an interface!");
|
||||||
|
|
Loading…
Reference in New Issue