brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Fix various integration tests
Date Fri, 31 Oct 2014 15:06:30 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/285#discussion_r19671652
  
    --- Diff: core/src/main/java/brooklyn/management/classloading/JavaBrooklynClassLoadingContext.java
---
    @@ -18,34 +18,56 @@
      */
     package brooklyn.management.classloading;
     
    -import java.net.URL;
    +import static com.google.common.base.Preconditions.checkNotNull;
    +import static com.google.common.base.Preconditions.checkState;
     
    -import com.google.common.base.Objects;
    +import java.net.URL;
     
     import brooklyn.management.ManagementContext;
     import brooklyn.util.exceptions.Exceptions;
     import brooklyn.util.guava.Maybe;
     
    +import com.google.common.base.Objects;
    +
     public class JavaBrooklynClassLoadingContext extends AbstractBrooklynClassLoadingContext
{
     
         private final ClassLoader loader;
     
    -    public JavaBrooklynClassLoadingContext(ManagementContext mgmt, ClassLoader loader)
{
    -        super(mgmt);
    -        this.loader = loader;
    +    public static JavaBrooklynClassLoadingContext create(ClassLoader loader) {
    +        return new JavaBrooklynClassLoadingContext(null, checkNotNull(loader, "loader"));
    +    }
    +    
    +    /**
    +     * At least one of mgmt or loader must not be null.
    +     */
    +    public static JavaBrooklynClassLoadingContext create(ManagementContext mgmt, ClassLoader
loader) {
    +        checkState(mgmt != null || loader != null, "mgmt and loader must not both be
null");
    +        return new JavaBrooklynClassLoadingContext(mgmt, loader);
         }
         
         public static JavaBrooklynClassLoadingContext newDefault(ManagementContext mgmt)
{
    -        ClassLoader cl = null;
    -        if (mgmt!=null) cl = mgmt.getCatalog().getRootClassLoader();
    -        if (cl==null) cl = JavaBrooklynClassLoadingContext.class.getClassLoader();
    -        return new JavaBrooklynClassLoadingContext(mgmt, cl);
    +        return new JavaBrooklynClassLoadingContext(checkNotNull(mgmt, "mgmt"), null);
         }
     
    +    private JavaBrooklynClassLoadingContext(ManagementContext mgmt, ClassLoader loader)
{
    --- End diff --
    
    need to keep this public and deprecate it for one cycle.  we have downstream projects
which use this method.  will do an emergency patch.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message