nus-yam/ex-repair huggingface dataset:
Program: 110701
Project: 110701
Buggy source:
/** 
 * Sets the visibility and license for an input file. The input file must already exist as a member of this package.
 * @throws IllegalArgumentException if the input file doesn't exist in thispackage's target map.
 */
void setVisibilityAndLicense(InputFile inputFile,RuleVisibility visibility,License license){
  String filename=inputFile.getName();
  Target cacheInstance=targets.get(filename);
  if (!(cacheInstance instanceof InputFile)) {
    throw new IllegalArgumentException("String_Node_Str" + filename + "String_Node_Str"+ pkg.getName()+ "String_Node_Str");
  }
  if (!((InputFile)cacheInstance).isVisibilitySpecified() || cacheInstance.getVisibility() != visibility || cacheInstance.getLicense() != license) {
    targets.put(filename,new InputFile(pkg,cacheInstance.getLabel(),cacheInstance.getLocation(),visibility,license));
  }
}

Fixed version (ground truth):
/** 
 * Sets the visibility and license for an input file. The input file must already exist as a member of this package.
 * @throws IllegalArgumentException if the input file doesn't exist in thispackage's target map.
 */
void setVisibilityAndLicense(InputFile inputFile,RuleVisibility visibility,License license){
  String filename=inputFile.getName();
  Target cacheInstance=targets.get(filename);
  if (!(cacheInstance instanceof InputFile)) {
    throw new IllegalArgumentException("String_Node_Str" + filename + "String_Node_Str"+ pkg.getName()+ "String_Node_Str");
  }
  if (!((InputFile)cacheInstance).isVisibilitySpecified() || cacheInstance.getVisibility() != visibility || !Objects.equals(cacheInstance.getLicense(),license)) {
    targets.put(filename,new InputFile(pkg,cacheInstance.getLabel(),cacheInstance.getLocation(),visibility,license));
  }
}
Program: 110703
Project: 110703
Buggy source:
/** 
 * Reports an error against the specified rule if it's beneath third_party but does not have a declared license.
 */
