Index: JMX.java
===================================================================
--- JMX.java	(revision 90081)
+++ JMX.java	(working copy)
@@ -9,12 +9,17 @@
 
 import java.beans.PropertyEditor;
 import java.beans.PropertyEditorManager;
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 import javax.management.Attribute;
+import javax.management.AttributeNotFoundException;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
 import javax.management.MBeanServerConnection;
 import javax.management.ObjectName;
+import javax.management.ReflectionException;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import org.apache.tools.ant.BuildException;
@@ -58,6 +63,8 @@
    private String serverURL;
 
    private String adapterName = "jmx/invoker/RMIAdaptor";
+   
+   private boolean failonerror = true;
 
    private List ops = new ArrayList();
 
@@ -96,7 +103,21 @@
       this.adapterName = adapterName;
    }
 
+   public boolean isFailonerror() {
+		return failonerror;
+	}
+
    /**
+    * Set the <code>failonerror</code> boolean to false to
+    * continue if task fails.
+    * 
+    * @param failonerror
+    */
+	public void setFailonerror(boolean failonerror) {
+		this.failonerror = failonerror;
+	}
+   
+   /**
     * Use the <code>addInvoke</code> method to add an <invoke> operation.
     * Include as attributes the target ObjectName and operation name.
     * Include as sub-elements parameters: see addParameter in the Invoke class.
@@ -207,15 +228,26 @@
             for (int i = 0; i < ops.size(); i++)
             {
                Operation op = (Operation)ops.get(i);
+               try {
                op.execute(server, this);
+               } catch (Exception e) {
+            	   if (isFailonerror()) {
+       	            throw new BuildException("problem: " + e);
+               	 } else {
+               		 log("Problem : " + e.getMessage());
+               	 }
+			}
             } // end of for ()
    
    
          }
          catch (Exception e)
          {
-            e.printStackTrace();
-            throw new BuildException("problem: " + e);
+        	 if (isFailonerror()) {
+	            throw new BuildException("problem: " + e);
+        	 } else {
+        		 log("Problem : " + e.getMessage());
+        	 }
          } // end of try-catch
       } 
       finally 
@@ -245,7 +277,6 @@
    {
       private ObjectName target;
       private String property;
-
       private String operation;
 
       private List params = new ArrayList();
@@ -326,7 +357,7 @@
       private ObjectName target;
 
       private String attribute;
-
+      
       private Param value;
 
       /**
@@ -377,7 +408,7 @@
            implements Operation
    {
        private ObjectName target;
-
+       
        private String attribute;
 
        private String property;
@@ -392,7 +423,7 @@
        {
            this.target = target;
        }
-
+       
        /**
         * The <code>setAttribute</code> method specifies the attribute to be
         * retrieved.
@@ -417,11 +448,30 @@
 
        public void execute(MBeanServerConnection server, Task parent) throws Exception
        {
-           Object result = server.getAttribute(target,attribute);
-           if( (property != null) && (result != null) )
-           {
-               parent.getProject().setProperty(property,result.toString());
-           }
+    	   JMX jmxparent = null;
+        	if (parent instanceof JMX) {
+        		jmxparent = (JMX)parent;
+        	} else {
+        		throw new BuildException("Incorrect parent task type");
+        	}
+        	try {
+			Object result = server.getAttribute(target,attribute);
+			if( (property != null) && (result != null) )
+			   {
+			       parent.getProject().setProperty(property,result.toString());
+			   }
+        	} catch (Exception e) {
+        		jmxparent.log("problem while retrieving data");
+        		if (jmxparent.isFailonerror()) {
+        			BuildException be = new BuildException("problem while retrieving data");
+        			be.setStackTrace(e.getStackTrace());
+        			throw e;
+        		}
+        		if( (property != null))
+ 			   {
+ 			       parent.getProject().setProperty(property,"null");
+ 			   }
+    		}		
        }
    }
 
