nus-yam/ex-repair huggingface dataset:
Program: 101289
Project: 101289
Buggy source:
public void run() throws IOException {
  if (!outputDir.exists() && !outputDir.mkdirs()) {
    throw new IOException("String_Node_Str");
  }
  totalStats=new RunStats(reportName);
  for (  final File test : tests) {
    logger.info("String_Node_Str",test.getAbsoluteFile().toURI().normalize().getPath());
    runTest(test.toURI().toURL());
  }
  logger.info("String_Node_Str");
  if (outputStrategy.contains(OutputStrategy.TOTAL)) {
    writeRunStats(totalStats);
  }
}

Fixed version (ground truth):
public void run() throws IOException {
  if (!outputDir.exists() && !outputDir.mkdirs()) {
    throw new IOException("String_Node_Str");
  }
  totalStats=new RunStats(reportName);
  for (  final File test : tests) {
    logger.info("String_Node_Str",test.getAbsoluteFile().toURI().normalize().getPath());
    try {
      runTest(test.toURI().toURL());
    }
 catch (    final EcmaError e) {
      if (outputEcmaErrors) {
        logger.warn(e.getMessage(),e);
      }
    }
  }
  logger.info("String_Node_Str");
  if (outputStrategy.contains(OutputStrategy.TOTAL)) {
    writeRunStats(totalStats);
  }
}
Program: 101290
Project: 101290
Buggy source:
@Override protected WebClient initialValue(){
  final WebClient client=new WebClient();
  client.setIncorrectnessListener(quietIncorrectnessListener);
  return client;
}

Fixed version (ground truth):
@Override protected WebClient initialValue(){
  final WebClient client=new WebClient(BrowserVersion.FIREFOX_3_6);
  client.setIncorrectnessListener(quietIncorrectnessListener);
  return client;
}
Program: 101292
Project: 101292
Buggy source:
@Override protected WebClient initialValue(){
  final WebClient client=new WebClient(BrowserVersion.FIREFOX_3_6);
  client.setIncorrectnessListener(quietIncorrectnessListener);
  return client;
}

Fixed version (ground truth):
@Override protected WebClient initialValue(){
  final WebClient client=new WebClient(BrowserVersion.FIREFOX_3_6);
  client.setIncorrectnessListener(quietIncorrectnessListener);
  client.setJavaScriptEnabled(true);
  client.setAjaxController(new NicelyResynchronizingAjaxController());
  return client;
}
Program: 101293
Project: 101293
Buggy source:
private void runTest(final URL test) throws IOException {
  final WebClient client=localClient.get();
  final File instrumentedFileDirectory=new File(outputDir,instrumentedFileDirectoryName);
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(coverageVariableName);
  if (noInstrumentPatterns != null) {
    instrumenter.setIgnorePatterns(noInstrumentPatterns);
  }
  if (outputInstrumentedFiles) {
    if (!instrumentedFileDirectory.exists() && !instrumentedFileDirectory.mkdirs()) {
      throw new RuntimeException("String_Node_Str" + instrumentedFileDirectory);
    }
    instrumenter.setOutputDir(instrumentedFileDirectory);
    instrumenter.setOutputInstrumentedFiles(outputInstrumentedFiles);
  }
  instrumenter.setCacheInstrumentedCode(cacheInstrumentedCode);
  client.setScriptPreProcessor(instrumenter);
  final Page page=client.getPage(test);
  if (page instanceof HtmlPage) {
    final HtmlPage htmlPage=(HtmlPage)page;
    client.waitForBackgroundJavaScript(30000);
    client.setScriptPreProcessor(null);
    final String runName=new File(test.toString()).getName();
    final NativeObject coverageData=(NativeObject)htmlPage.executeJavaScript(coverageVariableName).getJavaScriptResult();
    collectAndWriteRunStats(runName,instrumenter,coverageData);
  }
}

Fixed version (ground truth):
private void runTest(final URL test) throws IOException {
  final WebClient client=localClient.get();
  final File instrumentedFileDirectory=new File(outputDir,instrumentedFileDirectoryName);
  final ScriptInstrumenter instrumenter=new ScriptInstrumenter(client.getJavaScriptEngine().getContextFactory(),coverageVariableName);
  if (noInstrumentPatterns != null) {
    instrumenter.setIgnorePatterns(noInstrumentPatterns);
  }
  if (outputInstrumentedFiles) {
    if (!instrumentedFileDirectory.exists() && !instrumentedFileDirectory.mkdirs()) {
      throw new RuntimeException("String_Node_Str" + instrumentedFileDirectory);
    }
    instrumenter.setOutputDir(instrumentedFileDirectory);
    instrumenter.setOutputInstrumentedFiles(outputInstrumentedFiles);
  }
  instrumenter.setCacheInstrumentedCode(cacheInstrumentedCode);
  client.setScriptPreProcessor(instrumenter);
  final Page page=client.getPage(test);
  if (page instanceof HtmlPage) {
    final HtmlPage htmlPage=(HtmlPage)page;
    client.waitForBackgroundJavaScript(30000);
    client.setScriptPreProcessor(null);
    final String runName=new File(test.toString()).getName();
    final NativeObject coverageData=(NativeObject)htmlPage.executeJavaScript(coverageVariableName).getJavaScriptResult();
    collectAndWriteRunStats(runName,instrumenter,coverageData);
  }
}
Program: 101294
Project: 101294
Buggy source:
public ScriptInstrumenter(final String coverageVariableName){
  this.coverageVariableName=coverageVariableName;
  initializingCode=String.format("String_Node_Str",coverageVariableName,coverageVariableName);
  arrayInitializer=String.format("String_Node_Str",coverageVariableName);
}

