You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ve...@apache.org on 2009/03/23 22:20:51 UTC
svn commit: r757546 -
/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseControllerFactory.java
Author: veithen
Date: Mon Mar 23 21:20:40 2009
New Revision: 757546
URL: http://svn.apache.org/viewvc?rev=757546&view=rev
Log:
Improved error reporting in SynapseControllerFactory: we should distinguish between an unspecified property and a non existing directory/file.
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseControllerFactory.java
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseControllerFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseControllerFactory.java?rev=757546&r1=757545&r2=757546&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseControllerFactory.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseControllerFactory.java Mon Mar 23 21:20:40 2009
@@ -80,34 +80,12 @@
fatal("Server Configuration Information is null");
}
- String synapseHome = information.getSynapseHome();
- if (synapseHome == null || !new File(synapseHome).exists()) {
- fatalOnParameterValidationFailure("Synapse home");
- } else {
- log.info("Using Synapse home as : " + synapseHome);
- }
-
+ validatePath("Synapse home", information.getSynapseHome());
if (information.isCreateNewInstance()) {
- String axis2Repolocation = information.getAxis2RepoLocation();
- if (axis2Repolocation == null || !new File(axis2Repolocation).exists()) {
- fatalOnParameterValidationFailure("Axis2 repository");
- } else {
- log.info("Using the Axis2 Repository : " +
- new File(axis2Repolocation).getAbsolutePath());
- }
-
- String axis2Xml = information.getAxis2Xml();
- if (axis2Xml == null || !new File(axis2Xml).exists()) {
- fatalOnParameterValidationFailure("axis2.xml location");
- } else {
- log.info("Using the axis2.xml : " + new File(axis2Xml).getAbsolutePath());
- }
- }
-
- String synapseXMLPath = information.getSynapseXMLLocation();
- if (synapseXMLPath == null || !new File(synapseXMLPath).exists()) {
- fatalOnParameterValidationFailure("synapse.xml path");
+ validatePath("Axis2 repository", information.getAxis2RepoLocation());
+ validatePath("axis2.xml location", information.getAxis2Xml());
}
+ validatePath("synapse.xml location", information.getSynapseXMLLocation());
String serverName = information.getServerName();
if (serverName == null) {
@@ -128,10 +106,14 @@
(SynapseConfigUtils.getTimeoutHandlerInterval() / 1000) + "s");
}
- private static void fatalOnParameterValidationFailure(String msgPre) {
- String msg = "The " + msgPre + " must be set as a system property or init-parameter";
- log.fatal(msg);
- throw new SynapseException(msg);
+ private static void validatePath(String msgPre, String path) {
+ if (path == null) {
+ fatal("The " + msgPre + " must be set as a system property or init-parameter");
+ } else if (!new File(path).exists()) {
+ fatal("The " + msgPre + " " + path + " doesn't exist");
+ } else {
+ log.info("Using " + msgPre + " : " + new File(path).getAbsolutePath());
+ }
}
private static void fatal(String msg) {