nus-yam/ex-repair huggingface dataset:
Program: 70931
Project: 70931
Buggy source:
/** 
 * @param mode
 * @param scope
 * @param reader
 * @param writer
 * @throws BirtException
 */
private DataEngineContext(int mode,Scriptable scope,IDocArchiveReader reader,IDocArchiveWriter writer,ClassLoader classLoader) throws BirtException {
  Object[] params={new Integer(mode),scope,reader,writer,classLoader};
  logger.entering(DataEngineContext.class.getName(),"String_Node_Str",params);
  if (!(mode == MODE_GENERATION || mode == MODE_PRESENTATION || mode == DIRECT_PRESENTATION || mode == MODE_UPDATE))   throw new DataException(ResourceConstants.RD_INVALID_MODE);
  if (writer == null && mode == MODE_GENERATION)   throw new DataException(ResourceConstants.RD_INVALID_ARCHIVE);
  if (reader == null && mode == MODE_PRESENTATION)   throw new DataException(ResourceConstants.RD_INVALID_ARCHIVE);
  if (reader == null && mode == MODE_UPDATE)   throw new DataException(ResourceConstants.RD_INVALID_ARCHIVE);
  this.classLoader=classLoader;
  this.mode=mode;
  this.scope=scope;
  this.reader=reader;
  this.writer=writer;
  this.cacheOption=CACHE_USE_DEFAULT;
  logger.exiting(DataEngineContext.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param mode
 * @param scope
 * @param reader
 * @param writer
 * @throws BirtException
 */
private DataEngineContext(int mode,Scriptable scope,IDocArchiveReader reader,IDocArchiveWriter writer,ClassLoader classLoader,ScriptContext context) throws BirtException {
  Object[] params={new Integer(mode),scope,reader,writer,classLoader};
  logger.entering(DataEngineContext.class.getName(),"String_Node_Str",params);
  if (!(mode == MODE_GENERATION || mode == MODE_PRESENTATION || mode == DIRECT_PRESENTATION || mode == MODE_UPDATE))   throw new DataException(ResourceConstants.RD_INVALID_MODE);
  if (writer == null && mode == MODE_GENERATION)   throw new DataException(ResourceConstants.RD_INVALID_ARCHIVE);
  if (reader == null && mode == MODE_PRESENTATION)   throw new DataException(ResourceConstants.RD_INVALID_ARCHIVE);
  if (reader == null && mode == MODE_UPDATE)   throw new DataException(ResourceConstants.RD_INVALID_ARCHIVE);
  this.classLoader=classLoader;
  this.mode=mode;
  this.scope=newSubScope(scope,context);
  this.reader=reader;
  this.writer=writer;
  this.cacheOption=CACHE_USE_DEFAULT;
  this.scriptContext=context;
  logger.exiting(DataEngineContext.class.getName(),"String_Node_Str");
}
Program: 70932
Project: 70932
Buggy source:
/** 
 * @param locale The current task's locale
 */
public void setLocale(Locale locale){
  currentLocale=ULocale.forLocale(locale);
  DataException.setLocale(currentLocale);
}

Fixed version (ground truth):
/** 
 * @param locale The current task's locale
 */
public void setLocale(Locale locale){
  currentLocale=ULocale.forLocale(locale);
  propertyMap.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE,currentLocale);
  DataException.setLocale(currentLocale);
}
Program: 70933
Project: 70933
Buggy source:
/** 
 * Creates a subscope within parent scope
 * @param parentAndProtoScope parent scope. If null, the shared top-level scope is used as parent
 */
private Scriptable newSubScope(Scriptable parentAndProtoScope){
  if (parentAndProtoScope == null)   parentAndProtoScope=sharedScope;
  Scriptable scope=session.getEngineContext().getScriptContext().getContext().newObject(parentAndProtoScope);
  scope.setParentScope(parentAndProtoScope);
  scope.setPrototype(parentAndProtoScope);
  if (parentAndProtoScope.get(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCITON_BEAN_NAME,parentAndProtoScope) == org.mozilla.javascript.UniqueTag.NOT_FOUND) {
    final Map<String,Object> propertyMap=new HashMap<String,Object>();
    propertyMap.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE,session.getEngineContext().getLocale());
    IScriptFunctionContext functionContext=new IScriptFunctionContext(){
      public Object findProperty(      String name){
        return propertyMap.get(name);
      }
    }
;
    Object sObj=Context.javaToJS(functionContext,scope);
    scope.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCITON_BEAN_NAME,scope,sObj);
  }
 else {
    final IScriptFunctionContext context=(IScriptFunctionContext)Context.jsToJava(parentAndProtoScope.get(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCITON_BEAN_NAME,parentAndProtoScope),IScriptFunctionContext.class);
    final Map<String,Object> propertyMap=new HashMap<String,Object>();
    propertyMap.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE,session.getEngineContext().getLocale());
    IScriptFunctionContext functionContext=new IScriptFunctionContext(){
      public Object findProperty(      String name){
        if (context.findProperty(name) != null)         return context.findProperty(name);
        return propertyMap.get(name);
      }
    }
;
    Object sObj=Context.javaToJS(functionContext,scope);
    scope.put(org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.FUNCITON_BEAN_NAME,scope,sObj);
  }
  return scope;
}

Fixed version (ground truth):
/** 
 * Creates a subscope within parent scope
 * @param parentAndProtoScope parent scope. If null, the shared top-level scope is used as parent
 */
private Scriptable newSubScope(Scriptable parentAndProtoScope){
  if (parentAndProtoScope == null)   parentAndProtoScope=sharedScope;
  Scriptable scope=session.getEngineContext().getScriptContext().getContext().newObject(parentAndProtoScope);
  scope.setParentScope(parentAndProtoScope);
  scope.setPrototype(parentAndProtoScope);
  return scope;
}
Program: 70934
Project: 70934
Buggy source:
protected String[] getDataSetColumns(){
  if (columnList.isEmpty()) {
    return EMPTY;
  }
  String[] values=new String[columnList.size()];
  for (int i=0; i < columnList.size(); i++) {
    values[i]=((ComputedColumnHandle)columnList.get(i)).getName();
  }
  return values;
}