Fixed version (ground truth):
public ScriptInstrumenter(HtmlUnitContextFactory contextFactory,final String coverageVariableName){
  this.contextFactory=contextFactory;
  this.coverageVariableName=coverageVariableName;
  initializingCode=String.format("String_Node_Str",coverageVariableName,coverageVariableName);
  arrayInitializer=String.format("String_Node_Str",coverageVariableName);
}
Program: 101296
Project: 101296
Buggy source:
@Override public boolean visit(final AstNode node){
  if (isExecutableBlock(node)) {
    addInstrumentationSnippetFor(node);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visit(final AstNode node){
  handleVoidBug(node);
  handleNumberLiteralBug(node);
  if (isExecutableBlock(node)) {
    addInstrumentationSnippetFor(node);
  }
  return true;
}
Program: 101297
Project: 101297
Buggy source:
static FileStats merge(final FileStats s1,final FileStats s2){
  final List<LineCoverageRecord> r1=s1.getLineCoverageRecords();
  final List<LineCoverageRecord> r2=s2.getLineCoverageRecords();
  isTrue(s1.name.equals(s2.name));
  isTrue(r1.size() == r2.size());
  final List<LineCoverageRecord> mergedRecords=Lists.newLinkedList();
  for (int i=0; i < r1.size(); i++) {
    final LineCoverageRecord l1=r1.get(i);
    final LineCoverageRecord l2=r2.get(i);
    mergedRecords.add(LineCoverageRecord.merge(l1,l2));
  }
  return new FileStats(s1.name,mergedRecords);
}

Fixed version (ground truth):
static FileStats merge(final FileStats s1,final FileStats s2){
  final List<LineCoverageRecord> r1=s1.getLineCoverageRecords();
  final List<LineCoverageRecord> r2=s2.getLineCoverageRecords();
  Validate.isTrue(s1.name.equals(s2.name));
  Validate.isTrue(r1.size() == r2.size());
  final List<LineCoverageRecord> mergedRecords=Lists.newLinkedList();
  for (int i=0; i < r1.size(); i++) {
    final LineCoverageRecord l1=r1.get(i);
    final LineCoverageRecord l2=r2.get(i);
    mergedRecords.add(LineCoverageRecord.merge(l1,l2));
  }
  return new FileStats(s1.name,mergedRecords);
}
Program: 101298
Project: 101298
Buggy source:
public static LineCoverageRecord merge(final LineCoverageRecord l1,final LineCoverageRecord l2){
  isTrue(l1.lineNr == l2.lineNr);
  isTrue(l1.line.equals(l2.line));
  final LineCoverageRecord merged=new LineCoverageRecord();
  merged.lineNr=l1.lineNr;
  merged.timesExecuted=l1.timesExecuted + l2.timesExecuted;
  merged.line=l1.line;
  return merged;
}

Fixed version (ground truth):
public static LineCoverageRecord merge(final LineCoverageRecord l1,final LineCoverageRecord l2){
  Validate.isTrue(l1.lineNr == l2.lineNr);
  Validate.isTrue(l1.line.equals(l2.line));
  final LineCoverageRecord merged=new LineCoverageRecord();
  merged.lineNr=l1.lineNr;
  merged.timesExecuted=l1.timesExecuted == -1 ? -1 : l1.timesExecuted + l2.timesExecuted;
  merged.line=l1.line;
  return merged;
}
Program: 101299
Project: 101299
Buggy source:
private AstNode newInstrumentationNode(final int lineNr){
  final ExpressionStatement instrumentationNode=new ExpressionStatement();
  final UnaryExpression inc=new UnaryExpression();
  inc.setIsPostfix(true);
  inc.setOperator(Token.INC);
  final ElementGet outer=new ElementGet();
  final ElementGet inner=new ElementGet();
  outer.setTarget(inner);
  final Name covDataVar=new Name();
  covDataVar.setIdentifier(coverageVariableName);
  inner.setTarget(covDataVar);
  final StringLiteral fileName=new StringLiteral();
  fileName.setValue(data.getSourceName());
  fileName.setQuoteCharacter('\'');
  inner.setElement(fileName);
  final NumberLiteral index=new NumberLiteral();
  index.setValue(Integer.toString(lineNr));
  outer.setElement(index);
  inc.setOperand(outer);
  instrumentationNode.setExpression(inc);
  instrumentationNode.setHasResult();
  return instrumentationNode;
}

Fixed version (ground truth):
private AstNode newInstrumentationNode(final int lineNr){
  final ExpressionStatement instrumentationNode=new ExpressionStatement();
  final UnaryExpression inc=new UnaryExpression();
  inc.setIsPostfix(true);
  inc.setOperator(Token.INC);
  final ElementGet outer=new ElementGet();
  final ElementGet inner=new ElementGet();
  outer.setTarget(inner);
  final Name covDataVar=new Name();
  covDataVar.setIdentifier(coverageVariableName);
  inner.setTarget(covDataVar);
  final StringLiteral fileName=new StringLiteral();
  fileName.setValue(data.getSourceName());
  fileName.setQuoteCharacter('\'');
  inner.setElement(fileName);
  final NumberLiteral index=new NumberLiteral();
  index.setNumber(lineNr);
  index.setValue(Integer.toString(lineNr));
  outer.setElement(index);
  inc.setOperand(outer);
  instrumentationNode.setExpression(inc);
  instrumentationNode.setHasResult();
  return instrumentationNode;
}
Program: 101300
Project: 101300
Buggy source:
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    flattenElseIf((IfStatement)node,(IfStatement)parent);
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(node.getLineno()),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
  }
  data.addExecutableLine(node.getLineno(),node.getLength());
}

Fixed version (ground truth):
private void addInstrumentationSnippetFor(final AstNode node){
  final AstNode parent=node.getParent();
  final int type=node.getType();
  final int parentType=parent.getType();
  if (type == CASE) {
    handleSwitchCase((SwitchCase)node);
  }
 else   if (type == IF && parentType == IF) {
    flattenElseIf((IfStatement)node,(IfStatement)parent);
    data.addExecutableLine(node.getLineno(),node.getLength());
  }
 else   if (parentType != CASE) {
    if (parent.hasChildren()) {
      parent.addChildBefore(newInstrumentationNode(node.getLineno()),node);
    }
 else {
      final Block block=newInstrumentedBlock(node);
      if (parentType == IF) {
        final IfStatement ifStatement=(IfStatement)parent;
        if (ifStatement.getThenPart() == node) {
          ifStatement.setThenPart(block);
        }
 else         if (ifStatement.getElsePart() == node) {
          ifStatement.setElsePart(block);
        }
      }
 else       if (parentType == WHILE || parentType == FOR || parentType == DO) {
        ((Loop)parent).setBody(block);
      }
 else {
        logger.warn("String_Node_Str",parent.toSource());
      }
    }
    data.addExecutableLine(node.getLineno(),node.getLength());
  }
}
Program: 101301
Project: 101301
Buggy source:
public ScriptInstrumenter(HtmlUnitContextFactory contextFactory,final String coverageVariableName){
  this.contextFactory=contextFactory;
  this.coverageVariableName=coverageVariableName;
  initializingCode=String.format("String_Node_Str",coverageVariableName,coverageVariableName);
  arrayInitializer=String.format("String_Node_Str",coverageVariableName);
}

