Source:
private void prepareCommand(final TaskInfo.Builder bldr, final SingularityTaskId taskId, final SingularityTaskRequest task, final SingularityOfferHolder offerHolder, final Optional<long[]> ports) { CommandInfo.Builder commandBldr = CommandInfo.newBuilder(); if (task.getDeploy().getUser().isPresent()) { commandBldr.setUser(task.getDeploy().getUser().get()); } if (task.getDeploy().getCommand().isPresent()) { commandBldr.setValue(task.getDeploy().getCommand().get()); } if (task.getDeploy().getArguments().isPresent()) { commandBldr.addAllArguments(task.getDeploy().getArguments().get()); } if (task.getPendingTask().getCmdLineArgsList().isPresent()) { commandBldr.addAllArguments(task.getPendingTask().getCmdLineArgsList().get()); } if (task.getDeploy().getShell().isPresent()){ commandBldr.setShell(task.getDeploy().getShell().get()); } else if ((task.getDeploy().getArguments().isPresent() && !task.getDeploy().getArguments().get().isEmpty()) || task.getDeploy().getContainerInfo().isPresent() || (task.getPendingTask().getCmdLineArgsList().isPresent() && !task.getPendingTask().getCmdLineArgsList().get().isEmpty())) { commandBldr.setShell(false); } List<SingularityMesosArtifact> combinedArtifacts = task.getDeploy().getUris().or(Collections.<SingularityMesosArtifact> emptyList()); combinedArtifacts.addAll(task.getPendingTask().getExtraArtifacts().or(Collections.<SingularityMesosArtifact> emptyList())); for (SingularityMesosArtifact artifact : combinedArtifacts) { commandBldr.addUris(URI.newBuilder() .setValue(artifact.getUri()) .setCache(artifact.isCache()) .setExecutable(artifact.isExecutable()) .setExtract(artifact.isExtract()) .build()); } prepareEnvironment(task, taskId, commandBldr, offerHolder, ports); bldr.setCommand(commandBldr); }

Target:
private void prepareCommand(final TaskInfo.Builder bldr, final SingularityTaskId taskId, final SingularityTaskRequest task, final SingularityOfferHolder offerHolder, final Optional<long[]> ports) { CommandInfo.Builder commandBldr = CommandInfo.newBuilder(); if (task.getDeploy().getUser().isPresent()) { commandBldr.setUser(task.getDeploy().getUser().get()); } if (task.getDeploy().getCommand().isPresent()) { commandBldr.setValue(task.getDeploy().getCommand().get()); } if (task.getDeploy().getArguments().isPresent()) { commandBldr.addAllArguments(task.getDeploy().getArguments().get()); } if (task.getPendingTask().getCmdLineArgsList().isPresent()) { commandBldr.addAllArguments(task.getPendingTask().getCmdLineArgsList().get()); } if (task.getDeploy().getShell().isPresent()){ commandBldr.setShell(task.getDeploy().getShell().get()); } else if ((task.getDeploy().getArguments().isPresent() && !task.getDeploy().getArguments().get().isEmpty()) || task.getDeploy().getContainerInfo().isPresent() || (task.getPendingTask().getCmdLineArgsList().isPresent() && !task.getPendingTask().getCmdLineArgsList().get().isEmpty())) { commandBldr.setShell(false); } List<SingularityMesosArtifact> combinedArtifacts = new ArrayList<>(); combinedArtifacts.addAll(task.getDeploy().getUris().or(Collections.emptyList())); combinedArtifacts.addAll(task.getPendingTask().getExtraArtifacts()); prepareMesosUriDownloads(combinedArtifacts, commandBldr); prepareEnvironment(task, taskId, commandBldr, offerHolder, ports); bldr.setCommand(commandBldr); }