nus-yam/ex-repair huggingface dataset:
Program: 141413
Project: 141413
Buggy source:
protected void uploadFiles(final List<FileUploader> files) throws IOException {
  final Map<String,String> dataSourceDistCpEntries=new HashMap<String,String>();
  for (  FileUploader f : files) {
    f.prepare();
    f.upload();
    if (f instanceof HDFSFileUploader)     dataSourceDistCpEntries.putAll(((HDFSFileUploader)f).getDistCpEntries());
  }
  if (dataSourceDistCpEntries.size() > 0) {
    final Map<String,String> distCpEntries=new HashMap<String,String>();
    for (    Map.Entry<String,String> e : dataSourceDistCpEntries.entrySet()) {
      if (e.getKey().startsWith("String_Node_Str")) {
        final Path src=new Path(e.getKey());
        final Path dest=new Path(e.getValue());
        if (src.getName().equals(dest.getName())) {
          distCpEntries.put(e.getKey(),e.getValue());
          dataSourceDistCpEntries.remove(e.getKey());
        }
      }
    }
    final DataSourceDistCp cp=new DataSourceDistCp(this.conf,new Path(getDestURI().toString()));
    cp.copy(dataSourceDistCpEntries);
    DistCp distcp=new DistCp(this.conf);
    Map<String,Set<String>> reverseEntries=Utils.reverseMap(distCpEntries);
    for (    Map.Entry<String,Set<String>> e : reverseEntries.entrySet()) {
      final String dest=e.getKey();
      final Set<String> sources=e.getValue();
      String[] args=new String[sources.size() + 1];
      int i=0;
      for (      String src : sources)       args[i++]=src;
      args[i]=dest;
      distcp.run(args);
    }
  }
}

Fixed version (ground truth):
protected void uploadFiles(final List<FileUploader> files) throws IOException {
  final Map<String,String> originalDistCpEntries=new HashMap<String,String>();
  for (  FileUploader f : files) {
    f.prepare();
    f.upload();
    if (f instanceof HDFSFileUploader)     originalDistCpEntries.putAll(((HDFSFileUploader)f).getDistCpEntries());
  }
  if (originalDistCpEntries.size() > 0) {
    final Map<String,String> dataSourceDistCpEntries=new HashMap<String,String>();
    final Map<String,String> hadoopdistCpEntries=new HashMap<String,String>();
    for (    Map.Entry<String,String> e : originalDistCpEntries.entrySet()) {
      boolean useHadoopDistCp=false;
      if (e.getKey().startsWith("String_Node_Str")) {
        final Path src=new Path(e.getKey());
        final Path dest=new Path(e.getValue());
        if (src.getName().equals(dest.getName()))         useHadoopDistCp=true;
      }
      if (useHadoopDistCp)       hadoopdistCpEntries.put(e.getKey(),e.getValue());
 else       dataSourceDistCpEntries.put(e.getKey(),e.getValue());
    }
    final DataSourceDistCp cp=new DataSourceDistCp(this.conf,new Path(getDestURI().toString()));
    cp.copy(dataSourceDistCpEntries);
    hadoopDistCp(hadoopdistCpEntries);
  }
}
Program: 141414
Project: 141414
Buggy source:
protected void uploadFiles(final List<FileUploader> files) throws IOException {
  final Map<String,String> dataSourceDistCpEntries=new HashMap<String,String>();
  for (  FileUploader f : files) {
    f.prepare();
    f.upload();
    if (f instanceof HDFSFileUploader)     dataSourceDistCpEntries.putAll(((HDFSFileUploader)f).getDistCpEntries());
  }
  if (dataSourceDistCpEntries.size() > 0) {
    final Map<String,String> distCpEntries=new HashMap<String,String>();
    for (    Map.Entry<String,String> e : dataSourceDistCpEntries.entrySet()) {
      if (e.getKey().startsWith("String_Node_Str")) {
        final Path src=new Path(e.getKey());
        final Path dest=new Path(e.getValue());
        if (src.getName().equals(dest.getName())) {
          distCpEntries.put(e.getKey(),e.getValue());
          dataSourceDistCpEntries.remove(e.getKey());
        }
      }
    }
    final DataSourceDistCp cp=new DataSourceDistCp(this.conf,new Path(getDestURI().toString()));
    cp.copy(dataSourceDistCpEntries);
    DistCp distcp=new DistCp(this.conf);
    Map<String,Set<String>> reverseEntries=Utils.reverseMap(distCpEntries);
    for (    Map.Entry<String,Set<String>> e : reverseEntries.entrySet()) {
      final String dest=e.getKey();
      final Set<String> sources=e.getValue();
      String[] args=new String[sources.size() + 1];
      int i=0;
      for (      String src : sources)       args[i++]=src;
      args[i]=dest;
      distcp.run(args);
    }
  }
}

Fixed version (ground truth):
protected void uploadFiles(final List<FileUploader> files) throws IOException {
  final Map<String,String> originalDistCpEntries=new HashMap<String,String>();
  for (  FileUploader f : files) {
    f.prepare();
    f.upload();
    if (f instanceof HDFSFileUploader)     originalDistCpEntries.putAll(((HDFSFileUploader)f).getDistCpEntries());
  }
  if (originalDistCpEntries.size() > 0) {
    final Map<String,String> dataSourceDistCpEntries=new HashMap<String,String>();
    final Map<String,String> hadoopdistCpEntries=new HashMap<String,String>();
    for (    Map.Entry<String,String> e : originalDistCpEntries.entrySet()) {
      boolean useHadoopDistCp=false;
      if (e.getKey().startsWith("String_Node_Str")) {
        final Path src=new Path(e.getKey());
        final Path dest=new Path(e.getValue());
        if (src.getName().equals(dest.getName()))         useHadoopDistCp=true;
      }
      if (useHadoopDistCp)       hadoopdistCpEntries.put(e.getKey(),e.getValue());
 else       dataSourceDistCpEntries.put(e.getKey(),e.getValue());
    }
    final DataSourceDistCp cp=new DataSourceDistCp(this.conf,new Path(getDestURI().toString()));
    cp.copy(dataSourceDistCpEntries);
    hadoopDistCp(hadoopdistCpEntries);
  }
}
Program: 141417
Project: 141417
Buggy source:
protected final void writeRead(final ReadSequence readSequence,final OutputCollector<Text,Text> collector,final Reporter reporter) throws IOException {
  this.writer.write(readSequence.toFastQ());
  reporter.incrCounter(this.counterGroup,"String_Node_Str",1);
  if (this.reporter == null && reporter != null)   this.reporter=reporter;
  if (this.collector == null && collector != null)   this.collector=collector;
}