Fixed version (ground truth):
public ScriptInstrumenter(final HtmlUnitContextFactory contextFactory,final String coverageVariableName){
  this.contextFactory=contextFactory;
  this.coverageVariableName=coverageVariableName;
  initializingCode=String.format("String_Node_Str",coverageVariableName,coverageVariableName);
  arrayInitializer=String.format("String_Node_Str",coverageVariableName);
}
Program: 101303
Project: 101303
Buggy source:
@Override public void onReceive(Object message) throws Exception {
  if (message instanceof CodePointOpenCsvEntry) {
    CodePointOpenCsvEntry entry=(CodePointOpenCsvEntry)message;
    PostcodeUnit unit=new PostcodeUnit(CharMatcher.WHITESPACE.removeFrom(entry.getPostcode()));
    unit.pqi=entry.getPositionalQualityIndicator();
    unit.cartesianLocation=new CartesianLocation(Integer.parseInt(entry.getEastings()),Integer.parseInt(entry.getNorthings()));
    final TimerContext latLongCtx=latLongTransform.time();
    try {
      DirectPosition eastNorth=new GeneralDirectPosition(Integer.parseInt(entry.getEastings()),Integer.parseInt(entry.getNorthings()));
      DirectPosition latLng=osgbToWgs84Transform.transform(eastNorth,eastNorth);
      unit.location=new Location(round(latLng.getOrdinate(0),8),round(latLng.getOrdinate(1),8));
    }
  finally {
      latLongCtx.stop();
    }
    final TimerContext saveCtx=savePostcodeUnit.time();
    try {
      unit.save();
      postcodesProcessed.inc();
    }
 catch (    MongoException.DuplicateKey e) {
    }
 finally {
      saveCtx.stop();
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Object message) throws Exception {
  if (message instanceof CodePointOpenCsvEntry) {
    CodePointOpenCsvEntry entry=(CodePointOpenCsvEntry)message;
    PostcodeUnit unit=new PostcodeUnit(CharMatcher.WHITESPACE.removeFrom(entry.getPostcode()));
    unit.pqi=entry.getPositionalQualityIndicator();
    unit.cartesianLocation=new CartesianLocation(Integer.parseInt(entry.getEastings()),Integer.parseInt(entry.getNorthings()));
    final TimerContext latLongCtx=latLongTransform.time();
    try {
      DirectPosition eastNorth=new GeneralDirectPosition(Integer.parseInt(entry.getEastings()),Integer.parseInt(entry.getNorthings()));
      DirectPosition latLng=osgbToWgs84Transform.transform(eastNorth,eastNorth);
      unit.location=new Location(round(latLng.getOrdinate(1),8),round(latLng.getOrdinate(0),8));
    }
  finally {
      latLongCtx.stop();
    }
    final TimerContext saveCtx=savePostcodeUnit.time();
    try {
      unit.save();
      postcodesProcessed.inc();
    }
 catch (    MongoException.DuplicateKey e) {
    }
 finally {
      saveCtx.stop();
    }
  }
}
Program: 101304
Project: 101304
Buggy source:
public static Result ll(){
  Form<Geocode> geocodeForm=form(Geocode.class).bindFromRequest();
  if (geocodeForm.hasErrors()) {
    return badRequest(index.render(form(DistanceCalc.class),geocodeForm,new ArrayList<PostcodeUnit>()));
  }
 else {
    Geocode geocode=geocodeForm.get();
    PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(CharMatcher.WHITESPACE.removeFrom(geocode.postcode)).get();
    return ok(toJson(unit.location));
  }
}

Fixed version (ground truth):
public static Result ll(){
  Form<Geocode> geocodeForm=form(Geocode.class).bindFromRequest();
  if (geocodeForm.hasErrors()) {
    return badRequest(index.render(form(DistanceCalc.class),geocodeForm,new ArrayList<PostcodeUnit>()));
  }
 else {
    Geocode geocode=geocodeForm.get();
    PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(CharMatcher.WHITESPACE.removeFrom(geocode.postcode.toUpperCase())).get();
    return ok(toJson(unit.location));
  }
}
Program: 101305
Project: 101305
Buggy source:
public static Result eastingsNorthings(String postcode){
  if (postcode == null)   return notFound();
  PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(CharMatcher.WHITESPACE.removeFrom(postcode.toUpperCase())).get();
  if (unit == null) {
    return notFound();
  }
 else {
    return ok(toJson(unit.cartesianLocation));
  }
}

Fixed version (ground truth):
public static Result eastingsNorthings(String postcode){
  if (Strings.isNullOrEmpty(postcode))   return badRequest("String_Node_Str");
  postcode=CharMatcher.WHITESPACE.removeFrom(postcode.toUpperCase());
  if (postcode.length() < 5 || postcode.length() > 7)   return badRequest("String_Node_Str");
  PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(postcode).get();
  if (unit == null) {
    return notFound();
  }
 else {
    return ok(toJson(unit.cartesianLocation));
  }
}
Program: 101306
Project: 101306
Buggy source:
public static Result en(){
  Form<Geocode> geocodeForm=form(Geocode.class).bindFromRequest();
  if (geocodeForm.hasErrors()) {
    return badRequest(index.render(form(DistanceCalc.class),geocodeForm,new ArrayList<PostcodeUnit>()));
  }
 else {
    Geocode geocode=geocodeForm.get();
    PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(CharMatcher.WHITESPACE.removeFrom(geocode.postcode)).get();
    return ok(toJson(unit.cartesianLocation));
  }
}

Fixed version (ground truth):
public static Result en(){
  Form<Geocode> geocodeForm=form(Geocode.class).bindFromRequest();
  if (geocodeForm.hasErrors()) {
    return badRequest(index.render(form(DistanceCalc.class),geocodeForm,new ArrayList<PostcodeUnit>()));
  }
 else {
    Geocode geocode=geocodeForm.get();
    PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(CharMatcher.WHITESPACE.removeFrom(geocode.postcode.toUpperCase())).get();
    return ok(toJson(unit.cartesianLocation));
  }
}
Program: 101307
Project: 101307
Buggy source:
public static Result latLng(String postcode){
  if (postcode == null)   return notFound();
  PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(CharMatcher.WHITESPACE.removeFrom(postcode.toUpperCase())).get();
  if (unit == null) {
    return notFound();
  }
 else {
    return ok(toJson(unit.location));
  }
}

Fixed version (ground truth):
public static Result latLng(String postcode){
  if (Strings.isNullOrEmpty(postcode))   return badRequest("String_Node_Str");
  postcode=CharMatcher.WHITESPACE.removeFrom(postcode.toUpperCase());
  if (postcode.length() < 5 || postcode.length() > 7)   return badRequest("String_Node_Str");
  PostcodeUnit unit=PostcodeUnit.find.field("String_Node_Str").equal(postcode).get();
  if (unit == null) {
    return notFound();
  }
 else {
    return ok(toJson(unit.location));
  }
}
Program: 101308
Project: 101308
Buggy source:
public WriteResult delete(WriteConcern wc){
  return datastore.delete(this,wc);
}

Fixed version (ground truth):
public WriteResult delete(){
  return datastore.delete(this);
}
Program: 101309
Project: 101309
Buggy source:
public void getAdditionalKeys(Map<String,ManagedSecretKey> keys) throws OpsException {
  ItemBase model=getModel();
  if (model.links != null) {
    for (    Link link : model.links.getLinks()) {
      ItemBase item=platformLayer.getItem(link.getTarget());
      LinkTarget linkTarget=providers.toInterface(item,LinkTarget.class);
      PlatformLayerKey caPath=linkTarget.getCaForClientKey();
      if (caPath != null) {
        String alias=links.buildKeyName(link);
        keys.put(alias,findCaSignedKey(caPath,alias));
      }
    }
  }
}

Fixed version (ground truth):
public void getAdditionalKeys(Map<String,ManagedSecretKey> keys) throws OpsException {
  for (  Link link : getLinks()) {
    ItemBase item=platformLayer.getItem(link.getTarget());
    LinkTarget linkTarget=providers.toInterface(item,LinkTarget.class);
    PlatformLayerKey caPath=linkTarget.getCaForClientKey();
    if (caPath != null) {
      String alias=links.buildKeyName(link);
      keys.put(alias,findCaSignedKey(caPath,alias));
    }
  }
}
Program: 101311
Project: 101311
Buggy source:
public void addString(String valueName,String value){
  MetricTreeBase child=findChild(key);
  if (child != null) {
    throw new IllegalStateException();
  }
 else {
    child=new MetricTreeString(key,value);
    children.add(child);
  }
}

Fixed version (ground truth):
public void addString(String key,String value){
  MetricTreeBase child=findChild(key);
  if (child != null) {
    throw new IllegalStateException();
  }
 else {
    child=new MetricTreeString(key,value);
    children.add(child);
  }
}
Program: 101312
Project: 101312
Buggy source:
@Override public Object runCommand() throws PlatformLayerClientException, JSONException, IOException {
  PlatformLayerClient client=getPlatformLayerClient();
  if (stdin) {
    if (value != null) {
      throw new CliException("String_Node_Str");
    }
    InputStream stream=new NoCloseInputStream(System.in);
    byte[] data=IoUtils.readAllBinary(stream);
    if (format.equals("String_Node_Str")) {
      value=CryptoUtils.toBase64(data);
    }
 else {
      throw new CliException("String_Node_Str" + format);
    }
  }
 else {
    throw new CliException("String_Node_Str");
  }
  PlatformLayerKey resolved=path.resolve(getContext());
  UntypedItem item=client.getItemUntyped(resolved);
  Element element=item.getRoot();
  List<String> tokens=Lists.newArrayList(Splitter.on("String_Node_Str").split(key));
  for (int i=0; i < tokens.size(); i++) {
    String token=tokens.get(i);
    Node child=XmlHelper.getChildElement(element,token);
    if (child == null) {
      if (i == tokens.size() - 1) {
        child=element.getOwnerDocument().createElement(token);
        element.appendChild(child);
      }
 else {
        throw new CliException("String_Node_Str" + token);
      }
    }
    element=(Element)child;
  }
  element.setTextContent(value);
  String xml=item.serialize();
  UntypedItem updated=client.putItem(resolved,xml,Format.XML);
  return updated;
}

Fixed version (ground truth):
@Override public Object runCommand() throws PlatformLayerClientException, JSONException, IOException {
  PlatformLayerClient client=getPlatformLayerClient();
  if (stdin) {
    if (value != null) {
      throw new CliException("String_Node_Str");
    }
    InputStream stream=new NoCloseInputStream(System.in);
    byte[] data=IoUtils.readAllBinary(stream);
    if ("String_Node_Str".equals(format)) {
      value=CryptoUtils.toBase64(data);
    }
 else {
      value=new String(data);
    }
  }
 else   if (value == null) {
    throw new CliException("String_Node_Str");
  }
  PlatformLayerKey resolved=path.resolve(getContext());
  UntypedItem item=client.getItemUntyped(resolved);
  Element element=item.getRoot();
  List<String> tokens=Lists.newArrayList(Splitter.on("String_Node_Str").split(key));
  for (int i=0; i < tokens.size(); i++) {
    String token=tokens.get(i);
    Node child=XmlHelper.getChildElement(element,token);
    if (child == null) {
      if (i == tokens.size() - 1) {
        child=element.getOwnerDocument().createElement(token);
        element.appendChild(child);
      }
 else {
        throw new CliException("String_Node_Str" + token);
      }
    }
    element=(Element)child;
  }
  element.setTextContent(value);
  String xml=item.serialize();
  UntypedItem updated=client.putItem(resolved,xml,Format.XML);
  return updated;
}
Program: 101314
Project: 101314
Buggy source:
public static Node getChildElement(Node parent,String elementName){
  NodeList childNodes=parent.getChildNodes();
  for (int i=0; i < childNodes.getLength(); i++) {
    Node childNode=childNodes.item(i);
    if (elementName.equals(childNode.getNodeName())) {
      return childNode;
    }
  }
  return null;
}

Fixed version (ground truth):
public static Node getChildElement(Node parent,String elementName){
  NodeList childNodes=parent.getChildNodes();
  for (int i=0; i < childNodes.getLength(); i++) {
    Node childNode=childNodes.item(i);
    String nodeName=childNode.getLocalName();
    if (elementName.equals(nodeName)) {
      return childNode;
    }
  }
  return null;
}
Program: 101315
Project: 101315
Buggy source:
String buildEnvironmentString(){
  if (environment.isEmpty()) {
    return null;
  }
  StringBuilder sb=new StringBuilder();
  for (  Map.Entry<String,String> entry : properties.entrySet()) {
    if (sb.length() != 0) {
      sb.append("String_Node_Str");
    }
    sb.append(entry.getKey() + "String_Node_Str" + entry.getValue()+ "String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
String buildEnvironmentString(){
  if (environment.isEmpty()) {
    return null;
  }
  StringBuilder sb=new StringBuilder();
  for (  Map.Entry<String,String> entry : environment.entrySet()) {
    if (sb.length() != 0) {
      sb.append("String_Node_Str");
    }
    sb.append(entry.getKey() + "String_Node_Str" + entry.getValue()+ "String_Node_Str");
  }
  return sb.toString();
}
Program: 101316
Project: 101316
Buggy source:
private ServerLine readResponseLine() throws IOException {
  StringBuffer sb=new StringBuffer();
  int lineType=fromStdout.read();
  if (lineType < 0) {
    throw new EOFException();
  }
  if (lineType == 0 || lineType == 2) {
    return new ServerLine(lineType,null);
  }
  while (true) {
    int c=fromStdout.read();
    if (c < 0) {
      throw new EOFException();
    }
    if (c == '\n') {
      break;
    }
    sb.append((char)c);
  }
  ServerLine serverLine=new ServerLine(lineType,sb.toString());
  log.debug("String_Node_Str" + serverLine.lineType + "String_Node_Str"+ serverLine.data);
  return serverLine;
}

Fixed version (ground truth):
private ServerLine readResponseLine() throws IOException {
  log.debug("String_Node_Str");
  StringBuffer sb=new StringBuffer();
  int lineType=fromStdout.read();
  if (lineType < 0) {
    throw new EOFException();
  }
  if (lineType == 0 || lineType == 2) {
    return new ServerLine(lineType,null);
  }
  while (true) {
    int c=fromStdout.read();
    if (c < 0) {
      throw new EOFException();
    }
    if (c == '\n') {
      break;
    }
    sb.append((char)c);
  }
  ServerLine serverLine=new ServerLine(lineType,sb.toString());
  log.debug("String_Node_Str" + serverLine.lineType + "String_Node_Str"+ serverLine.data);
  return serverLine;
}
Program: 101317
Project: 101317
Buggy source:
public ScpChannel(ClientSession clientSession,String cmd) throws IOException {
  this.toStdin=new PipedOutputStream();
  this.fromStdout=new PipedInputStream();
  try {
    channel=BugFixChannelExec.createExecChannel(clientSession,cmd);
  }
 catch (  Exception e1) {
    throw new IOException("String_Node_Str",e1);
  }
  this.stderr=new ByteArrayOutputStream();
  channel.setIn(new PipedInputStream(toStdin));
  channel.setOut(new PipedOutputStream(fromStdout));
  channel.setErr(stderr);
}

Fixed version (ground truth):
public ScpChannel(ClientSession clientSession,String cmd) throws IOException {
  this.toStdin=new PipedOutputStream();
  this.fromStdout=new PipedInputStream();
  log.debug("String_Node_Str" + cmd);
  try {
    channel=BugFixChannelExec.createExecChannel(clientSession,cmd);
  }
 catch (  Exception e1) {
    throw new IOException("String_Node_Str",e1);
  }
  this.stderr=new ByteArrayOutputStream();
  channel.setIn(new PipedInputStream(toStdin));
  channel.setOut(new PipedOutputStream(fromStdout));
  channel.setErr(stderr);
}
Program: 101318
Project: 101318
Buggy source:
public void connect(TimeSpan connectTimeout) throws SshException {
  try {
    channel.open().await(connectTimeout.getTotalMilliseconds());
  }
 catch (  Exception e) {
    ExceptionUtils.handleInterrupted(e);
    throw new SshException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void connect(TimeSpan connectTimeout) throws SshException {
  try {
    log.debug("String_Node_Str");
    channel.open().await(connectTimeout.getTotalMilliseconds());
  }
 catch (  Exception e) {
    ExceptionUtils.handleInterrupted(e);
    throw new SshException("String_Node_Str",e);
  }
}
Program: 101319
Project: 101319
Buggy source:
@Override protected ItemBase buildItemTemplate() throws OpsException {
  InstanceBase instance=OpsContext.get().getInstance(InstanceBase.class);
  PlatformLayerKey instanceKey=OpsSystem.toKey(instance);
  PublicEndpointBase publicEndpoint=platformLayerCloudHelpers.createPublicEndpoint(instance,parentItem);
  publicEndpoint.publicPort=publicPort;
  publicEndpoint.backendPort=backendPort;
  publicEndpoint.instance=instanceKey;
  publicEndpoint.key=PlatformLayerKey.fromId(instance.getId() + "String_Node_Str" + publicPort);
  Tag uniqueTag=UniqueTag.build(instance);
  publicEndpoint.getTags().add(uniqueTag);
  return publicEndpoint;
}

Fixed version (ground truth):
@Override protected PublicEndpointBase buildItemTemplate() throws OpsException {
  InstanceBase instance=OpsContext.get().getInstance(InstanceBase.class);
  PlatformLayerKey instanceKey=OpsSystem.toKey(instance);
  PublicEndpointBase publicEndpoint=platformLayerCloudHelpers.createPublicEndpoint(instance,parentItem);
  publicEndpoint.publicPort=publicPort;
  publicEndpoint.backendPort=backendPort;
  publicEndpoint.instance=instanceKey;
  publicEndpoint.key=PlatformLayerKey.fromId(instance.getId() + "String_Node_Str" + publicPort);
  Tag uniqueTag=UniqueTag.build(instance);
  publicEndpoint.getTags().add(uniqueTag);
  return publicEndpoint;
}
Program: 101320
Project: 101320
Buggy source:
@Override public TagChanges get() throws OpsException {
  TagChanges tagChanges=new TagChanges();
  EndpointInfo endpointInfo=endpointHelpers.findEndpoint(endpoint.getTags(),publicPort);
  if (endpointInfo == null) {
    throw new OpsException("String_Node_Str" + publicPort);
  }
  tagChanges.addTags.add(new Tag(Tag.PUBLIC_ENDPOINT,endpointInfo.publicIp + "String_Node_Str" + endpointInfo.port));
  return tagChanges;
}

Fixed version (ground truth):
@Override public TagChanges get() throws OpsException {
  TagChanges tagChanges=new TagChanges();
  PublicEndpointBase item=endpoint.getItem();
  if (item == null) {
    if (!OpsContext.isDelete()) {
      throw new OpsException("String_Node_Str");
    }
 else {
      log.warn("String_Node_Str");
      return null;
    }
  }
  EndpointInfo endpointInfo=endpointHelpers.findEndpoint(item.getTags(),publicPort);
  if (endpointInfo == null) {
    throw new OpsException("String_Node_Str" + publicPort);
  }
  tagChanges.addTags.add(new Tag(Tag.PUBLIC_ENDPOINT,endpointInfo.publicIp + "String_Node_Str" + endpointInfo.port));
  return tagChanges;
}
Program: 101322
Project: 101322
Buggy source:
@Handler public void handler() throws OpsException {
  ItemBase itemTemplate=buildItemTemplate();
  Tag uniqueTag=getUniqueTag(itemTemplate);
  if (OpsContext.isConfigure()) {
    try {
      platformLayer.putItemByTag(itemTemplate,uniqueTag);
    }
 catch (    PlatformLayerClientException e) {
      throw new OpsException("String_Node_Str",e);
    }
  }
  if (OpsContext.isDelete()) {
    List<? extends ItemBase> items=platformLayer.listItems(itemTemplate.getClass(),Filter.byTag(uniqueTag));
    if (items.size() != 0) {
      if (items.size() != 1) {
        throw new OpsException("String_Node_Str" + uniqueTag);
      }
      try {
        platformLayer.deleteItem(items.get(0).getKey());
      }
 catch (      PlatformLayerClientException e) {
        throw new OpsException("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
@Handler public void handler() throws OpsException {
  T itemTemplate=buildItemTemplate();
  Tag uniqueTag=getUniqueTag(itemTemplate);
  if (OpsContext.isConfigure()) {
    try {
      item=platformLayer.putItemByTag(itemTemplate,uniqueTag);
    }
 catch (    PlatformLayerClientException e) {
      throw new OpsException("String_Node_Str",e);
    }
  }
  if (OpsContext.isDelete()) {
    List<? extends ItemBase> items=platformLayer.listItems(itemTemplate.getClass(),Filter.byTag(uniqueTag));
    if (items.size() != 0) {
      if (items.size() != 1) {
        throw new OpsException("String_Node_Str" + uniqueTag);
      }
      item=(T)items.get(0);
      try {
        platformLayer.deleteItem(items.get(0).getKey());
      }
 catch (      PlatformLayerClientException e) {
        throw new OpsException("String_Node_Str",e);
      }
    }
  }
}
Program: 101323
Project: 101323
Buggy source:
protected abstract ItemBase buildItemTemplate() throws OpsException ;

Fixed version (ground truth):
protected abstract T buildItemTemplate() throws OpsException ;
Program: 101324
Project: 101324
Buggy source:
private void postResponseCleanup(){
  RequestContext context=requests.poll();
  currentResponse=null;
  listener.requestFinished(this,context);
  if (disconnectIfNonKeepAliveRequest && !HttpHeaders.isKeepAlive(currentResponse))   channel.close();
}

Fixed version (ground truth):
private void postResponseCleanup(){
  RequestContext context=requests.poll();
  boolean keepAlive=isKeepAlive(context.getRequest()) && isKeepAlive(currentResponse);
  currentResponse=null;
  listener.requestFinished(this,context);
  if (!keepAlive) {
    if (terminate == null)     terminate(RequestFuture.SHUTTING_DOWN,true);
    if (disconnectIfNonKeepAliveRequest && channel.isOpen())     channel.close();
  }
}
Program: 101325
Project: 101325
Buggy source:
@Override public void channelClosed(ChannelHandlerContext ctx,ChannelStateEvent e) throws Exception {
  if (channel == null)   listener.connectionFailed(this);
}

Fixed version (ground truth):
@Override public void channelClosed(ChannelHandlerContext ctx,ChannelStateEvent e) throws Exception {
  terminate(RequestFuture.CONNECTION_LOST,true);
}
Program: 101326
Project: 101326
Buggy source:
@Override public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e) throws Exception {
  if (channel == null)   return;
  RequestContext current;
synchronized (mutex) {
    willClose=true;
    current=requests.poll();
  }
  if (current != null) {
    current.getFuture().failedWithCause(e.getCause());
    listener.requestFinished(this,current);
  }
  if (channel.isConnected())   channel.close();
}

Fixed version (ground truth):
@Override public void exceptionCaught(ChannelHandlerContext ctx,ExceptionEvent e) throws Exception {
  terminate(e.getCause(),true);
}
Program: 101327
Project: 101327
Buggy source:
@Override public void run(){
  try {
    channel.write(context.getRequest());
  }
 catch (  Exception e) {
synchronized (mutex) {
      requests.remove(context);
    }
    context.getFuture().failedWithCause(e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    channel.write(context.getRequest());
  }
 catch (  Exception e) {
    handleWriteFailed(context,e);
  }
}
Program: 101328
Project: 101328
Buggy source:
@Override public boolean execute(final RequestContext context){
  Utils.ensureValue(context != null,"String_Node_Str");
  if (context.getFuture().isDone()) {
    listener.requestFinished(this,context);
    return true;
  }
  if (!context.isIdempotent() && !allowNonIdempotentPipelining) {
    context.getFuture().failedWithCause(RequestFuture.EXECUTION_REJECTED);
    listener.requestFinished(this,context);
    return true;
  }
synchronized (mutex) {
    if (!isAvailable()) {
      context.getFuture().failedWithCause(RequestFuture.EXECUTION_REJECTED);
      listener.requestFinished(this,context);
      return true;
    }
 else     if ((terminate != null) || !channel.isConnected()) {
      return false;
    }
    requests.add(context);
    if (!HttpHeaders.isKeepAlive(context.getRequest()))     willClose=true;
  }
  context.getFuture().markExecutionStart();
  if (executor != null) {
    executor.execute(new Runnable(){
      @Override public void run(){
        try {
          channel.write(context.getRequest());
        }
 catch (        Exception e) {
synchronized (mutex) {
            requests.remove(context);
          }
          context.getFuture().failedWithCause(e);
        }
      }
    }
);
  }
 else {
    try {
      channel.write(context.getRequest());
    }
 catch (    Exception e) {
synchronized (mutex) {
        requests.remove(context);
      }
      context.getFuture().failedWithCause(e);
      return true;
    }
  }
  context.getFuture().attachConnection(this);
  if (context.getTimeout() > 0)   timeoutController.controlTimeout(context);
  return true;
}

Fixed version (ground truth):
@Override public boolean execute(final RequestContext context){
  Utils.ensureValue(context != null,"String_Node_Str");
  if (context.getFuture().isDone()) {
    listener.requestFinished(this,context);
    return true;
  }
  if (!context.isIdempotent() && !allowNonIdempotentPipelining) {
    context.getFuture().failedWithCause(RequestFuture.EXECUTION_REJECTED);
    listener.requestFinished(this,context);
    return true;
  }
synchronized (mutex) {
    if ((terminate != null) || (channel == null) || !channel.isConnected()) {
      return false;
    }
 else     if (!isAvailable()) {
      context.getFuture().failedWithCause(RequestFuture.EXECUTION_REJECTED);
      listener.requestFinished(this,context);
      return true;
    }
    requests.add(context);
    if (!isKeepAlive(context.getRequest()))     willClose=true;
  }
  context.getFuture().markExecutionStart();
  if (executor != null) {
    executor.execute(new Runnable(){
      @Override public void run(){
        try {
          channel.write(context.getRequest());
        }
 catch (        Exception e) {
          handleWriteFailed(context,e);
        }
      }
    }
);
  }
 else {
    try {
      channel.write(context.getRequest());
    }
 catch (    Exception e) {
      handleWriteFailed(context,e);
      return true;
    }
  }
  context.getFuture().attachConnection(this);
  if (context.getTimeout() > 0)   timeoutController.controlTimeout(context);
  return true;
}
Program: 101329
Project: 101329
Buggy source:
@Override public void terminate(Throwable reason){
synchronized (mutex) {
    if (terminate != null)     return;
    terminate=reason;
    willClose=true;
  }
  if ((channel != null) && channel.isConnected())   channel.close();
}

Fixed version (ground truth):
private void terminate(Throwable reason,boolean restoreCurrent){
synchronized (mutex) {
    if (terminate != null)     return;
    terminate=reason;
    willClose=true;
  }
  if (channel == null) {
    listener.connectionFailed(this);
  }
 else {
    if (channel.isConnected())     try {
      channel.close();
    }
 catch (    Exception ignored) {
    }
    Collection<RequestContext> requestsToRestore=new ArrayList<>();
    for (    RequestContext request : requests) {
      if (request.getFuture().isDone())       continue;
      boolean shouldRestore=restoreCurrent && (request.isIdempotent() || restoreNonIdempotentOperations);
      if (shouldRestore)       requestsToRestore.add(request);
 else       request.getFuture().failedWithCause(reason);
    }
    if (requestsToRestore.isEmpty())     listener.connectionTerminated(this);
 else     listener.connectionTerminated(this,requestsToRestore);
  }
}
Program: 101330
Project: 101330
Buggy source:
@Override public boolean cancel(){
synchronized (this) {
    if (done)     return false;
    executionEnd=System.nanoTime();
    cause=CANCELLED;
    done=true;
    connection.terminate(CANCELLED);
    if (waiters > 0)     notifyAll();
  }
  notifyListeners();
  return true;
}

Fixed version (ground truth):
@Override public boolean cancel(){
synchronized (this) {
    if (done)     return false;
    executionEnd=System.nanoTime();
    cause=CANCELLED;
    done=true;
    if (connection != null)     connection.terminate(CANCELLED);
    if (waiters > 0)     notifyAll();
  }
  notifyListeners();
  return true;
}
Program: 101331
Project: 101331
Buggy source:
@Override public boolean willProcessResponse(HttpResponse response) throws Exception {
  if (!isAcceptableResponse(response))   return false;
  if ((response.getContent() != null) && (response.getContent().readableBytes() > 0)) {
    result=convertBufferToResult(response.getContent());
    finished=true;
    return true;
  }
  long length=HttpHeaders.getContentLength(response,-1);
  if (length > Integer.MAX_VALUE) {
    finished=true;
    return false;
  }
  if (length == 0) {
    finished=true;
    return false;
  }
  if (response.isChunked()) {
    if (length == -1) {
      buffer=ChannelBuffers.dynamicBuffer(2048);
    }
 else {
      buffer=ChannelBuffers.dynamicBuffer((int)length);
    }
    return true;
  }
  finished=true;
  return false;
}

Fixed version (ground truth):
@Override public boolean willProcessResponse(HttpResponse response) throws Exception {
  if (!isAcceptableResponse(response))   return false;
  if ((response.getContent() != null) && (response.getContent().readableBytes() > 0)) {
    result=convertBufferToResult(response.getContent());
    finished=true;
    return true;
  }
  long length=HttpHeaders.getContentLength(response,-1);
  if ((length > Integer.MAX_VALUE) || (length < -1)) {
    finished=true;
    return false;
  }
  if (length == 0) {
    finished=true;
    return false;
  }
  if (response.isChunked()) {
    if (length < 0) {
      buffer=ChannelBuffers.dynamicBuffer(2048);
    }
 else {
      buffer=ChannelBuffers.dynamicBuffer((int)length);
    }
    return true;
  }
  finished=true;
  return false;
}
Program: 101332
Project: 101332
Buggy source:
@Override public HttpClient createClient(){
  AbstractHttpClient client;
  if (gatherStats)   client=new StatsGatheringHttpClient();
 else   client=new DefaultHttpClient();
  client.setUseSsl(useSsl);
  client.setRequestCompressionLevel(requestCompressionLevel);
  client.setAutoInflate(autoInflate);
  client.setConnectionTimeout(connectionTimeout);
  client.setRequestInactivityTimeout(requestInactivityTimeout);
  client.setMaxConnectionsPerHost(maxConnectionsPerHost);
  client.setMaxQueuedRequests(maxQueuedRequests);
  client.setUseNio(useNio);
  client.setMaxIoWorkerThreads(maxIoWorkerThreads);
  client.setMaxHelperThreads(maxHelperThreads);
  client.setHostContextFactory(hostContextFactory);
  client.setConnectionFactory(connectionFactory);
  client.setTimeoutManager(timeoutController);
  client.setCleanupInactiveHostContexts(cleanupInactiveHostContexts);
  client.setSslContextFactory(sslContextFactory);
  return client;
}

Fixed version (ground truth):
@Override public HttpClient createClient(){
  AbstractHttpClient client;
  if (gatherStats)   client=new StatsGatheringHttpClient();
 else   client=new DefaultHttpClient();
  client.setUseSsl(useSsl);
  client.setRequestCompressionLevel(requestCompressionLevel);
  client.setAutoInflate(autoInflate);
  client.setConnectionTimeout(connectionTimeout);
  client.setRequestInactivityTimeout(requestInactivityTimeout);
  client.setMaxConnectionsPerHost(maxConnectionsPerHost);
  client.setMaxQueuedRequests(maxQueuedRequests);
  client.setUseNio(useNio);
  client.setMaxIoWorkerThreads(maxIoWorkerThreads);
  client.setMaxHelperThreads(maxHelperThreads);
  client.setHostContextFactory(hostContextFactory);
  client.setConnectionFactory(connectionFactory);
  client.setFutureFactory(futureFactory);
  client.setTimeoutManager(timeoutController);
  client.setCleanupInactiveHostContexts(cleanupInactiveHostContexts);
  client.setSslContextFactory(sslContextFactory);
  return client;
}
Program: 101333
Project: 101333
Buggy source:
@Override public Card addNewCard(String idList,String name,Map<String,String> keyValueMap){
  validateObjectId(idList);
  final String url=TrelloURL.create(apiKey,TrelloURL.CARD_POST_URL).token(token).build();
  if (keyValueMap == null)   keyValueMap=new HashMap<String,String>();
  if (keyValueMap.containsKey("String_Node_Str"))   keyValueMap.remove("String_Node_Str");
  keyValueMap.put("String_Node_Str",name);
  return trelloObjFactory.createObject(new TypeToken<Card>(){
  }
,doApiPost(url,keyValueMap));
}

Fixed version (ground truth):
@Override public Card addNewCard(String idList,String name,Map<String,String> keyValueMap){
  validateObjectId(idList);
  final String url=TrelloURL.create(apiKey,TrelloURL.CARD_POST_URL).token(token).build();
  if (keyValueMap == null)   keyValueMap=new HashMap<String,String>();
  if (keyValueMap.containsKey("String_Node_Str"))   keyValueMap.remove("String_Node_Str");
  keyValueMap.put("String_Node_Str",name);
  keyValueMap.put("String_Node_Str",idList);
  return trelloObjFactory.createObject(new TypeToken<Card>(){
  }
,doApiPost(url,keyValueMap));
}
Program: 101334
Project: 101334
Buggy source:
public TrelloURL filter(String... filters){
  this.filters=filters;
  return this;
}

Fixed version (ground truth):
public TrelloURL filter(String... filters){
  this.filters=isArrayEmpty(filters) ? null : filters;
  return this;
}
Program: 101336
Project: 101336
Buggy source:
@Test public void testFromSimpleCypherResult() throws Exception {
  final CypherQueryExecutor.CypherResult result=result("String_Node_Str",gdb.getReferenceNode());
  final SubGraph graph=SubGraph.from(result);
  assertRefNodeGraph(graph);
}

Fixed version (ground truth):
@Test public void testFromSimpleCypherResult() throws Exception {
  final CypherQueryExecutor.CypherResult result=result("String_Node_Str",aNode);
  final SubGraph graph=SubGraph.from(gdb,result);
  assertRefNodeGraph(graph);
}
Program: 101337
Project: 101337
Buggy source:
@Test public void testFromSimpleGraph() throws Exception {
  final Node n1=gdb.createNode();
  n1.setProperty("String_Node_Str","String_Node_Str");
  final Node n0=gdb.getReferenceNode();
  final Relationship relationship=n0.createRelationshipTo(n1,DynamicRelationshipType.withName("String_Node_Str"));
  relationship.setProperty("String_Node_Str",true);
  final SubGraph graph=SubGraph.from(gdb);
  final Map<Long,Map<String,Object>> nodes=graph.getNodes();
  assertEquals(2,nodes.size());
  final Map<String,Object> node=nodes.get(n1.getId());
  assertEquals(2,node.size());
  assertEquals(n1.getId(),node.get("String_Node_Str"));
  assertEquals(n1.getProperty("String_Node_Str"),node.get("String_Node_Str"));
  final Map<Long,Map<String,Object>> rels=graph.getRelationships();
  assertEquals(1,rels.size());
  final Map<String,Object> rel=rels.get(relationship.getId());
  assertEquals(7,rel.size());
  assertEquals(relationship.getId(),rel.get("String_Node_Str"));
  assertEquals(relationship.getProperty("String_Node_Str"),rel.get("String_Node_Str"));
  assertEquals(relationship.getType().name(),rel.get("String_Node_Str"));
  assertEquals(n0.getId(),rel.get("String_Node_Str"));
  assertEquals(n1.getId(),rel.get("String_Node_Str"));
  assertEquals(0,rel.get("String_Node_Str"));
  assertEquals(1,rel.get("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testFromSimpleGraph() throws Exception {
  final Node n1=gdb.createNode();
  n1.setProperty("String_Node_Str","String_Node_Str");
  final Node n0=aNode;
  final Relationship relationship=n0.createRelationshipTo(n1,DynamicRelationshipType.withName("String_Node_Str"));
  relationship.setProperty("String_Node_Str",true);
  final SubGraph graph=SubGraph.from(gdb);
  final Map<Long,Map<String,Object>> nodes=graph.getNodes();
  assertEquals(2,nodes.size());
  final Map<String,Object> node=nodes.get(n1.getId());
  assertEquals(2,node.size());
  assertEquals(n1.getId(),node.get("String_Node_Str"));
  assertEquals(n1.getProperty("String_Node_Str"),node.get("String_Node_Str"));
  final Map<Long,Map<String,Object>> rels=graph.getRelationships();
  assertEquals(1,rels.size());
  final Map<String,Object> rel=rels.get(relationship.getId());
  assertEquals(7,rel.size());
  assertEquals(relationship.getId(),rel.get("String_Node_Str"));
  assertEquals(relationship.getProperty("String_Node_Str"),rel.get("String_Node_Str"));
  assertEquals(relationship.getType().name(),rel.get("String_Node_Str"));
  assertEquals(n0.getId(),rel.get("String_Node_Str"));
  assertEquals(n1.getId(),rel.get("String_Node_Str"));
  assertEquals(0,rel.get("String_Node_Str"));
  assertEquals(1,rel.get("String_Node_Str"));
}