private static void checkThirdPartyRuleHasLicense(Rule rule,Package.Builder pkgBuilder,EventHandler eventHandler){
  if (isThirdPartyPackage(rule.getLabel().getPackageIdentifier())) {
    License license=rule.getLicense();
    if (license == null) {
      license=pkgBuilder.getDefaultLicense();
    }
    if (license == License.NO_LICENSE) {
      rule.reportError("String_Node_Str" + rule.getLabel() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",eventHandler);
    }
  }
}

Fixed version (ground truth):
/** 
 * Reports an error against the specified rule if it's beneath third_party but does not have a declared license.
 */
private static void checkThirdPartyRuleHasLicense(Rule rule,Package.Builder pkgBuilder,EventHandler eventHandler){
  if (isThirdPartyPackage(rule.getLabel().getPackageIdentifier())) {
    License license=rule.getLicense();
    if (license == null) {
      license=pkgBuilder.getDefaultLicense();
    }
    if (!license.isSpecified()) {
      rule.reportError("String_Node_Str" + rule.getLabel() + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",eventHandler);
    }
  }
}
Program: 110704
Project: 110704
Buggy source:
/** 
 * Uses the given label to retrieve the workspace-relative path of the given location (including the line number). <p>For example, the location /usr/local/workspace/my/cool/package/BUILD:3:1 and the label //my/cool/package:BUILD would lead to "my/cool/package:BUILD:3".
 * @return The workspace-relative path of the given location, or null if it could not be computed.
 */
@Nullable private static String maybeGetRelativeLocation(@Nullable Location location,Label label){
  if (location == null) {
    return null;
  }
  String absolutePath=Location.printPathAndLine(location);
  int pos=absolutePath.indexOf(label.getPackageName());
  return (pos < 0) ? null : absolutePath.substring(pos);
}

Fixed version (ground truth):
/** 
 * Uses the given label to retrieve the workspace-relative path of the given location (including the line number). <p>For example, the location /usr/local/workspace/my/cool/package/BUILD:3:1 and the label //my/cool/package:BUILD would lead to "my/cool/package:BUILD:3".
 * @return The workspace-relative path of the given location, or null if it could not be computed.
 */
@Nullable private static String maybeGetRelativeLocation(@Nullable Location location,Label label){
  if (location == null) {
    return null;
  }
  String absolutePath=Location.printLocation(location);
  int pos=absolutePath.indexOf(label.getPackageName());
  return (pos < 0) ? null : absolutePath.substring(pos);
}
Program: 110705
Project: 110705
Buggy source:
private void enqueueTarget(final Target from,final Attribute attr,final Label label,final int depth,final int count){
  if (depth >= maxDepth) {
    return;
  }
  if (from != null && from.getLabel().getPackageFragment() == label.getPackageFragment() && !blockNewActions() && count < RECURSION_LIMIT) {
    newVisitRunnable(from,attr,label,depth,count + 1).run();
  }
 else {
    execute(newVisitRunnable(from,attr,label,depth,0));
  }
}

Fixed version (ground truth):
private void enqueueTarget(final Target from,final Attribute attr,final Label label,final int depth,final int count){
  if (depth >= maxDepth) {
    return;
  }
  if (from != null && from.getLabel().getPackageFragment().equals(label.getPackageFragment()) && !blockNewActions() && count < RECURSION_LIMIT) {
    newVisitRunnable(from,attr,label,depth,count + 1).run();
  }
 else {
    execute(newVisitRunnable(from,attr,label,depth,0));
  }
}
Program: 110706
Project: 110706
Buggy source:
@Override public void output(QueryOptions options,Digraph<Target> result,OutputStream out,AspectResolver aspectProvider){
  this.graphNodeStringLimit=options.graphNodeStringLimit;
  boolean sortLabels=options.orderOutput == OrderOutput.FULL;
  if (options.graphFactored) {
    outputFactored(result,new PrintWriter(out),sortLabels);
  }
 else {
    outputUnfactored(result,new PrintWriter(out),sortLabels,options);
  }
}

Fixed version (ground truth):
@Override public void output(QueryOptions options,Digraph<Target> result,OutputStream out,AspectResolver aspectProvider){
  this.graphNodeStringLimit=options.graphNodeStringLimit;
  boolean sortLabels=options.orderOutput == OrderOutput.FULL;
  if (options.graphFactored) {
    outputFactored(result,new PrintWriter(new OutputStreamWriter(out,StandardCharsets.UTF_8)),sortLabels);
  }
 else {
    outputUnfactored(result,new PrintWriter(new OutputStreamWriter(out,StandardCharsets.UTF_8)),sortLabels,options);
  }
}
Program: 110707
Project: 110707
Buggy source:
/** 
 * Returns an equivalence relation for nodes in the specified graph. <p>Two nodes are considered equal iff they have equal topology (predecessors and successors). TODO(bazel-team): Make this a method of Digraph.
 */
private static <LABEL>EquivalenceRelation<Node<LABEL>> createEquivalenceRelation(){
  return new EquivalenceRelation<Node<LABEL>>(){
    @Override public int compare(    Node<LABEL> x,    Node<LABEL> y){
      if (x == y) {
        return 0;
      }
      if (x.numPredecessors() != y.numPredecessors() || x.numSuccessors() != y.numSuccessors()) {
        return -1;
      }
      Set<Node<LABEL>> xpred=new HashSet<>(x.getPredecessors());
      Set<Node<LABEL>> ypred=new HashSet<>(y.getPredecessors());
      if (!xpred.equals(ypred)) {
        return -1;
      }
      Set<Node<LABEL>> xsucc=new HashSet<>(x.getSuccessors());
      Set<Node<LABEL>> ysucc=new HashSet<>(y.getSuccessors());
      if (!xsucc.equals(ysucc)) {
        return -1;
      }
      return 0;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns an equivalence relation for nodes in the specified graph. <p>Two nodes are considered equal iff they have equal topology (predecessors and successors). TODO(bazel-team): Make this a method of Digraph.
 */
@SuppressWarnings("String_Node_Str") private static <LABEL>EquivalenceRelation<Node<LABEL>> createEquivalenceRelation(){
  return new EquivalenceRelation<Node<LABEL>>(){
    @Override public int compare(    Node<LABEL> x,    Node<LABEL> y){
      if (x == y) {
        return 0;
      }
      if (x.numPredecessors() != y.numPredecessors() || x.numSuccessors() != y.numSuccessors()) {
        return -1;
      }
      Set<Node<LABEL>> xpred=new HashSet<>(x.getPredecessors());
      Set<Node<LABEL>> ypred=new HashSet<>(y.getPredecessors());
      if (!xpred.equals(ypred)) {
        return -1;
      }
      Set<Node<LABEL>> xsucc=new HashSet<>(x.getSuccessors());
      Set<Node<LABEL>> ysucc=new HashSet<>(y.getSuccessors());
      if (!xsucc.equals(ysucc)) {
        return -1;
      }
      return 0;
    }
  }
;
}
Program: 110708
Project: 110708
Buggy source:
/** 
 * Creates and returns a new Blaze RPCServer. Call   {@link RPCServer#serve()} to start the server.
 */
private static RPCServer createBlazeRPCServer(Iterable<BlazeModule> modules,List<String> args) throws IOException, OptionsParsingException, AbruptExitException {
  final RPCServer[] rpcServer=new RPCServer[1];
  Runnable prepareForAbruptShutdown=() -> rpcServer[0].prepareForAbruptShutdown();
  BlazeRuntime runtime=newRuntime(modules,args,prepareForAbruptShutdown);
  BlazeCommandDispatcher dispatcher=new BlazeCommandDispatcher(runtime);
  CommandExecutor commandExecutor=new CommandExecutor(runtime,dispatcher);
  BlazeServerStartupOptions startupOptions=runtime.getStartupOptionsProvider().getOptions(BlazeServerStartupOptions.class);
  try {
    Class<?> factoryClass=Class.forName("String_Node_Str");
    RPCServer.Factory factory=(RPCServer.Factory)factoryClass.getConstructor().newInstance();
    rpcServer[0]=factory.create(commandExecutor,runtime.getClock(),startupOptions.commandPort,runtime.getWorkspace().getWorkspace(),runtime.getServerDirectory(),startupOptions.maxIdleSeconds);
    return rpcServer[0];
  }
 catch (  ReflectiveOperationException|IllegalArgumentException e) {
    throw new AbruptExitException("String_Node_Str",ExitCode.BLAZE_INTERNAL_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Creates and returns a new Blaze RPCServer. Call   {@link RPCServer#serve()} to start the server.
 */
@SuppressWarnings("String_Node_Str") private static RPCServer createBlazeRPCServer(Iterable<BlazeModule> modules,List<String> args) throws IOException, OptionsParsingException, AbruptExitException {
  final RPCServer[] rpcServer=new RPCServer[1];
  Runnable prepareForAbruptShutdown=() -> rpcServer[0].prepareForAbruptShutdown();
  BlazeRuntime runtime=newRuntime(modules,args,prepareForAbruptShutdown);
  BlazeCommandDispatcher dispatcher=new BlazeCommandDispatcher(runtime);
  CommandExecutor commandExecutor=new CommandExecutor(runtime,dispatcher);
  BlazeServerStartupOptions startupOptions=runtime.getStartupOptionsProvider().getOptions(BlazeServerStartupOptions.class);
  try {
    Class<?> factoryClass=Class.forName("String_Node_Str");
    RPCServer.Factory factory=(RPCServer.Factory)factoryClass.getConstructor().newInstance();
    rpcServer[0]=factory.create(commandExecutor,runtime.getClock(),startupOptions.commandPort,runtime.getWorkspace().getWorkspace(),runtime.getServerDirectory(),startupOptions.maxIdleSeconds);
    return rpcServer[0];
  }
 catch (  ReflectiveOperationException|IllegalArgumentException e) {
    throw new AbruptExitException("String_Node_Str",ExitCode.BLAZE_INTERNAL_ERROR);
  }
}
Program: 110709
Project: 110709
Buggy source:
UnprefixingClassWriter(int flags){
  super(Opcodes.ASM5);
  this.writer=new ClassWriter(flags);
  this.cv=this.writer;
  if (!prefix.isEmpty()) {
    this.cv=new ClassRemapperWithBugFix(this.cv,new Remapper(){
      @Override public String map(      String typeName){
        return unprefix(typeName);
      }
    }
);
  }
}

Fixed version (ground truth):
UnprefixingClassWriter(int flags){
  super(Opcodes.ASM5);
  this.writer=new ClassWriter(flags);
  this.cv=this.writer;
  if (!prefix.isEmpty()) {
    this.cv=new ClassRemapper(this.cv,new Remapper(){
      @Override public String map(      String typeName){
        return unprefix(typeName);
      }
    }
);
  }
}
Program: 110710
Project: 110710
Buggy source:
@Override public void accept(ClassVisitor cv,Attribute[] attrs,int flags){
  cv=new ClassRemapperWithBugFix(cv,new Remapper(){
    @Override public String map(    String typeName){
      return prefix(typeName);
    }
  }
);
  super.accept(cv,attrs,flags);
}

Fixed version (ground truth):
@Override public void accept(ClassVisitor cv,Attribute[] attrs,int flags){
  cv=new ClassRemapper(cv,new Remapper(){
    @Override public String map(    String typeName){
      return prefix(typeName);
    }
  }
);
  super.accept(cv,attrs,flags);
}
Program: 110712
Project: 110712
Buggy source:
private SkylarkDict(@Nullable Environment env){
  mutability=env == null ? Mutability.IMMUTABLE : env.mutability();
}

Fixed version (ground truth):
private SkylarkDict(@Nullable Environment env){
  this.mutability=env == null ? Mutability.IMMUTABLE : env.mutability();
}
Program: 110713
Project: 110713
Buggy source:
@Override public List<E> getContents(){
  return contents;
}

Fixed version (ground truth):
/** 
 * Casts this list as a List of   {@code T}, checking that each element has type   {@code T}.
 * @param type the expected class of elements
 * @param description a description of the argument being converted, or null, for debugging
 */
public <T>List<T> getContents(Class<T> type,@Nullable String description) throws EvalException {
  return castList(getContentsUnsafe(),type,description);
}
Program: 110714
Project: 110714
Buggy source:
@Override public Collection<V> values(){
  return getContentsUnsafe().values();
}

Fixed version (ground truth):
@Override public Collection<V> values(){
  return Collections.unmodifiableMap(getContentsUnsafe()).values();
}
Program: 110715
Project: 110715
Buggy source:
@Override public Iterator<E> iterator(){
  return getContentsUnsafe().iterator();
}

Fixed version (ground truth):
@Override public Iterator<E> iterator(){
  return Collections.unmodifiableCollection(getContentsUnsafe()).iterator();
}
Program: 110716
Project: 110716
Buggy source:
@Override public Set<K> keySet(){
  return getContentsUnsafe().keySet();
}

Fixed version (ground truth):
@Override public Set<K> keySet(){
  return Collections.unmodifiableMap(getContentsUnsafe()).keySet();
}
Program: 110717
Project: 110717
Buggy source:
@Override public List<E> subList(int fromIndex,int toIndex){
  return getContentsUnsafe().subList(fromIndex,toIndex);
}

Fixed version (ground truth):
@Override public List<E> subList(int fromIndex,int toIndex){
  return Collections.unmodifiableList(getContentsUnsafe()).subList(fromIndex,toIndex);
}
Program: 110718
Project: 110718
Buggy source:
@Override public Set<Map.Entry<K,V>> entrySet(){
  return getContentsUnsafe().entrySet();
}

Fixed version (ground truth):
@Override public Set<Map.Entry<K,V>> entrySet(){
  return Collections.unmodifiableMap(getContentsUnsafe()).entrySet();
}
Program: 110719
Project: 110719
Buggy source:
@Override public ListIterator<E> listIterator(int index){
  return getContentsUnsafe().listIterator(index);
}

Fixed version (ground truth):
@Override public ListIterator<E> listIterator(int index){
  return Collections.unmodifiableList(getContentsUnsafe()).listIterator(index);
}
Program: 110723
Project: 110723
Buggy source:
private Iterable<SkyKey> getSubdirDeps(DirectoryListingValue dirListingValue,RootedPath rootedPath,RepositoryName repositoryName,Set<PathFragment> excludedPaths){
  Path root=rootedPath.getRoot();
  PathFragment rootRelativePath=rootedPath.getRelativePath();
  boolean followSymlinks=shouldFollowSymlinksWhenTraversing(dirListingValue.getDirents());
  List<SkyKey> childDeps=new ArrayList<>();
  for (  Dirent dirent : dirListingValue.getDirents()) {
    Type type=dirent.getType();
    if (type != Type.DIRECTORY && (type != Type.SYMLINK || !followSymlinks)) {
      continue;
    }
    String basename=dirent.getName();
    if (rootRelativePath.equals(PathFragment.EMPTY_FRAGMENT) && PathPackageLocator.DEFAULT_TOP_LEVEL_EXCLUDES.contains(basename)) {
      continue;
    }
    if (basename.equals(Label.EXTERNAL_PACKAGE_NAME.getPathString())) {
      continue;
    }
    PathFragment subdirectory=rootRelativePath.getRelative(basename);
    if (excludedPaths.contains(subdirectory)) {
      continue;
    }
    ImmutableSet<PathFragment> excludedSubdirectoriesBeneathThisSubdirectory=PathFragment.filterPathsStartingWith(excludedPaths,subdirectory);
    RootedPath subdirectoryRootedPath=RootedPath.toRootedPath(root,subdirectory);
    childDeps.add(skyKeyTransformer.makeSkyKey(repositoryName,subdirectoryRootedPath,excludedSubdirectoriesBeneathThisSubdirectory));
  }
  return childDeps;
}

Fixed version (ground truth):
private Iterable<SkyKey> getSubdirDeps(DirectoryListingValue dirListingValue,RootedPath rootedPath,RepositoryName repositoryName,Set<PathFragment> excludedPaths){
  Path root=rootedPath.getRoot();
  PathFragment rootRelativePath=rootedPath.getRelativePath();
  boolean followSymlinks=shouldFollowSymlinksWhenTraversing(dirListingValue.getDirents());
  List<SkyKey> childDeps=new ArrayList<>();
  for (  Dirent dirent : dirListingValue.getDirents()) {
    Type type=dirent.getType();
    if (type != Type.DIRECTORY && (type != Type.SYMLINK || !followSymlinks)) {
      continue;
    }
    String basename=dirent.getName();
    if (rootRelativePath.equals(PathFragment.EMPTY_FRAGMENT) && PathPackageLocator.DEFAULT_TOP_LEVEL_EXCLUDES.contains(basename)) {
      continue;
    }
    PathFragment subdirectory=rootRelativePath.getRelative(basename);
    if (subdirectory.equals(Label.EXTERNAL_PACKAGE_NAME)) {
      continue;
    }
    if (excludedPaths.contains(subdirectory)) {
      continue;
    }
    ImmutableSet<PathFragment> excludedSubdirectoriesBeneathThisSubdirectory=PathFragment.filterPathsStartingWith(excludedPaths,subdirectory);
    RootedPath subdirectoryRootedPath=RootedPath.toRootedPath(root,subdirectory);
    childDeps.add(skyKeyTransformer.makeSkyKey(repositoryName,subdirectoryRootedPath,excludedSubdirectoriesBeneathThisSubdirectory));
  }
  return childDeps;
}
Program: 110724
Project: 110724
Buggy source:
void upload(Path execRoot,Collection<Path> files,FileOutErr outErr,ActionResult.Builder result) throws IOException, InterruptedException {
  ArrayList<Digest> digests=new ArrayList<>();
  ImmutableSet<Digest> digestsToUpload=getMissingDigests(digests);
  List<Chunker> filesToUpload=new ArrayList<>(digestsToUpload.size());
  for (  Path file : files) {
    if (!file.exists()) {
      continue;
    }
    if (file.isDirectory()) {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    Digest digest=Digests.computeDigest(file);
    digests.add(digest);
    if (digestsToUpload.contains(digest)) {
      Chunker chunker=new Chunker(file);
      filesToUpload.add(chunker);
    }
  }
  if (!filesToUpload.isEmpty()) {
    uploader.uploadBlobs(filesToUpload);
  }
  int index=0;
  for (  Path file : files) {
    result.addOutputFilesBuilder().setPath(file.relativeTo(execRoot).getPathString()).setDigest(digests.get(index++)).setIsExecutable(file.isExecutable());
  }
  if (outErr.getErrorPath().exists()) {
    Digest stderr=uploadFileContents(outErr.getErrorPath());
    result.setStderrDigest(stderr);
  }
  if (outErr.getOutputPath().exists()) {
    Digest stdout=uploadFileContents(outErr.getOutputPath());
    result.setStdoutDigest(stdout);
  }
}

Fixed version (ground truth):
void upload(Path execRoot,Collection<Path> files,FileOutErr outErr,ActionResult.Builder result) throws IOException, InterruptedException {
  Map<Digest,Path> digestToFile=new HashMap<>();
  for (  Path file : files) {
    if (!file.exists()) {
      continue;
    }
    if (file.isDirectory()) {
      throw new UnsupportedOperationException("String_Node_Str");
    }
    Digest digest=Digests.computeDigest(file);
    result.addOutputFilesBuilder().setPath(file.relativeTo(execRoot).getPathString()).setDigest(digest).setIsExecutable(file.isExecutable());
    digestToFile.put(digest,file);
  }
  ImmutableSet<Digest> digestsToUpload=getMissingDigests(digestToFile.keySet());
  List<Chunker> filesToUpload=new ArrayList<>();
  for (  Digest digest : digestsToUpload) {
    Path file=digestToFile.get(digest);
    if (file == null) {
      String message="String_Node_Str" + digest;
      throw new IOException(message);
    }
    filesToUpload.add(new Chunker(file));
  }
  if (!filesToUpload.isEmpty()) {
    uploader.uploadBlobs(filesToUpload);
  }
  if (outErr.getErrorPath().exists()) {
    Digest stderr=uploadFileContents(outErr.getErrorPath());
    result.setStderrDigest(stderr);
  }
  if (outErr.getOutputPath().exists()) {
    Digest stdout=uploadFileContents(outErr.getOutputPath());
    result.setStdoutDigest(stdout);
  }
}
Program: 110725
Project: 110725
Buggy source:
@Test public void testUploadBlobMultipleChunks() throws Exception {
  final Digest digest=Digests.computeDigestUtf8("String_Node_Str");
  serviceRegistry.addService(new ContentAddressableStorageImplBase(){
    @Override public void findMissingBlobs(    FindMissingBlobsRequest request,    StreamObserver<FindMissingBlobsResponse> responseObserver){
      responseObserver.onNext(FindMissingBlobsResponse.newBuilder().addMissingBlobDigests(digest).build());
      responseObserver.onCompleted();
    }
  }
);
  ByteStreamImplBase mockByteStreamImpl=Mockito.mock(ByteStreamImplBase.class);
  serviceRegistry.addService(mockByteStreamImpl);
  for (int chunkSize=1; chunkSize <= 6; ++chunkSize) {
    GrpcRemoteCache client=newClient();
    Chunker.setDefaultChunkSizeForTesting(chunkSize);
    when(mockByteStreamImpl.write(Mockito.<StreamObserver<WriteResponse>>anyObject())).thenAnswer(blobChunkedWriteAnswer("String_Node_Str",chunkSize));
    assertThat(client.uploadBlob("String_Node_Str".getBytes(UTF_8))).isEqualTo(digest);
  }
}

Fixed version (ground truth):
@Test public void testUploadBlobMultipleChunks() throws Exception {
  final Digest digest=Digests.computeDigestUtf8("String_Node_Str");
  serviceRegistry.addService(new ContentAddressableStorageImplBase(){
    @Override public void findMissingBlobs(    FindMissingBlobsRequest request,    StreamObserver<FindMissingBlobsResponse> responseObserver){
      responseObserver.onNext(FindMissingBlobsResponse.newBuilder().addMissingBlobDigests(digest).build());
      responseObserver.onCompleted();
    }
  }
);
  ByteStreamImplBase mockByteStreamImpl=Mockito.mock(ByteStreamImplBase.class);
  serviceRegistry.addService(mockByteStreamImpl);
  for (int chunkSize=1; chunkSize <= 6; ++chunkSize) {
    GrpcRemoteCache client=newClient();
    Chunker.setDefaultChunkSizeForTesting(chunkSize);
    when(mockByteStreamImpl.write(Mockito.<StreamObserver<WriteResponse>>anyObject())).thenAnswer(blobChunkedWriteAnswer("String_Node_Str",chunkSize));
    assertThat(client.uploadBlob("String_Node_Str".getBytes(UTF_8))).isEqualTo(digest);
  }
  Mockito.verify(mockByteStreamImpl,Mockito.times(6)).write(Mockito.<StreamObserver<WriteResponse>>anyObject());
}
Program: 110727
Project: 110727
Buggy source:
@Override public void onCompleted(){
}

Fixed version (ground truth):
@Override public void onCompleted(){
  responseObserver.onCompleted();
}
Program: 110728
Project: 110728
Buggy source:
@Override public void onNext(WriteRequest request){
  ((StreamObserver<WriteResponse>)invocation.getArguments()[0]).onError(Status.UNAVAILABLE.asRuntimeException());
}

Fixed version (ground truth):
@Override public void onNext(WriteRequest request){
  numErrors--;
  if (numErrors >= 0) {
    responseObserver.onError(Status.UNAVAILABLE.asRuntimeException());
    return;
  }
  assertThat(request.getFinishWrite()).isTrue();
  String resourceName=request.getResourceName();
  String dataStr=request.getData().toStringUtf8();
  int size=0;
  if (resourceName.contains(fooDigest.getHash())) {
    assertThat(dataStr).isEqualTo("String_Node_Str");
    size=3;
  }
 else   if (resourceName.contains(barDigest.getHash())) {
    assertThat(dataStr).isEqualTo("String_Node_Str");
    size=1;
  }
 else   if (resourceName.contains(bazDigest.getHash())) {
    assertThat(dataStr).isEqualTo("String_Node_Str");
    size=1;
  }
 else {
    fail("String_Node_Str" + resourceName);
  }
  responseObserver.onNext(WriteResponse.newBuilder().setCommittedSize(size).build());
}
Program: 110729
Project: 110729
Buggy source:
@Test public void testUploadCacheHits() throws Exception {
  final GrpcRemoteCache client=newClient();
  final Digest fooDigest=fakeFileCache.createScratchInput(ActionInputHelper.fromPath("String_Node_Str"),"String_Node_Str");
  final Digest barDigest=fakeFileCache.createScratchInput(ActionInputHelper.fromPath("String_Node_Str"),"String_Node_Str");
  final Path fooFile=execRoot.getRelative("String_Node_Str");
  final Path barFile=execRoot.getRelative("String_Node_Str");
  barFile.setExecutable(true);
  serviceRegistry.addService(new ContentAddressableStorageImplBase(){
    @Override public void findMissingBlobs(    FindMissingBlobsRequest request,    StreamObserver<FindMissingBlobsResponse> responseObserver){
      assertThat(request).isEqualTo(FindMissingBlobsRequest.newBuilder().addBlobDigests(fooDigest).addBlobDigests(barDigest).build());
      responseObserver.onNext(FindMissingBlobsResponse.getDefaultInstance());
      responseObserver.onCompleted();
    }
  }
);
  ActionResult.Builder result=ActionResult.newBuilder();
  client.upload(execRoot,ImmutableList.<Path>of(fooFile,barFile),outErr,result);
  ActionResult.Builder expectedResult=ActionResult.newBuilder();
  expectedResult.addOutputFilesBuilder().setPath("String_Node_Str").setDigest(fooDigest);
  expectedResult.addOutputFilesBuilder().setPath("String_Node_Str").setDigest(barDigest).setIsExecutable(true);
  assertThat(result.build()).isEqualTo(expectedResult.build());
}

Fixed version (ground truth):
@Test public void testUploadCacheHits() throws Exception {
  final GrpcRemoteCache client=newClient();
  final Digest fooDigest=fakeFileCache.createScratchInput(ActionInputHelper.fromPath("String_Node_Str"),"String_Node_Str");
  final Digest barDigest=fakeFileCache.createScratchInput(ActionInputHelper.fromPath("String_Node_Str"),"String_Node_Str");
  final Path fooFile=execRoot.getRelative("String_Node_Str");
  final Path barFile=execRoot.getRelative("String_Node_Str");
  barFile.setExecutable(true);
  serviceRegistry.addService(new ContentAddressableStorageImplBase(){
    @Override public void findMissingBlobs(    FindMissingBlobsRequest request,    StreamObserver<FindMissingBlobsResponse> responseObserver){
      assertThat(request.getBlobDigestsList()).containsExactly(fooDigest,barDigest);
      responseObserver.onNext(FindMissingBlobsResponse.getDefaultInstance());
      responseObserver.onCompleted();
    }
  }
);
  ActionResult.Builder result=ActionResult.newBuilder();
  client.upload(execRoot,ImmutableList.<Path>of(fooFile,barFile),outErr,result);
  ActionResult.Builder expectedResult=ActionResult.newBuilder();
  expectedResult.addOutputFilesBuilder().setPath("String_Node_Str").setDigest(fooDigest);
  expectedResult.addOutputFilesBuilder().setPath("String_Node_Str").setDigest(barDigest).setIsExecutable(true);
  assertThat(result.build()).isEqualTo(expectedResult.build());
}
Program: 110730
Project: 110730
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public StreamObserver<WriteRequest> answer(final InvocationOnMock invocation){
  return new StreamObserver<WriteRequest>(){
    @Override public void onNext(    WriteRequest request){
      ((StreamObserver<WriteResponse>)invocation.getArguments()[0]).onError(Status.UNAVAILABLE.asRuntimeException());
    }
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable t){
      fail("String_Node_Str" + t);
    }
  }
;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public StreamObserver<WriteRequest> answer(InvocationOnMock invocation){
  StreamObserver<WriteResponse> responseObserver=(StreamObserver<WriteResponse>)invocation.getArguments()[0];
  return new StreamObserver<WriteRequest>(){
    @Override public void onNext(    WriteRequest request){
      numErrors--;
      if (numErrors >= 0) {
        responseObserver.onError(Status.UNAVAILABLE.asRuntimeException());
        return;
      }
      assertThat(request.getFinishWrite()).isTrue();
      String resourceName=request.getResourceName();
      String dataStr=request.getData().toStringUtf8();
      int size=0;
      if (resourceName.contains(fooDigest.getHash())) {
        assertThat(dataStr).isEqualTo("String_Node_Str");
        size=3;
      }
 else       if (resourceName.contains(barDigest.getHash())) {
        assertThat(dataStr).isEqualTo("String_Node_Str");
        size=1;
      }
 else       if (resourceName.contains(bazDigest.getHash())) {
        assertThat(dataStr).isEqualTo("String_Node_Str");
        size=1;
      }
 else {
        fail("String_Node_Str" + resourceName);
      }
      responseObserver.onNext(WriteResponse.newBuilder().setCommittedSize(size).build());
    }
    @Override public void onCompleted(){
      responseObserver.onCompleted();
    }
    @Override public void onError(    Throwable t){
      fail("String_Node_Str" + t);
    }
  }
;
}
Program: 110731
Project: 110731
Buggy source:
@Override public void findMissingBlobs(FindMissingBlobsRequest request,StreamObserver<FindMissingBlobsResponse> responseObserver){
  if (numErrors-- <= 0) {
    responseObserver.onNext(FindMissingBlobsResponse.getDefaultInstance());
    responseObserver.onCompleted();
  }
 else {
    responseObserver.onError(Status.UNAVAILABLE.asRuntimeException());
  }
}

Fixed version (ground truth):
@Override public void findMissingBlobs(FindMissingBlobsRequest request,StreamObserver<FindMissingBlobsResponse> responseObserver){
  if (numErrors-- <= 0) {
    responseObserver.onNext(FindMissingBlobsResponse.newBuilder().addMissingBlobDigests(fooDigest).addMissingBlobDigests(barDigest).addMissingBlobDigests(bazDigest).build());
    responseObserver.onCompleted();
  }
 else {
    responseObserver.onError(Status.UNAVAILABLE.asRuntimeException());
  }
}
Program: 110732
Project: 110732
Buggy source:
boolean isValidWith(SourceChecker checker) throws IOException {
  return !primary.equals(overwritten) && !checker.checkEquality(primary.source(),overwritten.source());
}

Fixed version (ground truth):
boolean isValidWith(SourceChecker checker) throws IOException {
  return !primary.valueEquals(overwritten) && !checker.checkEquality(primary.source(),overwritten.source());
}
Program: 110733
Project: 110733
Buggy source:
@Test public void writeResourceXmlWithAttributes() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addValuesWithAttributes("String_Node_Str",ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),"String_Node_Str","String_Node_Str").addValuesWithAttributes("String_Node_Str",ImmutableMap.of("String_Node_Str","String_Node_Str"),"String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",END_RESOURCES);
}

Fixed version (ground truth):
@Test public void writeResourceXmlWithAttributes() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addValuesWithAttributes("String_Node_Str",ImmutableMap.of("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),"String_Node_Str","String_Node_Str").addValuesWithAttributes("String_Node_Str",ImmutableMap.of("String_Node_Str","String_Node_Str"),"String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str",END_RESOURCES);
}
Program: 110734
Project: 110734
Buggy source:
@Test public void writeResourceXmlWithQualfiers() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str").addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str",END_RESOURCES);
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str",END_RESOURCES);
}

Fixed version (ground truth):
@Test public void writeResourceXmlWithQualfiers() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str").addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str",END_RESOURCES);
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str",END_RESOURCES);
}
Program: 110735
Project: 110735
Buggy source:
@Test public void writeResourceXml() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str","String_Node_Str").addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",END_RESOURCES);
}

Fixed version (ground truth):
@Test public void writeResourceXml() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str","String_Node_Str").addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str",END_RESOURCES);
}
Program: 110737
Project: 110737
Buggy source:
@Test public void writePublicResourceSameNameDifferentType() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str","String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",END_RESOURCES);
}

