Author: midon
Date: Mon Oct 12 20:33:31 2009
New Revision: 824485

URL: http://svn.apache.org/viewvc?rev=824485&view=rev
Log:
Reset the watchdog and the observer in case of exception

Modified:
    
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/util/AxisUtils.java
    
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/WatchDog.java

Modified: 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/util/AxisUtils.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/util/AxisUtils.java?rev=824485&r1=824484&r2=824485&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/util/AxisUtils.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/util/AxisUtils.java
 Mon Oct 12 20:33:31 2009
@@ -90,13 +90,20 @@
         }
     }
 
-    public static void applySecurityPolicy(AxisService service, String 
policy_file) {
+    public static void applySecurityPolicy(AxisService service, String 
policy_file) throws IllegalArgumentException {
         URI policyUri = new File(policy_file).toURI();
         if (log.isDebugEnabled()) log.debug("Applying security policy: " + 
policyUri);
         try {
             InputStream policyStream = policyUri.toURL().openStream();
             try {
                 Policy policyDoc = PolicyEngine.getPolicy(policyStream);
+                // Neethi parser is really dumb.
+                // In case of parsing error, the exception is printed out and 
swallowed. Null is returned.
+                if(policyDoc == null){
+                    String msg = "Failed to parse policy: "+policy_file+". Due 
to Neethi limitations the reason can't be provided. See stacktraces in standard 
output (not logs)";
+                    log.error(msg);
+                    throw new IllegalArgumentException(msg);
+                }
                 
service.getPolicyInclude().addPolicyElement(PolicyInclude.AXIS_SERVICE_POLICY, 
policyDoc);
                 // make sure the proper modules are engaged, if they are 
available
                 engageModules(service, "rampart", "rahas");

Modified: 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/WatchDog.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/WatchDog.java?rev=824485&r1=824484&r2=824485&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/WatchDog.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/utils/src/main/java/org/apache/ode/utils/WatchDog.java
 Mon Oct 12 20:33:31 2009
@@ -151,6 +151,16 @@
                         if (log.isInfoEnabled()) log.info("[" + mutable + "]" 
+ " does not exist.");
                     }
                 }
+            }catch(Exception e){
+                if (log.isDebugEnabled()) log.debug("[" + mutable + "]" + " 
exception occurred during check.", e);
+                // reset so that the next check retries right away
+                expire = 0;
+                lastModif = null;
+                existedBefore = false;
+                warnedAlready = false;
+                observer.reset();
+                if (log.isInfoEnabled()) log.info("[" + mutable + "] 
resetted.");
+                throw new RuntimeException(e);
             } finally {
                 observer.getLock().unlock();
             }
@@ -244,6 +254,8 @@
          */
         void init();
 
+        void reset();
+
         /**
          * Called only if the resource previously existed and now does not 
exist.
          * <br/>The default implementation invokes {...@link #init()} .
@@ -288,6 +300,10 @@
         public void init() {
         }
 
+        public void reset() {
+            object = null;
+        }
+
         /**
          * delegate to #init
          */


Reply via email to