Skip to content

Commit

Permalink
FORGE-1544: Fixed exception being thrown while furnace is booting up
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jan 31, 2014
1 parent a48d8aa commit af3717d
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.jboss.forge.furnace.addons.AddonId;
import org.jboss.forge.furnace.addons.AddonRegistry;
import org.jboss.forge.furnace.event.PreShutdown;
import org.jboss.forge.furnace.services.Imported;
import org.jboss.forge.furnace.util.Predicate;

/**
Expand Down Expand Up @@ -59,7 +60,11 @@ public Iterable<UICommand> getCommands()
{
try
{
result.add(createAnnotatedCommand(method));
UICommand cmd = createAnnotatedCommand(method);
if (cmd != null)
{
result.add(cmd);
}
}
catch (Exception e)
{
Expand All @@ -71,7 +76,14 @@ public Iterable<UICommand> getCommands()

private UICommand createAnnotatedCommand(Method method)
{
Object instance = registry.getServices(method.getDeclaringClass()).get();
Imported<?> service = registry.getServices(method.getDeclaringClass());
if (service.isUnsatisfied())
{
// Class may not be loaded yet
logger.log(Level.SEVERE, "Error while finding " + method.getDeclaringClass() + " as a service");
return null;
}
Object instance = service.get();
Command ann = method.getAnnotation(Command.class);

List<Predicate<UIContext>> enabledPredicates = new ArrayList<>();
Expand Down

0 comments on commit af3717d

Please sign in to comment.