Buggy code:
public class TaskImpl implements Task { private static final Log LOG = LogFactory . getLog ( TaskImpl . class ) ; private static final float FETCHER_PROGRESS = 0.5F ; private final TajoConf systemConf ; private final QueryContext queryContext ; private final ExecutionBlockContext executionBlockContext ; private final TaskRequest request ; private final Map < String , TableDesc > descs ; private final TableStats inputStats ; private final Path taskDir ; private final TaskAttemptContext context ; private List < Fetcher > fetcherRunners ; private LogicalNode plan ; private PhysicalExec executor ; private boolean interQuery ; private Path inputTableBaseDir ; private long startTime ; private long endTime ; private List < FileChunk > localChunks ; private List < FileChunk > remoteChunks ; private ShuffleType shuffleType = null ; private Schema finalSchema = null ; private TupleComparator sortComp = null ; private final int maxUrlLength ; public TaskImpl ( final TaskRequest request , final ExecutionBlockContext executionBlockContext ) throws IOException { } public void initPlan ( ) throws IOException { } private void updateDescsForScanNodes ( NodeType nodeType ) { } private void startScriptExecutors ( ) throws IOException { } private void stopScriptExecutors ( ) { } @ Override public void init ( ) throws IOException { } private TaskAttemptId getId ( ) { } public String toString ( ) { } @ Override public boolean isStopped ( ) { } @ Override public TaskAttemptContext getTaskContext ( ) { } @ Override public ExecutionBlockContext getExecutionBlockContext ( ) { } @ Override public boolean hasFetchPhase ( ) { } @ Override public void fetch ( ExecutorService fetcherExecutor ) { <START_BUG> fetcherRunners . sort ( new Comparator < Fetcher > ( ) { <END_BUG> @ Override public int compare ( Fetcher f1 , Fetcher f2 ) { String strUri = f1 . getURI ( ) . toString ( ) ; int index = strUri . lastIndexOf ( "&ta" ) ; String taskIdStr1 = strUri . substring ( ( index + ( "&ta" . length ( ) ) ) ) ; strUri = f2 . getURI ( ) . toString ( ) ; index = strUri . lastIndexOf ( "&ta" ) ; String taskIdStr2 = strUri . substring ( ( index + ( "&ta" . length ( ) ) ) ) ; return taskIdStr1 . compareTo ( taskIdStr2 ) ; } } ) ; for ( Fetcher f : fetcherRunners ) { fetcherExecutor . submit ( new TaskImpl . FetchRunner ( context , f ) ) ; } } @ Override public void kill ( ) { } @ Override public void abort ( ) { } @ Override public TaskStatusProto getReport ( ) { } @ Override public boolean isProgressChanged ( ) { } @ Override public void updateProgress ( ) { } private TableStatsProto reloadInputStats ( ) { } private TaskCompletionReport getTaskCompletionReport ( ) { } private void waitForFetch ( ) throws IOException , InterruptedException { } @ Override public void run ( ) throws Exception { } @ Override public void cleanup ( ) { } @ Override public TaskHistory createTaskHistory ( ) { } public List < Fetcher > getFetchers ( ) { } public int hashCode ( ) { } public boolean equals ( Object obj ) { } private FileFragment [ ] localizeFetchedData ( String name ) throws IOException { } private class FetchRunner implements Runnable { private final TaskAttemptContext ctx ; private final Fetcher fetcher ; private int maxRetryNum ; public FetchRunner ( TaskAttemptContext ctx , Fetcher fetcher ) { } @ Override public void run ( ) { } } @ VisibleForTesting public static float adjustFetchProcess ( int totalFetcher , int remainFetcher ) { } private synchronized void fetcherFinished ( TaskAttemptContext ctx ) { } private List < Fetcher > getFetchRunners ( TaskAttemptContext ctx , List < FetchProto > fetches ) throws IOException { } private List < FileChunk > getLocalStoredFileChunk ( URI fetchURI , TajoConf conf ) throws IOException { } public static Path getTaskAttemptDir ( TaskAttemptId quid ) { } }

Fix:
Collections . sort ( fetcherRunners , new Comparator < Fetcher > ( ) {