nus-yam/ex-repair huggingface dataset:
Program: 66816
Project: 66816
Buggy source:
/** 
 * @param outResults
 * @param defn
 * @param session
 * @param scope
 * @param context
 * @throws DataException 
 */
public CubeQueryExecutor(IBaseQueryResults outResults,ICubeQueryDefinition defn,DataEngineSession session,Scriptable scope,DataEngineContext context) throws DataException {
  this.defn=defn;
  this.scope=scope;
  this.context=context;
  this.session=session;
  TempPathManager.setTempPath(session.getTempDir());
  this.outResults=outResults;
  this.dimensionFilterEvalHelpers=new ArrayList<IJSFilterHelper>();
  this.dimensionSimpleFilter=new ArrayList<SimpleLevelFilter>();
  this.aggrMeasureFilterEvalHelpers=new ArrayList<IAggrMeasureFilterEvalHelper>();
  this.advancedFacttableBasedFilterEvalHelper=new ArrayList<IJSFacttableFilterEvalHelper>();
  if (!(context.getMode() == DataEngineContext.MODE_PRESENTATION && defn.getQueryResultsID() != null)) {
    populateFilterHelpers();
  }
}

Fixed version (ground truth):
/** 
 * @param outResults
 * @param defn
 * @param session
 * @param scope
 * @param context
 * @throws DataException 
 */
public CubeQueryExecutor(IBaseQueryResults outResults,ICubeQueryDefinition defn,DataEngineSession session,Scriptable scope,DataEngineContext context) throws DataException {
  this.defn=defn;
  this.scope=scope;
  this.context=context;
  this.session=session;
  DataEngineThreadLocal.getInstance().getPathManager().setTempPath(session.getTempDir());
  this.outResults=outResults;
  this.dimensionFilterEvalHelpers=new ArrayList<IJSFilterHelper>();
  this.dimensionSimpleFilter=new ArrayList<SimpleLevelFilter>();
  this.aggrMeasureFilterEvalHelpers=new ArrayList<IAggrMeasureFilterEvalHelper>();
  this.advancedFacttableBasedFilterEvalHelper=new ArrayList<IJSFacttableFilterEvalHelper>();
  if (!(context.getMode() == DataEngineContext.MODE_PRESENTATION && defn.getQueryResultsID() != null)) {
    populateFilterHelpers();
  }
}
Program: 66817
Project: 66817
Buggy source:
public void setApplicationClassLoader(ClassLoader appLoader){
  if (appLoader == null) {
    return;
  }
  ClassLoader loader=appLoader;
  try {
    appLoader.loadClass("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    loader=new RhinoClassLoaderDecoration(appLoader,getClass().getClassLoader());
  }
  context.setApplicationClassLoader(loader);
}

Fixed version (ground truth):
public void setApplicationClassLoader(final ClassLoader appLoader){
  if (appLoader == null) {
    return;
  }
  ClassLoader loader=appLoader;
  try {
    appLoader.loadClass("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    loader=AccessController.doPrivileged(new PrivilegedAction<ClassLoader>(){
      public ClassLoader run(){
        return new RhinoClassLoaderDecoration(appLoader,JavascriptEngine.class.getClassLoader());
      }
    }
);
  }
  context.setApplicationClassLoader(loader);
}
Program: 66818
Project: 66818
Buggy source:
public Script run(){
  return context.compileString(script,id,lineNumber,null);
}

Fixed version (ground truth):
public ClassLoader run(){
  return new RhinoClassLoaderDecoration(appLoader,JavascriptEngine.class.getClassLoader());
}
Program: 66820
Project: 66820
Buggy source:
/** 
 * Sets postscript level.
 * @param level
 */
public void setPostscriptLevel(int level){
  options.put(PS_LEVEL,new Integer(level));
}

Fixed version (ground truth):
/** 
 * Sets postscript level.
 * @param level
 */
public void setPostscriptLevel(int level){
  options.put(PS_LEVEL,level);
}
Program: 66821
Project: 66821
Buggy source:
private String applyFont(String fontName,int fontStyle,float fontSize,String text){
  if (isIntrinsicFont(fontName)) {
    return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
  }
 else {
    try {
      String fontPath=getFontPath(fontName);
      if (fontPath == null) {
        return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
      }
      ITrueTypeWriter trueTypeWriter=getTrueTypeFontWriter(fontPath,fontName);
      trueTypeWriter.ensureGlyphsAvailable(text);
      String displayName=trueTypeWriter.getDisplayName();
      setFont(displayName,fontSize);
      return trueTypeWriter.toHexString(text);
    }
 catch (    Exception e) {
      log.log(Level.WARNING,"String_Node_Str" + fontName);
    }
    return null;
  }
}

Fixed version (ground truth):
private String applyFont(String fontName,int fontStyle,float fontSize,String text){
  if (isIntrinsicFont(fontName)) {
    return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
  }
 else {
    try {
      String fontPath=getFontPath(fontName);
      if (fontPath == null) {
        return applyIntrinsicFont(fontName,fontStyle,fontSize,text);
      }
      ITrueTypeWriter trueTypeWriter=getTrueTypeFontWriter(fontPath,fontName);
      trueTypeWriter.ensureGlyphsAvailable(text);
      String displayName=trueTypeWriter.getDisplayName();
      setFont(displayName,fontSize);
      return trueTypeWriter.toHexString(text);
    }
 catch (    IOException ioe) {
      log.log(Level.WARNING,"String_Node_Str" + fontName);
    }
catch (    DocumentException de) {
      log.log(Level.WARNING,"String_Node_Str" + fontName);
    }
    return null;
  }
}
Program: 66822
Project: 66822
Buggy source:
private String getFontPath(String fontName){
  try {
    FontFactoryImp fontImpl=FontFactory.getFontImp();
    Properties trueTypeFonts=(Properties)getField(FontFactoryImp.class,"String_Node_Str",fontImpl);
    String fontPath=trueTypeFonts.getProperty(fontName.toLowerCase());
    return fontPath;
  }
 catch (  Exception e) {
    log.log(Level.WARNING,"String_Node_Str" + fontName);
  }
  return null;
}