Fixed version (ground truth):
protected String[] getDataSetColumns(){
  if (columnList.isEmpty()) {
    return EMPTY;
  }
  List<String> valueList=new ArrayList<String>();
  for (int i=0; i < columnList.size(); i++) {
    ComputedColumnHandle columnHandle=((ComputedColumnHandle)columnList.get(i));
    if (columnHandle.getAggregateFunction() == null)     valueList.add(columnHandle.getName());
  }
  return valueList.toArray(new String[valueList.size()]);
}
Program: 70938
Project: 70938
Buggy source:
public void end(IReportContent report){
  engine.complete();
  if (writer == null) {
    writer=new ExcelWriter(out,context,isRTLSheet,pageHeader,pageFooter,orientation,engine);
  }
  try {
    writer.start(report);
    writer.outputCacheData();
    writer.end();
  }
 catch (  IOException e) {
    logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public void end(IReportContent report){
  engine.cacheBookmarks(sheetIndex);
  engine.complete();
  try {
    writer.start(report,engine.getStyleMap(),engine.getAllBookmarks());
    outputCacheData();
    writer.end();
  }
 catch (  IOException e) {
    logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
}
Program: 70939
Project: 70939
Buggy source:
public void start(IReportContent report){
  setupRenderOptions();
  String reportOrientation=report.getDesign().getReportDesign().getBidiOrientation();
  if ("String_Node_Str".equalsIgnoreCase(reportOrientation))   isRTLSheet=true;
  IStyle style=report.getRoot().getComputedStyle();
  SimpleMasterPageDesign master=(SimpleMasterPageDesign)report.getDesign().getPageSetup().getMasterPage(0);
  engine=new ExcelLayoutEngine(new PageDef(master,style),context,this);
}

Fixed version (ground truth):
public void start(IReportContent report){
  setupRenderOptions();
  String reportOrientation=report.getDesign().getReportDesign().getBidiOrientation();
  if ("String_Node_Str".equalsIgnoreCase(reportOrientation))   isRTLSheet=true;
  IStyle style=report.getRoot().getComputedStyle();
  SimpleMasterPageDesign master=(SimpleMasterPageDesign)report.getDesign().getPageSetup().getMasterPage(0);
  engine=new ExcelLayoutEngine(new PageDef(master,style),context,this);
  createWriter();
}
Program: 70940
Project: 70940
Buggy source:
public void outputSheet(){
  if (writer == null)   writer=new ExcelWriter(out,context,isRTLSheet,pageHeader,pageFooter,orientation,engine);
  try {
    writer.outputSheet();
  }
 catch (  IOException e) {
    logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
public void outputSheet(){
  engine.cacheBookmarks(sheetIndex);
  engine.complete();
  try {
    outputCacheData();
  }
 catch (  IOException e) {
    logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
  sheetIndex++;
}
Program: 70941
Project: 70941
Buggy source:
public HyperlinkDef parseHyperLink(IContent content){
  HyperlinkDef hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
    IReportRunnable reportRunnable=service.getReportRunnable();
    IReportContext reportContext=service.getReportContext();
    IHTMLActionHandler actionHandler=(IHTMLActionHandler)service.getOption(RenderOption.ACTION_HANDLER);
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      hyperlink=new HyperlinkDef(bookmark,IHyperlinkAction.ACTION_BOOKMARK,null,tooltip);
    break;
case IHyperlinkAction.ACTION_HYPERLINK:
  String url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_HYPERLINK,null,tooltip);
break;
case IHyperlinkAction.ACTION_DRILLTHROUGH:
url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_DRILLTHROUGH,null,tooltip);
break;
}
}
return hyperlink;
}

Fixed version (ground truth):
public HyperlinkDef parseHyperLink(IContent content){
  HyperlinkDef hyperlink=null;
  IHyperlinkAction linkAction=content.getHyperlinkAction();
  if (linkAction != null) {
    String tooltip=linkAction.getTooltip();
    String bookmark=linkAction.getBookmark();
    IReportRunnable reportRunnable=service.getReportRunnable();
    IReportContext reportContext=service.getReportContext();
    IHTMLActionHandler actionHandler=(IHTMLActionHandler)service.getOption(RenderOption.ACTION_HANDLER);
switch (linkAction.getType()) {
case IHyperlinkAction.ACTION_BOOKMARK:
      hyperlink=new HyperlinkDef(bookmark,IHyperlinkAction.ACTION_BOOKMARK,tooltip);
    break;
case IHyperlinkAction.ACTION_HYPERLINK:
  String url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_HYPERLINK,tooltip);
break;
case IHyperlinkAction.ACTION_DRILLTHROUGH:
url=org.eclipse.birt.report.engine.layout.emitter.EmitterUtil.getHyperlinkUrl(linkAction,reportRunnable,actionHandler,reportContext);
hyperlink=new HyperlinkDef(url,IHyperlinkAction.ACTION_DRILLTHROUGH,tooltip);
break;
}
}
return hyperlink;
}
Program: 70942
Project: 70942
Buggy source:
/** 
 * @param dataSet
 * @return
 */
private Scriptable getScriptScope(IDataSetInstanceHandle dataSet){
  Scriptable shared=this.context.getSharedScope();
  Scriptable scope=(Scriptable)Context.javaToJS(new DataSetInstance(dataSet),shared);
  scope.setParentScope(shared);
  scope.setPrototype(shared);
  return scope;
}

Fixed version (ground truth):
/** 
 * @param dataSet
 * @return
 */
private Scriptable getScriptScope(IDataSetInstanceHandle dataSet){
  Scriptable shared=this.context.getSharedScope();
  Scriptable scope=(Scriptable)Context.javaToJS(new DataSetInstance(dataSet),shared);
  scope.setParentScope(shared);
  scope.setPrototype(dataSet.getScriptScope());
  return scope;
}
Program: 70943
Project: 70943
Buggy source:
/** 
 * Returns a timestamp value which is midnight of the current date.
 * @return
 */
private static Timestamp today(){
  Calendar c=Calendar.getInstance();
  return new Timestamp(c.getTimeInMillis());
}

Fixed version (ground truth):
/** 
 * Returns a timestamp value which is midnight of the current date.
 * @return
 */
private static Date today(){
  Calendar c=Calendar.getInstance();
  return c.getTime();
}
Program: 70945
Project: 70945
Buggy source:
/** 
 * Flush cached plane shadows.
 * @param _idr
 * @param planeShadows
 * @throws ChartException
 * @since 2.2.1
 */
static void flushPlaneShadows(IDeviceRenderer _idr,List planeShadows,Comparator<?> cp) throws ChartException {
  if (_idr == null || planeShadows == null) {
    return;
  }
  IRenderInstruction wi;
  if (cp != null) {
    Collections.sort(planeShadows,cp);
  }
 else {
    Collections.sort(planeShadows);
  }
  for (int i=0; i < planeShadows.size(); i++) {
    wi=(IRenderInstruction)planeShadows.get(i);
    if (wi.isModel()) {
      List al=wi.getModel();
      for (int j=0; j < al.size(); j++) {
        PrimitiveRenderEvent pre=(PrimitiveRenderEvent)al.get(j);
        pre.fill(_idr);
        pre.draw(_idr);
      }
    }
 else {
      wi.getEvent().iObjIndex=i + 1;
switch (wi.getInstruction()) {
case PrimitiveRenderEvent.FILL | PrimitiveRenderEvent.DRAW:
        wi.getEvent().fill(_idr);
      wi.getEvent().draw(_idr);
    break;
case PrimitiveRenderEvent.FILL:
  wi.getEvent().fill(_idr);
break;
case PrimitiveRenderEvent.DRAW:
wi.getEvent().draw(_idr);
break;
}
}
}
planeShadows.clear();
}

Fixed version (ground truth):
/** 
 * Flush cached plane shadows.
 * @param _idr
 * @param planeShadows
 * @throws ChartException
 * @since 2.2.1
 */
static void flushPlaneShadows(IDeviceRenderer _idr,List planeShadows,Comparator cp) throws ChartException {
  if (_idr == null || planeShadows == null) {
    return;
  }
  IRenderInstruction wi;
  if (cp != null) {
    Collections.sort(planeShadows,cp);
  }
 else {
    Collections.sort(planeShadows);
  }
  for (int i=0; i < planeShadows.size(); i++) {
    wi=(IRenderInstruction)planeShadows.get(i);
    if (wi.isModel()) {
      List al=wi.getModel();
      for (int j=0; j < al.size(); j++) {
        PrimitiveRenderEvent pre=(PrimitiveRenderEvent)al.get(j);
        pre.fill(_idr);
        pre.draw(_idr);
      }
    }
 else {
      wi.getEvent().iObjIndex=i + 1;
switch (wi.getInstruction()) {
case PrimitiveRenderEvent.FILL | PrimitiveRenderEvent.DRAW:
        wi.getEvent().fill(_idr);
      wi.getEvent().draw(_idr);
    break;
case PrimitiveRenderEvent.FILL:
  wi.getEvent().fill(_idr);
break;
case PrimitiveRenderEvent.DRAW:
wi.getEvent().draw(_idr);
break;
}
}
}
planeShadows.clear();
}
Program: 70946
Project: 70946
Buggy source:
/** 
 * Flush cached planes.
 * @param _idr
 * @param planes
 * @throws ChartException
 * @since 2.2.1
 */
static void flushPlanes(IDeviceRenderer _idr,List planes,Comparator<?> cp) throws ChartException {
  if (_idr == null || planes == null) {
    return;
  }
  IRenderInstruction wi;
  if (cp != null) {
    Collections.sort(planes,cp);
  }
 else {
    Collections.sort(planes);
  }
  for (int i=0; i < planes.size(); i++) {
    wi=(IRenderInstruction)planes.get(i);
    if (wi.isModel()) {
      List al=wi.getModel();
      for (int j=0; j < al.size(); j++) {
        PrimitiveRenderEvent pre=(PrimitiveRenderEvent)al.get(j);
        pre.fill(_idr);
        pre.draw(_idr);
      }
    }
 else {
      wi.getEvent().iObjIndex=i + 1;
switch (wi.getInstruction()) {
case PrimitiveRenderEvent.FILL | PrimitiveRenderEvent.DRAW:
        wi.getEvent().fill(_idr);
      wi.getEvent().draw(_idr);
    break;
case PrimitiveRenderEvent.FILL:
  wi.getEvent().fill(_idr);
break;
case PrimitiveRenderEvent.DRAW:
wi.getEvent().draw(_idr);
break;
}
}
}
planes.clear();
}

Fixed version (ground truth):
/** 
 * Flush cached planes.
 * @param _idr
 * @param planes
 * @throws ChartException
 * @since 2.2.1
 */
static void flushPlanes(IDeviceRenderer _idr,List planes,Comparator cp) throws ChartException {
  if (_idr == null || planes == null) {
    return;
  }
  IRenderInstruction wi;
  if (cp != null) {
    Collections.sort(planes,cp);
  }
 else {
    Collections.sort(planes);
  }
  for (int i=0; i < planes.size(); i++) {
    wi=(IRenderInstruction)planes.get(i);
    if (wi.isModel()) {
      List al=wi.getModel();
      for (int j=0; j < al.size(); j++) {
        PrimitiveRenderEvent pre=(PrimitiveRenderEvent)al.get(j);
        pre.fill(_idr);
        pre.draw(_idr);
      }
    }
 else {
      wi.getEvent().iObjIndex=i + 1;
switch (wi.getInstruction()) {
case PrimitiveRenderEvent.FILL | PrimitiveRenderEvent.DRAW:
        wi.getEvent().fill(_idr);
      wi.getEvent().draw(_idr);
    break;
case PrimitiveRenderEvent.FILL:
  wi.getEvent().fill(_idr);
break;
case PrimitiveRenderEvent.DRAW:
wi.getEvent().draw(_idr);
break;
}
}
}
planes.clear();
}
Program: 70947
Project: 70947
Buggy source:
/** 
 * Get the connection with SWING device to render the graphics.
 */
SwingInteractivityViewer(){
  final PluginSettings ps=PluginSettings.instance();
  try {
    idr=ps.getDevice("String_Node_Str");
  }
 catch (  ChartException ex) {
    ex.printStackTrace();
  }
  cm=InteractivityCharts.createHSChart();
}

Fixed version (ground truth):
/** 
 * Get the connection with SWING device to render the graphics.
 */
SwingInteractivityViewer(){
  PlatformConfig config=new PlatformConfig();
  config.setProperty("String_Node_Str","String_Node_Str");
  final PluginSettings ps=PluginSettings.instance(config);
  try {
    idr=ps.getDevice("String_Node_Str");
  }
 catch (  ChartException ex) {
    ex.printStackTrace();
  }
  cm=InteractivityCharts.createHSChart();
}
Program: 70948
Project: 70948
Buggy source:
/** 
 * Get the connection with SWT device to render the graphics.
 */
SwtInteractivityViewer(Composite parent,int style){
  super(parent,style);
  final PluginSettings ps=PluginSettings.instance();
  try {
    idr=ps.getDevice("String_Node_Str");
    idr.setProperty(IDeviceRenderer.UPDATE_NOTIFIER,this);
  }
 catch (  ChartException ex) {
    ex.printStackTrace();
  }
  cm=InteractivityCharts.createHSChart();
}

Fixed version (ground truth):
/** 
 * Get the connection with SWT device to render the graphics.
 */
SwtInteractivityViewer(Composite parent,int style){
  super(parent,style);
  PlatformConfig config=new PlatformConfig();
  config.setProperty("String_Node_Str","String_Node_Str");
  final PluginSettings ps=PluginSettings.instance(config);
  try {
    idr=ps.getDevice("String_Node_Str");
    idr.setProperty(IDeviceRenderer.UPDATE_NOTIFIER,this);
  }
 catch (  ChartException ex) {
    ex.printStackTrace();
  }
  cm=InteractivityCharts.createHSChart();
}
Program: 70951
Project: 70951
Buggy source:
public final int getSeriesCount(Axis ax){
  final ArrayList<StackGroup> alSG=htAxisToStackGroups.get(ax);
  if (alSG == null || alSG.isEmpty()) {
    return 0;
  }
  int iCount=0;
  StackGroup sg;
  for (int i=0; i < alSG.size(); i++) {
    sg=alSG.get(i);
    iCount+=sg.alSeries.size();
  }
  return iCount;
}

Fixed version (ground truth):
public final int getSeriesCount(Axis ax){
  final List<StackGroup> alSG=htAxisToStackGroups.get(ax);
  if (alSG == null || alSG.isEmpty()) {
    return 0;
  }
  int iCount=0;
  StackGroup sg;
  for (int i=0; i < alSG.size(); i++) {
    sg=alSG.get(i);
    iCount+=sg.alSeries.size();
  }
  return iCount;
}
Program: 70952
Project: 70952
Buggy source:
public final ArrayList<StackGroup> getStackGroups(Axis ax){
  return htAxisToStackGroups.get(ax);
}

Fixed version (ground truth):
public final List<StackGroup> getStackGroups(Axis ax){
  return htAxisToStackGroups.get(ax);
}
Program: 70954
Project: 70954
Buggy source:
public static TableInfo createTable(ITableContent table,int width){
  width=getElementWidth(table,width);
  int colcount=table.getColumnCount();
  if (colcount == 0) {
    return null;
  }
  int[] index=new int[colcount];
  int know=0;
  List unmount=new ArrayList();
  for (int i=0; i < colcount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      unmount.add(new Integer(i));
    }
 else {
      try {
        index[i]=ExcelUtil.covertDimensionType(value,width);
        know+=index[i];
      }
 catch (      IllegalArgumentException ex) {
        unmount.add(new Integer(i));
      }
    }
  }
  int left=width - know;
  if (left > 0 && unmount.size() == 0) {
    index[index.length - 1]=index[index.length - 1] + left;
    return new DefaultTableInfo(index);
  }
 else   if (left < 0) {
    return new DefaultTableInfo(split(width,colcount));
  }
 else   if (left > 0 && unmount.size() > 0) {
    int[] size=split(left,unmount.size());
    Iterator iter=unmount.iterator();
    int i=0;
    while (iter.hasNext()) {
      int pos=((Integer)iter.next()).intValue();
      index[pos]=size[i];
      i++;
    }
    return new DefaultTableInfo(index);
  }
 else {
    return new DefaultTableInfo(index);
  }
}

