I think that this commit broke the ability to stop and start a context. When I 
start it after having stopped it, I get a 
LifecycleException:  An invalid Lifecycle transition was attempted 
([before_start]) for component [WebappLoader[/testWeb]] in state [DESTROYED]

Sylvain

On 1 mai 2010, at 19:44, ma...@apache.org wrote:

> Author: markt
> Date: Sat May  1 17:44:26 2010
> New Revision: 940089
> 
> URL: http://svn.apache.org/viewvc?rev=940089&view=rev
> Log:
> Remove the controller - MBean registration will always happen in 
> init()/destroy() after Lifecycle refactoring
> Fix a handful of Eclipse/FindBugs warnings
> 
> Modified:
>    tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
>    tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
> 
> Modified: tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties?rev=940089&r1=940088&r2=940089&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties 
> (original)
> +++ tomcat/trunk/java/org/apache/catalina/loader/LocalStrings.properties Sat 
> May  1 17:44:26 2010
> @@ -65,4 +65,5 @@ webappLoader.starting=Starting this Load
> webappLoader.stopping=Stopping this Loader
> webappLoader.failModifiedCheck=Error tracking modifications
> webappLoader.copyFailure=Failed to copy resources
> +webappLoader.mkdirFailure=Failed to create destination directory to copy 
> resources
> webappLoader.namingFailure=Failed to access resource {0}
> 
> Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java?rev=940089&r1=940088&r2=940089&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java (original)
> +++ tomcat/trunk/java/org/apache/catalina/loader/WebappLoader.java Sat May  1 
> 17:44:26 2010
> @@ -271,8 +271,8 @@ public class WebappLoader extends Lifecy
> 
>         boolean oldDelegate = this.delegate;
>         this.delegate = delegate;
> -        support.firePropertyChange("delegate", new Boolean(oldDelegate),
> -                                   new Boolean(this.delegate));
> +        support.firePropertyChange("delegate", Boolean.valueOf(oldDelegate),
> +                                   Boolean.valueOf(this.delegate));
> 
>     }
> 
> @@ -332,8 +332,8 @@ public class WebappLoader extends Lifecy
>         boolean oldReloadable = this.reloadable;
>         this.reloadable = reloadable;
>         support.firePropertyChange("reloadable",
> -                                   new Boolean(oldReloadable),
> -                                   new Boolean(this.reloadable));
> +                                   Boolean.valueOf(oldReloadable),
> +                                   Boolean.valueOf(this.reloadable));
> 
>     }
> 
> @@ -542,7 +542,6 @@ public class WebappLoader extends Lifecy
>                     oname=new ObjectName(ctx.getEngineName() + 
> ":type=Loader,path=" +
>                                 path + ",host=" + ctx.getParent().getName());
>                     Registry.getRegistry(null, null).registerComponent(this, 
> oname, null);
> -                    controller=oname;
>                 } catch (Exception e) {
>                     log.error("Error registering loader", e );
>                 }
> @@ -558,11 +557,8 @@ public class WebappLoader extends Lifecy
> 
>     @Override
>     protected void destroyInternal() {
> -        if( controller==oname ) {
> -            // Self-registration, undo it
> -            Registry.getRegistry(null, null).unregisterComponent(oname);
> -            oname = null;
> -        }
> +        Registry.getRegistry(null, null).unregisterComponent(oname);
> +        oname = null;
>     }
> 
>     /**
> @@ -813,6 +809,7 @@ public class WebappLoader extends Lifecy
>                         String path = libDir.getCanonicalPath();
>                         classLoader.addPermission(path);
>                     } catch (IOException e) {
> +                        // Ignore
>                     }
>                 }
> 
> @@ -825,6 +822,7 @@ public class WebappLoader extends Lifecy
>                             String path = libDir.getCanonicalPath();
>                             classLoader.addPermission(path);
>                         } catch (IOException e) {
> +                            // Ignore
>                         }
>                     }
>                     if (classesURL != null) {
> @@ -833,6 +831,7 @@ public class WebappLoader extends Lifecy
>                             String path = classesDir.getCanonicalPath();
>                             classLoader.addPermission(path);
>                         } catch (IOException e) {
> +                            // Ignore
>                         }
>                     }
>                 }
> @@ -840,6 +839,7 @@ public class WebappLoader extends Lifecy
>             }
> 
>         } catch (MalformedURLException e) {
> +            // Ignore
>         }
> 
>     }
> @@ -903,7 +903,9 @@ public class WebappLoader extends Lifecy
>             } else {
> 
>                 classRepository = new File(workDir, classesPath);
> -                classRepository.mkdirs();
> +                if (!classRepository.mkdirs())
> +                    throw new IOException(
> +                            sm.getString("webappLoader.mkdirFailure"));
>                 if (!copyDir(classes, classRepository)) {
>                     throw new IOException(
>                             sm.getString("webappLoader.copyFailure"));
> @@ -951,7 +953,9 @@ public class WebappLoader extends Lifecy
>             } else {
>                 copyJars = true;
>                 destDir = new File(workDir, libPath);
> -                destDir.mkdirs();
> +                if (!destDir.mkdirs())
> +                    throw new IOException(
> +                            sm.getString("webappLoader.mkdirFailure"));
>             }
> 
>             // Looking up directory /WEB-INF/lib in the context
> @@ -1056,7 +1060,6 @@ public class WebappLoader extends Lifecy
>                 String cp=getClasspath( loader );
>                 if( cp==null ) {
>                     log.info( "Unknown loader " + loader + " " + 
> loader.getClass());
> -                    break;
>                 } else {
>                     if (n > 0) 
>                         classpath.append(File.pathSeparator);
> @@ -1141,7 +1144,8 @@ public class WebappLoader extends Lifecy
>                     if (!copy((InputStream) object, os))
>                         return false;
>                 } else if (object instanceof DirContext) {
> -                    currentFile.mkdir();
> +                    if (!currentFile.mkdir())
> +                        return false;
>                     if (!copyDir((DirContext) object, currentFile))
>                         return false;
>                 }
> @@ -1187,7 +1191,6 @@ public class WebappLoader extends Lifecy
>         org.apache.juli.logging.LogFactory.getLog( WebappLoader.class );
> 
>     private ObjectName oname;
> -    private ObjectName controller;
> 
>     public ObjectName preRegister(MBeanServer server,
>                                   ObjectName name) throws Exception {
> @@ -1196,20 +1199,14 @@ public class WebappLoader extends Lifecy
>     }
> 
>     public void postRegister(Boolean registrationDone) {
> +        // NOOP
>     }
> 
>     public void preDeregister() throws Exception {
> +        // NOOP
>     }
> 
>     public void postDeregister() {
> +        // NOOP
>     }
> -
> -    public ObjectName getController() {
> -        return controller;
> -    }
> -
> -    public void setController(ObjectName controller) {
> -        this.controller = controller;
> -    }
> -
> }
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to