You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by as...@apache.org on 2008/05/16 09:37:28 UTC

svn commit: r656953 - /synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/ServerManager.java

Author: asankha
Date: Fri May 16 00:37:28 2008
New Revision: 656953

URL: http://svn.apache.org/viewvc?rev=656953&view=rev
Log:
make the validation of the paths and config files more robust

Modified:
    synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/ServerManager.java

Modified: synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/ServerManager.java
URL: http://svn.apache.org/viewvc/synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/ServerManager.java?rev=656953&r1=656952&r2=656953&view=diff
==============================================================================
--- synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/ServerManager.java (original)
+++ synapse/branches/1.2/modules/core/src/main/java/org/apache/synapse/ServerManager.java Fri May 16 00:37:28 2008
@@ -246,34 +246,28 @@
      * Validate core settings for startup
      */
     private void validate() {
-        if (axis2Repolocation == null) {
+        if (synapseHome == null || !new File(synapseHome).exists()) {
+            handleFatal("Synapse home");
+        } else {
+            log.info("Using Synapse home as : " + synapseHome);
+        }
+
+        if (axis2Repolocation == null || !new File(axis2Repolocation).exists()) {
             handleFatal("Axis2 repository");
         } else {
             log.info("Using the Axis2 Repository : " + new File(axis2Repolocation).getAbsolutePath());
         }
 
-        if (axis2Xml == null) {
+        if (axis2Xml == null || !new File(axis2Xml).exists()) {
             handleFatal("axis2.xml location");
         } else {
             log.info("Using the axis2.xml : " + new File(axis2Xml).getAbsolutePath());
         }
 
-        if (synapseHome == null) {
-            handleFatal("Synapse home");
-        } else {
-            log.info("Using Synapse home as : " + synapseHome);
-        }
-
-        if (synapseXMLPath == null) {
+        if (synapseXMLPath == null || !new File(synapseXMLPath).exists()) {
             handleFatal("synapse.xml path");
         }
 
-//        if (resolveRoot == null) {
-//            handleFatal("resolve root");
-//        } else {
-//            log.info("Using resolve.root as : " + resolveRoot);
-//        }
-
         if (serverName == null) {
             try {
                 serverName = InetAddress.getLocalHost().getHostName();
@@ -302,7 +296,7 @@
     }
 
     public void setAxis2Repolocation(String axis2Repolocation) {
-        if (!new File(axis2Repolocation).isAbsolute()) {
+        if (!new File(axis2Repolocation).isAbsolute() && synapseHome != null) {
             this.axis2Repolocation = synapseHome + File.separator + axis2Repolocation;
         } else {
             this.axis2Repolocation = axis2Repolocation;
@@ -310,7 +304,7 @@
     }
 
     public void setAxis2Xml(String axis2Xml) {
-        if (!new File(axis2Xml).isAbsolute()) {
+        if (!new File(axis2Xml).isAbsolute() && synapseHome != null) {
             this.axis2Xml = synapseHome + File.separator + axis2Xml;
         } else {
             this.axis2Xml = axis2Xml;
@@ -330,7 +324,7 @@
     }
 
     public void setResolveRoot(String resolveRoot) {
-        if (!new File(resolveRoot).isAbsolute()) {
+        if (!new File(resolveRoot).isAbsolute() && synapseHome != null) {
             this.resolveRoot = synapseHome + File.separator + resolveRoot;
         } else {
             this.resolveRoot = resolveRoot;
@@ -350,7 +344,7 @@
     }
 
     public void setSynapseXMLPath(String synapseXMLPath) {
-        if (!new File(synapseXMLPath).isAbsolute()) {
+        if (!new File(synapseXMLPath).isAbsolute() && synapseHome != null) {
             this.synapseXMLPath = synapseHome + File.separator + synapseXMLPath;
         } else {
             this.synapseXMLPath = synapseXMLPath;