Fixed version (ground truth):
public static TableInfo createTable(ITableContent table,int width){
  int tableWidth=getElementWidth(table,width);
  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.covertDimensionType(value,tableWidth);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth != 0 && unassignedCount == 0) {
    for (int i=0; i < columnCount; i++) {
      columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth < 0 && unassignedCount > 0) {
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1)       columns[1]=0;
 else       columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 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 DefaultTableInfo(columns);
}
Program: 70955
Project: 70955
Buggy source:
private void startCell(int cellindex,int colspan,int rowspan,int styleid,HyperlinkDef hyperLink,BookmarkDef linkedBookmark){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",cellindex);
  writer.attribute("String_Node_Str",styleid);
  if (hyperLink != null) {
    String urlAddress=hyperLink.getUrl();
    if (hyperLink.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      if (linkedBookmark != null)       urlAddress="String_Node_Str" + linkedBookmark.getValidName();
 else {
        logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      }
    }
    if (urlAddress.length() >= 255) {
      logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      urlAddress=urlAddress.substring(0,254);
    }
    writer.attribute("String_Node_Str",urlAddress);
    writer.attribute("String_Node_Str",colspan);
    writer.attribute("String_Node_Str",rowspan);
  }
}

Fixed version (ground truth):
private void startCell(int cellindex,int colspan,int rowspan,int styleid,HyperlinkDef hyperLink,BookmarkDef linkedBookmark){
  writer.openTag("String_Node_Str");
  writer.attribute("String_Node_Str",cellindex);
  writer.attribute("String_Node_Str",styleid);
  if (hyperLink != null) {
    String urlAddress=hyperLink.getUrl();
    if (hyperLink.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      if (linkedBookmark != null)       urlAddress="String_Node_Str" + linkedBookmark.getValidName();
 else {
        logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      }
    }
    if (urlAddress.length() >= 255) {
      logger.log(Level.WARNING,"String_Node_Str" + urlAddress + "String_Node_Str");
      urlAddress=urlAddress.substring(0,254);
    }
    writer.attribute("String_Node_Str",urlAddress);
  }
  writer.attribute("String_Node_Str",colspan);
  writer.attribute("String_Node_Str",rowspan);
}
Program: 70956
Project: 70956
Buggy source:
private int[] calculateColumnCoordinates(TableInfo table,int startCoordinate,int endCoordinate){
  XlsContainer currentContainer=getCurrentContainer();
  int columnCount=table.getColumnCount();
  int[] columnStartCoordinates=new int[columnCount + 1];
  if (isRightAligned(currentContainer)) {
    columnStartCoordinates[columnCount]=endCoordinate;
    for (int i=columnCount - 1; i >= 0; i--) {
      columnStartCoordinates[i]=columnStartCoordinates[i + 1] - table.getColumnWidth(i);
    }
  }
 else {
    columnStartCoordinates[0]=startCoordinate;
    for (int i=1; i <= columnCount; i++) {
      columnStartCoordinates[i]=columnStartCoordinates[i - 1] + table.getColumnWidth(i - 1);
    }
  }
  return columnStartCoordinates;
}