Fixed version (ground truth):
protected final void writeRead(final ReadSequence readSequence,final OutputCollector<Text,Text> collector,final Reporter reporter) throws IOException {
  this.writer.write(readSequence.toFastQ());
  reporter.incrCounter(this.counterGroup,Common.SOAP_INPUT_READS_COUNTER,1);
  if (this.reporter == null && reporter != null)   this.reporter=reporter;
  if (this.collector == null && collector != null)   this.collector=collector;
}
Program: 141419
Project: 141419
Buggy source:
/** 
 * Filter soap results to remove results with more than one hit
 * @param soapAlignFile SOAP alignment result file
 * @param soapAlignFilteredFile result file
 * @param reporter reporter that record events
 * @throws IOException if an error occurs while filtring data
 */
private static void filterSoapResult(final File soapAlignFile,final File soapAlignFilteredFile,final Reporter reporter) throws IOException {
  final BufferedReader readerResults=FileUtils.createBufferedReader(soapAlignFile);
  final BufferedWriter bw=new BufferedWriter(new FileWriter(soapAlignFilteredFile));
  final AlignResult aln=new AlignResult();
  String line=null;
  String lastSequenceId=null;
  while ((line=readerResults.readLine()) != null) {
    final String trimmedLine=line.trim();
    if ("String_Node_Str".equals(trimmedLine))     continue;
    aln.parseResultLine(trimmedLine);
    reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    final String currentSequenceId=aln.getSequenceId();
    if (aln.getNumberOfHits() == 1) {
      bw.write(line + "String_Node_Str");
      reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    }
 else     if (currentSequenceId != null && (!currentSequenceId.equals(lastSequenceId)))     reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    lastSequenceId=currentSequenceId;
  }
  readerResults.close();
  bw.close();
}

Fixed version (ground truth):
/** 
 * Filter soap results to remove results with more than one hit
 * @param soapAlignFile SOAP alignment result file
 * @param soapAlignFilteredFile result file
 * @param reporter reporter that record events
 * @throws IOException if an error occurs while filtring data
 */
private static void filterSoapResult(final File soapAlignFile,final File soapAlignFilteredFile,final Reporter reporter) throws IOException {
  final BufferedReader readerResults=FileUtils.createBufferedReader(soapAlignFile);
  final BufferedWriter bw=new BufferedWriter(new FileWriter(soapAlignFilteredFile));
  final AlignResult aln=new AlignResult();
  String line=null;
  String lastSequenceId=null;
  while ((line=readerResults.readLine()) != null) {
    final String trimmedLine=line.trim();
    if ("String_Node_Str".equals(trimmedLine))     continue;
    aln.parseResultLine(trimmedLine);
    reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    final String currentSequenceId=aln.getSequenceId();
    if (aln.getNumberOfHits() == 1) {
      bw.write(line + "String_Node_Str");
      reporter.incrCounter(COUNTER_GROUP,Common.SOAP_ALIGNEMENT_WITH_ONLY_ONE_HIT_COUNTER,1);
    }
 else     if (currentSequenceId != null && (!currentSequenceId.equals(lastSequenceId)))     reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    lastSequenceId=currentSequenceId;
  }
  readerResults.close();
  bw.close();
}
Program: 141422
Project: 141422
Buggy source:
protected final void writeRead(final ReadSequence readSequence,final OutputCollector<Text,Text> collector,final Reporter reporter) throws IOException {
  this.writer.write(readSequence.toFastQ());
  reporter.incrCounter(this.counterGroup,"String_Node_Str",1);
  if (this.reporter == null && reporter != null)   this.reporter=reporter;
  if (this.collector == null && collector != null)   this.collector=collector;
}

Fixed version (ground truth):
protected final void writeRead(final ReadSequence readSequence,final OutputCollector<Text,Text> collector,final Reporter reporter) throws IOException {
  this.writer.write(readSequence.toFastQ());
  reporter.incrCounter(this.counterGroup,Common.SOAP_INPUT_READS_COUNTER,1);
  if (this.reporter == null && reporter != null)   this.reporter=reporter;
  if (this.collector == null && collector != null)   this.collector=collector;
}
Program: 141424
Project: 141424
Buggy source:
/** 
 * Filter soap results to remove results with more than one hit
 * @param soapAlignFile SOAP alignment result file
 * @param soapAlignFilteredFile result file
 * @param reporter reporter that record events
 * @throws IOException if an error occurs while filtring data
 */
private static void filterSoapResult(final File soapAlignFile,final File soapAlignFilteredFile,final Reporter reporter) throws IOException {
  final BufferedReader readerResults=FileUtils.createBufferedReader(soapAlignFile);
  final BufferedWriter bw=new BufferedWriter(new FileWriter(soapAlignFilteredFile));
  final AlignResult aln=new AlignResult();
  String line=null;
  String lastSequenceId=null;
  while ((line=readerResults.readLine()) != null) {
    final String trimmedLine=line.trim();
    if ("String_Node_Str".equals(trimmedLine))     continue;
    aln.parseResultLine(trimmedLine);
    reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    final String currentSequenceId=aln.getSequenceId();
    if (aln.getNumberOfHits() == 1) {
      bw.write(line + "String_Node_Str");
      reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    }
 else     if (currentSequenceId != null && (!currentSequenceId.equals(lastSequenceId)))     reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    lastSequenceId=currentSequenceId;
  }
  readerResults.close();
  bw.close();
}

