[jboss-user] [JBoss Microcontainer Development] New message: "Re: ClassLoadingAdmin"

Ales Justin do-not-reply at jboss.com
Tue Mar 2 16:26:47 EST 2010


User development,

A new message was posted in the thread "ClassLoadingAdmin":

http://community.jboss.org/message/529482#529482

Author  : Ales Justin
Profile : http://community.jboss.org/people/alesj

Message:
--------------------------------------------------------------
Found a potential NPE -- see Module class:
 
   public static boolean resolveModules(Module... modules) throws Exception
   {
      if (modules == null || modules.length == 0)
         return true;
 
      LifeCycle[] lifeCycles = new LifeCycle[modules.length]; 
      for (int i = 0; i < modules.length; ++i)
      {
         Module module = modules[i];
         if (module == null)
            throw new IllegalArgumentException("Null module");
         LifeCycle lifeCycle = module.getLifeCycle();
         if (lifeCycle == null)
            log.warn(module + " has no lifecycle, don't know how to resolve it.");
         lifeCycles[i] = lifeCycle; // HERE -- we allow null
      }
 
      lifeCycles[0].resolve(lifeCycles); // NPE #1
      
      for (LifeCycle lifeCycle : lifeCycles)
      {
         if (lifeCycle.isResolved() == false) // NPE#2
            return false;
      }
      return true;
   }

 
And the code in #1 and #2 looks a lot the same -- could be made into one?

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/529482#529482




More information about the jboss-user mailing list