Fixed version (ground truth):
private String getFontPath(String fontName){
  try {
    FontFactoryImp fontImpl=FontFactory.getFontImp();
    Properties trueTypeFonts=(Properties)getField(FontFactoryImp.class,"String_Node_Str",fontImpl);
    String fontPath=trueTypeFonts.getProperty(fontName.toLowerCase());
    return fontPath;
  }
 catch (  IllegalAccessException e) {
    log.log(Level.WARNING,"String_Node_Str" + fontName);
  }
catch (  NoSuchFieldException e) {
    log.log(Level.WARNING,"String_Node_Str" + fontName);
  }
  return null;
}
Program: 66823
Project: 66823
Buggy source:
protected List<TrueTypeGlyph> getCharactersToOutput(int glyph) throws IOException {
  ArrayList<TrueTypeGlyph> characters=new ArrayList<TrueTypeGlyph>();
  int[] glyphDataPosition=getGlyphDataPosition(glyph);
  int glyphDataOffset=glyphDataPosition[0];
  int glyphDataLength=glyphDataPosition[1];
  if (glyphDataLength == 0)   return characters;
  int tableGlyphOffset=((int[])positionTables.get("String_Node_Str"))[0];
  rf.seek(tableGlyphOffset + glyphDataOffset);
  int numContours=rf.readShort();
  if (numContours >= 0)   return characters;
  rf.skipBytes(8);
  for (; ; ) {
    int flags=rf.readUnsignedShort();
    Integer cGlyph=new Integer(rf.readUnsignedShort());
    TrueTypeGlyph trueTypeGlyph=new TrueTypeGlyph(cGlyph.intValue());
    if (!glyphDefined.contains(trueTypeGlyph)) {
      characters.add(trueTypeGlyph);
    }
    if ((flags & MORE_COMPONENTS) == 0)     return characters;
    int skip;
    if ((flags & ARG_1_AND_2_ARE_WORDS) != 0)     skip=4;
 else     skip=2;
    if ((flags & WE_HAVE_A_SCALE) != 0)     skip+=2;
 else     if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0)     skip+=4;
    if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0)     skip+=8;
    rf.skipBytes(skip);
  }
}