Fixed version (ground truth):
@Test public void writePublicResourceSameNameDifferentType() throws Exception {
  Path target=fs.getPath("String_Node_Str");
  Path source=fs.getPath("String_Node_Str");
  AndroidDataWriter mergedDataWriter=AndroidDataWriter.createWithDefaults(target);
  ParsedAndroidData direct=AndroidDataBuilder.of(source).addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str").addResource("String_Node_Str",AndroidDataBuilder.ResourceType.VALUE,"String_Node_Str","String_Node_Str").createManifest("String_Node_Str","String_Node_Str","String_Node_Str").buildParsed();
  MergedAndroidData actual=UnwrittenMergedAndroidData.of(source.resolve("String_Node_Str"),direct,ParsedAndroidDataBuilder.empty()).write(mergedDataWriter);
  assertAbout(paths).that(actual.getManifest()).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).exists();
  assertAbout(paths).that(actual.getResourceDir().resolve("String_Node_Str")).xmlContentsIsEqualTo(START_RESOURCES + "String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str" + fs.getPath("String_Node_Str") + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str",END_RESOURCES);
}
Program: 110738
Project: 110738
Buggy source:
@Override public FileVisitResult visitFile(Path file,BasicFileAttributes attrs) throws IOException {
  Files.delete(file);
  return FileVisitResult.CONTINUE;
}

