nus-yam/ex-repair huggingface dataset:
Program: 29652
Project: 29652
Buggy source:
private void doComputeDefinitionNameTestCase(String ref,String expectedDefinitionName){
  assertEquals(expectedDefinitionName,RefUtils.computeDefinitionName(ref,Collections.<String>emptySet()));
}

Fixed version (ground truth):
private void doComputeDefinitionNameTestCase(String ref,String expectedDefinitionName){
  assertEquals(expectedDefinitionName,RefUtils.computeDefinitionName(ref));
}
Program: 29654
Project: 29654
Buggy source:
public static String computeDefinitionName(String ref,Set<String> reserved){
  final String[] refParts=ref.split("String_Node_Str");
  if (refParts.length > 2) {
    throw new RuntimeException("String_Node_Str" + ref);
  }
  final String file=refParts[0];
  final String definitionPath=refParts.length == 2 ? refParts[1] : null;
  String plausibleName;
  if (definitionPath != null) {
    final String[] jsonPathElements=definitionPath.split("String_Node_Str");
    plausibleName=jsonPathElements[jsonPathElements.length - 1];
  }
 else {
    final String[] filePathElements=file.split("String_Node_Str");
    plausibleName=filePathElements[filePathElements.length - 1];
    final String[] split=plausibleName.split("String_Node_Str");
    plausibleName=split[0];
  }
  String tryName=plausibleName;
  for (int i=2; reserved.contains(tryName); i++) {
    tryName=plausibleName + "String_Node_Str" + i;
  }
  return tryName;
}

Fixed version (ground truth):
public static String computeDefinitionName(String ref){
  final String[] refParts=ref.split("String_Node_Str");
  if (refParts.length > 2) {
    throw new RuntimeException("String_Node_Str" + ref);
  }
  final String file=refParts[0];
  final String definitionPath=refParts.length == 2 ? refParts[1] : null;
  String plausibleName;
  if (definitionPath != null) {
    final String[] jsonPathElements=definitionPath.split("String_Node_Str");
    plausibleName=jsonPathElements[jsonPathElements.length - 1];
  }
 else {
    final String[] filePathElements=file.split("String_Node_Str");
    plausibleName=filePathElements[filePathElements.length - 1];
    final String[] split=plausibleName.split("String_Node_Str");
    plausibleName=split[0];
  }
  return plausibleName;
}
Program: 29655
Project: 29655
Buggy source:
@Test public void testRefNameConflicts() throws Exception {
  Swagger swagger=new SwaggerParser().read("String_Node_Str");
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
}

