Buggy code:
public class GalaxyApplicationMaster extends HiWay { private static final Log log = LogFactory . getLog ( GalaxyApplicationMaster . class ) ; public static void main ( String [ ] args ) { } private Map < String , GalaxyDataTable > galaxyDataTables ; private Map < String , GalaxyDataType > galaxyDataTypes ; public final String galaxyPath ; private Map < String , Map < String , GalaxyTool > > galaxyTools ; public GalaxyApplicationMaster ( ) { } private Map < String , GalaxyTool > addAndGetToolMap ( String id ) { } private Set < GalaxyParam > getParams ( Element el , GalaxyTool tool ) throws XPathExpressionException { } @ Override public boolean init ( String [ ] args ) throws ParseException { } private GalaxyTool parseToolFile ( File file ) { } @ Override public void parseWorkflow ( ) { GalaxyApplicationMaster . log . info ( ( "Parsing<seq2seq4repair_space>Galaxy<seq2seq4repair_space>workflow<seq2seq4repair_space>" + ( getWorkflowFile ( ) ) ) ) ; Map < Long , TaskInstance > tasks = new HashMap < > ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( getWorkflowFile ( ) . getLocalPath ( ) ) ) ) { StringBuilder sb = new StringBuilder ( ) ; String line ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) . append ( "\n" ) ; } JSONObject workflow = new JSONObject ( sb . toString ( ) ) ; JSONObject steps = workflow . getJSONObject ( "steps" ) ; for ( int i = 0 ; i < ( steps . length ( ) ) ; i ++ ) { JSONObject step = steps . getJSONObject ( Integer . toString ( i ) ) ; long id = step . getLong ( "id" ) ; String type = step . getString ( "type" ) ; if ( type . equals ( "data_input" ) ) { JSONArray inputs = step . getJSONArray ( "inputs" ) ; for ( int j = 0 ; j < ( inputs . length ( ) ) ; j ++ ) { JSONObject input = inputs . getJSONObject ( j ) ; String name = input . getString ( "name" ) ; GalaxyData data = new GalaxyData ( name ) ; if ( name . contains ( "." ) ) { String extension = name . substring ( ( ( name . indexOf ( "." ) ) + 1 ) ) ; if ( galaxyDataTypes . containsKey ( extension ) ) { data . setDataType ( galaxyDataTypes . get ( extension ) ) ; } } String idName = id + "_output" ; data . setInput ( true ) ; getFiles ( ) . put ( idName , data ) ; } } else if ( type . equals ( "tool" ) ) { String toolVersion = step . getString ( "tool_version" ) ; String toolId = step . getString ( "tool_id" ) ; String [ ] splitId = toolId . split ( "//" ) ; if ( ( splitId . length ) > 2 ) toolId = splitId [ ( ( splitId . length ) - 2 ) ] ; GalaxyTool tool = galaxyTools . get ( toolId ) . get ( toolVersion ) ; if ( tool == null ) { GalaxyApplicationMaster . log . error ( ( ( ( ( "Tool<seq2seq4repair_space>" + toolId ) + "//" ) + toolVersion ) + "<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>located<seq2seq4repair_space>in<seq2seq4repair_space>local<seq2seq4repair_space>Galaxy<seq2seq4repair_space>installation." ) ) ; HiWay . onError ( new RuntimeException ( ) ) ; } <START_BUG> GalaxyTaskInstance task = new GalaxyTaskInstance ( id , tool . getId ( ) , tool , galaxyPath ) ; <END_BUG> tasks . put ( id , task ) ; Map < String , String > renameOutputs = new HashMap < > ( ) ; Set < String > hideOutputs = new HashSet < > ( ) ; if ( step . has ( "post_job_actions" ) ) { JSONObject post_job_actions = step . getJSONObject ( "post_job_actions" ) ; for ( Iterator < ? > it = post_job_actions . keys ( ) ; it . hasNext ( ) ; ) { JSONObject post_job_action = post_job_actions . getJSONObject ( ( ( String ) ( it . next ( ) ) ) ) ; String action_type = post_job_action . getString ( "action_type" ) ; if ( action_type . equals ( "RenameDatasetAction" ) ) { String output_name = post_job_action . getString ( "output_name" ) ; JSONObject action_arguments = post_job_action . getJSONObject ( "action_arguments" ) ; String newname = action_arguments . getString ( "newname" ) ; if ( newname . contains ( "<seq2seq4repair_space>" ) ) newname = newname . replaceAll ( "\\s" , "_" ) ; renameOutputs . put ( output_name , newname ) ; } else if ( action_type . equals ( "HideDatasetAction" ) ) { String output_name = post_job_action . getString ( "output_name" ) ; hideOutputs . add ( output_name ) ; } } } task . addToolState ( step . getString ( "tool_state" ) ) ; Map < String , String > inputNameToIdName = new HashMap < > ( ) ; JSONObject input_connections = step . getJSONObject ( "input_connections" ) ; for ( String input_name : JSONObject . getNames ( input_connections ) ) { JSONObject input_connection = input_connections . getJSONObject ( input_name ) ; inputNameToIdName . put ( input_name , ( ( ( input_connection . getString ( "id" ) ) + "_" ) + ( input_connection . getString ( "output_name" ) ) ) ) ; } JSONArray outputs = step . getJSONArray ( "outputs" ) ; List < String > outputFiles = new LinkedList < > ( ) ; for ( int j = 0 ; j < ( outputs . length ( ) ) ; j ++ ) { JSONObject output = outputs . getJSONObject ( j ) ; String outputName = output . getString ( "name" ) ; GalaxyDataType dataType = null ; GalaxyParamValue param = tool . getFirstMatchingParamByName ( outputName ) ;

Fix:
GalaxyTaskInstance task = new GalaxyTaskInstance ( id , getRunId ( ) , tool . getId ( ) , tool , galaxyPath ) ;