You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by David Jencks <da...@yahoo.com> on 2007/07/13 20:33:02 UTC

How to make minor deployment problems emit warnings rather than make the deployment fail?

Someone was having problems with their ear and our manifest classpath  
completion, they were getting an objection they had trouble  
understanding.  (GERONIMO-3316).  I've got the code so where it  
produces better messages, but I'm not quite sure the best way to  
provide an option to warn instead of stop.

I modified DeploymentException to take a list of causes, so at least  
we'll always get all the problems we find rather than just the  
first.  I'm wondering if an appropriate way to implement the warn/ 
throw behavior is a static field (set from a system property?????? or  
a gbean?????????) in DeploymentException and a factory method

public void warnOrThrow(String message, List<DeploymentException>  
causes, Log log) throws DeploymentException {
     if (causes.isEmpty()) {
         return;
     }
     DeploymentException ex = new DeploymentException(message, causes);
     if (strict) {
         throw ex;
     } else {
         log.warn("Normally fatal deployment error:", ex);
     }
}

I'm not completely thrilled with this idea but it seems sort of ok.   
Anyone have a better idea?

thanks
david jencks