Fixed version (ground truth):
private int[] calculateColumnCoordinates(TableInfo table,int startCoordinate,int endCoordinate){
  int columnCount=table.getColumnCount();
  int[] columnStartCoordinates=new int[columnCount + 1];
  columnStartCoordinates[0]=startCoordinate;
  for (int i=1; i <= columnCount; i++) {
    columnStartCoordinates[i]=columnStartCoordinates[i - 1] + table.getColumnWidth(i - 1);
  }
  return columnStartCoordinates;
}
Program: 70957
Project: 70957
Buggy source:
public boolean next() throws BirtException {
  checkStarted();
  if (this.columnValueMap == null)   return false;
  if (lastRowIndex < currRowIndex) {
    currRowIndex++;
    readCurrentRow();
  }
 else {
    lastRowIndex=currRowIndex - 1;
  }
  return this.columnValueMap != null && this.columnValueMap.size() > 0;
}

Fixed version (ground truth):
public boolean next() throws BirtException {
  if (!existCachedFile) {
    return false;
  }
  checkStarted();
  if (this.columnValueMap == null)   return false;
  if (lastRowIndex < currRowIndex) {
    currRowIndex++;
    readCurrentRow();
  }
 else {
    lastRowIndex=currRowIndex - 1;
  }
  return this.columnValueMap != null && this.columnValueMap.size() > 0;
}
Program: 70958
Project: 70958
Buggy source:
/** 
 * @param context
 * @param queryResultID
 * @throws DataException
 */
