Program: 17299
Project: 17299
Buggy source:
@VisibleForTesting public static ContainerLaunchContext createContainerLaunchContext(Map<ApplicationAccessType,String> acls,ContainerId containerId,TezConfiguration conf,TezVertexID vertexId,Token<JobTokenIdentifier> jobToken,Resource assignedCapability,Map<String,LocalResource> localResources,Map<String,String> vertexEnv,String javaOpts,TaskAttemptListener taskAttemptListener,Credentials credentials,boolean shouldProfile,AppContext appContext){
synchronized (commonContainerSpecLock) {
    if (commonContainerSpec == null) {
      commonContainerSpec=createCommonContainerLaunchContext(acls,conf,jobToken,vertexId,credentials,appContext);
    }
  }
  Map<String,LocalResource> lResources=new TreeMap<String,LocalResource>();
  lResources.putAll(commonContainerSpec.getLocalResources());
  lResources.putAll(localResources);
  Map<String,String> env=commonContainerSpec.getEnvironment();
  Map<String,String> myEnv=new HashMap<String,String>(env.size());
  myEnv.putAll(env);
  myEnv.putAll(vertexEnv);
  List<String> commands=TezEngineChildJVM.getVMCommand(taskAttemptListener.getAddress(),conf,vertexId,containerId,vertexId.getDAGId().getApplicationId(),shouldProfile,javaOpts);
  Map<String,ByteBuffer> myServiceData=new HashMap<String,ByteBuffer>();
  for (  Entry<String,ByteBuffer> entry : commonContainerSpec.getServiceData().entrySet()) {
    myServiceData.put(entry.getKey(),entry.getValue().duplicate());
  }
  ContainerLaunchContext container=ContainerLaunchContext.newInstance(lResources,myEnv,commands,myServiceData,commonContainerSpec.getTokens(),acls);
  return container;
}

Fixed version (ground truth):
@VisibleForTesting public static ContainerLaunchContext createContainerLaunchContext(Map<ApplicationAccessType,String> acls,ContainerId containerId,TezConfiguration conf,TezVertexID vertexId,Token<JobTokenIdentifier> jobToken,Resource assignedCapability,Map<String,LocalResource> localResources,Map<String,String> vertexEnv,String javaOpts,TaskAttemptListener taskAttemptListener,Credentials credentials,boolean shouldProfile,AppContext appContext){
synchronized (commonContainerSpecLock) {
    if (commonContainerSpec == null) {
      commonContainerSpec=createCommonContainerLaunchContext(acls,conf,jobToken,vertexId,credentials,appContext);
    }
  }
  Map<String,LocalResource> lResources=new TreeMap<String,LocalResource>();
  lResources.putAll(commonContainerSpec.getLocalResources());
  lResources.putAll(localResources);
  Map<String,String> env=commonContainerSpec.getEnvironment();
  Map<String,String> myEnv=new HashMap<String,String>(env.size());
  myEnv.putAll(env);
  myEnv.putAll(vertexEnv);
  List<String> commands=TezEngineChildJVM.getVMCommand(taskAttemptListener.getAddress(),conf,vertexId,containerId,vertexId.getDAGId().getApplicationId(),shouldProfile,javaOpts);
  Map<String,ByteBuffer> myServiceData=new HashMap<String,ByteBuffer>();
  for (  Entry<String,ByteBuffer> entry : commonContainerSpec.getServiceData().entrySet()) {
    myServiceData.put(entry.getKey(),entry.getValue().duplicate());
  }
  ContainerLaunchContext container=ContainerLaunchContext.newInstance(lResources,myEnv,commands,myServiceData,commonContainerSpec.getTokens().duplicate(),acls);
  return container;
}