Fixed version (ground truth):
/** 
 * Filter soap results to remove results with more than one hit
 * @param soapAlignFile SOAP alignment result file
 * @param soapAlignFilteredFile result file
 * @param reporter reporter that record events
 * @throws IOException if an error occurs while filtring data
 */
private static void filterSoapResult(final File soapAlignFile,final File soapAlignFilteredFile,final Reporter reporter) throws IOException {
  final BufferedReader readerResults=FileUtils.createBufferedReader(soapAlignFile);
  final BufferedWriter bw=new BufferedWriter(new FileWriter(soapAlignFilteredFile));
  final AlignResult aln=new AlignResult();
  String line=null;
  String lastSequenceId=null;
  while ((line=readerResults.readLine()) != null) {
    final String trimmedLine=line.trim();
    if ("String_Node_Str".equals(trimmedLine))     continue;
    aln.parseResultLine(trimmedLine);
    reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    final String currentSequenceId=aln.getSequenceId();
    if (aln.getNumberOfHits() == 1) {
      bw.write(line + "String_Node_Str");
      reporter.incrCounter(COUNTER_GROUP,Common.SOAP_ALIGNEMENT_WITH_ONLY_ONE_HIT_COUNTER,1);
    }
 else     if (currentSequenceId != null && (!currentSequenceId.equals(lastSequenceId)))     reporter.incrCounter(COUNTER_GROUP,"String_Node_Str",1);
    lastSequenceId=currentSequenceId;
  }
  readerResults.close();
  bw.close();
}
Program: 141425
Project: 141425
Buggy source:
private void writeLoadData(final StringBuilder sb,final List<Integer> rSampleIds,final List<String> rSampleNames,final List<Integer> rCondIndexes,final List<String> rCondNames){
  boolean first=true;
  for (int i=0; i < rSampleIds.size(); i++) {
    sb.append("String_Node_Str");
    sb.append(i + 1);
    sb.append("String_Node_Str");
    sb.append(StringUtils.bashEscaping(this.expressionFilesDirectory.getAbsolutePath()));
    sb.append("String_Node_Str");
    sb.append(rSampleIds.get(i));
    sb.append("String_Node_Str");
    if (first)     first=false;
 else {
      sb.append("String_Node_Str");
      sb.append(rSampleIds.get(i));
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
    sb.append(rSampleNames.get(i));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str" + "String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  String c : rCondNames) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append('"');
    sb.append(c);
    sb.append('"');
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  int i : rCondIndexes) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append(i);
  }
  sb.append("String_Node_Str");
}

Fixed version (ground truth):
private void writeLoadData(final StringBuilder sb,final List<Integer> rSampleIds,final List<String> rSampleNames,final List<Integer> rCondIndexes,final List<String> rCondNames){
  boolean first=true;
  for (int i=0; i < rSampleIds.size(); i++) {
    sb.append("String_Node_Str");
    sb.append(i + 1);
    sb.append("String_Node_Str");
    sb.append(StringUtils.bashEscaping(this.expressionFilesDirectory.getAbsolutePath()));
    sb.append("String_Node_Str");
    sb.append(rSampleIds.get(i));
    sb.append("String_Node_Str");
    if (first)     first=false;
 else {
      sb.append("String_Node_Str");
      sb.append(i + 1);
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
    sb.append(rSampleNames.get(i));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str" + "String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  String c : rCondNames) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append('"');
    sb.append(c);
    sb.append('"');
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  int i : rCondIndexes) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append(i);
  }
  sb.append("String_Node_Str");
}
Program: 141426
Project: 141426
Buggy source:
private void writeLoadData(final StringBuilder sb,final List<Integer> rSampleIds,final List<String> rSampleNames,final List<Integer> rCondIndexes,final List<String> rCondNames){
  boolean first=true;
  for (int i=0; i < rSampleIds.size(); i++) {
    sb.append("String_Node_Str");
    sb.append(i + 1);
    sb.append("String_Node_Str");
    sb.append(StringUtils.bashEscaping(this.expressionFilesDirectory.getAbsolutePath()));
    sb.append("String_Node_Str");
    sb.append(rSampleIds.get(i));
    sb.append("String_Node_Str");
    if (first)     first=false;
 else {
      sb.append("String_Node_Str");
      sb.append(rSampleIds.get(i));
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
    sb.append(rSampleNames.get(i));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str" + "String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  String c : rCondNames) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append('"');
    sb.append(c);
    sb.append('"');
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  int i : rCondIndexes) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append(i);
  }
  sb.append("String_Node_Str");
}

Fixed version (ground truth):
private void writeLoadData(final StringBuilder sb,final List<Integer> rSampleIds,final List<String> rSampleNames,final List<Integer> rCondIndexes,final List<String> rCondNames){
  boolean first=true;
  for (int i=0; i < rSampleIds.size(); i++) {
    sb.append("String_Node_Str");
    sb.append(i + 1);
    sb.append("String_Node_Str");
    sb.append(StringUtils.bashEscaping(this.expressionFilesDirectory.getAbsolutePath()));
    sb.append("String_Node_Str");
    sb.append(rSampleIds.get(i));
    sb.append("String_Node_Str");
    if (first)     first=false;
 else {
      sb.append("String_Node_Str");
      sb.append(i + 1);
      sb.append("String_Node_Str");
    }
    sb.append("String_Node_Str");
    sb.append(rSampleNames.get(i));
    sb.append("String_Node_Str");
  }
  sb.append("String_Node_Str" + "String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  String c : rCondNames) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append('"');
    sb.append(c);
    sb.append('"');
  }
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  first=true;
  for (  int i : rCondIndexes) {
    if (first)     first=false;
 else     sb.append(',');
    sb.append(i);
  }
  sb.append("String_Node_Str");
}
Program: 141431
Project: 141431
Buggy source:
@Override public void dispose(){
  super.dispose();
  getOWLModelManager().removeListener(this.listener);
  this.sqwrlQueryEngineModel.unregisterOntologyListener();
}

