Source:
public TaskInfo(Task<?> task) { this.id = IdGenerator.format(task.getTaskId()); this.state = task.getState(); this.startTime = new Timestamp(task.getStartTime().getTime()); this.delay = task.getDelay(TimeUnit.MILLISECONDS); this.command = task.toString(); if (task instanceof ProjectTask) { ProjectTask<?> projectTask = ((ProjectTask<?>) task); this.projectName = projectTask.getProjectNameKey().get(); this.remoteName = projectTask.getRemoteName(); } if(this.command.contains("ListenableFutureTask")){ RunnableScheduledFuture<?> t = task.getTask(); try { Field runner = FutureTask.class.getDeclaredField("runner"); runner.setAccessible(true); Thread thread = (Thread)runner.get(t); if(thread != null) { String regex = "[\\[\\]]"; String regex1 = "[,]"; this.command = thread.toString().split(regex)[1].split(regex1)[0]; Field runnable = Task.class.getDeclaredField("runnable"); runnable.setAccessible(true); ListenableFutureTask<?> listenableFutureTask = (ListenableFutureTask<?>)runnable.get(task); Field callable = FutureTask.class.getDeclaredField("callable"); callable.setAccessible(true); MergeabilityChecker.Task checkerTask = (MergeabilityChecker.Task)callable.get(listenableFutureTask); Field change = MergeabilityChecker.Task.class.getDeclaredField("change"); change.setAccessible(true); StringBuilder sb = new StringBuilder(); sb.append(this.command.substring(0, this.command.lastIndexOf('-'))); sb.append(" index-change-"); sb.append(String.valueOf(((Change)change.get(checkerTask)).getChangeId())); this.command = sb.toString(); } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { log.error("failed to get the actual command name for the ListenableFutureTask ", e); } } }

Target:
public TaskInfo(Task<?> task) { this.id = IdGenerator.format(task.getTaskId()); this.state = task.getState(); this.startTime = new Timestamp(task.getStartTime().getTime()); this.delay = task.getDelay(TimeUnit.MILLISECONDS); this.command = task.toString(); if (task instanceof ProjectTask) { ProjectTask<?> projectTask = ((ProjectTask<?>) task); this.projectName = projectTask.getProjectNameKey().get(); this.remoteName = projectTask.getRemoteName(); } if (this.command.contains("ListenableFutureTask")) { RunnableScheduledFuture<?> t = task.getTask(); try { Field runner = FutureTask.class.getDeclaredField("runner"); runner.setAccessible(true); Thread thread = (Thread)runner.get(t); if (thread != null) { String regex = "[\\[\\]]"; String regex1 = "[,]"; this.command = thread.toString().split(regex)[1].split(regex1)[0]; Field runnable = Task.class.getDeclaredField("runnable"); runnable.setAccessible(true); ListenableFutureTask<?> listenableFutureTask = (ListenableFutureTask<?>)runnable.get(task); Field callable = FutureTask.class.getDeclaredField("callable"); callable.setAccessible(true); MergeabilityChecker.Task checkerTask = (MergeabilityChecker.Task)callable.get(listenableFutureTask); Field change = MergeabilityChecker.Task.class.getDeclaredField("change"); change.setAccessible(true); this.command = new StringBuilder() .append(this.command.substring(0, this.command.lastIndexOf('-'))) .append(" index-change-") .append(String.valueOf(((Change)change.get(checkerTask)).getChangeId())) .toString(); } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { log.error("failed to get the actual command name for the ListenableFutureTask ", e); } } }