public CacheResultIterator(String tempDir,IQueryResults queryResults) throws DataException {
  Object[] params={tempDir,queryResults.getID()};
  logger.entering(CacheResultIterator.class.getName(),"String_Node_Str",params);
  this.columnValueMap=new HashMap();
  this.currRowIndex=-1;
  this.lastRowIndex=this.currRowIndex - 1;
  this.queryResults=queryResults;
  try {
    createCacheInputStream(tempDir);
    resultClass=new ResultClass(this.metaInputStream);
    rowCount=IOUtil.readInt(rowInputStream);
    if (rowCount == -1)     rowCount=Integer.MAX_VALUE;
    int columnSize=IOUtil.readInt(rowInputStream);
    columnList=new ArrayList();
    for (int i=0; i < columnSize; i++) {
      columnList.add(IOUtil.readObject(rowInputStream,DataEngineSession.getCurrentClassLoader()));
    }
    logger.exiting(CacheResultIterator.class.getName(),"String_Node_Str");
  }
 catch (  FileNotFoundException e) {
    throw new DataException(ResourceConstants.OPEN_CACHE_TEMPFILE_ERROR);
  }
catch (  IOException e) {
    throw new DataException(ResourceConstants.READ_CACHE_TEMPFILE_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * @param context
 * @param queryResultID
 * @throws DataException
 */
public CacheResultIterator(String tempDir,IQueryResults queryResults) throws DataException {
  Object[] params={tempDir,queryResults.getID()};
  logger.entering(CacheResultIterator.class.getName(),"String_Node_Str",params);
  this.columnValueMap=new HashMap();
  this.currRowIndex=-1;
  this.lastRowIndex=this.currRowIndex - 1;
  this.queryResults=queryResults;
  try {
    createCacheInputStream(tempDir);
    resultClass=new ResultClass(this.metaInputStream);
    rowCount=IOUtil.readInt(rowInputStream);
    if (rowCount == -1)     rowCount=Integer.MAX_VALUE;
    int columnSize=IOUtil.readInt(rowInputStream);
    columnList=new ArrayList();
    for (int i=0; i < columnSize; i++) {
      columnList.add(IOUtil.readObject(rowInputStream,DataEngineSession.getCurrentClassLoader()));
    }
    logger.exiting(CacheResultIterator.class.getName(),"String_Node_Str");
  }
 catch (  FileNotFoundException e) {
    existCachedFile=false;
  }
catch (  IOException e) {
    throw new DataException(ResourceConstants.READ_CACHE_TEMPFILE_ERROR);
  }
}
Program: 70959
Project: 70959
Buggy source:
public Object getValue(String name) throws BirtException {
  if (isBeforeFirst()) {
    this.next();
    this.lastRowIndex=this.currRowIndex;
  }
  return columnValueMap.get(name);
}

Fixed version (ground truth):
public Object getValue(String name) throws BirtException {
  if (!existCachedFile) {
    return null;
  }
  if (isBeforeFirst()) {
    this.next();
    this.lastRowIndex=this.currRowIndex;
  }
  return columnValueMap.get(name);
}
Program: 70960
Project: 70960
Buggy source:
public ConcreteImageLayout(LayoutEngineContext context,ContainerLayout parentContext,IContent content,Image imageObject){
  super(context,parentContext,content);
  this.imageObject=imageObject;
  ImageItemDesign imageDesign=(ImageItemDesign)content.getGenerateBy();
  if (null != imageDesign) {
    fitToContainer=imageDesign.isFitToContainer();
  }
}

Fixed version (ground truth):
public ConcreteImageLayout(LayoutEngineContext context,ContainerLayout parentContext,IContent content,Image imageObject){
  super(context,parentContext,content);
  this.imageObject=imageObject;
  Object reportItemDesign=content.getGenerateBy();
  if (null != reportItemDesign) {
    if (reportItemDesign instanceof ImageItemDesign) {
      fitToContainer=((ImageItemDesign)reportItemDesign).isFitToContainer();
    }
  }
}
Program: 70961
Project: 70961
Buggy source:
public ConcreteImageLayout(LayoutEngineContext context,ContainerLayout parentContext,IContent content,Image imageObject){
  super(context,parentContext,content);
  this.imageObject=imageObject;
  fitToContainer=((ImageItemDesign)content.getGenerateBy()).isFitToContainer();
}

Fixed version (ground truth):
public ConcreteImageLayout(LayoutEngineContext context,ContainerLayout parentContext,IContent content,Image imageObject){
  super(context,parentContext,content);
  this.imageObject=imageObject;
  ImageItemDesign imageDesign=(ImageItemDesign)content.getGenerateBy();
  if (null != imageDesign) {
    fitToContainer=imageDesign.isFitToContainer();
  }
}
Program: 70962
Project: 70962
Buggy source:
private String getFilePath(URL url){
  String path=url.getFile().replace('/','\\');
  try {
    return URLDecoder.decode(path,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ex) {
    return path;
  }
}

Fixed version (ground truth):
private String getFilePath(URL url){
  String path=url.getFile();
  try {
    return URLDecoder.decode(path,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException ex) {
    return path;
  }
}
Program: 70963
Project: 70963
Buggy source:
public Object[] getFieldValues(){
  ArrayList fields=new ArrayList();
  fields.add(new Integer(startIndex));
  fields.add(new Integer(endIndex));
  if (sortKeys != null) {
    fields.add(new Integer(sortKeys.length));
    for (int i=0; i < sortKeys.length; i++)     fields.add(sortKeys[i]);
  }
 else {
    fields.add(null);
  }
  if (sortDirections != null) {
    fields.add(new Integer(sortDirections.length));
    for (int i=0; i < sortDirections.length; i++)     fields.add(new Boolean(sortDirections[i]));
  }
 else {
    fields.add(null);
  }
  if (this.comparator != null) {
    fields.add(new Integer(comparator.length));
    for (int i=0; i < comparator.length; i++)     fields.add(new Integer(comparator[i].getStrength()));
  }
 else {
    fields.add(null);
  }
  fields.add(new Boolean(accept));
  return fields.toArray();
}

Fixed version (ground truth):
public Object[] getFieldValues(){
  ArrayList fields=new ArrayList();
  fields.add(new Integer(startIndex));
  fields.add(new Integer(endIndex));
  if (sortKeys != null) {
    fields.add(new Integer(sortKeys.length));
    for (int i=0; i < sortKeys.length; i++)     fields.add(sortKeys[i]);
  }
 else {
    fields.add(null);
  }
  if (sortDirections != null) {
    fields.add(new Integer(sortDirections.length));
    for (int i=0; i < sortDirections.length; i++)     fields.add(new Boolean(sortDirections[i]));
  }
 else {
    fields.add(null);
  }
  if (this.comparator != null) {
    fields.add(new Integer(comparator.length));
    for (int i=0; i < comparator.length; i++)     fields.add(comparator[i] == null ? ISortDefinition.ASCII_SORT_STRENGTH : new Integer(comparator[i].getStrength()));
  }
 else {
    fields.add(null);
  }
  fields.add(new Boolean(accept));
  return fields.toArray();
}
Program: 70964
Project: 70964
Buggy source:
static Loader createLoader(URL url){
  String file=url.getFile();
  if (file != null && file.endsWith("String_Node_Str")) {
    if ("String_Node_Str".equals(url.getProtocol())) {
      return new FileLoader(url);
    }
    return new UrlLoader(url);
  }
  return new JarLoader(url);
}

Fixed version (ground truth):
static Loader createLoader(URL url){
  try {
    String file=url.getFile();
    if (file != null && file.endsWith("String_Node_Str")) {
      if ("String_Node_Str".equals(url.getProtocol())) {
        return new FileLoader(url);
      }
      return new UrlLoader(url);
    }
    return new JarLoader(url);
  }
 catch (  IOException ex) {
    logger.log(Level.SEVERE,"String_Node_Str" + url,ex);
    return null;
  }
}
Program: 70965
Project: 70965
Buggy source:
JarLoader(URL url){
  baseUrl=url;
}

Fixed version (ground truth):
JarLoader(URL url) throws IOException {
  baseUrl=url;
  jarUrl=new URL("String_Node_Str","String_Node_Str",-1,baseUrl + "String_Node_Str");
  if (baseUrl.getProtocol().equalsIgnoreCase("String_Node_Str")) {
    String filePath=getFilePath(baseUrl);
    jarFile=new JarFile(filePath);
  }
 else {
    JarURLConnection jarConn=(JarURLConnection)jarUrl.openConnection();
    jarFile=jarConn.getJarFile();
  }
}
Program: 70966
Project: 70966
Buggy source:
public URLClassLoader(URL[] urls,ClassLoader parent){
  super(new URL[]{},parent);
  initURLs(urls);
  loaders=new ArrayList<Loader>(urls.length);
  for (int i=0; i < urls.length; i++) {
    Loader loader=createLoader(urls[i]);
    loaders.add(loader);
  }
}

Fixed version (ground truth):
public URLClassLoader(URL[] urls,ClassLoader parent){
  super(new URL[]{},parent);
  initURLs(urls);
  loaders=new ArrayList<Loader>(urls.length);
  for (int i=0; i < urls.length; i++) {
    Loader loader=createLoader(urls[i]);
    if (loader != null) {
      loaders.add(loader);
    }
  }
}
Program: 70967
Project: 70967
Buggy source:
public void addURL(URL url){
  if (this.urls.contains(url))   return;
  this.urls.add(url);
  this.loaders.add(createLoader(url));
}

Fixed version (ground truth):
public void addURL(URL url){
  if (url == null || this.urls.contains(url))   return;
  this.urls.add(url);
  Loader loader=createLoader(url);
  if (loader != null) {
    loaders.add(loader);
  }
}
Program: 70969
Project: 70969
Buggy source:
/** 
 * Clear the specified module handle
 * @param handle The module handle
 */
public void clear(ModuleHandle handle){
  mediatorMap.remove(handle);
  if (handle == getReportDesignHandle()) {
    setReportDesignHandle(null);
  }
}

Fixed version (ground truth):
/** 
 * Clear the specified module handle
 * @param handle The module handle
 */
public void clear(ModuleHandle handle){
  mediatorMap.remove(handle);
  if (handle == getReportDesignHandle()) {
    setReportDesignHandle(null);
    getSessionHandle().setResourceFolder(null);
  }
}
Program: 70970
Project: 70970
Buggy source:
protected void drawText(String text,float textX,float textY,float baseline,float width,float height,TextStyle textStyle){
  writer.drawText(text,textX,textY,width + 1f,height,textStyle.getFontInfo(),textStyle.getColor(),textStyle.isRtl(),link);
}

Fixed version (ground truth):
protected void drawText(String text,float textX,float textY,float baseline,float width,float height,TextStyle textStyle){
  writer.drawText(text,textX,textY,width,height,textStyle.getFontInfo(),textStyle.getColor(),textStyle.isRtl(),link);
}
Program: 70971
Project: 70971
Buggy source:
protected void setupPageBreak(PolicyNode node){
  ReportItemDesign item=node.design;
  IStyle style=item.getStyle();
  if (style != null) {
    CSSValue masterPage=style.getProperty(IStyle.STYLE_MASTER_PAGE);
    CSSValue pageBreakBefore=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
    CSSValue pageBreakAfter=style.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
    if (masterPage != null || (pageBreakBefore != null) && !pageBreakBefore.equals(IStyle.AUTO_VALUE)) {
      node.breakBefore=true;
      node.execute=true;
    }
    if (pageBreakAfter != null && !pageBreakAfter.equals(IStyle.AUTO_VALUE)) {
      node.breakAfter=true;
      node.execute=true;
    }
  }
  if (item.getJavaClass() != null || item.getOnCreate() != null || item.getOnPageBreak() != null) {
    node.breakBefore=true;
    node.breakAfter=true;
    node.execute=true;
  }
  if (node.breakBefore || node.breakAfter) {
    Iterator iter=rows.iterator();
    while (iter.hasNext()) {
      PolicyNode row=(PolicyNode)iter.next();
      row.executeAll=true;
    }
    return;
  }
  if (item.getHighlight() != null || item.getMap() != null) {
    node.execute=true;
  }
  if (item.getTOC() != null || item.getBookmark() != null || item.getAction() != null) {
    node.execute=true;
  }
  if (item.getQueries() != null) {
    node.execute=true;
  }
  if (item.getVisibility() != null) {
    node.execute=true;
  }
}

Fixed version (ground truth):
protected void setupPageBreak(PolicyNode node){
  ReportItemDesign item=node.design;
  IStyle style=item.getStyle();
  if (style != null) {
    CSSValue masterPage=style.getProperty(IStyle.STYLE_MASTER_PAGE);
    CSSValue pageBreakBefore=style.getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE);
    CSSValue pageBreakAfter=style.getProperty(IStyle.STYLE_PAGE_BREAK_AFTER);
    if (masterPage != null || (pageBreakBefore != null) && !pageBreakBefore.equals(IStyle.AUTO_VALUE)) {
      node.breakBefore=true;
      node.execute=true;
    }
    if (pageBreakAfter != null && !pageBreakAfter.equals(IStyle.AUTO_VALUE)) {
      node.breakAfter=true;
      node.execute=true;
    }
  }
  if (item.getJavaClass() != null || item.getOnCreate() != null || item.getOnPageBreak() != null) {
    node.breakBefore=true;
    node.breakAfter=true;
    node.execute=true;
    if (item instanceof TableItemDesign) {
      node.executeAll=true;
    }
  }
  if (node.breakBefore || node.breakAfter) {
    Iterator iter=rows.iterator();
    while (iter.hasNext()) {
      PolicyNode row=(PolicyNode)iter.next();
      row.executeAll=true;
    }
    return;
  }
  if (item.getHighlight() != null || item.getMap() != null) {
    node.execute=true;
  }
  if (item.getTOC() != null || item.getBookmark() != null || item.getAction() != null) {
    node.execute=true;
  }
  if (item.getQueries() != null) {
    node.execute=true;
  }
  if (item.getVisibility() != null) {
    node.execute=true;
  }
}
Program: 70972
Project: 70972
Buggy source:
/** 
 * Returns appropriate expressions if current has aggregations defined in chart.
 * @param helper
 * @param isSharingQuery
 * @return expressions list
 */
public List<String> getExpressions(GroupingLookupHelper helper,boolean isSharingQuery){
  if (isSharingQuery) {
    return helper.getExpressions();
  }
  return helper.getExpressionsForAggregate();
}

Fixed version (ground truth):
/** 
 * Returns appropriate expressions if current has aggregations defined in chart.
 * @param helper
 * @param isSharingQuery
 * @return expressions list
 */
public List<String> getExpressions(GroupingLookupHelper helper,boolean isSharingQuery){
  return helper.getExpressions();
}
Program: 70974
Project: 70974
Buggy source:
/** 
 * To compute the text of the label with a limited size, the label text will be wrapped and shortened with ellipsis if required, the size of the label bound will be returned.
 * @param xs
 * @param la
 * @param maxSize
 * @param lbLimit
 * @return
 * @throws ChartException
 */
public static final LabelLimiter limitLabelSize(IDisplayServer xs,Label la,LabelLimiter lbLimit) throws ChartException {
  double maxWidth, maxHeight, wrapping;
  if (lbLimit != null) {
    EllipsisHelper eHelper=EllipsisHelper.simpleInstance(xs,la,null);
    eHelper.checkLabelEllipsis(la.getCaption().getValue(),lbLimit);
    maxWidth=eHelper.getTester().getWidth();
    maxHeight=eHelper.getTester().getHeight();
    wrapping=lbLimit.getWrapping();
  }
 else {
    BoundingBox bb=Methods.computeLabelSize(xs,la,0,null);
    maxWidth=bb.getWidth();
    maxHeight=bb.getHeight();
    wrapping=0;
  }
  return new LabelLimiter(maxWidth,maxHeight,wrapping);
}

Fixed version (ground truth):
/** 
 * To compute the text of the label with a limited size, the label text will be wrapped and shortened with ellipsis if required, the size of the label bound will be returned.
 * @param xs
 * @param la
 * @param maxSize
 * @param lbLimit
 * @param options
 * @return
 * @throws ChartException
 */
public static final LabelLimiter limitLabelSize(IDisplayServer xs,Label la,LabelLimiter lbLimit,EnumSet<Option> options) throws ChartException {
  double maxWidth, maxHeight, wrapping;
  boolean bSuccessed=true;
  if (lbLimit != null) {
    EllipsisHelper eHelper=EllipsisHelper.simpleInstance(xs,la,null);
    if (eHelper.checkLabelEllipsis(la.getCaption().getValue(),lbLimit)) {
      maxWidth=eHelper.getTester().getWidth();
      maxHeight=eHelper.getTester().getHeight();
    }
 else {
      la.getCaption().setValue("String_Node_Str");
      maxWidth=0;
      maxHeight=0;
      bSuccessed=false;
    }
    wrapping=lbLimit.getWrapping();
  }
 else {
    BoundingBox bb=Methods.computeLabelSize(xs,la,0,null);
    maxWidth=bb.getWidth();
    maxHeight=bb.getHeight();
    wrapping=0;
  }
  if (options.contains(Option.FIX_WIDTH)) {
    maxWidth=lbLimit.maxWidth;
  }
  if (options.contains(Option.FIX_HEIGHT)) {
    maxHeight=lbLimit.maxHeight;
  }
  return new LabelLimiter(maxWidth,maxHeight,wrapping,bSuccessed);
}
Program: 70976
Project: 70976
Buggy source:
/** 
 * @param maxSize
 * @param dWrapping
 */
public LabelLimiter(double maxWidth,double maxHeight,double wrapping){
  this.maxWidth=maxWidth;
  this.maxHeight=maxHeight;
  this.wrapping=wrapping;
}

Fixed version (ground truth):
private LabelLimiter(double maxWidth,double maxHeight,double wrapping,boolean bSuccessed){
  this.maxWidth=maxWidth;
  this.maxHeight=maxHeight;
  this.wrapping=wrapping;
  this.bSuccessed=bSuccessed;
}
Program: 70981
Project: 70981
Buggy source:
private void setupClassStyles(StyledElementDesign design,ReportElementHandle handle){
  List<StyleHandle> styles=handle.getFactoryElementHandle().getAllFactoryStyles();
  StringBuffer buffer=new StringBuffer();
  for (int i=styles.size() - 1; i >= 0; i--) {
    StyleHandle styleHandle=styles.get(i);
    StyleDeclaration style=createPrivateStyle(styleHandle);
    String name=styleHandle.getName();
    if (!report.getStyles().containsKey(name))     report.addStyle(name,style);
    appendStyleName(buffer,name);
  }
  StyleHandle privateStyle=handle.getPrivateStyle();
  if (privateStyle != null) {
    StyleDeclaration style=createPrivateStyle(privateStyle);
    if (style != null && !style.isEmpty()) {
      appendStyleName(buffer,assignStyleName(style));
    }
  }
  if (buffer.length() > 0)   design.setStyleClass(buffer.toString());
  design.setStyle(createPrivateStyle(handle));
}

Fixed version (ground truth):
private void setupClassStyles(StyledElementDesign design,ReportElementHandle handle){
  List<StyleHandle> styles=handle.getFactoryElementHandle().getAllFactoryStyles();
  String lastName=null;
  StringBuffer buffer=new StringBuffer();
  for (int i=styles.size() - 1; i >= 0; i--) {
    StyleHandle styleHandle=styles.get(i);
    StyleDeclaration style=createPrivateStyle(styleHandle);
    String name=validateName(styleHandle.getName());
    if (!report.getStyles().containsKey(name))     report.addStyle(name,style);
    appendStyleName(buffer,name);
    lastName=name;
  }
  StyleHandle privateStyle=handle.getPrivateStyle();
  if (privateStyle != null) {
    StyleDeclaration style=createPrivateStyle(privateStyle);
    if (style != null && !style.isEmpty()) {
      String name=assignStyleName(style);
      if (!name.equals(lastName)) {
        appendStyleName(buffer,name);
      }
    }
  }
  if (buffer.length() > 0) {
    design.setStyleClass(buffer.toString());
  }
  design.setStyle(createPrivateStyle(handle));
}
Program: 70982
Project: 70982
Buggy source:
protected void processRowLevelPageBreak(IRowContent rowContent){
  if (rowContent == null || rowLevelPageBreakIntervals == null) {
    return;
  }
  try {
    if (lastRowLevelState[0] == null) {
      lastRowLevelState[0]=getRowLevelCursorState();
      checkedRowLevelState[0]=getRowLevelCursorState();
      return;
    }
    long[] currentRowLevelState=getRowLevelCursorState();
    for (int i=0; i < rowLevelPageBreakIntervals.length; i++) {
      if (rowLevelPageBreakIntervals[i] > 0) {
        long currentPos=currentRowLevelState[i];
        long lastPos=lastRowLevelState[0][i];
        if (currentPos == lastPos) {
          continue;
        }
        long lastCheckedPos=checkedRowLevelState[0][i];
        if (currentPos - lastCheckedPos >= rowLevelPageBreakIntervals[i]) {
          rowContent.getStyle().setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.ALWAYS_VALUE);
          System.arraycopy(currentRowLevelState,0,checkedRowLevelState[0],0,currentRowLevelState.length);
        }
        for (int j=i + 1; j < rowLevelPageBreakIntervals.length; j++) {
          checkedRowLevelState[0][j]=0;
        }
      }
    }
    lastRowLevelState[0]=currentRowLevelState;
  }
 catch (  OLAPException e) {
    logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
protected void processRowLevelPageBreak(IRowContent rowContent){
  if (rowContent == null || rowLevelPageBreakIntervals == null) {
    return;
  }
  try {
    if (lastRowLevelState[0] == null) {
      lastRowLevelState[0]=getRowLevelCursorState();
      checkedRowLevelState[0]=getRowLevelCursorState();
      return;
    }
    long[] currentRowLevelState=getRowLevelCursorState();
    for (int i=0; i < rowLevelPageBreakIntervals.length; i++) {
      long currentPos=currentRowLevelState[i];
      long lastPos=lastRowLevelState[0][i];
      if (currentPos == lastPos) {
        continue;
      }
      if (rowLevelPageBreakIntervals[i] > 0) {
        long lastCheckedPos=checkedRowLevelState[0][i];
        if (currentPos - lastCheckedPos >= rowLevelPageBreakIntervals[i]) {
          rowContent.getStyle().setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.ALWAYS_VALUE);
          System.arraycopy(currentRowLevelState,0,checkedRowLevelState[0],0,currentRowLevelState.length);
        }
      }
      for (int j=i + 1; j < rowLevelPageBreakIntervals.length; j++) {
        checkedRowLevelState[0][j]=0;
      }
    }
    lastRowLevelState[0]=currentRowLevelState;
  }
 catch (  OLAPException e) {
    logger.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
}