===================================================================== Found a 70 line (286 tokens) duplication in the following files: Starting at line 550 of /usr/local/dashboard/working/toolkit/src/org/cougaar/lib/util/UTILExpand.java Starting at line 630 of /usr/local/dashboard/working/toolkit/src/org/cougaar/lib/util/UTILExpand.java boolean wantConfidence, boolean myExtraOutput, Task t, List subtasks) { if (subtasks.isEmpty ()) { throw new UTILPluginException(pluginName+".handleTask - WARNING : getSubtasks returned empty vector!"); } // WARNING: The following MPTask code is somewhat GlobalSea specific. // However, in general if we try to create expansions containing // MPTasks, we crash, so this is a slightly better solution for now. if (logger.isDebugEnabled()){ logger.debug(pluginName + ".handleTask: Subtask(s) created for " + ((t instanceof MPTask)?"MPT":"t") + "ask :" + t.getUID()); } Workflow wf = null; if (t instanceof MPTask) { // Handling for the special case in which the subtasks of // an expanded MPTask are ALL also MPTasks. Iterator sub_t_i = subtasks.iterator(); boolean contains_mptasks = false; while (sub_t_i.hasNext()) { if (sub_t_i.next() instanceof MPTask) contains_mptasks = true; else if (contains_mptasks == true) throw new UTILPluginException(pluginName + ".handleTask : ERROR: Found expansion with mixed Task and MPTask children."); } // while if (contains_mptasks) wf = makeWorkflow(ldmf, subtasks, t /*parent*/); } // General case // If we haven't created a workflow yet, we want the "normal" case if (wf == null) { wf = makeWorkflow (ldmf, subtasks, t); } /* if (myExtraOutput){ logger.debug(pluginName + ".handleTask: Workflow created."); } */ Expansion exp = null; if(wantConfidence){ exp = makeExpansionWithConfidence (ldmf, wf); } else{ exp = makeExpansion (ldmf, wf); } if (logger.isDebugEnabled()){ logger.debug(pluginName + ".handleTask: Expansion created. (" + exp.getUID() + ")"); } for (Iterator i = subtasks.iterator (); i.hasNext ();) { blackboard.publishAdd (i.next()); } blackboard.publishAdd(exp); if (logger.isDebugEnabled()){ logger.debug(pluginName + ".handleTask: Expansion published. Workflow has " + alloc.enumToList(exp.getWorkflow ().getTasks()).size () + " subtasks." ); }