Fixed version (ground truth):
@Override public FileVisitResult visitFile(Path file,BasicFileAttributes attrs) throws IOException {
  DosFileAttributeView dosAttribs=Files.getFileAttributeView(path,DosFileAttributeView.class);
  if (dosAttribs != null) {
    dosAttribs.setReadOnly(false);
  }
  Files.delete(file);
  return FileVisitResult.CONTINUE;
}
Program: 110739
Project: 110739
Buggy source:
Digest uploadBlob(byte[] blob) throws IOException, InterruptedException {
  Digest digest=Digests.computeDigest(blob);
  ImmutableSet<Digest> missing=getMissingDigests(ImmutableList.of(digest));
  try {
    if (!missing.isEmpty()) {
      uploadChunks(1,new Chunker.Builder().addInput(blob));
    }
    return digest;
  }
 catch (  IOException e) {
    throw new RuntimeException();
  }
}

Fixed version (ground truth):
Digest uploadBlob(byte[] blob) throws IOException, InterruptedException {
  Digest digest=Digests.computeDigest(blob);
  ImmutableSet<Digest> missing=getMissingDigests(ImmutableList.of(digest));
  if (!missing.isEmpty()) {
    uploadChunks(1,new Chunker.Builder().addInput(blob));
  }
  return digest;
}
Program: 110740
Project: 110740
Buggy source:
/** 
 * Called when the server becomes idle. Should not block, but may invoke new threads.
 */