Fixed version (ground truth):
protected List<TrueTypeGlyph> getCharactersToOutput(int glyph) throws IOException {
  ArrayList<TrueTypeGlyph> characters=new ArrayList<TrueTypeGlyph>();
  int[] glyphDataPosition=getGlyphDataPosition(glyph);
  int glyphDataOffset=glyphDataPosition[0];
  int glyphDataLength=glyphDataPosition[1];
  if (glyphDataLength == 0)   return characters;
  int tableGlyphOffset=((int[])positionTables.get("String_Node_Str"))[0];
  rf.seek(tableGlyphOffset + glyphDataOffset);
  int numContours=rf.readShort();
  if (numContours >= 0)   return characters;
  rf.skipBytes(8);
  for (; ; ) {
    int flags=rf.readUnsignedShort();
    Integer cGlyph=rf.readUnsignedShort();
    TrueTypeGlyph trueTypeGlyph=new TrueTypeGlyph(cGlyph.intValue());
    if (!glyphDefined.contains(trueTypeGlyph)) {
      characters.add(trueTypeGlyph);
    }
    if ((flags & MORE_COMPONENTS) == 0)     return characters;
    int skip;
    if ((flags & ARG_1_AND_2_ARE_WORDS) != 0)     skip=4;
 else     skip=2;
    if ((flags & WE_HAVE_A_SCALE) != 0)     skip+=2;
 else     if ((flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0)     skip+=4;
    if ((flags & WE_HAVE_A_TWO_BY_TWO) != 0)     skip+=8;
    rf.skipBytes(skip);
  }
}
Program: 66825
Project: 66825
Buggy source:
/** 
 * The information in the maps of the table 'cmap' is coded in several formats. Format 6 is a trimmed table mapping. It is similar to format 0 but can have less than 256 entries.
 * @return a <CODE>HashMap</CODE> representing this map
 * @throws IOException the font file could not be read
 */
HashMap<Integer,int[]> readFormat6() throws IOException {
  HashMap<Integer,int[]> h=new HashMap<Integer,int[]>();
  rf.skipBytes(4);
  int start_code=rf.readUnsignedShort();
  int code_count=rf.readUnsignedShort();
  for (int k=0; k < code_count; ++k) {
    int r[]=new int[2];
    r[0]=rf.readUnsignedShort();
    r[1]=getGlyphWidth(r[0]);
    h.put(new Integer(k + start_code),r);
  }
  return h;
}

Fixed version (ground truth):
/** 
 * The information in the maps of the table 'cmap' is coded in several formats. Format 6 is a trimmed table mapping. It is similar to format 0 but can have less than 256 entries.
 * @return a <CODE>HashMap</CODE> representing this map
 * @throws IOException the font file could not be read
 */
HashMap<Integer,int[]> readFormat6() throws IOException {
  HashMap<Integer,int[]> h=new HashMap<Integer,int[]>();
  rf.skipBytes(4);
  int start_code=rf.readUnsignedShort();
  int code_count=rf.readUnsignedShort();
  for (int k=0; k < code_count; ++k) {
    int r[]=new int[2];
    r[0]=rf.readUnsignedShort();
    r[1]=getGlyphWidth(r[0]);
    h.put(k + start_code,r);
  }
  return h;
}
Program: 66827
Project: 66827
Buggy source:
/** 
 * Gets the glyph index and metrics for a character.
 * @param c the character
 * @return an <CODE>int</CODE> array with {glyph index, width}
 */
public int[] getMetricsTT(int c){
  if (!fontSpecific && cmap31 != null)   return (int[])cmap31.get(new Integer(c));
  if (fontSpecific && cmap10 != null)   return (int[])cmap10.get(new Integer(c));
  if (cmap31 != null)   return (int[])cmap31.get(new Integer(c));
  if (cmap10 != null)   return (int[])cmap10.get(new Integer(c));
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the glyph index and metrics for a character.
 * @param c the character
 * @return an <CODE>int</CODE> array with {glyph index, width}
 */
public int[] getMetricsTT(int c){
  if (!fontSpecific && cmap31 != null)   return (int[])cmap31.get(c);
  if (fontSpecific && cmap10 != null)   return (int[])cmap10.get(c);
  if (cmap31 != null)   return (int[])cmap31.get(c);
  if (cmap10 != null)   return (int[])cmap10.get(c);
  return null;
}
Program: 66828
Project: 66828
Buggy source:
public int getGlyphIndex(char c){
  int[] glyphIndexs=(int[])getCMap().get(new Integer(c));
  return glyphIndexs[0];
}

Fixed version (ground truth):
public int getGlyphIndex(char c){
  int[] glyphIndexs=(int[])getCMap().get(c);
  return glyphIndexs[0];
}
Program: 66829
Project: 66829
Buggy source:
protected String getEscapedStr(String s){
  StringBuffer result=null;
  int spacePos=1;
  char[] s2char=s.toCharArray();
  for (int i=0, max=s2char.length, delta=0; i < max; i++) {
    char c=s2char[i];
    String replacement=null;
    if (c == ' ') {
      if (spacePos % 2 == 1 || i == max - 1) {
        replacement="String_Node_Str";
      }
      spacePos++;
    }
 else {
      spacePos=0;
    }
    if (!(c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) || (c >= 0xE000 && c <= 0xFFFD))) {
      replacement="String_Node_Str";
    }
 else     if (c == '&') {
      replacement="String_Node_Str";
    }
 else     if (c == '<') {
      replacement="String_Node_Str";
    }
 else     if (c == '>') {
      replacement="String_Node_Str";
    }
 else     if (c == '\t') {
      replacement="String_Node_Str";
    }
 else     if (c == '=') {
      replacement="String_Node_Str";
    }
 else     if (c >= 0x80) {
      replacement="String_Node_Str" + Integer.toHexString(c) + ';';
    }
    if (replacement != null) {
      if (result == null) {
        result=new StringBuffer(s);
      }
      result.replace(i + delta,i + delta + 1,replacement);
      delta+=(replacement.length() - 1);
    }
  }
  if (result == null) {
    return s;
  }
  return result.toString();
}

Fixed version (ground truth):
protected String getEscapedStr(String s){
  StringBuffer result=null;
  int spacePos=1;
  char[] s2char=s.toCharArray();
  for (int i=0, max=s2char.length, delta=0; i < max; i++) {
    char c=s2char[i];
    String replacement=null;
    if (c == ' ') {
      if (spacePos % 2 != 0 || i == max - 1) {
        replacement="String_Node_Str";
      }
      spacePos++;
    }
 else {
      spacePos=0;
    }
    if (!(c == 0x9 || c == 0xA || c == 0xD || (c >= 0x20 && c <= 0xD7FF) || (c >= 0xE000 && c <= 0xFFFD))) {
      replacement="String_Node_Str";
    }
 else     if (c == '&') {
      replacement="String_Node_Str";
    }
 else     if (c == '<') {
      replacement="String_Node_Str";
    }
 else     if (c == '>') {
      replacement="String_Node_Str";
    }
 else     if (c == '\t') {
      replacement="String_Node_Str";
    }
 else     if (c == '=') {
      replacement="String_Node_Str";
    }
 else     if (c >= 0x80) {
      replacement="String_Node_Str" + Integer.toHexString(c) + ';';
    }
    if (replacement != null) {
      if (result == null) {
        result=new StringBuffer(s);
      }
      result.replace(i + delta,i + delta + 1,replacement);
      delta+=(replacement.length() - 1);
    }
  }
  if (result == null) {
    return s;
  }
  return result.toString();
}
Program: 66830
Project: 66830
Buggy source:
/** 
 * Closes the document.
 */
public void end(){
  int slidesizex=(int)(Math.ceil(pageWidth * 8));
  int slidesizey=(int)(Math.ceil(pageHeight * 8));
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println(("String_Node_Str" + slidesizex + "String_Node_Str"+ slidesizey+ "String_Node_Str"));
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"+ (i + 1)+ "String_Node_Str"));
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"));
    if (fileNamesLists.containsKey(new Integer(i + 1))) {
      List<String> fileNames=fileNamesLists.get(new Integer(i + 1));
      for (      String fileName : fileNames) {
        println(("String_Node_Str" + fileName + "String_Node_Str"));
      }
    }
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  writer.close();
  writer=null;
}

Fixed version (ground truth):
/** 
 * Closes the document.
 */
public void end(){
  int slidesizex=(int)(Math.ceil(pageWidth * 8));
  int slidesizey=(int)(Math.ceil(pageHeight * 8));
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println(("String_Node_Str" + slidesizex + "String_Node_Str"+ slidesizey+ "String_Node_Str"));
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"+ (i + 1)+ "String_Node_Str"));
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"));
    if (fileNamesLists.containsKey(i + 1)) {
      List<String> fileNames=fileNamesLists.get(i + 1);
      for (      String fileName : fileNames) {
        println(("String_Node_Str" + fileName + "String_Node_Str"));
      }
    }
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  writer.close();
  writer=null;
}
Program: 66832
Project: 66832
Buggy source:
public static String formatDateTime(String format,ULocale locale){
  String language=locale.getLanguage();
  String code=locale2Code.get(locale);
  if (code == null) {
    code=locale2Code.get(new Locale(language));
  }
  if (code == null) {
    return format;
  }
  return code + format;
}

Fixed version (ground truth):
public static String formatDateTime(String format,ULocale locale){
  String code=locale2Code.get(locale);
  if (code == null) {
    String language=locale.getLanguage();
    code=locale2Code.get(new ULocale(language,"String_Node_Str"));
  }
  if (code == null) {
    return format;
  }
  return code + format;
}
Program: 66833
Project: 66833
Buggy source:
private float getContentHeight(IContent content){
  return ExcelUtil.convertDimensionType(content.getHeight(),0,context.getDpi()) / 1000;
}

Fixed version (ground truth):
private float getContentHeight(IContent content){
  return ExcelUtil.convertDimensionType(content.getHeight(),0,context.getDpi()) / 1000f;
}
Program: 66834
Project: 66834
Buggy source:
public void endRow(IRowContent row){
  DimensionType height=row.getHeight();
  float rowHeight=ExcelUtil.convertDimensionType(height,0,context.getDpi()) / 1000;
  engine.endRow(rowHeight);
}

Fixed version (ground truth):
public void endRow(IRowContent row){
  DimensionType height=row.getHeight();
  float rowHeight=ExcelUtil.convertDimensionType(height,0,context.getDpi()) / 1000f;
  engine.endRow(rowHeight);
}
Program: 66837
Project: 66837
Buggy source:
public int getOutputType(){
  if (outputType == -1) {
    if (("String_Node_Str".equals(sExtension) && !"String_Node_Str".equalsIgnoreCase(outputFormat)) || "String_Node_Str".equals(sExtension)) {
      outputType=OUTPUT_AS_IMAGE;
    }
 else {
      outputType=OUTPUT_AS_IMAGE_WITH_MAP;
    }
  }
  return outputType;
}

Fixed version (ground truth):
public int getOutputType(){
  if (outputType == -1) {
    if ("String_Node_Str".equals(sExtension) || "String_Node_Str".equals(sExtension)) {
      outputType=OUTPUT_AS_IMAGE;
    }
 else {
      outputType=OUTPUT_AS_IMAGE_WITH_MAP;
    }
  }
  return outputType;
}
Program: 66838
Project: 66838
Buggy source:
public IResultObject fetch() throws IOException, DataException {
  if (rowBuffer == null) {
    prepareFirstFetch();
  }
  if (rowBufferSize == 0) {
    return null;
  }
  ValueIndex reObj=rowBuffer[0];
  IResultObject value=reObj.value;
  IResultObject readValue=subRowIterators[reObj.index].fetch();
  if (readValue == null) {
    rowBufferSize--;
    if (rowBufferSize > 0) {
      System.arraycopy(rowBuffer,1,rowBuffer,0,rowBufferSize);
    }
  }
 else {
    int pos=0;
    mValueIndex.value=readValue;
    mValueIndex.index=reObj.index;
    if (rowBufferSize > 1) {
      pos=Arrays.binarySearch(rowBuffer,mValueIndex);
      if (pos < 0)       pos=(pos + 1) * -1;
      pos--;
      if (pos == -1)       pos=0;
      if (pos > 0) {
        System.arraycopy(rowBuffer,1,rowBuffer,0,pos);
      }
    }
    rowBuffer[pos]=mValueIndex;
    mValueIndex=reObj;
  }
  return value;
}

Fixed version (ground truth):
public IResultObject fetch() throws IOException, DataException {
  if (rowBuffer == null) {
    prepareFirstFetch();
  }
  if (rowBufferSize == 0) {
    return null;
  }
  ValueIndex reObj=rowBuffer[0];
  IResultObject value=reObj.value;
  IResultObject readValue=subRowIterators[reObj.index].fetch();
  if (readValue == null) {
    rowBufferSize--;
    if (rowBufferSize > 0) {
      ValueIndex[] tBuffer=new ValueIndex[rowBufferSize];
      System.arraycopy(rowBuffer,1,tBuffer,0,rowBufferSize);
      rowBuffer=tBuffer;
    }
  }
 else {
    int pos=0;
    mValueIndex.value=readValue;
    mValueIndex.index=reObj.index;
    if (rowBufferSize > 1) {
      pos=Arrays.binarySearch(rowBuffer,mValueIndex);
      if (pos < 0)       pos=(pos + 1) * -1;
      pos--;
      if (pos == -1)       pos=0;
      if (pos > 0) {
        System.arraycopy(rowBuffer,1,rowBuffer,0,pos);
      }
    }
    rowBuffer[pos]=mValueIndex;
    mValueIndex=reObj;
  }
  return value;
}
Program: 66839
Project: 66839
Buggy source:
/** 
 * @return
 * @throws IOException
 */
public Object pop() throws IOException {
  if (popBuffer == null) {
    initPop();
  }
  if (popBufferSize == 0) {
    return null;
  }
  ValueIndex reObj=popBuffer[0];
  Object reValue=reObj.value;
  Object readValue=readNext(reObj.index);
  if (readValue == null) {
    popBufferSize--;
    if (popBufferSize > 0) {
      System.arraycopy(popBuffer,1,popBuffer,0,popBufferSize);
    }
  }
 else {
    int pos=0;
    mValueIndex.value=readValue;
    mValueIndex.index=reObj.index;
    if (popBufferSize > 1) {
      pos=Arrays.binarySearch(popBuffer,mValueIndex);
      if (pos < 0)       pos=(pos + 1) * -1;
      pos--;
      if (pos == -1)       pos=0;
      if (pos > 0) {
        System.arraycopy(popBuffer,1,popBuffer,0,pos);
      }
    }
    popBuffer[pos]=mValueIndex;
    mValueIndex=reObj;
  }
  if (forceDistinct) {
    if (lastPopObject == null) {
      lastPopObject=reValue;
    }
 else {
      if (((Comparable)lastPopObject).compareTo(reValue) == 0) {
        return pop();
      }
    }
  }
  lastPopObject=reValue;
  return reValue;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws IOException
 */
public Object pop() throws IOException {
  if (popBuffer == null) {
    initPop();
  }
  if (popBufferSize == 0) {
    return null;
  }
  ValueIndex reObj=popBuffer[0];
  Object reValue=reObj.value;
  Object readValue=readNext(reObj.index);
  if (readValue == null) {
    popBufferSize--;
    if (popBufferSize > 0) {
      ValueIndex[] tBuffer=new ValueIndex[popBufferSize];
      System.arraycopy(popBuffer,1,tBuffer,0,popBufferSize);
      popBuffer=tBuffer;
    }
  }
 else {
    int pos=0;
    mValueIndex.value=readValue;
    mValueIndex.index=reObj.index;
    if (popBufferSize > 1) {
      pos=Arrays.binarySearch(popBuffer,mValueIndex);
      if (pos < 0)       pos=(pos + 1) * -1;
      pos--;
      if (pos == -1)       pos=0;
      if (pos > 0) {
        System.arraycopy(popBuffer,1,popBuffer,0,pos);
      }
    }
    popBuffer[pos]=mValueIndex;
    mValueIndex=reObj;
  }
  if (forceDistinct) {
    if (lastPopObject == null) {
      lastPopObject=reValue;
    }
 else {
      if (((Comparable)lastPopObject).compareTo(reValue) == 0) {
        return pop();
      }
    }
  }
  lastPopObject=reValue;
  return reValue;
}
Program: 66840
Project: 66840
Buggy source:
/** 
 * @param target
 * @since 2.5.1
 */
protected void copySeriesDefinition(Object target){
  Chart targetCM=context.getModel();
  if (target != null && target instanceof Chart) {
    targetCM=(Chart)target;
  }
  ExtendedItemHandle refHandle=getChartReferenceItemHandle();
  if (refHandle != null) {
    ChartReportItemUtil.copyChartSeriesDefinition(ChartReportItemUtil.getChartFromHandle(refHandle),targetCM);
  }
}

Fixed version (ground truth):
/** 
 * @param target
 * @since 2.5.1
 */
protected void copySeriesDefinition(Object target){
  Chart targetCM=context.getModel();
  if (target != null && target instanceof Chart) {
    targetCM=(Chart)target;
  }
  ExtendedItemHandle refHandle=getChartReferenceItemHandle();
  if (refHandle != null) {
    Chart srcChart=ChartReportItemUtil.getChartFromHandle(refHandle);
    ChartReportItemUtil.copyChartSeriesDefinition(srcChart,targetCM);
    ChartReportItemUtil.copyChartSampleData(srcChart,targetCM);
  }
}
Program: 66841
Project: 66841
Buggy source:
public void setTotalPage(ITextArea totalPage){
  super.setTotalPage(totalPage);
  isTotalPage=true;
  HashMap<Float,PdfTemplate> map=((PDFPageDevice)pageDevice).getTemplateMap();
  if (!map.isEmpty()) {
    float scaleCache=this.scale;
    Iterator<Float> iter=map.keySet().iterator();
    while (iter.hasNext()) {
      Float s=iter.next();
      PdfTemplate template=map.get(s);
      if (template != null) {
        this.scale=s.floatValue();
        drawText(totalPage);
      }
    }
    this.scale=scaleCache;
  }
  isTotalPage=false;
}

Fixed version (ground truth):
public void setTotalPage(ITextArea totalPage){
  super.setTotalPage(totalPage);
  isTotalPage=true;
  HashMap<Float,PdfTemplate> map=((PDFPageDevice)pageDevice).getTemplateMap();
  if (!map.isEmpty()) {
    float scaleCache=this.scale;
    for (    Entry<Float,PdfTemplate> e : map.entrySet()) {
      Float s=e.getKey();
      PdfTemplate template=e.getValue();
      if (template != null) {
        this.scale=s.floatValue();
        drawText(totalPage);
      }
    }
    this.scale=scaleCache;
  }
  isTotalPage=false;
}
Program: 66842
Project: 66842
Buggy source:
/** 
 * checks if the name is duplicate
 * @return Returns true if the name is duplicate,and false if it isduplicate
 */
private boolean isDuplicateName(){
  String name=nameEditor.getText().trim();
  return !name.equals(originalName) && Utility.checkDataSetName(name);
}

Fixed version (ground truth):
/** 
 * checks if the name is duplicate
 * @return Returns true if the name is duplicate,and false if it isduplicate
 */
private boolean isDuplicateName(){
  String name=nameEditor.getText().trim();
  return Utility.checkDataSetName(name);
}
Program: 66843
Project: 66843
Buggy source:
/** 
 */
private void populateDataTypeComboItems(){
  Map<String,String> indexMap=new HashMap<String,String>();
  String[] dataTypeDisplayNames=new String[dataTypes.length];
  for (int i=0; i < dataTypes.length; i++) {
    dataTypeDisplayNames[i]=dataTypes[i].getDisplayName();
    indexMap.put(dataTypeDisplayNames[i],dataTypes[i].getName());
  }
  Arrays.sort(dataTypeDisplayNames);
  cmbDataType.setItems(dataTypeDisplayNames);
  for (int i=0; i < dataTypeDisplayNames.length; i++) {
    String name=(String)indexMap.get(dataTypeDisplayNames[i]);
    cmbDataType.setData(name,new Integer(i));
  }
}

Fixed version (ground truth):
/** 
 */
private void populateDataTypeComboItems(){
  Map<String,String> indexMap=new HashMap<String,String>();
  String[] dataTypeDisplayNames=new String[dataTypes.length];
  for (int i=0; i < dataTypes.length; i++) {
    dataTypeDisplayNames[i]=dataTypes[i].getDisplayName();
    indexMap.put(dataTypeDisplayNames[i],dataTypes[i].getName());
  }
  Arrays.sort(dataTypeDisplayNames);
  cmbDataType.setItems(dataTypeDisplayNames);
  for (int i=0; i < dataTypeDisplayNames.length; i++) {
    String name=(String)indexMap.get(dataTypeDisplayNames[i]);
    cmbDataType.setData(name,Integer.valueOf(i));
  }
}
Program: 66844
Project: 66844
Buggy source:
/** 
 * Update the computed columns after removing an established one and cache the updated DataSetViewData[]
 */
private void updateColumnsOfDataSetHandle(){
  DataSetHandle dataSet=((DataSetEditor)getContainer()).getHandle();
  DataSetViewData[] items=DataSetProvider.getCurrentInstance().getColumns(dataSet,false,true,true);
  int inexistence=0;
  for (int i=0; i < items.length; i++) {
    boolean exist=false;
    if (items[i].isComputedColumn()) {
      Iterator iter=computedColumns.iterator();
      while (iter.hasNext()) {
        ComputedColumn computedColumn=null;
        Object obj=iter.next();
        if (obj instanceof ComputedColumnHandle) {
          computedColumn=(ComputedColumn)((ComputedColumnHandle)obj).getStructure();
        }
        if (items[i].getName().equals(computedColumn.getName())) {
          exist=true;
        }
      }
      if (!exist) {
        items[i]=null;
        inexistence++;
      }
    }
  }
  if (inexistence == 0)   return;
  DataSetViewData[] existItems=new DataSetViewData[items.length - inexistence];
  int index=0;
  for (int i=0; i < items.length; i++) {
    if (items[i] != null) {
      existItems[index]=items[i];
      index++;
    }
  }
  DataSetProvider.getCurrentInstance().updateColumnsOfDataSetHandle(dataSet,existItems);
}

Fixed version (ground truth):
/** 
 * Update the computed columns after removing an established one and cache the updated DataSetViewData[]
 */
private void updateColumnsOfDataSetHandle(){
  DataSetHandle dataSet=((DataSetEditor)getContainer()).getHandle();
  DataSetViewData[] items=DataSetProvider.getCurrentInstance().getColumns(dataSet,false,true,true);
  int inexistence=0;
  for (int i=0; i < items.length; i++) {
    boolean exist=false;
    if (items[i].isComputedColumn()) {
      Iterator iter=computedColumns.iterator();
      while (iter.hasNext()) {
        ComputedColumn computedColumn=null;
        Object obj=iter.next();
        if (obj instanceof ComputedColumnHandle) {
          computedColumn=(ComputedColumn)((ComputedColumnHandle)obj).getStructure();
        }
        if (computedColumn != null && items[i].getName().equals(computedColumn.getName())) {
          exist=true;
        }
      }
      if (!exist) {
        items[i]=null;
        inexistence++;
      }
    }
  }
  if (inexistence == 0)   return;
  DataSetViewData[] existItems=new DataSetViewData[items.length - inexistence];
  int index=0;
  for (int i=0; i < items.length; i++) {
    if (items[i] != null) {
      existItems[index]=items[i];
      index++;
    }
  }
  DataSetProvider.getCurrentInstance().updateColumnsOfDataSetHandle(dataSet,existItems);
}
Program: 66845
Project: 66845
Buggy source:
/** 
 * @param parent
 * @param index
 */
private void createAggrListCell(final Composite parent,final int index){
  Label label=ControlProvider.createLabel(parent,dialogLabels[index]);
  this.maxWidth=computeMaxWidth(label);
  cmbAggregation=ControlProvider.createCombo(parent,SWT.READ_ONLY);
  cmbAggregation.setLayoutData(ControlProvider.getGridDataWithHSpan(2));
  cmbAggregation.setVisibleItemCount(30);
  cmbAggregation.add(BLANK);
  cmbAggregation.setData(BLANK,new Integer(0));
  for (int i=0; i < functions.length; i++) {
    cmbAggregation.add(functions[i].getDisplayName());
    cmbAggregation.setData(functions[i].getName(),new Integer(i + 1));
  }
  String aggrFuncName=(String)getProperty(getStructureOrHandle(),cellProperties[index]);
  int selectionIndex=getAggrFuncIndex(aggrFuncName);
  cmbAggregation.select(selectionIndex);
  cmbAggregation.setToolTipText(selectionIndex > 0 ? functions[selectionIndex - 1].getDescription() : BLANK);
  cmbAggregation.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      handleAggrSelectEvent(true);
      validateSyntax();
      updateFilterUIStatus();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * @param parent
 * @param index
 */
private void createAggrListCell(final Composite parent,final int index){
  Label label=ControlProvider.createLabel(parent,dialogLabels[index]);
  this.maxWidth=computeMaxWidth(label);
  cmbAggregation=ControlProvider.createCombo(parent,SWT.READ_ONLY);
  cmbAggregation.setLayoutData(ControlProvider.getGridDataWithHSpan(2));
  cmbAggregation.setVisibleItemCount(30);
  cmbAggregation.add(BLANK);
  cmbAggregation.setData(BLANK,Integer.valueOf(0));
  for (int i=0; i < functions.length; i++) {
    cmbAggregation.add(functions[i].getDisplayName());
    cmbAggregation.setData(functions[i].getName(),Integer.valueOf(i + 1));
  }
  String aggrFuncName=(String)getProperty(getStructureOrHandle(),cellProperties[index]);
  int selectionIndex=getAggrFuncIndex(aggrFuncName);
  cmbAggregation.select(selectionIndex);
  cmbAggregation.setToolTipText(selectionIndex > 0 ? functions[selectionIndex - 1].getDescription() : BLANK);
  cmbAggregation.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      handleAggrSelectEvent(true);
      validateSyntax();
      updateFilterUIStatus();
    }
  }
);
}
Program: 66846
Project: 66846
Buggy source:
protected void okPressed(){
  super.okPressed();
  try {
    DataSetUIUtil.updateColumnCache(this.getHandle(),false);
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
    return;
  }
  if (super.rootNode.hasSubNodes()) {
    PropertyNode[] nodes=rootNode.getSubNodes();
    for (int n=0; n < nodes.length; n++) {
      if (nodes[n].getPage() instanceof DataSetParametersPage) {
        if (viewer == null && viewer.getTree() == null)         return;
        DataSetParametersPage page=(DataSetParametersPage)nodes[n].getPage();
        if (!page.canFinish() && !viewer.getTree().isDisposed()) {
          TreeItem firstNode=viewer.getTree().getItems()[n];
          StructuredSelection select=new StructuredSelection(firstNode.getData());
          viewer.setSelection(select);
          String name=((DataSetParametersPage)nodes[n].getPage()).getNoneValuedParameterName();
          this.setMessage(Messages.getFormattedString("String_Node_Str",new Object[]{name}),IMessageProvider.ERROR);
          return;
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void okPressed(){
  super.okPressed();
  try {
    DataSetUIUtil.updateColumnCache(this.getHandle(),false);
  }
 catch (  Exception e) {
    ExceptionHandler.handle(e);
    return;
  }
  if (super.rootNode.hasSubNodes()) {
    PropertyNode[] nodes=rootNode.getSubNodes();
    for (int n=0; n < nodes.length; n++) {
      if (nodes[n].getPage() instanceof DataSetParametersPage) {
        if (viewer == null || viewer.getTree() == null)         return;
        DataSetParametersPage page=(DataSetParametersPage)nodes[n].getPage();
        if (!page.canFinish() && !viewer.getTree().isDisposed()) {
          TreeItem firstNode=viewer.getTree().getItems()[n];
          StructuredSelection select=new StructuredSelection(firstNode.getData());
          viewer.setSelection(select);
          String name=((DataSetParametersPage)nodes[n].getPage()).getNoneValuedParameterName();
          this.setMessage(Messages.getFormattedString("String_Node_Str",new Object[]{name}),IMessageProvider.ERROR);
          return;
        }
      }
    }
  }
}
Program: 66847
Project: 66847
Buggy source:
private void parsePageSize(IReportContent report){
  SimpleMasterPageDesign masterPage=(SimpleMasterPageDesign)report.getDesign().getPageSetup().getMasterPage(0);
  this.pageWidth=ExcelUtil.convertDimensionType(masterPage.getPageWidth(),0,dpi);
  this.pageHeight=ExcelUtil.convertDimensionType(masterPage.getPageHeight(),0,dpi);
  leftMargin=ExcelUtil.convertDimensionType(masterPage.getLeftMargin(),pageWidth,dpi);
  rightMargin=ExcelUtil.convertDimensionType(masterPage.getRightMargin(),pageWidth,dpi);
  topMargin=ExcelUtil.convertDimensionType(masterPage.getTopMargin(),pageHeight,dpi);
  bottomMargin=ExcelUtil.convertDimensionType(masterPage.getBottomMargin(),pageHeight,dpi);
  this.contentWidth=pageWidth - leftMargin - rightMargin;
}

Fixed version (ground truth):
public void parsePageSize(IPageContent page){
  this.pageWidth=ExcelUtil.convertDimensionType(page.getPageWidth(),0,dpi);
  this.pageHeight=ExcelUtil.convertDimensionType(page.getPageHeight(),0,dpi);
  leftMargin=ExcelUtil.convertDimensionType(page.getMarginLeft(),pageWidth,dpi);
  rightMargin=ExcelUtil.convertDimensionType(page.getMarginRight(),pageWidth,dpi);
  topMargin=ExcelUtil.convertDimensionType(page.getMarginTop(),pageHeight,dpi);
  bottomMargin=ExcelUtil.convertDimensionType(page.getMarginBottom(),pageHeight,dpi);
  this.contentWidth=pageWidth - leftMargin - rightMargin;
}
Program: 66848
Project: 66848
Buggy source:
public void setReport(IReportContent report){
  this.report=report;
  IRenderOption renderOptions=report.getReportContext().getRenderOption();
  Object dpi=renderOptions.getOption(IRenderOption.RENDER_DPI);
  int renderDpi=0;
  if (dpi != null && dpi instanceof Integer) {
    renderDpi=((Integer)dpi).intValue();
  }
  this.dpi=PropertyUtil.getRenderDpi(report,renderDpi);
  Object textWrapping=renderOptions.getOption(IExcelRenderOption.WRAPPING_TEXT);
  if (textWrapping instanceof Boolean) {
    this.wrappingText=((Boolean)textWrapping);
  }
  Object officeVersion=renderOptions.getOption(IExcelRenderOption.OFFICE_VERSION);
  if ("String_Node_Str".equals(officeVersion)) {
    this.officeVersion="String_Node_Str";
  }
  Object hideGridlines=renderOptions.getOption(IExcelRenderOption.HIDE_GRIDLINES);
  if (hideGridlines instanceof Boolean) {
    this.hideGridlines=(Boolean)hideGridlines;
  }
  Object ignoreImage=renderOptions.getOption(IExcelRenderOption.IGNORE_IMAGE);
  if (ignoreImage instanceof Boolean) {
    this.ignoreImage=(Boolean)ignoreImage;
  }
  ReportDesignHandle designHandle=report.getDesign().getReportDesign();
  parseReportOrientation(designHandle);
  parseReportLayout(designHandle);
  parseSheetName(designHandle);
  parsePageSize(report);
}

Fixed version (ground truth):
public void setReport(IReportContent report){
  this.report=report;
  IRenderOption renderOptions=report.getReportContext().getRenderOption();
  Object dpi=renderOptions.getOption(IRenderOption.RENDER_DPI);
  int renderDpi=0;
  if (dpi != null && dpi instanceof Integer) {
    renderDpi=((Integer)dpi).intValue();
  }
  this.dpi=PropertyUtil.getRenderDpi(report,renderDpi);
  Object textWrapping=renderOptions.getOption(IExcelRenderOption.WRAPPING_TEXT);
  if (textWrapping instanceof Boolean) {
    this.wrappingText=((Boolean)textWrapping);
  }
  Object officeVersion=renderOptions.getOption(IExcelRenderOption.OFFICE_VERSION);
  if ("String_Node_Str".equals(officeVersion)) {
    this.officeVersion="String_Node_Str";
  }
  Object hideGridlines=renderOptions.getOption(IExcelRenderOption.HIDE_GRIDLINES);
  if (hideGridlines instanceof Boolean) {
    this.hideGridlines=(Boolean)hideGridlines;
  }
  Object ignoreImage=renderOptions.getOption(IExcelRenderOption.IGNORE_IMAGE);
  if (ignoreImage instanceof Boolean) {
    this.ignoreImage=(Boolean)ignoreImage;
  }
  ReportDesignHandle designHandle=report.getDesign().getReportDesign();
  parseReportOrientation(designHandle);
  parseReportLayout(designHandle);
  parseSheetName(designHandle);
}
Program: 66849
Project: 66849
Buggy source:
public void startPage(IPageContent pageContent) throws BirtException {
  this.pageContent=pageContent;
  if (page == null || context.isEnableMultipleSheet()) {
    newPage();
  }
  page.startPage(pageContent);
  XlsContainer topContainer=containers.peek();
  topContainer.setStyle(StyleBuilder.createStyleEntry(pageContent.getComputedStyle()));
  if (!page.isOutputInMasterPage() && pageContent.getPageHeader() != null) {
    contentVisitor.visitChildren(pageContent.getPageHeader(),null);
  }
}

Fixed version (ground truth):
public void startPage(IPageContent pageContent) throws BirtException {
  if (page == null || context.isEnableMultipleSheet()) {
    initializePage(pageContent);
    newPage();
  }
  page.startPage(pageContent);
  XlsContainer topContainer=containers.peek();
  topContainer.setStyle(StyleBuilder.createStyleEntry(pageContent.getComputedStyle()));
  if (!page.isOutputInMasterPage() && pageContent.getPageHeader() != null) {
    contentVisitor.visitChildren(pageContent.getPageHeader(),null);
  }
}
Program: 66850
Project: 66850
Buggy source:
public void initalize(IStyle style){
  setCacheSize();
  ContainerSizeInfo rule=new ContainerSizeInfo(0,context.getContentWidth());
  engine=new StyleEngine(this);
  containers.push(createContainer(rule,style,null));
  createWriter();
}

Fixed version (ground truth):
public void initalize(IStyle style){
  setCacheSize();
  engine=new StyleEngine(this);
  createWriter();
}
Program: 66851
Project: 66851
Buggy source:
private void outputDataIfBufferIsFull(){
  if (getCurrentContainer().getRowIndex() >= maxRow) {
    outputSheet(page);
    newPage();
    page.startPage(pageContent);
    page.setHeader(null);
  }
}

Fixed version (ground truth):
private void outputDataIfBufferIsFull(){
  if (getCurrentContainer().getRowIndex() >= maxRow) {
    Page lastPage=page;
    outputSheet(page);
    newPage();
    page.startPage(lastPage);
    page.setHeader(null);
  }
}
Program: 66852
Project: 66852
Buggy source:
public static ColumnsInfo createTable(ITableContent table,int width,int dpi){
  int tableWidth=getElementWidth(table,width,dpi);
  int columnCount=table.getColumnCount();
  if (columnCount == 0) {
    return null;
  }
  int[] columns=new int[columnCount];
  int unassignedCount=0;
  int totalAssigned=0;
  for (int i=0; i < columnCount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      columns[i]=-1;
      unassignedCount++;
    }
 else {
      columns[i]=ExcelUtil.convertDimensionType(value,tableWidth,dpi);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth != 0 && unassignedCount == 0 && table.getWidth() != null) {
    int totalResized=0;
    for (int i=0; i < columnCount - 1; i++) {
      columns[i]=resize(columns[i],totalAssigned,leftWidth);
      totalResized+=columns[i];
    }
    columns[columnCount - 1]=tableWidth - totalResized;
  }
 else   if (leftWidth < 0 && unassignedCount > 0) {
    int totalResized=0;
    int lastAssignedIndex=0;
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1) {
        columns[i]=0;
      }
 else {
        columns[i]=resize(columns[i],totalAssigned,leftWidth);
        lastAssignedIndex=i;
      }
      totalResized+=columns[i];
    }
    columns[lastAssignedIndex]+=tableWidth - totalResized;
  }
 else   if (leftWidth >= 0 && unassignedCount > 0) {
    int per=(int)leftWidth / unassignedCount;
    int index=0;
    for (int i=0; i < columns.length; i++) {
      if (columns[i] == -1) {
        columns[i]=per;
        index=i;
      }
    }
    columns[index]=leftWidth - per * (unassignedCount - 1);
  }
  return new ColumnsInfo(columns);
}

Fixed version (ground truth):
public static ColumnsInfo createTable(ITableContent table,int width,int dpi){
  int tableWidth=getElementWidth(table,width,dpi);
  int columnCount=table.getColumnCount();
  if (columnCount == 0) {
    return null;
  }
  int[] columns=new int[columnCount];
  int unassignedCount=0;
  int totalAssigned=0;
  for (int i=0; i < columnCount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      columns[i]=-1;
      unassignedCount++;
    }
 else {
      columns[i]=ExcelUtil.convertDimensionType(value,tableWidth,dpi);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth < 0 && unassignedCount > 0) {
    int totalResized=0;
    int lastAssignedIndex=0;
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1) {
        columns[i]=0;
      }
 else {
        columns[i]=resize(columns[i],totalAssigned,leftWidth);
        lastAssignedIndex=i;
      }
      totalResized+=columns[i];
    }
    columns[lastAssignedIndex]+=tableWidth - totalResized;
  }
 else   if (leftWidth >= 0 && unassignedCount > 0) {
    int per=(int)leftWidth / unassignedCount;
    int index=0;
    for (int i=0; i < columns.length; i++) {
      if (columns[i] == -1) {
        columns[i]=per;
        index=i;
      }
    }
    columns[index]=leftWidth - per * (unassignedCount - 1);
  }
  return new ColumnsInfo(columns);
}
Program: 66853
Project: 66853
Buggy source:
public void startPage(IPageContent pageContent){
  orientation=capitalize(pageContent.getOrientation());
  if (needOutputInMasterPage(pageContent.getPageHeader()) && needOutputInMasterPage(pageContent.getPageFooter())) {
    outputInMasterPage=true;
    header=formatHeaderFooter(pageContent.getPageHeader());
    footer=formatHeaderFooter(pageContent.getPageFooter());
  }
}

Fixed version (ground truth):
public void startPage(Page page){
  orientation=page.orientation;
  outputInMasterPage=page.outputInMasterPage;
  header=page.header;
  footer=page.footer;
}
Program: 66854
Project: 66854
Buggy source:
public static int convertBorderWeight(int width){
  int w=-1;
  if (width >= 749 && width < 1499) {
    w=1;
  }
 else   if (width >= 1499 && width < 2249) {
    w=2;
  }
 else   if (width >= 2249) {
    w=3;
  }
 else {
    w=2;
  }
  return w;
}

Fixed version (ground truth):
public static int convertBorderWeight(int width){
  int w=-1;
  if (width <= 750) {
    w=1;
  }
 else   if (width >= 750 && width <= 2250) {
    w=2;
  }
 else   if (width > 2250) {
    w=3;
  }
 else {
    w=2;
  }
  return w;
}
Program: 66856
Project: 66856
Buggy source:
/** 
 * Test setRenderOption(IRenderOption) method Test getRenderOption() method
 */
public void testGetRenderOption(){
  RenderOptionBase rendop=new RenderOptionBase();
  rendop.setOutputFormat("String_Node_Str");
  rendop.setOutputFileName("String_Node_Str");
  HTMLRenderContext context=new HTMLRenderContext();
  context.SetRenderOption(rendop);
  RenderOptionBase ropb=(RenderOptionBase)(context.getRenderOption());
  assertEquals("String_Node_Str",ropb.getOutputFormat());
  Map outsetting=new HashMap();
  outsetting=ropb.getOutputSetting();
  assertFalse(outsetting.isEmpty());
  assertEquals(2,outsetting.size());
  ropb.getOutputSetting().put(HTMLRenderOption.URL_ENCODING,"String_Node_Str");
  assertEquals(3,outsetting.size());
}

Fixed version (ground truth):
/** 
 * Test setRenderOption(IRenderOption) method Test getRenderOption() method
 */
public void testGetRenderOption(){
  RenderOptionBase rendop=new RenderOptionBase();
  rendop.setOutputFormat("String_Node_Str");
  rendop.setOutputFileName("String_Node_Str");
  HTMLRenderContext context=new HTMLRenderContext();
  context.setRenderOption(rendop);
  RenderOptionBase ropb=(RenderOptionBase)(context.getRenderOption());
  assertEquals("String_Node_Str",ropb.getOutputFormat());
  Map outsetting=new HashMap();
  outsetting=ropb.getOutputSetting();
  assertFalse(outsetting.isEmpty());
  assertEquals(2,outsetting.size());
  ropb.getOutputSetting().put(HTMLRenderOption.URL_ENCODING,"String_Node_Str");
  assertEquals(3,outsetting.size());
}
Program: 66857
Project: 66857
Buggy source:
public IRenderOption getPreferredRenderOption(){
  EXCELRenderOption renderOption=new EXCELRenderOption();
  renderOption.setEmitterID(getID());
  renderOption.setOutputFormat("String_Node_Str");
  if (values != null && values.length > 0) {
    for (    IOptionValue optionValue : values) {
      if (optionValue != null) {
        renderOption.setOption(getRenderOptionName(optionValue.getName()),optionValue.getValue());
      }
    }
  }
  return renderOption;
}

Fixed version (ground truth):
public IRenderOption getPreferredRenderOption(){
  EXCELRenderOption renderOption=new EXCELRenderOption();
  renderOption.setEmitterID(getID());
  renderOption.setOutputFormat("String_Node_Str");
  if (values != null && values.length > 0) {
    for (    IOptionValue optionValue : values) {
      if (optionValue != null) {
        renderOption.setOption(optionValue.getName(),optionValue.getValue());
      }
    }
  }
  return renderOption;
}
Program: 66858
Project: 66858
Buggy source:
protected ConfigurableOption initializeWrappingText(){
  ConfigurableOption wrappingText=new ConfigurableOption(TEXT_WRAPPING);
  wrappingText.setDisplayName(getMessage("String_Node_Str"));
  wrappingText.setDataType(IConfigurableOption.DataType.BOOLEAN);
  wrappingText.setDisplayType(IConfigurableOption.DisplayType.CHECKBOX);
  wrappingText.setDefaultValue(Boolean.TRUE);
  wrappingText.setToolTip(null);
  wrappingText.setDescription(getMessage("String_Node_Str"));
  return wrappingText;
}

Fixed version (ground truth):
protected ConfigurableOption initializeWrappingText(){
  ConfigurableOption wrappingText=new ConfigurableOption(WRAPPING_TEXT);
  wrappingText.setDisplayName(getMessage("String_Node_Str"));
  wrappingText.setDataType(IConfigurableOption.DataType.BOOLEAN);
  wrappingText.setDisplayType(IConfigurableOption.DisplayType.CHECKBOX);
  wrappingText.setDefaultValue(Boolean.TRUE);
  wrappingText.setToolTip(null);
  wrappingText.setDescription(getMessage("String_Node_Str"));
  return wrappingText;
}