Fixed version (ground truth):
@Override public void dispose(){
  super.dispose();
  getOWLModelManager().removeListener(this.listener);
  if (this.sqwrlQueryEngineModel != null)   this.sqwrlQueryEngineModel.unregisterOntologyListener();
}
Program: 141432
Project: 141432
Buggy source:
@Override public void dispose(){
  super.dispose();
  getOWLModelManager().removeListener(this.listener);
  this.swrlRuleEngineModel.unregisterOntologyListener();
}

Fixed version (ground truth):
@Override public void dispose(){
  super.dispose();
  getOWLModelManager().removeListener(this.listener);
  if (this.swrlRuleEngineModel != null)   this.swrlRuleEngineModel.unregisterOntologyListener();
}
Program: 141433
Project: 141433
Buggy source:
@Override public void initialise(){
  super.initialise();
  this.modelManager=getOWLModelManager();
  this.modelManager.addListener(listener);
  setLayout(new BorderLayout());
  log.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void initialise(){
  super.initialise();
  this.modelManager=getOWLModelManager();
  this.modelManager.addListener(listener);
  setLayout(new BorderLayout());
  if (this.modelManager.getActiveOntology() != null)   update();
  log.info("String_Node_Str");
}
Program: 141434
Project: 141434
Buggy source:
@Override public void initialise(){
  super.initialise();
  log.info("String_Node_Str");
  this.modelManager=getOWLModelManager();
  this.modelManager.addListener(this.listener);
  setLayout(new BorderLayout());
  log.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void initialise(){
  super.initialise();
  log.info("String_Node_Str");
  this.modelManager=getOWLModelManager();
  this.modelManager.addListener(this.listener);
  setLayout(new BorderLayout());
  if (this.modelManager.getActiveOntology() != null)   update();
  log.info("String_Node_Str");
}
Program: 141435
Project: 141435
Buggy source:
public static int reverse(int n){
  for (int i=0; i < 32; i++) {
    n=question0502.swapBit(n,i,31);
  }
  return n;
}

Fixed version (ground truth):
public static int reverse(int n){
  for (int i=0; i < 32; i++) {
    n=question0502.swapBit(n,i,31 - i);
  }
  return n;
}
Program: 141436
Project: 141436
Buggy source:
public int getCapacity(int[] heights){
  int capacity=0;
  int minHeight=Integer.MIN_VALUE;
  for (int i=0; i < heights.length; i++) {
    capacity=Math.max(capacity,heights[i] - minHeight);
    minHeight=Math.min(minHeight,heights[i]);
  }
  return minHeight;
}

Fixed version (ground truth):
public int getCapacity(int[] heights){
  int capacity=0;
  int minHeight=Integer.MAX_VALUE;
  for (int i=0; i < heights.length; i++) {
    capacity=Math.max(capacity,heights[i] - minHeight);
    minHeight=Math.min(minHeight,heights[i]);
  }
  return minHeight;
}
Program: 141437
Project: 141437
Buggy source:
public TreeNode(T n){
  this.data=n;
}

Fixed version (ground truth):
public TreeNode(T n){
  this.data=n;
  left=null;
  right=null;
  parent=null;
}
Program: 141438
Project: 141438
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public void preorder(TreeNode n){
  n.parent=null;
  TreeNode current=n;
  TreeNode prev=null;
  while (current != null) {
    TreeNode next=null;
    if (prev == null || prev == current.parent) {
      System.out.println(current.data);
      if (current.left != null) {
        next=current.left;
      }
 else       if (current.right != null) {
        next=current.right;
      }
 else       next=current.parent;
    }
 else     if (prev == current.left) {
      if (current.right != null)       next=current.right;
 else {
        next=current.parent;
      }
    }
 else     if (prev == current.right) {
      next=current.parent;
    }
    current=next;
  }
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static void preorder(TreeNode n){
  n.parent=null;
  TreeNode current=n;
  TreeNode prev=null;
  while (current != null) {
    TreeNode next=null;
    if (prev == null || prev == current.parent) {
      System.out.println(current.data);
      if (current.left != null) {
        next=current.left;
      }
 else       if (current.right != null) {
        next=current.right;
      }
 else       next=current.parent;
    }
 else     if (prev == current.left) {
      if (current.right != null)       next=current.right;
 else {
        next=current.parent;
      }
    }
 else     if (prev == current.right) {
      next=current.parent;
    }
    prev=current;
    current=next;
  }
}
Program: 141439
Project: 141439
Buggy source:
@Override public Set<String> getPropertyNames(String... exclude){
  Set<CratePersistentProperty> properties=getPersistentProperties();
  Set<String> excluded=new HashSet<String>(asList(exclude));
  Set<String> propertyNames=new LinkedHashSet<String>(properties.size());
  for (  CratePersistentProperty property : properties) {
    if (!excluded.contains(property.getFieldName())) {
      propertyNames.add(property.getFieldName());
    }
  }
  return propertyNames;
}

Fixed version (ground truth):
@Override public Set<String> getPropertyNames(String... exclude){
  Set<CratePersistentProperty> properties=getPersistentProperties();
  Set<String> excluded=new HashSet<String>(asList(exclude));
  Set<String> propertyNames=new TreeSet<String>();
  for (  CratePersistentProperty property : properties) {
    if (!excluded.contains(property.getFieldName())) {
      propertyNames.add(property.getFieldName());
    }
  }
  return propertyNames;
}
Program: 141440
Project: 141440
Buggy source:
public BulkInsertOperation(Class<T> entityClass,String tableName,List<T> entities){
  super(tableName,entityClass,entities,INSERT);
}

Fixed version (ground truth):
public BulkInsertOperation(Class<T> entityClass,String tableName,List<T> entities){
  super(tableName,entityClass,entities,INSERT);
  columns=new TreeSet<String>();
  columns.add(DEFAULT_TYPE_KEY);
  columns.addAll(getColumns());
}
Program: 141441
Project: 141441
Buggy source:
public BulkActionResult<T> handle(SQLBulkResponse response);

Fixed version (ground truth):
public ActionableResult<T> handle(SQLBulkResponse response);
Program: 141442
Project: 141442
Buggy source:
/** 
 * Delete the given list of objects from the given table. The object must define an id (primary key). All life cycle callback methods will be invoked for entities succeeding the delete operation.
 * @param ids the list of objects to store in the table.
 * @param entityClass the parameterized type of the object.
 * @param tableName name of the table to delete the object from.
 * @return Results containing the details of the bulk operation
 */
<T>BulkActionResult<Object> bulkDelete(List<Object> ids,Class<T> entityClass,String tableName);

Fixed version (ground truth):
/** 
 * Delete the given list of objects from the given table. The object must define an id (primary key). All life cycle callback methods will be invoked for entities succeeding the delete operation.
 * @param ids the list of objects to store in the table.
 * @param entityClass the parameterized type of the object.
 * @param tableName name of the table to delete the object from.
 * @return Results containing the details of the bulk operation
 */
<T>ActionableResult<Object> bulkDelete(List<Object> ids,Class<T> entityClass,String tableName);
Program: 141443
Project: 141443
Buggy source:
/** 
 * Insert the given list of objects in the given table. If the object defines an id (primary key), it must not be null. All life cycle callback methods will be invoked for entities succeeding the insert operation.
 * @param entities the list of objects to store in the table.
 * @param entityClass the parameterized type of the object.
 * @param tableName name of the table to store the object in.
 * @return Results containing the details of the bulk operation
 */
<T>BulkActionResult<T> bulkInsert(List<T> entities,Class<T> entityClass,String tableName);

Fixed version (ground truth):
/** 
 * Insert the given list of objects in the given table. If the object defines an id (primary key), it must not be null. All life cycle callback methods will be invoked for entities succeeding the insert operation.
 * @param entities the list of objects to store in the table.
 * @param entityClass the parameterized type of the object.
 * @param tableName name of the table to store the object in.
 * @return Results containing the details of the bulk operation
 */
<T>ActionableResult<T> bulkInsert(List<T> entities,Class<T> entityClass,String tableName);
Program: 141444
Project: 141444
Buggy source:
/** 
 * Update the given list of objects in the given table. The object must define an id (primary key). All life cycle callback methods will be invoked for entities succeeding the update operation.
 * @param entities the list of objects to store in the table.
 * @param entityClass the parameterized type of the object.
 * @param tableName name of the table to store the object in.
 * @return Results containing the details of the bulk operation
 */
<T>BulkActionResult<T> bulkUpdate(List<T> entities,Class<T> entityClass,String tableName);

Fixed version (ground truth):
/** 
 * Update the given list of objects in the given table. The object must define an id (primary key). All life cycle callback methods will be invoked for entities succeeding the update operation.
 * @param entities the list of objects to store in the table.
 * @param entityClass the parameterized type of the object.
 * @param tableName name of the table to store the object in.
 * @return Results containing the details of the bulk operation
 */
<T>ActionableResult<T> bulkUpdate(List<T> entities,Class<T> entityClass,String tableName);
Program: 141445
Project: 141445
Buggy source:
/** 
 * Execute the given bulk operation (insert | update | delete) All operations are executed whatsoever. It does not matter whether one single operation failed or all succeeded
 * @param action must not be {@literal null}.
 * @param handler must not be {@literal null}. 
 */
<T>BulkActionResult<T> execute(CrateBulkAction action,CrateBulkActionResponseHandler<T> handler) throws DataAccessException, CrateSQLActionException ;

Fixed version (ground truth):
/** 
 * Execute the given bulk operation (insert | update | delete) All operations are executed whatsoever. It does not matter whether one single operation failed or all succeeded
 * @param action must not be {@literal null}.
 * @param handler must not be {@literal null}. 
 */
<T>ActionableResult<T> execute(CrateBulkAction action,CrateBulkActionResponseHandler<T> handler) throws DataAccessException, CrateSQLActionException ;
Program: 141446
Project: 141446
Buggy source:
@Override public <T>BulkActionResult<T> bulkInsert(List<T> entities,Class<T> entityClass,String tableName){
  boolean hasId=isIdPropertyDefined(entityClass);
  if (!hasId) {
    logger.warn(NO_ID_WARNING,entityClass.getName());
  }
  BulkInsertOperation<T> actionHandler=new BulkInsertOperation<T>(entityClass,tableName,entities);
  return execute(actionHandler,actionHandler);
}

Fixed version (ground truth):
@Override public <T>ActionableResult<T> bulkInsert(List<T> entities,Class<T> entityClass,String tableName){
  boolean hasId=isIdPropertyDefined(entityClass);
  if (!hasId) {
    logger.warn(NO_ID_WARNING,entityClass.getName());
  }
  BulkInsertOperation<T> actionHandler=new BulkInsertOperation<T>(entityClass,tableName,entities);
  return execute(actionHandler,actionHandler);
}
Program: 141447
Project: 141447
Buggy source:
private CrateSQLStatement initSelectStatement(Class<?> entityClass,String tableName){
  CratePersistentEntity<?> entity=getPersistentEntityFor(entityClass);
  boolean isVersioned=entity.hasVersionProperty();
  Set<String> columns=isVersioned ? entity.getPropertyNames(entity.getVersionProperty().getFieldName()) : entity.getPropertyNames();
  String idColumn=entity.hasIdProperty() ? entity.getIdProperty().getFieldName() : null;
  return new Select(idColumn,tableName,columns);
}

Fixed version (ground truth):
private CrateSQLStatement initSelectStatement(Class<?> entityClass,String tableName){
  CratePersistentEntity<?> entity=getPersistentEntityFor(entityClass);
  boolean isVersioned=entity.hasVersionProperty();
  Set<String> columns=isVersioned ? entity.getPropertyNames(entity.getVersionProperty().getFieldName()) : entity.getPropertyNames();
  String idColumn=id != null ? entity.getIdProperty().getFieldName() : null;
  return new Select(idColumn,tableName,columns);
}
Program: 141448
Project: 141448
Buggy source:
@Override public BulkActionResult<Object> handle(SQLBulkResponse response){
  Result[] results=response.results();
  BulkActionResult<Object> actionResults=new BulkActionResult<Object>();
  for (int index=0; index < results.length; index++) {
    Object id=convertedIds.get(index);
    ActionResult<Object> actionResult=actionResults.addResult(results[index],id);
    if (actionResult.isSuccess()) {
      doAfterDelete(id);
    }
  }
  return actionResults;
}

Fixed version (ground truth):
@Override public ActionableResult<Object> handle(SQLBulkResponse response){
  Result[] results=response.results();
  BulkActionResult<Object> actionResults=new BulkActionResult<Object>();
  for (int index=0; index < results.length; index++) {
    Object id=convertedIds.get(index);
    ActionResult<Object> actionResult=actionResults.addResult(results[index],id);
    if (actionResult.isSuccess()) {
      doAfterDelete(id);
    }
  }
  return actionResults;
}
Program: 141449
Project: 141449
Buggy source:
@Override public <T>BulkActionResult<T> execute(CrateBulkAction action,CrateBulkActionResponseHandler<T> handler) throws DataAccessException {
  notNull(action,"String_Node_Str");
  notNull(action.getActionType(),"String_Node_Str");
  notNull(handler,"String_Node_Str");
  if (!ALLOWED_BULK_OPERATIONS.contains(action.getActionType())) {
    throw new CrateSQLActionException(format(BULK_ACTION,action.getActionType(),ALLOWED_BULK_OPERATIONS));
  }
  try {
    SQLBulkRequest request=action.getSQLRequest();
    if (logger.isDebugEnabled()) {
      logger.debug(SQL_STATEMENT,request.stmt(),Arrays.deepToString(request.bulkArgs()));
    }
    return handler.handle(client.bulkSql(request).get());
  }
 catch (  SQLActionException e) {
    throw tryConvertingRuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new CrateSQLActionException(e.getMessage(),e);
  }
catch (  ExecutionException e) {
    throw new CrateSQLActionException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public <T>ActionableResult<T> execute(CrateBulkAction action,CrateBulkActionResponseHandler<T> handler) throws DataAccessException {
  notNull(action,"String_Node_Str");
  notNull(action.getActionType(),"String_Node_Str");
  notNull(handler,"String_Node_Str");
  if (!ALLOWED_BULK_OPERATIONS.contains(action.getActionType())) {
    throw new CrateSQLActionException(format(BULK_ACTION,action.getActionType(),ALLOWED_BULK_OPERATIONS));
  }
  try {
    SQLBulkRequest request=action.getSQLRequest();
    if (logger.isDebugEnabled()) {
      logger.debug(SQL_STATEMENT,request.stmt(),Arrays.deepToString(request.bulkArgs()));
    }
    return handler.handle(client.bulkSql(request).get());
  }
 catch (  SQLActionException e) {
    throw tryConvertingRuntimeException(e);
  }
catch (  InterruptedException e) {
    throw new CrateSQLActionException(e.getMessage(),e);
  }
catch (  ExecutionException e) {
    throw new CrateSQLActionException(e.getMessage(),e);
  }
}
Program: 141450
Project: 141450
Buggy source:
@Override public <T>BulkActionResult<Object> bulkDelete(List<Object> ids,Class<T> entityClass,String tableName){
  notEmpty(ids);
  notNull(entityClass);
  hasText(tableName);
  BulkDeleteOperation actionHandler=new BulkDeleteOperation(entityClass,tableName,ids);
  return execute(actionHandler,actionHandler);
}

Fixed version (ground truth):
@Override public <T>ActionableResult<Object> bulkDelete(List<Object> ids,Class<T> entityClass,String tableName){
  notEmpty(ids);
  notNull(entityClass);
  hasText(tableName);
  BulkDeleteOperation actionHandler=new BulkDeleteOperation(entityClass,tableName,ids);
  return execute(actionHandler,actionHandler);
}
Program: 141451
Project: 141451
Buggy source:
public SelectAction(Class<?> entityClass,String tableName,Object id){
  notNull(entityClass);
  notNull(id);
  this.select=initSelectStatement(entityClass,tableName);
  this.id=crateConverter.convertToCrateType(id,null);
}

Fixed version (ground truth):
public SelectAction(Class<?> entityClass,String tableName,Object id){
  notNull(entityClass);
  this.id=crateConverter.convertToCrateType(id,null);
  this.select=initSelectStatement(entityClass,tableName);
}
Program: 141452
Project: 141452
Buggy source:
@Override public <T>BulkActionResult<T> bulkUpdate(List<T> entities,Class<T> entityClass,String tableName){
  notNull(entityClass);
  notEmpty(entities);
  BulkUpdateOperation<T> actionHandler=new BulkUpdateOperation<T>(entityClass,tableName,entities);
  return execute(actionHandler,actionHandler);
}

Fixed version (ground truth):
@Override public <T>ActionableResult<T> bulkUpdate(List<T> entities,Class<T> entityClass,String tableName){
  notNull(entityClass);
  notEmpty(entities);
  BulkUpdateOperation<T> actionHandler=new BulkUpdateOperation<T>(entityClass,tableName,entities);
  return execute(actionHandler,actionHandler);
}
Program: 141453
Project: 141453
Buggy source:
Long getVersion(T entity);

Fixed version (ground truth):
/** 
 * Returns the version value from the given entity.
 * @return
 */
Long getVersion(T entity);
Program: 141454
Project: 141454
Buggy source:
String getIdAttribute();

Fixed version (ground truth):
/** 
 * Returns the attribute that the id will be persisted to.
 * @return
 */
String getIdAttribute();
Program: 141455
Project: 141455
Buggy source:
@Override public Long getVersion(T entity){
  CratePersistentProperty versionProperty=entityMetadata.getVersionProperty();
  try {
    if (versionProperty != null) {
      return (Long)BeanWrapper.create(entity,null).getProperty(versionProperty);
    }
  }
 catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
@Override public Long getVersion(T entity){
  if (entityMetadata.hasVersionProperty()) {
    return (Long)entityMetadata.getPropertyAccessor(entity).getProperty(entityMetadata.getVersionProperty());
  }
  return null;
}
Program: 141456
Project: 141456
Buggy source:
@Override public String getIdAttribute(){
  Assert.notNull(entityMetadata.getIdProperty(),"String_Node_Str" + entityMetadata.getType().getSimpleName() + "String_Node_Str");
  return entityMetadata.getIdProperty().getFieldName();
}

Fixed version (ground truth):
@Override public String getIdAttribute(){
  notNull(entityMetadata.getIdProperty(),format(ID_MSG,entityMetadata.getType().getSimpleName()));
  return entityMetadata.getIdProperty().getFieldName();
}
Program: 141457
Project: 141457
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public ID getId(T entity){
  CratePersistentProperty id=entityMetadata.getIdProperty();
  try {
    return (ID)BeanWrapper.create(entity,null).getProperty(id);
  }
 catch (  Exception e) {
    throw new IllegalStateException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public ID getId(T entity){
  if (entityMetadata.hasIdProperty()) {
    return (ID)entityMetadata.getPropertyAccessor(entity).getProperty(entityMetadata.getIdProperty());
  }
  return null;
}
Program: 141459
Project: 141459
Buggy source:
@Test public void shouldWriteArrayOfPrimitive(){
  Boolean[] array=new Boolean[1];
  array[0]=true;
  Map<String,Object> expected=new HashMap<String,Object>();
  expected.put(DEFAULT_TYPE_KEY,PrimitiveArray.class.getName());
  expected.put("String_Node_Str",array);
  PrimitiveArray entity=new PrimitiveArray();
  entity.booleans=array;
  CrateDocument document=new CrateDocument();
  converter.write(entity,document);
  assertThat(document,hasEntry(DEFAULT_TYPE_KEY,(Object)PrimitiveArray.class.getName()));
  assertThat(document,hasKey("String_Node_Str"));
  assertThat(document.get("String_Node_Str"),is(instanceOf(CrateArray.class)));
  assertThat(((CrateArray)document.get("String_Node_Str")).size(),is(1));
  assertThat(((CrateArray)document.get("String_Node_Str")).get(0).toString(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void shouldWriteArrayOfPrimitive(){
  boolean[] array=new boolean[]{true};
  Map<String,Object> expected=new HashMap<String,Object>();
  expected.put(DEFAULT_TYPE_KEY,PrimitiveArray.class.getName());
  expected.put("String_Node_Str",array);
  PrimitiveArray entity=new PrimitiveArray();
  entity.booleans=array;
  CrateDocument document=new CrateDocument();
  converter.write(entity,document);
  assertThat(document,hasEntry(DEFAULT_TYPE_KEY,(Object)PrimitiveArray.class.getName()));
  assertThat(document,hasKey("String_Node_Str"));
  assertThat(document.get("String_Node_Str"),is(instanceOf(CrateArray.class)));
  assertThat(((CrateArray)document.get("String_Node_Str")).size(),is(1));
  assertThat(((CrateArray)document.get("String_Node_Str")).get(0).toString(),is("String_Node_Str"));
}
Program: 141460
Project: 141460
Buggy source:
/** 
 * Nesting ARRAY or Collection types is not supported by crate. It is safe to assume that the payload will contain either a Map or a primitive type. Map types will be converted to   {@link CrateDocument}while simple types will be added without any conversion
 * @param array {@link CrateArray} for adding either Map or Simple types
 * @param payload containing either a Map or primitive type.
 */
@SuppressWarnings("String_Node_Str") private void toCrateArray(CrateArray array,Object payload){
  Collection<Object> objects=(Collection<Object>)payload;
  for (  Object object : objects) {
    TypeInformation<?> type=getTypeInformation(object.getClass());
    if (type.isMap()) {
      CrateDocument document=new CrateDocument();
      toCrateDocument(document,object);
      array.add(document);
    }
 else {
      array.add(object);
    }
  }
}

Fixed version (ground truth):
/** 
 * Nesting Array or Collection types is not supported by crate. It is safe to assume that the payload will contain either a Map or a primitive type. Map types will be converted to   {@link CrateDocument}while simple types will be added without any conversion
 * @param array {@link CrateArray} for adding either Map or Simple types
 * @param payload containing either a Map or primitive type.
 */
@SuppressWarnings("String_Node_Str") private void toCrateArray(CrateArray array,Object payload){
  Collection<Object> objects=(Collection<Object>)(payload.getClass().isArray() ? asList((Object[])payload) : payload);
  for (  Object object : objects) {
    TypeInformation<?> type=getTypeInformation(object.getClass());
    if (type.isMap()) {
      CrateDocument document=new CrateDocument();
      toCrateDocument(document,object);
      array.add(document);
    }
 else {
      array.add(object);
    }
  }
}
Program: 141461
Project: 141461
Buggy source:
public CrateDocument toDocument(){
  CrateDocument root=new CrateDocument();
  for (  Row row : rows) {
    if (row.isObject()) {
      toCrateDocument(root,row.getPayload());
      logger.debug("String_Node_Str",row.getColumn());
    }
 else     if (row.isArray()) {
      CrateArray array=new CrateArray();
      toCrateArray(array,row.getPayload());
      root.put(row.getColumn(),array);
      logger.debug("String_Node_Str",row.getColumn());
    }
 else {
      root.put(row.getColumn(),row.getPayload());
      logger.debug("String_Node_Str",new Object[]{row.getColumn(),row.getPayload().getClass().getName()});
    }
  }
  return root;
}

Fixed version (ground truth):
public CrateDocument toDocument(){
  CrateDocument root=new CrateDocument();
  for (  Row row : rows) {
    if (row.isObject()) {
      CrateDocument document=new CrateDocument();
      toCrateDocument(document,row.getPayload());
      root.put(row.getColumn(),document);
      logger.debug("String_Node_Str",row.getColumn());
    }
 else     if (row.isArray()) {
      CrateArray array=new CrateArray();
      toCrateArray(array,row.getPayload());
      root.put(row.getColumn(),array);
      logger.debug("String_Node_Str",row.getColumn());
    }
 else {
      root.put(row.getColumn(),row.getPayload());
      logger.debug("String_Node_Str",new Object[]{row.getColumn(),row.getPayload().getClass().getName()});
    }
  }
  return root;
}
Program: 141462
Project: 141462
Buggy source:
private String resolveTableName(TypeInformation<T> typeInformation){
  String tableName=null;
  Class<T> clazz=typeInformation.getType();
  if (clazz.isAnnotationPresent(Table.class)) {
    String name=typeInformation.getType().getAnnotation(Table.class).name();
    hasText(name,"String_Node_Str");
    tableName=name;
  }
 else {
    tableName=replace(clazz.getName(),"String_Node_Str","String_Node_Str");
  }
  return tableName;
}

Fixed version (ground truth):
private String resolveTableName(TypeInformation<T> typeInformation){
  String fallback=replace(typeInformation.getType().getName(),"String_Node_Str","String_Node_Str");
  String tableName=null;
  Table annotation=findAnnotation(Table.class);
  if (annotation != null) {
    tableName=hasText(annotation.name()) ? replace(annotation.name(),"String_Node_Str","String_Node_Str") : fallback;
  }
 else {
    tableName=fallback;
  }
  return tableName;
}
Program: 141463
Project: 141463
Buggy source:
/** 
 * Helper method to write the map into the crate document.
 * @param source the source object.
 * @param sink the target document.
 * @param type the type information for the document.
 * @return the written crate document.
 */
private CrateDocument writeMapInternal(final Map<Object,Object> source,final CrateDocument sink,final TypeInformation<?> type){
  for (  Map.Entry<Object,Object> entry : source.entrySet()) {
    Object key=entry.getKey();
    Object val=entry.getValue();
    if (conversions.isSimpleType(key.getClass())) {
      String simpleKey=key.toString();
      if (val == null || conversions.isSimpleType(val.getClass())) {
        writeSimpleInternal(val,sink,simpleKey);
      }
 else       if (val instanceof Collection || val.getClass().isArray()) {
        sink.put(simpleKey,writeCollectionInternal(asCollection(val),new CrateArray(),type.getMapValueType()));
      }
 else {
        CrateDocument document=new CrateDocument();
        TypeInformation<?> valueTypeInfo=type.isMap() ? type.getMapValueType() : OBJECT;
        writeInternal(val,document,valueTypeInfo);
        sink.put(simpleKey,document);
      }
    }
 else {
      throw new MappingException("String_Node_Str");
    }
  }
  return sink;
}

Fixed version (ground truth):
/** 
 * Helper method to write the map into the crate document.
 * @param source the source object.
 * @param sink the target document.
 * @param type the type information for the document.
 * @return the written crate document.
 */
private CrateDocument writeMapInternal(final Map<Object,Object> source,final CrateDocument sink,final TypeInformation<?> type){
  for (  Map.Entry<Object,Object> entry : source.entrySet()) {
    Object key=entry.getKey();
    Object val=entry.getValue();
    if (conversions.isSimpleType(key.getClass())) {
      String simpleKey=key.toString();
      if (val == null || (conversions.isSimpleType(val.getClass()) && !val.getClass().isArray())) {
        writeSimpleInternal(val,sink,simpleKey);
      }
 else       if (val instanceof Collection || val.getClass().isArray()) {
        sink.put(simpleKey,writeCollectionInternal(asCollection(val),new CrateArray(),type.getMapValueType()));
      }
 else {
        CrateDocument document=new CrateDocument();
        TypeInformation<?> valueTypeInfo=type.isMap() ? type.getMapValueType() : OBJECT;
        writeInternal(val,document,valueTypeInfo);
        sink.put(simpleKey,document);
      }
    }
 else {
      throw new MappingException("String_Node_Str");
    }
  }
  return sink;
}
Program: 141464
Project: 141464
Buggy source:
@Test public void shouldWriteArrayOfPrimitiveWrapper(){
  Integer[] array=new Integer[]{new Integer(1)};
  Map<String,Object> expected=new HashMap<String,Object>();
  expected.put(DEFAULT_TYPE_KEY,PrimitiveWrapperArray.class.getName());
  expected.put("String_Node_Str",array);
  PrimitiveWrapperArray entity=new PrimitiveWrapperArray();
  entity.integers=array;
  CrateDocument document=new CrateDocument();
  converter.write(entity,document);
  assertThat(document,hasEntry(DEFAULT_TYPE_KEY,(Object)PrimitiveWrapperArray.class.getName()));
  assertThat(document,hasKey("String_Node_Str"));
  assertThat(document.get("String_Node_Str"),is(instanceOf(CrateArray.class)));
  assertThat(((CrateArray)document.get("String_Node_Str")).size(),is(1));
  assertThat(((CrateArray)document.get("String_Node_Str")).get(0).toString(),is("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void shouldWriteArrayOfPrimitiveWrapper(){
  Integer[] array=new Integer[]{new Integer(1)};
  CrateArray crateArray=new CrateArray(new Integer(1));
  Map<String,Object> expected=new HashMap<String,Object>();
  expected.put(DEFAULT_TYPE_KEY,PrimitiveWrapperArray.class.getName());
  expected.put("String_Node_Str",crateArray);
  PrimitiveWrapperArray entity=new PrimitiveWrapperArray();
  entity.integers=array;
  CrateDocument document=new CrateDocument();
  converter.write(entity,document);
  assertThat(document,hasEntry(DEFAULT_TYPE_KEY,(Object)PrimitiveWrapperArray.class.getName()));
  assertThat(document,hasKey("String_Node_Str"));
  assertThat(document.get("String_Node_Str"),is(instanceOf(CrateArray.class)));
  assertThat(((CrateArray)document.get("String_Node_Str")).size(),is(1));
  assertThat(((CrateArray)document.get("String_Node_Str")).get(0).toString(),is("String_Node_Str"));
}