Fixed version (ground truth):
@Test public void testRefNameConflicts() throws Exception {
  Swagger swagger=new SwaggerParser().read("String_Node_Str");
  Yaml.prettyPrint(swagger);
  assertTrue(swagger.getDefinitions().size() == 2);
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
}
Program: 29656
Project: 29656
Buggy source:
@Test public void testRefEnum() throws Exception {
  Swagger swagger=new SwaggerParser().read("String_Node_Str");
  Assert.assertNotNull(swagger);
  Assert.assertTrue(swagger.getDefinitions().size() == 5);
  Yaml.prettyPrint(swagger);
  Assert.assertNotNull(swagger.getDefinitions().get("String_Node_Str"));
  Assert.assertNotNull(swagger.getDefinitions().get("String_Node_Str"));
  Assert.assertNotNull(swagger.getDefinitions().get("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testRefEnum() throws Exception {
  Swagger swagger=new SwaggerParser().read("String_Node_Str");
  Assert.assertNotNull(swagger);
  Assert.assertTrue(swagger.getDefinitions().size() == 5);
  Assert.assertNotNull(swagger.getDefinitions().get("String_Node_Str"));
  Assert.assertNotNull(swagger.getDefinitions().get("String_Node_Str"));
  Assert.assertNotNull(swagger.getDefinitions().get("String_Node_Str"));
}
Program: 29658
Project: 29658
Buggy source:
private void doComputeDefinitionNameTestCase(String ref,String expectedDefinitionName){
  assertEquals(expectedDefinitionName,RefUtils.computeDefinitionName(ref,Collections.<String>emptySet()));
}

Fixed version (ground truth):
private void doComputeDefinitionNameTestCase(String ref,String expectedDefinitionName){
  assertEquals(expectedDefinitionName,RefUtils.computeDefinitionName(ref));
}
Program: 29659
Project: 29659
Buggy source:
public Model modelFromExtendedTypedObject(ExtendedTypedObject obj){
  String type=obj.getType() == null ? null : obj.getType().toString();
  String format=obj.getFormat() == null ? null : obj.getFormat().toString();
  Model output=null;
  if (obj.getRef() != null) {
    output=new RefModel().asDefault(obj.getRef());
  }
 else {
    if ("String_Node_Str".equals(type)) {
      ArrayModel am=new ArrayModel();
      Items items=obj.getItems();
      type=items.getType() == null ? null : items.getType().toString();
      format=items.getFormat() == null ? null : items.getFormat().toString();
      Property innerType=PropertyBuilder.build(type,format,null);
      if (innerType != null) {
        am.setItems(innerType);
      }
 else       if (items.getRef() != null) {
        am.setItems(new RefProperty(items.getRef()));
      }
 else {
        am.setItems(new RefProperty(type));
      }
      output=am;
    }
 else {
      Property input=PropertyBuilder.build(type,format,null);
      if (input != null) {
        output=PropertyBuilder.toModel(input);
      }
 else       if (!"String_Node_Str".equals(type)) {
        output=new RefModel().asDefault(type);
      }
    }
  }
  return output;
}

Fixed version (ground truth):
public Model modelFromExtendedTypedObject(ExtendedTypedObject obj){
  String type=obj.getType() == null ? null : obj.getType().toString();
  String format=obj.getFormat() == null ? null : obj.getFormat().toString();
  Model output=null;
  if (obj.getRef() != null) {
    output=new RefModel().asDefault(obj.getRef());
  }
 else {
    if ("String_Node_Str".equals(type)) {
      ArrayModel am=new ArrayModel();
      Items items=obj.getItems();
      type=items.getType() == null ? null : items.getType().toString();
      format=items.getFormat() == null ? null : items.getFormat().toString();
      Property innerType=PropertyBuilder.build(type,format,null);
      if (innerType != null) {
        am.setItems(innerType);
      }
      if (items.getRef() != null) {
        am.setItems(new RefProperty(items.getRef()));
      }
 else {
        am.setItems(new RefProperty(type));
      }
      output=am;
    }
 else {
      Property input=PropertyBuilder.build(type,format,null);
      if (input != null) {
        output=PropertyBuilder.toModel(input);
      }
 else       if (!"String_Node_Str".equals(type)) {
        output=new RefModel().asDefault(type);
      }
    }
  }
  return output;
}
Program: 29660
Project: 29660
Buggy source:
private void processRefProperty(RefProperty subRef,String externalFile){
  if (isAnExternalRefFormat(subRef.getRefFormat())) {
    String $ref=constructRef(subRef,externalFile);
    subRef.set$ref($ref);
    if ($ref.startsWith("String_Node_Str"))     processRefToExternalDefinition($ref,RefFormat.RELATIVE);
 else {
      processRefToExternalDefinition($ref,RefFormat.URL);
    }
  }
 else {
    processRefToExternalDefinition(externalFile + subRef.get$ref(),RefFormat.RELATIVE);
  }
}

Fixed version (ground truth):
private void processRefProperty(RefProperty subRef,String externalFile){
  if (isAnExternalRefFormat(subRef.getRefFormat())) {
    if (subRef.get$ref().startsWith("String_Node_Str"))     processRefToExternalDefinition(subRef.get$ref(),RefFormat.RELATIVE);
 else {
      processRefToExternalDefinition(subRef.get$ref(),RefFormat.URL);
    }
  }
 else {
    processRefToExternalDefinition(externalFile + subRef.get$ref(),RefFormat.RELATIVE);
  }
}
Program: 29661
Project: 29661
Buggy source:
@Test public void testRefNameConflicts() throws Exception {
  Swagger swagger=new SwaggerParser().read("String_Node_Str");
  Yaml.prettyPrint(swagger);
  assertTrue(swagger.getDefinitions().size() == 2);
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
}

Fixed version (ground truth):
@Test public void testRefNameConflicts() throws Exception {
  Swagger swagger=new SwaggerParser().read("String_Node_Str");
  assertTrue(swagger.getDefinitions().size() == 2);
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",((RefProperty)swagger.getPath("String_Node_Str").getPost().getResponses().get("String_Node_Str").getSchema()).get$ref());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
  assertEquals("String_Node_Str",swagger.getDefinitions().get("String_Node_Str").getProperties().get("String_Node_Str").getExample());
}
Program: 29663
Project: 29663
Buggy source:
public static String readExternalUrlRef(String file,RefFormat refFormat,List<AuthorizationValue> auths,String rootPath){
  if (!RefUtils.isAnExternalRefFormat(refFormat)) {
    throw new RuntimeException("String_Node_Str");
  }
  String result;
  try {
    if (refFormat == RefFormat.URL) {
      result=RemoteUrl.urlToString(file,auths);
    }
 else {
      String url=buildUrl(rootPath,file);
      return readExternalRef(url,RefFormat.URL,auths,null);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + refFormat + "String_Node_Str"+ file,e);
  }
  return result;
}

Fixed version (ground truth):
public static String readExternalUrlRef(String file,RefFormat refFormat,List<AuthorizationValue> auths,String rootPath){
  if (!RefUtils.isAnExternalRefFormat(refFormat)) {
    throw new RuntimeException("String_Node_Str");
  }
  String result;
  try {
    if (refFormat == RefFormat.URL) {
      result=RemoteUrl.urlToString(file,auths);
    }
 else {
      String url=buildUrl(rootPath,file);
      return readExternalRef(url,RefFormat.URL,auths,null);
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + refFormat + "String_Node_Str"+ file+ "String_Node_Str"+ rootPath,e);
  }
  return result;
}
Program: 29664
Project: 29664
Buggy source:
public static String readExternalRef(String file,RefFormat refFormat,List<AuthorizationValue> auths,Path parentDirectory){
  if (!RefUtils.isAnExternalRefFormat(refFormat)) {
    throw new RuntimeException("String_Node_Str");
  }
  String result;
  try {
    if (refFormat == RefFormat.URL) {
      result=RemoteUrl.urlToString(file,auths);
    }
 else {
      final Path pathToUse=parentDirectory.resolve(file).normalize();
      if (Files.exists(pathToUse)) {
        result=IOUtils.toString(new FileInputStream(pathToUse.toFile()),"String_Node_Str");
      }
 else {
        result=ClasspathHelper.loadFileFromClasspath(file);
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + refFormat + "String_Node_Str"+ file,e);
  }
  return result;
}

Fixed version (ground truth):
public static String readExternalRef(String file,RefFormat refFormat,List<AuthorizationValue> auths,Path parentDirectory){
  if (!RefUtils.isAnExternalRefFormat(refFormat)) {
    throw new RuntimeException("String_Node_Str");
  }
  String result;
  try {
    if (refFormat == RefFormat.URL) {
      result=RemoteUrl.urlToString(file,auths);
    }
 else {
      final Path pathToUse=parentDirectory.resolve(file).normalize();
      if (Files.exists(pathToUse)) {
        result=IOUtils.toString(new FileInputStream(pathToUse.toFile()),"String_Node_Str");
      }
 else {
        result=ClasspathHelper.loadFileFromClasspath(file);
      }
    }
  }
 catch (  Exception e) {
    throw new RuntimeException("String_Node_Str" + refFormat + "String_Node_Str"+ file+ "String_Node_Str"+ parentDirectory,e);
  }
  return result;
}
Program: 29665
Project: 29665
Buggy source:
@Test public void testIssue304(){
  SwaggerDeserializationResult result=new SwaggerParser().readWithInfo("String_Node_Str",null,true);
  assertNotNull(result.getSwagger());
  Swagger swagger=result.getSwagger();
  assertFalse(swagger.getDefinitions().get("String_Node_Str") instanceof RefModel);
}

Fixed version (ground truth):
@Test public void testIssue304(){
  SwaggerDeserializationResult result=new SwaggerParser().readWithInfo("String_Node_Str",null,true);
  assertNotNull(result.getSwagger().getDefinitions());
}
Program: 29669
Project: 29669
Buggy source:
public SwaggerDeserializationResult readWithInfo(String swaggerAsString){
  if (swaggerAsString == null) {
    return new SwaggerDeserializationResult().message("String_Node_Str");
  }
  try {
    JsonNode node;
    if (swaggerAsString.trim().startsWith("String_Node_Str")) {
      ObjectMapper mapper=Json.mapper();
      node=mapper.readTree(swaggerAsString);
    }
 else {
      node=DeserializationUtils.readYamlTree(swaggerAsString);
    }
    SwaggerDeserializationResult result=new Swagger20Parser().readWithInfo(node);
    if (result != null) {
      result.setSwagger(new SwaggerResolver(result.getSwagger(),new ArrayList<AuthorizationValue>(),null).resolve());
    }
 else {
      result=new SwaggerDeserializationResult().message("String_Node_Str");
    }
    return result;
  }
 catch (  Exception e) {
    return new SwaggerDeserializationResult().message("String_Node_Str");
  }
}

Fixed version (ground truth):
public SwaggerDeserializationResult readWithInfo(String swaggerAsString,boolean resolve){
  if (swaggerAsString == null) {
    return new SwaggerDeserializationResult().message("String_Node_Str");
  }
  try {
    JsonNode node;
    if (swaggerAsString.trim().startsWith("String_Node_Str")) {
      ObjectMapper mapper=Json.mapper();
      node=mapper.readTree(swaggerAsString);
    }
 else {
      node=DeserializationUtils.readYamlTree(swaggerAsString);
    }
    SwaggerDeserializationResult result=new Swagger20Parser().readWithInfo(node);
    if (result != null) {
      if (resolve) {
        result.setSwagger(new SwaggerResolver(result.getSwagger(),new ArrayList<AuthorizationValue>(),null).resolve());
      }
    }
 else {
      result=new SwaggerDeserializationResult().message("String_Node_Str");
    }
    return result;
  }
 catch (  Exception e) {
    return new SwaggerDeserializationResult().message("String_Node_Str");
  }
}
Program: 29673
Project: 29673
Buggy source:
public List<Parameter> processParameters(List<Parameter> parameters){
  if (parameters == null) {
    return null;
  }
  final List<Parameter> processedPathLevelParameters=new ArrayList<>();
  for (  Parameter parameter : parameters) {
    if (parameter instanceof RefParameter) {
      RefParameter refParameter=(RefParameter)parameter;
      final Parameter resolvedParameter=cache.loadRef(refParameter.get$ref(),refParameter.getRefFormat(),Parameter.class);
      parameter=resolvedParameter;
    }
    if (parameter instanceof BodyParameter) {
      BodyParameter bodyParameter=(BodyParameter)parameter;
      final Model schema=bodyParameter.getSchema();
      modelProcessor.processModel(schema);
    }
    processedPathLevelParameters.add(parameter);
  }
  return processedPathLevelParameters;
}

Fixed version (ground truth):
public List<Parameter> processParameters(List<Parameter> parameters){
  if (parameters == null) {
    return null;
  }
  final List<Parameter> processedPathLevelParameters=new ArrayList<>();
  final List<Parameter> refParameters=new ArrayList<>();
  for (  Parameter parameter : parameters) {
    if (parameter instanceof RefParameter) {
      RefParameter refParameter=(RefParameter)parameter;
      final Parameter resolvedParameter=cache.loadRef(refParameter.get$ref(),refParameter.getRefFormat(),Parameter.class);
      parameter=resolvedParameter;
      refParameters.add(parameter);
    }
 else     if (parameter instanceof BodyParameter) {
      BodyParameter bodyParameter=(BodyParameter)parameter;
      final Model schema=bodyParameter.getSchema();
      modelProcessor.processModel(schema);
    }
 else {
      processedPathLevelParameters.add(parameter);
    }
  }
  for (  Parameter refParam : refParameters) {
    int pos=0;
    for (    Parameter param : processedPathLevelParameters) {
      if (refParam.getName().equals(param.getName())) {
        processedPathLevelParameters.set(pos,refParam);
      }
      pos++;
    }
  }
  return processedPathLevelParameters;
}
Program: 29677
Project: 29677
Buggy source:
public String processRefToExternalDefinition(String $ref,RefFormat refFormat){
  final Model model=cache.loadRef($ref,refFormat,Model.class);
  String newRef;
  Map<String,Model> definitions=swagger.getDefinitions();
  if (definitions == null) {
    definitions=new HashMap<>();
  }
  final String possiblyConflictingDefinitionName=computeDefinitionName($ref);
  final Model existingModel=definitions.get(possiblyConflictingDefinitionName);
  if (existingModel != null) {
    final String previouslyRenamedRef=cache.getRenamedRef($ref);
    if (previouslyRenamedRef != null) {
      newRef=previouslyRenamedRef;
    }
 else {
      String deconflictedName=deconflictName(possiblyConflictingDefinitionName,definitions);
      cache.putRenamedRef($ref,deconflictedName);
      newRef=deconflictedName;
      swagger.addDefinition(deconflictedName,model);
    }
  }
 else {
    newRef=possiblyConflictingDefinitionName;
    cache.putRenamedRef($ref,newRef);
    Map<String,Property> subProps=model.getProperties();
    if (subProps != null) {
      for (      Map.Entry<String,Property> prop : subProps.entrySet()) {
        if (prop.getValue() instanceof RefProperty) {
          RefProperty subRef=(RefProperty)prop.getValue();
          subRef.set$ref(processRefToExternalDefinition(subRef.get$ref(),subRef.getRefFormat()));
        }
      }
    }
    swagger.addDefinition(newRef,model);
  }
  return newRef;
}

Fixed version (ground truth):
public String processRefToExternalDefinition(String $ref,RefFormat refFormat){
  System.out.println("String_Node_Str" + $ref);
  final Model model=cache.loadRef($ref,refFormat,Model.class);
  if (model == null) {
    System.out.println("String_Node_Str" + $ref);
    ;
  }
  String newRef;
  Map<String,Model> definitions=swagger.getDefinitions();
  if (definitions == null) {
    definitions=new HashMap<>();
  }
  final String possiblyConflictingDefinitionName=computeDefinitionName($ref);
  final Model existingModel=definitions.get(possiblyConflictingDefinitionName);
  if (existingModel != null) {
    final String previouslyRenamedRef=cache.getRenamedRef($ref);
    if (previouslyRenamedRef != null) {
      newRef=previouslyRenamedRef;
    }
 else {
      String deconflictedName=deconflictName(possiblyConflictingDefinitionName,definitions);
      cache.putRenamedRef($ref,deconflictedName);
      newRef=deconflictedName;
      swagger.addDefinition(deconflictedName,model);
    }
  }
 else {
    newRef=possiblyConflictingDefinitionName;
    cache.putRenamedRef($ref,newRef);
    Map<String,Property> subProps=model.getProperties();
    if (subProps != null) {
      for (      Map.Entry<String,Property> prop : subProps.entrySet()) {
        if (prop.getValue() instanceof RefProperty) {
          RefProperty subRef=(RefProperty)prop.getValue();
          System.out.println(subRef.get$ref() + "String_Node_Str" + subRef.getRefFormat());
          if (isAnExternalRefFormat(subRef.getRefFormat()))           subRef.set$ref(processRefToExternalDefinition(subRef.get$ref(),subRef.getRefFormat()));
        }
      }
    }
    swagger.addDefinition(newRef,model);
  }
  return newRef;
}
Program: 29683
Project: 29683
Buggy source:
/** 
 * Return a migrator renaming object members <p>Note that this migrator will not fail if the member to rename does not exists; however it <strong>will</strong> fail if the <em>target</em> member already exists in the target JSON Object.</p>
 * @param from the member name to rename
 * @param to the new name
 * @return a migrator
 */
public static SwaggerMigrator renameMember(final String from,final String to){
  Objects.requireNonNull(from);
  Objects.requireNonNull(to);
  return new SwaggerMigrator(){
    @Nonnull @Override public JsonNode migrate(    @Nonnull final JsonNode input){
      Objects.requireNonNull(input);
      if (!input.has(from))       return input;
      if (input.has(to))       throw new UncheckedSwaggerTransformException();
      final ObjectNode ret=input.deepCopy();
      ret.put(to,ret.get(from));
      ret.remove(from);
      return ret;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Return a migrator renaming object members <p>Note that this migrator will not fail if the member to rename does not exists; however it <strong>will</strong> fail if the <em>target</em> member already exists in the target JSON Object.</p>
 * @param from the member name to rename
 * @param to the new name
 * @return a migrator
 */
public static SwaggerMigrator renameMember(final String from,final String to){
  Objects.requireNonNull(from);
  Objects.requireNonNull(to);
  return new SwaggerMigrator(){
    @Nonnull @Override public JsonNode migrate(    @Nonnull final JsonNode input) throws SwaggerTransformException {
      Objects.requireNonNull(input);
      if (!input.has(from))       return input;
      if (input.has(to))       throw new SwaggerTransformException("String_Node_Str" + "String_Node_Str" + to + '"');
      final ObjectNode ret=input.deepCopy();
      ret.put(to,ret.get(from));
      ret.remove(from);
      return ret;
    }
  }
;
}
Program: 29684
Project: 29684
Buggy source:
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerMigrationException {
  Objects.requireNonNull(input);
  final MutableJsonTree tree=new MutableJsonTree(input);
  SwaggerMigrator migrator;
  migrator=membersToString("String_Node_Str","String_Node_Str");
  tree.applyMigrator(migrator);
  migrator=patchFromResource("String_Node_Str");
  tree.applyMigrator(migrator);
  return tree.getBaseNode();
}

Fixed version (ground truth):
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerMigrationException {
  Objects.requireNonNull(input);
  final MutableJsonTree tree=new MutableJsonTree(input);
  SwaggerMigrator migrator;
  migrator=membersToString("String_Node_Str","String_Node_Str");
  tree.applyMigrator(migrator);
  migrator=patchFromResource("String_Node_Str");
  tree.applyMigrator(migrator);
  if (input.path("String_Node_Str").isTextual()) {
    String basePath=input.get("String_Node_Str").textValue();
    ((ObjectNode)tree.getCurrentNode()).remove("String_Node_Str");
    try {
      basePath=checkLegalBasePath(basePath);
    }
 catch (    IllegalArgumentException e) {
      throw new SwaggerMigrationException(e.getMessage());
    }
    migrator=new PathAppenderMigrator(basePath);
    tree.setPointer(JsonPointer.of("String_Node_Str"));
    tree.applyMigratorToElements(migrator);
  }
  return tree.getBaseNode();
}
Program: 29685
Project: 29685
Buggy source:
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerTransformException {
  Objects.requireNonNull(input,"String_Node_Str");
  final ObjectNode ret=input.deepCopy();
  JsonNode node;
  for (  final String memberName : memberNames) {
    node=input.path(memberName);
    if (node.isMissingNode())     continue;
    if (node.isContainerNode())     throw new UncheckedSwaggerTransformException("String_Node_Str");
    if (!node.isTextual())     ret.put(memberName,node.asText());
  }
  return ret;
}

Fixed version (ground truth):
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerTransformException {
  Objects.requireNonNull(input,"String_Node_Str");
  final ObjectNode ret=input.deepCopy();
  JsonNode node;
  for (  final String memberName : memberNames) {
    node=input.path(memberName);
    if (node.isMissingNode())     continue;
    if (node.isContainerNode())     throw new SwaggerTransformException("String_Node_Str" + "String_Node_Str");
    if (!node.isTextual())     ret.put(memberName,node.asText());
  }
  return ret;
}
Program: 29686
Project: 29686
Buggy source:
public V11TypeMigrator(){
  try {
    final JsonNode node=JsonLoader.fromResource("String_Node_Str");
    patches=MAPPER.readValue(node.traverse(),TYPE_REF);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public V11TypeMigrator(){
  try {
    JsonNode node;
    node=JsonLoader.fromResource("String_Node_Str");
    patches=MAPPER.readValue(node.traverse(),TYPE_REF);
    node=JsonLoader.fromResource("String_Node_Str");
    fileTypePatch=MAPPER.readValue(node.traverse(),JsonPatch.class);
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 29687
Project: 29687
Buggy source:
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerMigrationException {
  Objects.requireNonNull(input);
  final JsonNode node=input.path("String_Node_Str");
  if (node.isMissingNode())   return input;
  if (!node.isTextual())   throw new SwaggerMigrationException("String_Node_Str");
  final String dataType=node.textValue();
  final JsonPatch patch=Optional.fromNullable(patches.get(dataType)).or(DEFAULT_PATCH);
  return SwaggerMigrators.fromPatch(patch).migrate(input);
}

Fixed version (ground truth):
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerMigrationException {
  Objects.requireNonNull(input);
  final JsonNode node=input.path("String_Node_Str");
  if (node.isMissingNode())   return postMigrate(input);
  if (!node.isTextual())   throw new SwaggerMigrationException("String_Node_Str");
  final String dataType=node.textValue();
  final JsonPatch patch=Optional.fromNullable(patches.get(dataType)).or(DEFAULT_PATCH);
  final JsonNode migrated=SwaggerMigrators.fromPatch(patch).migrate(input);
  return postMigrate(migrated);
}
Program: 29688
Project: 29688
Buggy source:
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerTransformException {
  final MutableJsonTree tree=new MutableJsonTree(input);
  tree.applyMigrator(renameMember("String_Node_Str","String_Node_Str"));
  tree.setPointer(PARAMETERS);
  tree.applyMigratorToElements(parametersMigrator);
  return tree.getBaseNode();
}

Fixed version (ground truth):
@Nonnull @Override public JsonNode migrate(@Nonnull final JsonNode input) throws SwaggerTransformException {
  final MutableJsonTree tree=new MutableJsonTree(input);
  tree.applyMigrator(renameMember("String_Node_Str","String_Node_Str"));
  tree.applyMigrator(renameMember("String_Node_Str","String_Node_Str"));
  JsonPointer ptr=JsonPointer.of("String_Node_Str");
  if (!ptr.path(tree.getBaseNode()).isMissingNode()) {
    tree.setPointer(ptr);
    tree.applyMigratorToElements(renameMember("String_Node_Str","String_Node_Str"));
  }
  tree.setPointer(PARAMETERS);
  tree.applyMigratorToElements(parametersMigrator);
  return tree.getBaseNode();
}
Program: 29689
Project: 29689
Buggy source:
public TAUnit readTA(int partition,int unit,boolean withlog) throws X10FlashException, IOException {
  if (!_bundle.simulate()) {
    String command="String_Node_Str" + partition + "String_Node_Str"+ unit;
    logger.info("String_Node_Str" + command);
    USBFlash.write(command.getBytes());
    CommandPacket reply=USBFlash.readCommandReply(true);
    logger.info("String_Node_Str" + reply.getResponse());
    if (reply.getResponse().equals("String_Node_Str")) {
      TAUnit taunit=new TAUnit(unit,reply.getDataArray());
      return taunit;
    }
 else {
      logger.warn("String_Node_Str" + reply.getMessage() + "String_Node_Str"+ HexDump.toHex(unit)+ "String_Node_Str");
    }
  }
  return null;
}

Fixed version (ground truth):
public TAUnit readTA(int partition,int unit,boolean withlog) throws X10FlashException, IOException {
  if (!_bundle.simulate()) {
    String command="String_Node_Str" + partition + "String_Node_Str"+ unit;
    if (withlog)     logger.info("String_Node_Str" + command);
    USBFlash.write(command.getBytes());
    CommandPacket reply=USBFlash.readCommandReply(true);
    if (withlog)     logger.info("String_Node_Str" + reply.getResponse());
    if (reply.getResponse().equals("String_Node_Str")) {
      TAUnit taunit=new TAUnit(unit,reply.getDataArray());
      return taunit;
    }
 else {
      if (withlog)       logger.warn("String_Node_Str" + reply.getMessage() + "String_Node_Str"+ HexDump.toHex(unit)+ "String_Node_Str");
    }
  }
  return null;
}
Program: 29690
Project: 29690
Buggy source:
public void writeTA(int partition,TAUnit unit) throws X10FlashException, IOException {
  try {
    logger.info("String_Node_Str" + HexDump.toHex(unit.getUnitNumber()) + "String_Node_Str"+ partition);
    if (!_bundle.simulate()) {
      logger.info("String_Node_Str" + HexDump.toHex(unit.getDataLength()));
      String command="String_Node_Str" + HexDump.toHex(unit.getDataLength());
      USBFlash.write(command.getBytes());
      CommandPacket p=USBFlash.readCommandReply(false);
      if (unit.getDataLength() > 0) {
        USBFlash.write(unit.getUnitData());
      }
      p=USBFlash.readCommandReply(true);
      logger.info("String_Node_Str" + p.getResponse());
      logger.info("String_Node_Str" + partition + "String_Node_Str"+ unit.getUnitNumber());
      command="String_Node_Str" + partition + "String_Node_Str"+ unit.getUnitNumber();
      USBFlash.write(command.getBytes());
      p=USBFlash.readCommandReply(true);
      logger.info("String_Node_Str" + p.getResponse());
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void writeTA(int partition,TAUnit unit) throws X10FlashException, IOException {
  try {
    logger.info("String_Node_Str" + HexDump.toHex((int)unit.getUnitNumber()) + "String_Node_Str"+ partition);
    if (!_bundle.simulate()) {
      logger.info("String_Node_Str" + HexDump.toHex(unit.getDataLength()));
      String command="String_Node_Str" + HexDump.toHex(unit.getDataLength());
      USBFlash.write(command.getBytes());
      CommandPacket p=USBFlash.readCommandReply(false);
      if (unit.getDataLength() > 0) {
        USBFlash.write(unit.getUnitData());
      }
      p=USBFlash.readCommandReply(true);
      logger.info("String_Node_Str" + p.getResponse());
      logger.info("String_Node_Str" + partition + "String_Node_Str"+ unit.getUnitNumber());
      command="String_Node_Str" + partition + "String_Node_Str"+ unit.getUnitNumber();
      USBFlash.write(command.getBytes());
      p=USBFlash.readCommandReply(true);
      logger.info("String_Node_Str" + p.getResponse());
    }
  }
 catch (  Exception e) {
  }
}
Program: 29691
Project: 29691
Buggy source:
private void backupTA(int partition,String timestamp){
  logger.info("String_Node_Str" + partition);
  String folder=OS.getFolderRegisteredDevices() + File.separator + getPhoneProperty("String_Node_Str")+ File.separator+ "String_Node_Str"+ File.separator+ timestamp;
  new File(folder).mkdirs();
  TextFile tazone=new TextFile(folder + File.separator + partition+ "String_Node_Str","String_Node_Str");
  try {
    tazone.open(false);
  }
 catch (  Exception e1) {
    logger.error("String_Node_Str");
    return;
  }
  try {
    tazone.writeln(HexDump.toHex((byte)partition));
    for (int unit=0; unit < 12000; unit++) {
      LogProgress.updateProgress();
      try {
        TAUnit taunit=this.readTA(partition,unit,false);
        if (taunit != null)         tazone.writeln(taunit.toString());
      }
 catch (      Exception e3) {
      }
    }
    tazone.close();
    logger.info("String_Node_Str" + partition + "String_Node_Str"+ folder+ File.separator+ partition+ "String_Node_Str");
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private void backupTA(int partition,String timestamp){
  logger.info("String_Node_Str" + partition);
  String folder=OS.getFolderRegisteredDevices() + File.separator + getPhoneProperty("String_Node_Str")+ File.separator+ "String_Node_Str"+ File.separator+ timestamp;
  new File(folder).mkdirs();
  TextFile tazone=new TextFile(folder + File.separator + partition+ "String_Node_Str","String_Node_Str");
  try {
    tazone.open(false);
  }
 catch (  Exception e1) {
    logger.error("String_Node_Str");
    return;
  }
  try {
    tazone.writeln(HexDump.toHex((byte)partition));
    for (int unit=0; unit < 12000; unit++) {
      LogProgress.updateProgress();
      try {
        TAUnit taunit=this.readTA(partition,unit,false);
        if (taunit != null)         tazone.writeln(taunit.toString());
      }
 catch (      Exception e3) {
        e3.printStackTrace();
      }
    }
    tazone.close();
    logger.info("String_Node_Str" + partition + "String_Node_Str"+ folder+ File.separator+ partition+ "String_Node_Str");
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 29694
Project: 29694
Buggy source:
public XMLBootDelivery(File xmlsource) throws IOException, JDOMException {
  SAXBuilder builder=new SAXBuilder();
  FileInputStream fin=new FileInputStream(xmlsource);
  Document document=builder.build(fin);
  String spaceid=document.getRootElement().getAttribute("String_Node_Str").getValue();
  bootversion=document.getRootElement().getAttribute("String_Node_Str").getValue().replaceAll(spaceid,"String_Node_Str").trim();
  if (bootversion.startsWith("String_Node_Str"))   bootversion=bootversion.substring(1);
  Iterator<Element> i=document.getRootElement().getChildren().iterator();
  while (i.hasNext()) {
    Element e=i.next();
    XMLBootConfig c=new XMLBootConfig(e.getAttributeValue("String_Node_Str"));
    c.setTA(e.getChild("String_Node_Str").getChild("String_Node_Str").getAttributeValue("String_Node_Str"));
    Iterator<Element> files=e.getChild("String_Node_Str").getChildren().iterator();
    while (files.hasNext()) {
      c.addFile(files.next().getAttributeValue("String_Node_Str"));
    }
    c.setAttributes(e.getChild("String_Node_Str").getAttributeValue("String_Node_Str"));
    bootconfigs.add(c);
  }
  fin.close();
}

Fixed version (ground truth):
public XMLBootDelivery(File xmlsource) throws IOException, JDOMException {
  SAXBuilder builder=new SAXBuilder();
  FileInputStream fin=new FileInputStream(xmlsource);
  Document document=builder.build(fin);
  String spaceid=document.getRootElement().getAttribute("String_Node_Str").getValue();
  bootversion=document.getRootElement().getAttribute("String_Node_Str").getValue().replaceAll(spaceid,"String_Node_Str").trim();
  if (bootversion.startsWith("String_Node_Str"))   bootversion=bootversion.substring(1);
  Iterator<Element> i=document.getRootElement().getChildren().iterator();
  while (i.hasNext()) {
    Element e=i.next();
    XMLBootConfig c=new XMLBootConfig(e.getAttributeValue("String_Node_Str"));
    if (e.getChild("String_Node_Str").getChild("String_Node_Str") != null) {
      c.setTA(e.getChild("String_Node_Str").getChild("String_Node_Str").getAttributeValue("String_Node_Str"));
    }
    Iterator<Element> files=e.getChild("String_Node_Str").getChildren().iterator();
    while (files.hasNext()) {
      c.addFile(files.next().getAttributeValue("String_Node_Str"));
    }
    c.setAttributes(e.getChild("String_Node_Str").getAttributeValue("String_Node_Str"));
    bootconfigs.add(c);
  }
  fin.close();
}
Program: 29695
Project: 29695
Buggy source:
public Enumeration<Object> getFiles(){
  Properties flist=new Properties();
  Enumeration<XMLBootConfig> e=bootconfigs.elements();
  while (e.hasMoreElements()) {
    XMLBootConfig bc=e.nextElement();
    flist.setProperty(bc.getTA(),bc.getTA());
    Iterator<String> fl=bc.getFiles().iterator();
    while (fl.hasNext()) {
      String f=fl.next();
      flist.setProperty(f,f);
    }
  }
  return flist.keys();
}

Fixed version (ground truth):
public Enumeration<Object> getFiles(){
  Properties flist=new Properties();
  Enumeration<XMLBootConfig> e=bootconfigs.elements();
  while (e.hasMoreElements()) {
    XMLBootConfig bc=e.nextElement();
    if (bc.getTA().length() > 0)     flist.setProperty(bc.getTA(),bc.getTA());
    Iterator<String> fl=bc.getFiles().iterator();
    while (fl.hasNext()) {
      String f=fl.next();
      flist.setProperty(f,f);
    }
  }
  return flist.keys();
}
Program: 29696
Project: 29696
Buggy source:
public TAUnit readTA(int partition,int unit) throws X10FlashException, IOException {
  logger.info("String_Node_Str" + unit + "String_Node_Str"+ partition);
  if (!_bundle.simulate()) {
    String command="String_Node_Str" + partition + "String_Node_Str"+ unit;
    logger.info(command);
    USBFlash.write(command.getBytes());
    logger.info("String_Node_Str");
    CommandPacket reply=USBFlash.readCommandReply();
    logger.info("String_Node_Str" + reply.getMessage());
  }
  return null;
}

Fixed version (ground truth):
public TAUnit readTA(int partition,int unit) throws X10FlashException, IOException {
  if (!_bundle.simulate()) {
    String command="String_Node_Str" + partition + "String_Node_Str"+ unit;
    USBFlash.write(command.getBytes());
    CommandPacket reply=USBFlash.readCommandReply();
    if (reply.getStatus() == 1) {
      logger.info("String_Node_Str" + unit + "String_Node_Str"+ partition);
      TAUnit taunit=new TAUnit(unit,reply.getMessage().getBytes());
      return taunit;
    }
  }
  return null;
}
Program: 29697
Project: 29697
Buggy source:
public void backupTA(){
}

Fixed version (ground truth):
private void backupTA(int partition,String timestamp){
  logger.info("String_Node_Str" + partition);
  String folder=OS.getFolderRegisteredDevices() + File.separator + getPhoneProperty("String_Node_Str")+ File.separator+ "String_Node_Str"+ File.separator+ timestamp;
  new File(folder).mkdirs();
  TextFile tazone=new TextFile(folder + File.separator + partition+ "String_Node_Str","String_Node_Str");
  try {
    tazone.open(false);
  }
 catch (  Exception e1) {
    logger.error("String_Node_Str");
    return;
  }
  try {
    tazone.writeln(HexDump.toHex((byte)partition));
    for (int unit=0; unit < 8000; unit++) {
      LogProgress.updateProgress();
      try {
        TAUnit taunit=this.readTA(partition,unit);
        if (taunit != null)         tazone.writeln(taunit.toString());
      }
 catch (      Exception e3) {
      }
    }
    tazone.close();
    logger.info("String_Node_Str" + partition + "String_Node_Str"+ folder+ File.separator+ partition+ "String_Node_Str");
  }
 catch (  Exception e) {
  }
}
Program: 29699
Project: 29699
Buggy source:
public void close(){
}

Fixed version (ground truth):
public void close(){
  try {
    sync();
    powerDown();
  }
 catch (  Exception e) {
  }
  USBFlash.close();
}
Program: 29701
Project: 29701
Buggy source:
public void flash() throws X10FlashException, IOException {
  try {
    logger.info("String_Node_Str");
    loadProperties();
    bc=getBootConfig();
    pd=_bundle.getXMLPartitionDelivery();
    if (pd != null)     pd.setFolder(_bundle.getPartitionDelivery().getFolder());
 else {
      String result=WidgetTask.openYESNOBox(_curshell,"String_Node_Str");
      if (Integer.parseInt(result) != SWT.YES)       throw new X10FlashException("String_Node_Str");
    }
    loadTAFiles();
    if (hasScript()) {
      if (checkScript())       runScript();
    }
 else {
      logger.error("String_Node_Str");
    }
  }
 catch (  Exception e) {
  }
  LogProgress.initProgress(0);
  sync();
  powerDown();
  DeviceChangedListener.pause(false);
}

Fixed version (ground truth):
public void flash() throws X10FlashException, IOException {
  try {
    logger.info("String_Node_Str");
    bc=getBootConfig();
    pd=_bundle.getXMLPartitionDelivery();
    if (pd != null)     pd.setFolder(_bundle.getPartitionDelivery().getFolder());
 else {
      String result=WidgetTask.openYESNOBox(_curshell,"String_Node_Str");
      if (Integer.parseInt(result) != SWT.YES)       throw new X10FlashException("String_Node_Str");
    }
    loadTAFiles();
    if (hasScript()) {
      if (checkScript())       runScript();
    }
 else {
      logger.error("String_Node_Str");
    }
  }
 catch (  Exception e) {
  }
  LogProgress.initProgress(0);
  close();
}
Program: 29702
Project: 29702
Buggy source:
public static Flasher getFlasher(Bundle b,Shell sh){
  DeviceEntry ent=Devices.getDeviceFromVariant(b.getDevice());
  if (ent.getProtocol().equals("String_Node_Str"))   return new S1Flasher(b,sh);
  if (ent.getProtocol().equals("String_Node_Str"))   return new CommandFlasher(b,sh);
  return null;
}

Fixed version (ground truth):
public static Flasher getFlasher(Bundle b,Shell sh){
  if (Devices.getConnectedDevice().getPid().equals("String_Node_Str"))   return new S1Flasher(b,sh);
  if (Devices.getConnectedDevice().getPid().equals("String_Node_Str"))   return new CommandFlasher(b,sh);
  if (Devices.getDeviceFromVariant(b.getDevice()).getProtocol().equals("String_Node_Str"))   return new CommandFlasher(b,sh);
  return new S1Flasher(b,sh);
}
Program: 29703
Project: 29703
Buggy source:
public void closeDevice(int par){
  try {
    endSession(par);
  }
 catch (  Exception e) {
  }
  USBFlash.close();
  DeviceChangedListener.pause(false);
}

Fixed version (ground truth):
public void closeDevice(int par){
  try {
    endSession(par);
  }
 catch (  Exception e) {
  }
  USBFlash.close();
}
Program: 29704
Project: 29704
Buggy source:
public void close(){
  try {
    endSession();
  }
 catch (  Exception e) {
  }
  USBFlash.close();
  DeviceChangedListener.pause(false);
}

Fixed version (ground truth):
public void close(){
  try {
    endSession();
  }
 catch (  Exception e) {
  }
  USBFlash.close();
}
Program: 29705
Project: 29705
Buggy source:
public void addData(byte[] datachunk) throws IOException {
  JBBPBitInputStream chunkStream=new JBBPBitInputStream(new ByteArrayInputStream(datachunk));
  while (chunkStream.hasAvailableData()) {
    if (tempbuffer == null)     tempbuffer=chunkStream.readByteArray(1);
 else     tempbuffer=BytesUtil.concatAll(tempbuffer,chunkStream.readByteArray(1));
    if (!isHeaderValid()) {
      if (tempbuffer.length == 13) {
        JBBPBitInputStream headerStream=new JBBPBitInputStream(new ByteArrayInputStream(tempbuffer));
        command=headerStream.readInt(JBBPByteOrder.BIG_ENDIAN);
        flag=headerStream.readInt(JBBPByteOrder.BIG_ENDIAN);
        length=headerStream.readInt(JBBPByteOrder.BIG_ENDIAN);
        hdrcksum=(byte)headerStream.readByte();
        headerStream.close();
        tempbuffer=null;
      }
    }
 else     if (!isDataComplete()) {
      if (tempbuffer.length == length) {
        JBBPBitInputStream dataStream=new JBBPBitInputStream(new ByteArrayInputStream(tempbuffer));
        data=dataStream.readByteArray(length);
        dataStream.close();
        tempbuffer=null;
      }
    }
 else     if (!isCRCComplete()) {
      if (tempbuffer.length == 4) {
        JBBPBitInputStream crcStream=new JBBPBitInputStream(new ByteArrayInputStream(tempbuffer));
        crc32=crcStream.readByteArray(4);
        crcStream.close();
        tempbuffer=null;
      }
    }
  }
  chunkStream.close();
}

Fixed version (ground truth):
public void addData(byte[] datachunk) throws IOException {
  for (int i=0; i < datachunk.length; i++) {
    if (bcommand.toByteArray().length < 4) {
      bcommand.write(datachunk[i]);
      if (command == 0 && bcommand.toByteArray().length == 4) {
        command=BytesUtil.getInt(bcommand.toByteArray());
      }
    }
 else     if (bflag.toByteArray().length < 4) {
      bflag.write(datachunk[i]);
      if (flag == 0 && bflag.toByteArray().length == 4) {
        flag=BytesUtil.getInt(bflag.toByteArray());
      }
    }
 else     if (blength.toByteArray().length < 4) {
      blength.write(datachunk[i]);
      if (length == 0 && blength.toByteArray().length == 4) {
        length=BytesUtil.getInt(blength.toByteArray());
      }
    }
 else     if (hdrcksum == 0) {
      hdrcksum=datachunk[i];
    }
 else     if (bdata.toByteArray().length < length) {
      bdata.write(datachunk[i]);
      if (data == null && bdata.toByteArray().length == length) {
        data=bdata.toByteArray();
      }
    }
 else     if (bcrc32.toByteArray().length < 4) {
      bcrc32.write(datachunk[i]);
      if (crc32 == null && bcrc32.toByteArray().length == 4) {
        crc32=bcrc32.toByteArray();
      }
    }
  }
}
Program: 29706
Project: 29706
Buggy source:
public static void close(){
  if (OS.getName().equals("String_Node_Str")) {
    USBFlashWin32.windowsClose();
  }
 else   USBFlashLinux.linuxClose();
  DeviceChangedListener.pause(false);
}

Fixed version (ground truth):
public static void close(){
  if (OS.getName().equals("String_Node_Str")) {
    USBFlashWin32.windowsClose();
  }
 else   USBFlashLinux.linuxClose();
}
Program: 29707
Project: 29707
Buggy source:
public static void open(String pid) throws IOException, Exception {
  DeviceChangedListener.pause(true);
  if (OS.getName().equals("String_Node_Str")) {
    USBFlashWin32.windowsOpen(pid);
  }
 else {
    USBFlashLinux.linuxOpen(pid);
  }
}

Fixed version (ground truth):
public static void open(String pid) throws IOException, Exception {
  if (OS.getName().equals("String_Node_Str")) {
    USBFlashWin32.windowsOpen(pid);
  }
 else {
    USBFlashLinux.linuxOpen(pid);
  }
}
Program: 29708
Project: 29708
Buggy source:
public static void windowsReadS1Reply() throws X10FlashException, IOException {
  logger.debug("String_Node_Str");
  S1Packet p=new S1Packet(JKernel32.readBytes(13));
  logger.debug("String_Node_Str");
  if (p.getDataLength() > 0)   p.addData(JKernel32.readBytes(p.getDataLength()));
  p.addData(JKernel32.readBytes(4));
  p.validate();
  logger.debug("String_Node_Str" + p);
  lastreply=p.getDataArray();
  lastflags=p.getFlags();
}

Fixed version (ground truth):
public static void windowsReadS1Reply() throws X10FlashException, IOException {
  logger.debug("String_Node_Str");
  byte[] read=JKernel32.readBytes(0x1000);
  S1Packet p=new S1Packet(read);
  while (p.hasMoreToRead()) {
    read=JKernel32.readBytes(0x1000);
    p.addData(read);
  }
  p.validate();
  logger.debug("String_Node_Str" + p);
  lastreply=p.getDataArray();
  lastflags=p.getFlags();
}