public void idle(){
  Preconditions.checkState(!executor.isShutdown());
  @SuppressWarnings("String_Node_Str") Future<?> possiblyIgnoredError=executor.schedule(() -> {
    try (AutoProfiler p=AutoProfiler.logged("String_Node_Str",LOG)){
      System.gc();
    }
   }
,10,TimeUnit.SECONDS);
}

Fixed version (ground truth):
/** 
 * Called when the server becomes idle. Should not block, but may invoke new threads.
 */
public void idle(){
  Preconditions.checkState(!executor.isShutdown());
  @SuppressWarnings("String_Node_Str") Future<?> possiblyIgnoredError=executor.schedule(() -> {
    try (AutoProfiler p=AutoProfiler.logged("String_Node_Str",log)){
      System.gc();
    }
   }
,10,TimeUnit.SECONDS);
}
Program: 110741
Project: 110741
Buggy source:
private boolean memoryHeuristic(long idleMillis){
  if (idleMillis < FIVE_MIN_MILLIS) {
    return true;
  }
  ProcMeminfoParser memInfo=null;
  try {
    memInfo=new ProcMeminfoParser();
  }
 catch (  IOException e) {
    LOG.info("String_Node_Str" + e);
    return true;
  }
  long totalPhysical, totalFree;
  try {
    totalPhysical=memInfo.getTotalKb();
    totalFree=memInfo.getFreeRamKb();
  }
 catch (  IllegalArgumentException e) {
    LoggingUtil.logToRemote(Level.WARNING,"String_Node_Str",e);
    return true;
  }
  double fractionFree=(double)totalFree / totalPhysical;
  if (fractionFree < .1) {
    LOG.info("String_Node_Str");
    LOG.info(String.format("String_Node_Str",totalPhysical,totalFree));
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean memoryHeuristic(long idleMillis){
  if (idleMillis < FIVE_MIN_MILLIS) {
    return true;
  }
  ProcMeminfoParser memInfo=null;
  try {
    memInfo=new ProcMeminfoParser();
  }
 catch (  IOException e) {
    log.info("String_Node_Str" + e);
    return true;
  }
  long totalPhysical;
  long totalFree;
  try {
    totalPhysical=memInfo.getTotalKb();
    totalFree=memInfo.getFreeRamKb();
  }
 catch (  IllegalArgumentException e) {
    LoggingUtil.logToRemote(Level.WARNING,"String_Node_Str",e);
    return true;
  }
  double fractionFree=(double)totalFree / totalPhysical;
  if (fractionFree < .1) {
    log.info("String_Node_Str");
    log.info(String.format("String_Node_Str",totalPhysical,totalFree));
    return false;
  }
  return true;
}
Program: 110742
Project: 110742
Buggy source:
@Override void doExec(Environment env) throws EvalException, InterruptedException {
  if (env.getSemantics().incompatibleLoadArgumentIsLabel) {
    String s=imp.getValue();
    if (!s.startsWith("String_Node_Str") && !s.startsWith("String_Node_Str")) {
      throw new EvalException(getLocation(),"String_Node_Str" + "String_Node_Str");
    }
  }
  for (  Map.Entry<Identifier,String> entry : symbolMap.entrySet()) {
    try {
      Identifier name=entry.getKey();
      Identifier declared=new Identifier(entry.getValue());
      if (declared.isPrivate()) {
        throw new EvalException(getLocation(),"String_Node_Str" + declared.getName() + "String_Node_Str");
      }
      env.importSymbol(imp.getValue(),name,declared.getName());
    }
 catch (    Environment.LoadFailedException e) {
      throw new EvalException(getLocation(),e.getMessage());
    }
  }
}

Fixed version (ground truth):
@Override void doExec(Environment env) throws EvalException, InterruptedException {
  if (env.getSemantics().incompatibleLoadArgumentIsLabel) {
    String s=imp.getValue();
    if (!s.startsWith("String_Node_Str") && !s.startsWith("String_Node_Str")) {
      throw new EvalException(getLocation(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
  }
  for (  Map.Entry<Identifier,String> entry : symbolMap.entrySet()) {
    try {
      Identifier name=entry.getKey();
      Identifier declared=new Identifier(entry.getValue());
      if (declared.isPrivate()) {
        throw new EvalException(getLocation(),"String_Node_Str" + declared.getName() + "String_Node_Str");
      }
      env.importSymbol(imp.getValue(),name,declared.getName());
    }
 catch (    Environment.LoadFailedException e) {
      throw new EvalException(getLocation(),e.getMessage());
    }
  }
}
Program: 110743
Project: 110743
Buggy source:
/** 
 * Uses a rule name to fetch the corresponding Rule from the external package. 
 */
@Nullable public static List<Rule> getRuleByRuleClass(final String ruleClassName,Environment env) throws ExternalPackageException, InterruptedException {
  Set<Rule> rules=getRules(env,false,new Function<Package,Iterable<Rule>>(){
    @Nullable @Override public Iterable<Rule> apply(    Package externalPackage){
      return externalPackage.getRulesMatchingRuleClass(ruleClassName);
    }
  }
);
  if (env.valuesMissing()) {
    return null;
  }
  return ImmutableList.copyOf(rules);
}

Fixed version (ground truth):
/** 
 * Uses a rule name to fetch the corresponding Rule from the external package. 
 */
@Nullable public static List<Rule> getRuleByRuleClass(final String ruleClassName,Environment env) throws ExternalPackageException, InterruptedException {
  List<Rule> rules=getRules(env,false,new Function<Package,Iterable<Rule>>(){
    @Nullable @Override public Iterable<Rule> apply(    Package externalPackage){
      return externalPackage.getRulesMatchingRuleClass(ruleClassName);
    }
  }
);
  if (env.valuesMissing()) {
    return null;
  }
  return ImmutableList.copyOf(rules);
}