String target = ((MessageAddress) a.getTargets().iterator().next()).toString();
String target = "null"; Iterator it = null; Collection c = a.getTargets(); if (c != null) it = a.getTargets().iterator(); if (it != null && it.hasNext()) target = ((MessageAddress) it.next()).toString();
    public void execute() {                Iterator iter;               //********* Check for the servlet being added ***********        if (servlet == null) {            iter = servletSubscription.getAddedCollection().iterator();            if (iter.hasNext()) {                servlet = (ActionMonitorServlet)iter.next();                logger.debug("**** Saw new ActionMonitorServlet");            }        }                //********* Check for actions being added ***********        iter = actionsSubscription.getAddedCollection().iterator();        while (iter.hasNext()) {            Action a = (Action)iter.next();            if (servlet != null) { servlet.addAction(a); }            //At least temp for testing -- next 2 lines            String target = ((MessageAddress) a.getTargets().iterator().next()).toString();            logger.debug("[AgentId="+agentId+"]**** Saw new Action["+ActionUtils.getAssetID(a)+"], with ActionRecord = " + a.getValue() + " UID=" + a.getUID()+" src="+a.getSource()+",tgt="+target);        }                //********* Check for changes in our modes ************                iter = actionsSubscription.getChangedCollection().iterator();        while (iter.hasNext()) {            Action a = (Action)iter.next();            if (servlet != null) { servlet.changedAction(a); }            logger.debug("[AgentId="+agentId+"]**** Saw changed Action["+ActionUtils.getAssetID(a)+"], with ActionRecord = " + a.getValue() + " UID=" + a.getUID());        }        //Emit # of action wrappers on BB        int size = actionsSubscription.getCollection().size();        logger.debug("[AgentId="+agentId+"]**** Total # of Action objects on BB right now = "+size);            }