nus-yam/ex-repair huggingface dataset:
Program: 70329
Project: 70329
Buggy source:
/** 
 * Gets size of label item.
 * @return the size of label item.
 */
public Dimension getSize(){
  DimensionHandle handle=((ReportItemHandle)getHandle()).getWidth();
  int px=0;
  int py=0;
  if (!DesignChoiceConstants.UNITS_PERCENTAGE.equals(handle.getUnits())) {
    px=(int)DEUtil.convertoToPixel(handle);
  }
  handle=((ReportItemHandle)getHandle()).getHeight();
  if (!DesignChoiceConstants.UNITS_PERCENTAGE.equals(handle.getUnits())) {
    py=(int)DEUtil.convertoToPixel(handle);
  }
  px=Math.max(0,px);
  py=Math.max(0,py);
  return new Dimension(px,py);
}

Fixed version (ground truth):
/** 
 * Gets size of label item.
 * @return the size of label item.
 */
public Dimension getSize(){
  DimensionHandle widthHandle=((ReportItemHandle)getHandle()).getWidth();
  int px=0;
  int py=0;
  if (!DesignChoiceConstants.UNITS_PERCENTAGE.equals(widthHandle.getUnits())) {
    px=(int)DEUtil.convertoToPixel(widthHandle);
  }
  DimensionHandle heightHandle=((ReportItemHandle)getHandle()).getHeight();
  if (!DesignChoiceConstants.UNITS_PERCENTAGE.equals(heightHandle.getUnits())) {
    py=(int)DEUtil.convertoToPixel(heightHandle);
  }
  px=Math.max(0,px);
  py=Math.max(0,py);
  if (DEUtil.isFixLayout(getHandle())) {
    if (px == 0 && widthHandle.isSet()) {
      px=1;
    }
    if (py == 0 && heightHandle.isSet()) {
      py=1;
    }
  }
  return new Dimension(px,py);
}
Program: 70330
Project: 70330
Buggy source:
/** 
 * Set row height
 * @param rowHeight
 * @throws SemanticException
 */
public void setHeight(int rowHeight) throws SemanticException {
  double value=MetricUtility.pixelToPixelInch(rowHeight);
  DimensionValue dimensionValue=new DimensionValue(value,DesignChoiceConstants.UNITS_IN);
  getRowHandle().getHeight().setValue(dimensionValue);
}

Fixed version (ground truth):
public void setHeight(int rowHeight) throws SemanticException {
  setHeight(rowHeight,DesignChoiceConstants.UNITS_IN);
}
Program: 70331
Project: 70331
Buggy source:
public DummyEngineTask(ReportEngine engine,IReportRunnable runnable,ModuleHandle moduleHandle){
  super(engine,runnable);
  setEngineTaskParameters(this,moduleHandle);
}

Fixed version (ground truth):
public DummyEngineTask(ReportEngine engine,IReportRunnable runnable,ModuleHandle moduleHandle){
  super(engine,runnable);
  setEngineTaskParameters(this,moduleHandle);
  this.taskType=IEngineTask.TASK_UNKNOWN;
}
Program: 70333
Project: 70333
Buggy source:
/** 
 * Test get/setExpression methods set an expression then get the expression and check the text type to test if they work correctly
 */
public void testExpression(){
  DynamicTextItemDesign multi=new DynamicTextItemDesign();
  Expression<String> exp=Expression.newConstant("String_Node_Str");
  Expression<String> type=Expression.newConstant("String_Node_Str");
  multi.setContent(exp);
  multi.setContentType(type);
  assertEquals(multi.getContent(),exp);
  assertEquals(multi.getContentType(),type);
}

Fixed version (ground truth):
/** 
 * Test get/setExpression methods set an expression then get the expression and check the text type to test if they work correctly
 */
public void testExpression(){
  DynamicTextItemDesign multi=new DynamicTextItemDesign();
  Expression<Object> exp=new Expression<Object>("String_Node_Str",Object.class);
  Expression<String> type=Expression.newConstant("String_Node_Str");
  multi.setContent(exp);
  multi.setContentType(type);
  assertEquals(multi.getContent(),exp);
  assertEquals(multi.getContentType(),type);
}
Program: 70334
Project: 70334
Buggy source:
public Object visitDynamicTextItem(DynamicTextItemDesign dynamicText,Object value){
  IDataQueryDefinition query;
  if (dynamicText.useCachedResult()) {
    query=getRefenceQuery(dynamicText);
    if (query == null) {
      registerUnresolvedQueryReference(dynamicText);
      return null;
    }
  }
 else {
    query=createQuery(dynamicText,(IDataQueryDefinition)value);
  }
  if (query != value && query instanceof BaseQueryDefinition) {
    setUsesDetails((BaseQueryDefinition)query);
  }
  try {
    Expression<String> newContent=transformExpression(dynamicText.getContent(),query);
    dynamicText.setContent(newContent);
    transformExpressions(dynamicText,query);
    return getResultQuery(query,value);
  }
 catch (  BirtException ex) {
    context.addException(dynamicText.getHandle(),ex);
    return null;
  }
}

Fixed version (ground truth):
public Object visitDynamicTextItem(DynamicTextItemDesign dynamicText,Object value){
  IDataQueryDefinition query;
  if (dynamicText.useCachedResult()) {
    query=getRefenceQuery(dynamicText);
    if (query == null) {
      registerUnresolvedQueryReference(dynamicText);
      return null;
    }
  }
 else {
    query=createQuery(dynamicText,(IDataQueryDefinition)value);
  }
  if (query != value && query instanceof BaseQueryDefinition) {
    setUsesDetails((BaseQueryDefinition)query);
  }
  try {
    Expression<Object> newContent=transformExpression(dynamicText.getContent(),query);
    dynamicText.setContent(newContent);
    transformExpressions(dynamicText,query);
    return getResultQuery(query,value);
  }
 catch (  BirtException ex) {
    context.addException(dynamicText.getHandle(),ex);
    return null;
  }
}
Program: 70335
Project: 70335
Buggy source:
/** 
 * @param content The content to set.
 */
public void setContent(Expression<String> content){
  this.content=content;
}

Fixed version (ground truth):
/** 
 * @param content The content to set.
 */
public void setContent(Expression<Object> content){
  this.content=content;
}
Program: 70336
Project: 70336
Buggy source:
/** 
 * @return Returns the content.
 */
public Expression<String> getContent(){
  return content;
}

Fixed version (ground truth):
/** 
 * @return Returns the content.
 */
public Expression<Object> getContent(){
  return content;
}
Program: 70337
Project: 70337
Buggy source:
protected void readDynamicTextField(DataInputStream in,DynamicTextItemDesign design,short fieldType) throws IOException {
switch (fieldType) {
case FIELD_CONTENT_TYPE:
    Expression<String> contentType=readStringExpression(in);
  design.setContentType(contentType);
break;
case FIELD_CONTENT:
Expression<String> content=readStringExpression(in);
design.setContent(content);
break;
default :
readReportItemField(in,design,fieldType);
}
}

Fixed version (ground truth):
protected void readDynamicTextField(DataInputStream in,DynamicTextItemDesign design,short fieldType) throws IOException {
switch (fieldType) {
case FIELD_CONTENT_TYPE:
    Expression<String> contentType=readStringExpression(in);
  design.setContentType(contentType);
break;
case FIELD_CONTENT:
Expression<Object> content=readObjectExpression(in);
design.setContent(content);
break;
default :
readReportItemField(in,design,fieldType);
}
}
Program: 70338
Project: 70338
Buggy source:
protected void writeDynamicText(DataOutputStream out,DynamicTextItemDesign design) throws IOException {
  writeReportItem(out,design);
  Expression<String> contentType=design.getContentType();
  Expression<String> content=design.getContent();
  if (contentType != null) {
    IOUtil.writeShort(out,FIELD_CONTENT_TYPE);
    write(out,contentType);
  }
  if (content != null) {
    IOUtil.writeShort(out,FIELD_CONTENT);
    write(out,content);
  }
}

Fixed version (ground truth):
protected void writeDynamicText(DataOutputStream out,DynamicTextItemDesign design) throws IOException {
  writeReportItem(out,design);
  Expression<String> contentType=design.getContentType();
  Expression<Object> content=design.getContent();
  if (contentType != null) {
    IOUtil.writeShort(out,FIELD_CONTENT_TYPE);
    write(out,contentType);
  }
  if (content != null) {
    IOUtil.writeShort(out,FIELD_CONTENT);
    write(out,content);
  }
}
Program: 70339
Project: 70339
Buggy source:
public void visitTextDataItem(TextDataHandle handle){
  DynamicTextItemDesign dynamicTextItem=new DynamicTextItemDesign();
  setupReportItem(dynamicTextItem,handle);
  String valueExpr=handle.getValueExpr();
  String contentType=handle.getContentType();
  dynamicTextItem.setContent(createExpression(validateExpression(valueExpr)));
  dynamicTextItem.setContentType(createConstant(contentType));
  setupHighlight(dynamicTextItem,valueExpr);
  setMap(dynamicTextItem,valueExpr);
  setCurrentElement(dynamicTextItem);
}

Fixed version (ground truth):
public void visitTextDataItem(TextDataHandle handle){
  DynamicTextItemDesign dynamicTextItem=new DynamicTextItemDesign();
  setupReportItem(dynamicTextItem,handle);
  String valueExpr=handle.getValueExpr();
  String contentType=handle.getContentType();
  dynamicTextItem.setContent(createObjectExpression(validateExpression(valueExpr)));
  dynamicTextItem.setContentType(createConstant(contentType));
  setupHighlight(dynamicTextItem,valueExpr);
  setMap(dynamicTextItem,valueExpr);
  setCurrentElement(dynamicTextItem);
}
Program: 70341
Project: 70341
Buggy source:
private void createDropDownComponent(){
  Point pLoc=UIHelper.getScreenLocation(btnDropDown.getParent());
  int iXLoc=pLoc.x;
  int iYLoc=pLoc.y + btnDropDown.getParent().getSize().y;
  int iShellWidth=MARKER_BLOCK_HEIGHT * MARKER_ROW_MAX_NUMBER + 15;
  int iShellHeight=175;
  if ((getStyle() & SWT.RIGHT_TO_LEFT) != 0) {
    iXLoc-=iShellWidth;
  }
  if (iXLoc + iShellWidth > this.getDisplay().getClientArea().width) {
    iXLoc=this.getDisplay().getClientArea().width - iShellWidth;
  }
  Shell shell=new Shell(this.getShell(),SWT.NONE);
  shell.setLayout(new FillLayout());
  shell.setSize(iShellWidth,iShellHeight);
  shell.setLocation(iXLoc,iYLoc);
  cmpDropDown=new MarkerDropDownEditorComposite(shell,SWT.NONE);
  shell.layout();
  shell.open();
}

Fixed version (ground truth):
private void createDropDownComponent(){
  Point pLoc=UIHelper.getScreenLocation(btnDropDown.getParent());
  int iXLoc=pLoc.x;
  int iYLoc=pLoc.y + btnDropDown.getParent().getSize().y;
  int iShellWidth=MARKER_BLOCK_HEIGHT * MARKER_ROW_MAX_NUMBER + 15;
  if ((getStyle() & SWT.RIGHT_TO_LEFT) != 0) {
    iXLoc-=iShellWidth;
  }
  if (iXLoc + iShellWidth > this.getDisplay().getClientArea().width) {
    iXLoc=this.getDisplay().getClientArea().width - iShellWidth;
  }
  Shell shell=new Shell(this.getShell(),SWT.NONE);
  shell.setLayout(new FillLayout());
  shell.setLocation(iXLoc,iYLoc);
  cmpDropDown=new MarkerDropDownEditorComposite(shell,SWT.NONE);
  shell.layout();
  shell.pack();
  shell.open();
}
Program: 70342
Project: 70342
Buggy source:
private boolean isOwnColumnBinding(int pos){
  List<ComputedColumnHandle> bindings=getBindingList(inputElement);
  return bindings.get(pos).getElementHandle() == inputElement;
}

Fixed version (ground truth):
private boolean isOwnColumnBinding(int pos){
  List<ComputedColumnHandle> bindings=getBindingList(inputElement);
  return pos < 0 ? false : bindings.get(pos).getElementHandle() == inputElement;
}
Program: 70343
Project: 70343
Buggy source:
public ScriptException(String message){
  super(message);
}

Fixed version (ground truth):
public ScriptException(String message){
  super(message);
  this.message=message;
}
Program: 70344
Project: 70344
Buggy source:
public void onCreate(IAutoTextInstance autoTextInstance,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(IAutoTextInstance autoTextInstance,IReportContext reportContext) throws ScriptException {
}
Program: 70345
Project: 70345
Buggy source:
public void onPrepare(IAutoText autoText,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(IAutoText autoText,IReportContext reportContext) throws ScriptException {
}
Program: 70346
Project: 70346
Buggy source:
public void onRender(IAutoTextInstance autoTextInstance,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(IAutoTextInstance autoTextInstance,IReportContext reportContext) throws ScriptException {
}
Program: 70347
Project: 70347
Buggy source:
public void onPageBreak(IAutoTextInstance autoTextInstance,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(IAutoTextInstance autoTextInstance,IReportContext reportContext) throws ScriptException {
}
Program: 70348
Project: 70348
Buggy source:
public void onCreate(ICellInstance cellInstance,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(ICellInstance cellInstance,IReportContext reportContext) throws ScriptException {
}
Program: 70349
Project: 70349
Buggy source:
public void onPrepare(ICell cell,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(ICell cell,IReportContext reportContext) throws ScriptException {
}
Program: 70350
Project: 70350
Buggy source:
public void onRender(ICellInstance cellInstance,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(ICellInstance cellInstance,IReportContext reportContext) throws ScriptException {
}
Program: 70351
Project: 70351
Buggy source:
public void onPageBreak(ICellInstance cellInstance,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(ICellInstance cellInstance,IReportContext reportContext) throws ScriptException {
}
Program: 70352
Project: 70352
Buggy source:
public void onCreate(IDataItemInstance data,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(IDataItemInstance data,IReportContext reportContext) throws ScriptException {
}
Program: 70353
Project: 70353
Buggy source:
public void onPrepare(IDataItem dataItemHandle,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(IDataItem dataItemHandle,IReportContext reportContext) throws ScriptException {
}
Program: 70354
Project: 70354
Buggy source:
public void onRender(IDataItemInstance data,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(IDataItemInstance data,IReportContext reportContext) throws ScriptException {
}
Program: 70355
Project: 70355
Buggy source:
public void onPageBreak(IDataItemInstance data,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(IDataItemInstance data,IReportContext reportContext) throws ScriptException {
}
Program: 70356
Project: 70356
Buggy source:
public void beforeClose(IDataSetInstance dataSet,IReportContext reportContext){
}

Fixed version (ground truth):
public void beforeClose(IDataSetInstance dataSet,IReportContext reportContext) throws ScriptException {
}
Program: 70357
Project: 70357
Buggy source:
public void afterOpen(IDataSetInstance dataSet,IReportContext reportContext){
}

Fixed version (ground truth):
public void afterOpen(IDataSetInstance dataSet,IReportContext reportContext) throws ScriptException {
}
Program: 70358
Project: 70358
Buggy source:
public void onFetch(IDataSetInstance dataSet,IDataSetRow row,IReportContext reportContext){
}

Fixed version (ground truth):
public void onFetch(IDataSetInstance dataSet,IDataSetRow row,IReportContext reportContext) throws ScriptException {
}
Program: 70359
Project: 70359
Buggy source:
public void afterClose(IReportContext reportContext){
}

Fixed version (ground truth):
public void afterClose(IReportContext reportContext) throws ScriptException {
}
Program: 70360
Project: 70360
Buggy source:
public void beforeOpen(IDataSetInstance dataSet,IReportContext reportContext){
}

Fixed version (ground truth):
public void beforeOpen(IDataSetInstance dataSet,IReportContext reportContext) throws ScriptException {
}
Program: 70361
Project: 70361
Buggy source:
public void beforeClose(IDataSourceInstance dataSource,IReportContext reportContext){
}

Fixed version (ground truth):
public void beforeClose(IDataSourceInstance dataSource,IReportContext reportContext) throws ScriptException {
}
Program: 70362
Project: 70362
Buggy source:
public void afterOpen(IDataSourceInstance dataSource,IReportContext reportContext){
}

Fixed version (ground truth):
public void afterOpen(IDataSourceInstance dataSource,IReportContext reportContext) throws ScriptException {
}
Program: 70363
Project: 70363
Buggy source:
public void afterClose(IReportContext reportContext){
}

Fixed version (ground truth):
public void afterClose(IReportContext reportContext) throws ScriptException {
}
Program: 70364
Project: 70364
Buggy source:
public void beforeOpen(IDataSourceInstance dataSource,IReportContext reportContext){
}

Fixed version (ground truth):
public void beforeOpen(IDataSourceInstance dataSource,IReportContext reportContext) throws ScriptException {
}
Program: 70365
Project: 70365
Buggy source:
public void onCreate(IDynamicTextInstance text,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(IDynamicTextInstance text,IReportContext reportContext) throws ScriptException {
}
Program: 70366
Project: 70366
Buggy source:
public void onPrepare(IDynamicText textData,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(IDynamicText textData,IReportContext reportContext) throws ScriptException {
}
Program: 70367
Project: 70367
Buggy source:
public void onRender(IDynamicTextInstance text,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(IDynamicTextInstance text,IReportContext reportContext) throws ScriptException {
}
Program: 70368
Project: 70368
Buggy source:
public void onPageBreak(IDynamicTextInstance text,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(IDynamicTextInstance text,IReportContext reportContext) throws ScriptException {
}
Program: 70369
Project: 70369
Buggy source:
public void onCreate(IGridInstance grid,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(IGridInstance grid,IReportContext reportContext) throws ScriptException {
}
Program: 70370
Project: 70370
Buggy source:
public void onPrepare(IGrid grid,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(IGrid grid,IReportContext reportContext) throws ScriptException {
}
Program: 70371
Project: 70371
Buggy source:
public void onRender(IGridInstance grid,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(IGridInstance grid,IReportContext reportContext) throws ScriptException {
}
Program: 70372
Project: 70372
Buggy source:
public void onPageBreak(IGridInstance grid,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(IGridInstance grid,IReportContext reportContext) throws ScriptException {
}
Program: 70373
Project: 70373
Buggy source:
public void onCreate(IImageInstance image,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(IImageInstance image,IReportContext reportContext) throws ScriptException {
}
Program: 70374
Project: 70374
Buggy source:
public void onPrepare(IImage imageHandle,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(IImage imageHandle,IReportContext reportContext) throws ScriptException {
}
Program: 70375
Project: 70375
Buggy source:
public void onRender(IImageInstance image,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(IImageInstance image,IReportContext reportContext) throws ScriptException {
}
Program: 70376
Project: 70376
Buggy source:
public void onPageBreak(IImageInstance image,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(IImageInstance image,IReportContext reportContext) throws ScriptException {
}
Program: 70377
Project: 70377
Buggy source:
public void onCreate(ILabelInstance label,IReportContext reportContext){
}

Fixed version (ground truth):
public void onCreate(ILabelInstance label,IReportContext reportContext) throws ScriptException {
}
Program: 70378
Project: 70378
Buggy source:
public void onPrepare(ILabel labelHandle,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPrepare(ILabel labelHandle,IReportContext reportContext) throws ScriptException {
}
Program: 70379
Project: 70379
Buggy source:
public void onRender(ILabelInstance label,IReportContext reportContext){
}

Fixed version (ground truth):
public void onRender(ILabelInstance label,IReportContext reportContext) throws ScriptException {
}
Program: 70380
Project: 70380
Buggy source:
public void onPageBreak(ILabelInstance label,IReportContext reportContext){
}

Fixed version (ground truth):
public void onPageBreak(ILabelInstance label,IReportContext reportContext) throws ScriptException {
}
Program: 70381
Project: 70381
Buggy source:
public void testFitToPageTrue() throws EngineException {
  List pages=getPages(true,true);
  float[] scales=new float[]{0.75f,0.75f,0.75f,0.23f};
  assertTrue(pages.size() == scales.length);
  for (int i=0; i < pages.size(); i++) {
    PageArea page=(PageArea)pages.get(i);
    float delta=scales[i] - page.getScale();
    assertTrue(delta > -0.01 && delta < 0.01);
  }
}

Fixed version (ground truth):
public void testFitToPageTrue() throws EngineException {
  List pages=getPages(true,true);
  float[] scales=new float[]{0.75f,0.75f,0.75f,0.24f};
  assertTrue(pages.size() == scales.length);
  for (int i=0; i < pages.size(); i++) {
    PageArea page=(PageArea)pages.get(i);
    float delta=scales[i] - page.getScale();
    assertTrue(delta > -0.01 && delta < 0.01);
  }
}
Program: 70382
Project: 70382
Buggy source:
/** 
 * Check if the arguments are valid. If yes, continue to execuate the report. If no, simply return.
 */
public int execute(){
  try {
    if (parseHelpOptions() > 0)     return 0;
    parseNormalOptions();
    if (engine == null) {
      EngineConfig config=createEngineConfig();
      Platform.startup(config);
      IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
      engine=factory.createReportEngine(config);
      engine.changeLogLevel(Level.WARNING);
    }
    if ("String_Node_Str".equalsIgnoreCase(mode)) {
      return runReport();
    }
 else     if ("String_Node_Str".equalsIgnoreCase(mode)) {
      return renderReport();
    }
 else {
      return runAndRenderReport();
    }
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    return -1;
  }
 finally {
    Platform.shutdown();
  }
}

Fixed version (ground truth):
/** 
 * Check if the arguments are valid. If yes, continue to execuate the report. If no, simply return.
 */
public int execute(){
  if (parseHelpOptions() > 0)   return 0;
  try {
    parseNormalOptions();
    if (engine == null) {
      EngineConfig config=createEngineConfig();
      Platform.startup(config);
      IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
      engine=factory.createReportEngine(config);
      engine.changeLogLevel(Level.WARNING);
    }
    if ("String_Node_Str".equalsIgnoreCase(mode)) {
      return runReport();
    }
 else     if ("String_Node_Str".equalsIgnoreCase(mode)) {
      return renderReport();
    }
 else {
      return runAndRenderReport();
    }
  }
 catch (  Exception ex) {
    logger.log(Level.SEVERE,"String_Node_Str",ex);
    return -1;
  }
 finally {
    Platform.shutdown();
  }
}
Program: 70383
Project: 70383
Buggy source:
/** 
 * Returns format code according to format type and current locale
 */
public String getLocalizedFormatCode(){
  if (UNFORMATTED.equals(formatPattern) || DATETIME_UNFORMATTED.equals(formatPattern) || DATE_UNFORMATTED.equals(formatPattern)|| TIME_UNFORMATTED.equals(formatPattern)) {
    return "String_Node_Str";
  }
  SimpleDateFormat dateFormat=getFormatter();
  return dateFormat.toLocalizedPattern();
}

Fixed version (ground truth):
/** 
 * Returns format code according to format type and current locale
 */
public String getLocalizedFormatCode(){
  if (UNFORMATTED.equals(formatPattern) || DATETIME_UNFORMATTED.equals(formatPattern) || DATE_UNFORMATTED.equals(formatPattern)|| TIME_UNFORMATTED.equals(formatPattern)) {
    return ((SimpleDateFormat)dateFormat).toLocalizedPattern();
  }
  SimpleDateFormat dateFormat=getFormatter();
  return dateFormat.toLocalizedPattern();
}
Program: 70384
Project: 70384
Buggy source:
/** 
 * Returns format code according to format type and current locale
 */
public String getFormatCode(){
  if (UNFORMATTED.equals(formatPattern) || DATETIME_UNFORMATTED.equals(formatPattern) || DATE_UNFORMATTED.equals(formatPattern)|| TIME_UNFORMATTED.equals(formatPattern)) {
    return "String_Node_Str";
  }
  SimpleDateFormat dateFormat=getFormatter();
  return dateFormat.toPattern();
}

Fixed version (ground truth):
/** 
 * Returns format code according to format type and current locale
 */
public String getFormatCode(){
  if (UNFORMATTED.equals(formatPattern) || DATETIME_UNFORMATTED.equals(formatPattern) || DATE_UNFORMATTED.equals(formatPattern)|| TIME_UNFORMATTED.equals(formatPattern)) {
    return ((SimpleDateFormat)dateFormat).toPattern();
  }
  SimpleDateFormat dateFormat=getFormatter();
  return dateFormat.toPattern();
}
Program: 70386
Project: 70386
Buggy source:
private Data createDateData(Object txt,StyleEntry entry,String timeFormat){
  timeFormat=ExcelUtil.parse(timeFormat,locale);
  if (timeFormat.equals("String_Node_Str")) {
    if (txt instanceof java.sql.Date) {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
 else     if (txt instanceof java.sql.Time) {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
 else {
      timeFormat=DateTimeUtil.formatDateTime("String_Node_Str",locale);
    }
  }
 else {
    timeFormat=DateTimeUtil.formatDateTime(timeFormat,locale);
  }
  entry.setProperty(StyleConstant.DATE_FORMAT_PROP,timeFormat);
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,Integer.toString(SheetData.DATE));
  return new Data(txt,entry,SheetData.DATE,getCurrentContainer());
}

Fixed version (ground truth):
private Data createDateData(Object txt,StyleEntry entry,String timeFormat){
  timeFormat=ExcelUtil.parse(txt,timeFormat,locale);
  timeFormat=DateTimeUtil.formatDateTime(timeFormat,locale);
  entry.setProperty(StyleConstant.DATE_FORMAT_PROP,timeFormat);
  entry.setProperty(StyleConstant.DATA_TYPE_PROP,Integer.toString(SheetData.DATE));
  return new Data(txt,entry,SheetData.DATE,getCurrentContainer());
}
Program: 70387
Project: 70387
Buggy source:
/** 
 * support body auto resize, remove invalid header and footer
 * @param page
 */
protected void updateBodySize(){
  if (header != null && header.getHeight() >= root.getHeight()) {
    removeHeader();
    header=null;
  }
  if (footer != null && footer.getHeight() >= root.getHeight()) {
    removeHeader();
    footer=null;
  }
  if (header != null && footer != null && footer.getHeight() + header.getHeight() >= root.getHeight()) {
    removeFooter();
    removeHeader();
  }
  body.setHeight(root.getContentHeight() - (header == null ? 0 : header.getHeight()) - (footer == null ? 0 : footer.getHeight()));
  body.setPosition(body.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth());
  if (footer != null) {
    footer.setPosition(footer.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth() + (body == null ? 0 : body.getHeight()));
  }
}

Fixed version (ground truth):
/** 
 * support body auto resize, remove invalid header and footer
 * @param page
 */
protected void updateBodySize(){
  if (header != null && header.getHeight() >= root.getHeight()) {
    removeHeader();
    header=null;
  }
  if (footer != null && footer.getHeight() >= root.getHeight()) {
    removeHeader();
    footer=null;
  }
  if (header != null && footer != null && footer.getHeight() + header.getHeight() >= root.getHeight()) {
    removeHeader();
  }
  body.setHeight(root.getContentHeight() - (header == null ? 0 : header.getHeight()) - (footer == null ? 0 : footer.getHeight()));
  body.setPosition(body.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth());
  if (footer != null) {
    footer.setPosition(footer.getX(),(header == null ? 0 : header.getHeight()) + root.getBoxStyle().getTopBorderWidth() + (body == null ? 0 : body.getHeight()));
  }
}
Program: 70388
Project: 70388
Buggy source:
public static void initFileHandler(String sLogFolder,final Level level) throws SecurityException, IOException {
  if (sLogFolder.length() > 0 && sLogFolder.lastIndexOf(File.separator) == sLogFolder.length() - 1) {
    sLogFolder=sLogFolder.substring(0,sLogFolder.length() - 1);
  }
  final String sName=ChartEnginePlugin.ID + new SimpleDateFormat("String_Node_Str").format(new Date());
  final String sDir=sLogFolder;
  try {
    fileHandler=AccessController.doPrivileged(new PrivilegedExceptionAction<FileHandler>(){
      public FileHandler run() throws Exception {
        Level logLevel=level != null ? level : Level.FINEST;
        FileHandler fileHandler=new FileHandler(sDir + File.separator + sName+ "String_Node_Str",true);
        fileHandler.setFormatter(new SimpleFormatter());
        fileHandler.setLevel(logLevel);
        return fileHandler;
      }
    }
);
  }
 catch (  PrivilegedActionException e) {
    Exception typedException=e.getException();
    if (typedException instanceof SecurityException) {
      throw (SecurityException)typedException;
    }
 else     if (typedException instanceof IOException) {
      throw (IOException)typedException;
    }
  }
}

Fixed version (ground truth):
public static void initFileHandler(String sLogFolder,final Level level) throws SecurityException, IOException {
  if (sLogFolder == null) {
    if (stateDir == null) {
      return;
    }
 else {
      sLogFolder=stateDir;
    }
  }
  if (sLogFolder.length() > 0 && sLogFolder.lastIndexOf(File.separator) == sLogFolder.length() - 1) {
    sLogFolder=sLogFolder.substring(0,sLogFolder.length() - 1);
  }
  final String sName=ChartEnginePlugin.ID + new SimpleDateFormat("String_Node_Str").format(new Date());
  final String sDir=sLogFolder;
  try {
    fileHandler=AccessController.doPrivileged(new PrivilegedExceptionAction<FileHandler>(){
      public FileHandler run() throws Exception {
        Level logLevel=level != null ? level : Level.FINEST;
        FileHandler fileHandler=new FileHandler(sDir + File.separator + sName+ "String_Node_Str",true);
        fileHandler.setFormatter(new SimpleFormatter());
        fileHandler.setLevel(logLevel);
        return fileHandler;
      }
    }
);
  }
 catch (  PrivilegedActionException e) {
    Exception typedException=e.getException();
    if (typedException instanceof SecurityException) {
      throw (SecurityException)typedException;
    }
 else     if (typedException instanceof IOException) {
      throw (IOException)typedException;
    }
  }
}
Program: 70389
Project: 70389
Buggy source:
@Override public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
}

Fixed version (ground truth):
@Override public void start(BundleContext context) throws Exception {
  super.start(context);
  plugin=this;
  JavaUtilLoggerImpl.setStateDir(getStateLocation().toOSString());
}
Program: 70390
Project: 70390
Buggy source:
private void initFileLogger(String loggingDir,Level loggingLevel){
  if (loggingLevel != null && loggingLevel == Level.OFF) {
    return;
  }
  try {
    String dir=null;
    if (loggingDir != null) {
      dir=loggingDir;
    }
 else     if (inEclipseEnv()) {
      dir=ChartEnginePlugin.getInstance().getStateLocation().toOSString();
    }
    if (dir != null) {
      JavaUtilLoggerImpl.initFileHandler(dir,loggingLevel);
    }
  }
 catch (  SecurityException e) {
    logger.log(e);
  }
catch (  IOException e) {
    logger.log(e);
  }
}

Fixed version (ground truth):
private void initFileLogger(String loggingDir,Level loggingLevel){
  if (loggingLevel != null && loggingLevel == Level.OFF) {
    return;
  }
  try {
    String dir=null;
    if (loggingDir != null) {
      dir=loggingDir;
    }
    JavaUtilLoggerImpl.initFileHandler(dir,loggingLevel);
  }
 catch (  SecurityException e) {
    logger.log(e);
  }
catch (  IOException e) {
    logger.log(e);
  }
}
Program: 70391
Project: 70391
Buggy source:
/** 
 * Removes the guide handle.
 */
protected void removeGuideFeedBack(){
  if (guideHandle != null && guideHandle.getParent() == getHandleLayer()) {
    getHandleLayer().remove(guideHandle);
  }
  guideHandle=null;
}

Fixed version (ground truth):
/** 
 * Removes the guide handle.
 */
protected void removeGuideFeedBack(){
  if (guideHandle != null && guideHandle.getParent() == getHandleLayer()) {
    getHandleLayer().remove(guideHandle);
  }
 else   if (getParent() instanceof ReportElementEditPart) {
    ((ReportElementEditPart)getParent()).removeGuideFeedBack();
  }
  guideHandle=null;
}
Program: 70392
Project: 70392
Buggy source:
public void activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
}

Fixed version (ground truth):
public void activate(){
  if (isActive())   return;
  super.activate();
  refreshPageClip();
  getFigure().addMouseMotionListener(new MouseMotionListener.Stub(){
    public void mouseEntered(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseExited(    MouseEvent me){
      delayRemoveGuideFeedBack();
    }
    public void mouseHover(    MouseEvent me){
      addGuideFeedBack();
    }
    public void mouseMoved(    MouseEvent me){
      addGuideFeedBack();
    }
  }
);
  getFigure().setFocusTraversable(true);
  updateLayoutPreference();
}
Program: 70394
Project: 70394
Buggy source:
public void mouseMove(MouseEvent e){
  String tooltip=null;
  TableItem item=((Table)e.widget).getItem(new Point(e.x,e.y));
  if (item != null) {
    List<Object[]> data=(List<Object[]>)tableViewerColumns.getData(KEY_PREVIEW_DATA);
    StringBuilder sb=new StringBuilder();
    int index=((Table)e.widget).indexOf(item);
    int i=0;
    for (; i < data.size(); i++) {
      if (sb.length() > 45) {
        break;
      }
      if (data.get(i)[index] != null) {
        if (i != 0)         sb.append("String_Node_Str");
        sb.append(String.valueOf(data.get(i)[index]));
      }
    }
    if (i < data.size()) {
      sb.append("String_Node_Str");
    }
    tooltip=sb.toString();
  }
  table.setToolTipText(tooltip);
}

Fixed version (ground truth):
public void mouseMove(MouseEvent e){
  String tooltip=null;
  TableItem item=((Table)e.widget).getItem(new Point(e.x,e.y));
  if (item != null) {
    List<Object[]> data=(List<Object[]>)tableViewerColumns.getData(KEY_PREVIEW_DATA);
    if (data != null) {
      StringBuilder sb=new StringBuilder();
      int index=((Table)e.widget).indexOf(item);
      int i=0;
      for (; i < data.size(); i++) {
        if (sb.length() > 45) {
          break;
        }
        if (data.get(i)[index] != null) {
          if (i != 0)           sb.append("String_Node_Str");
          sb.append(String.valueOf(data.get(i)[index]));
        }
      }
      if (i < data.size()) {
        sb.append("String_Node_Str");
      }
      tooltip=sb.toString();
    }
  }
  table.setToolTipText(tooltip);
}
Program: 70395
Project: 70395
Buggy source:
/** 
 * Generates a draw2d constraint object derived from the specified child EditPart using the provided Request. The returned constraint will be translated to the application's model later using  {@link #translateToModelConstraint(Object)}.
 * @param request the ChangeBoundsRequest
 * @param child the child EditPart for which the constraint should be generated
 * @return the draw2d constraint
 */
protected Object getConstraintFor(ChangeBoundsRequest request,GraphicalEditPart child){
  Rectangle rect=child.getFigure().getBounds();
  rect=request.getTransformedRectangle(rect);
  rect.translate(getLayoutOrigin().getNegated());
  return getConstraintFor(rect);
}

Fixed version (ground truth):
/** 
 * Generates a draw2d constraint object derived from the specified child EditPart using the provided Request. The returned constraint will be translated to the application's model later using  {@link #translateToModelConstraint(Object)}.
 * @param request the ChangeBoundsRequest
 * @param child the child EditPart for which the constraint should be generated
 * @return the draw2d constraint
 */
protected Object getConstraintFor(ChangeBoundsRequest request,GraphicalEditPart child){
  IFigure figure=child.getFigure();
  Rectangle rect=new PrecisionRectangle(figure.getBounds());
  figure.translateToAbsolute(rect);
  rect=request.getTransformedRectangle(rect);
  figure.translateToRelative(rect);
  rect.translate(getLayoutOrigin().getNegated());
  if (figure instanceof IOutsideBorder) {
    Border border=((IOutsideBorder)figure).getOutsideBorder();
    if (border != null) {
      Insets insets=border.getInsets(figure);
      rect.shrink(insets.right,insets.bottom);
    }
  }
  return getConstraintFor(rect);
}
Program: 70396
Project: 70396
Buggy source:
/** 
 * Update column headers and data to table.
 * @param headers
 * @param dataList
 */
private void updateTablePreview(final ColumnBindingInfo[] headers,final List<?> dataList){
  fireEvent(tablePreview,EVENT_QUERY);
  if (tablePreview.isDisposed()) {
    return;
  }
  if (headers == null) {
    tablePreview.setEnabled(false);
    tablePreview.createDummyTable();
  }
 else {
    tablePreview.setEnabled(true);
    tablePreview.setColumns(headers);
    refreshTableColor();
    if (dataList != null) {
      for (Iterator<?> iterator=dataList.iterator(); iterator.hasNext(); ) {
        String[] dataRow=(String[])iterator.next();
        for (int i=0; i < dataRow.length; i++) {
          tablePreview.addEntry(dataRow[i],i);
        }
      }
    }
  }
  tablePreview.layout();
  int index=tableViewerColumns.getTable().getSelectionIndex();
  if (index >= 0) {
    tablePreview.moveTo(index);
  }
}

Fixed version (ground truth):
/** 
 * Update column headers and data to table.
 * @param headers
 * @param dataList
 */
private void updateTablePreview(final ColumnBindingInfo[] headers,final List<?> dataList){
  fireEvent(tablePreview,EVENT_QUERY);
  if (tablePreview.isDisposed()) {
    return;
  }
  if (headers == null || headers.length == 0) {
    tablePreview.setEnabled(false);
    tablePreview.createDummyTable();
  }
 else {
    tablePreview.setEnabled(true);
    tablePreview.setColumns(headers);
    refreshTableColor();
    if (dataList != null) {
      for (Iterator<?> iterator=dataList.iterator(); iterator.hasNext(); ) {
        String[] dataRow=(String[])iterator.next();
        for (int i=0; i < dataRow.length; i++) {
          tablePreview.addEntry(dataRow[i],i);
        }
      }
    }
  }
  tablePreview.layout();
  int index=tableViewerColumns.getTable().getSelectionIndex();
  if (index >= 0) {
    tablePreview.moveTo(index);
  }
}
Program: 70398
Project: 70398
Buggy source:
protected void updateChildrenPosition() throws BirtException {
  currentBP=0;
  if (children.size() > 0) {
    Iterator iter=children.iterator();
    int y=getOffsetY();
    int h=0;
    while (iter.hasNext()) {
      ContainerArea area=(ContainerArea)iter.next();
{
        area.setAllocatedPosition(getOffsetX(),y);
        int ah=area.getAllocatedHeight();
        y+=ah;
        h+=ah;
        if (area.finished) {
          currentBP+=ah;
        }
      }
    }
    setContentHeight(h);
  }
 else {
    setContentHeight(0);
  }
}

Fixed version (ground truth):
public void updateChildrenPosition() throws BirtException {
  currentBP=0;
  if (children.size() > 0) {
    Iterator iter=children.iterator();
    int y=getOffsetY();
    int h=0;
    while (iter.hasNext()) {
      ContainerArea area=(ContainerArea)iter.next();
{
        area.setAllocatedPosition(getOffsetX(),y);
        int ah=area.getAllocatedHeight();
        y+=ah;
        h+=ah;
        if (area.finished) {
          currentBP+=ah;
        }
      }
    }
    setContentHeight(h);
  }
 else {
    setContentHeight(0);
  }
}
Program: 70400
Project: 70400
Buggy source:
public CellArea cloneArea(){
  return new CellArea(this);
}

Fixed version (ground truth):
public CellArea cloneArea(){
  CellArea cell=new CellArea(this);
  cell.setBoxStyle(new BoxStyle(cell.getBoxStyle()));
  return cell;
}
Program: 70401
Project: 70401
Buggy source:
public SplitResult split(int height,boolean force) throws BirtException {
  if (force) {
    return _split(height,force);
  }
 else   if (isPageBreakInsideAvoid()) {
    if (isPageBreakBeforeAvoid()) {
      return SplitResult.BEFORE_AVOID_WITH_NULL;
    }
 else {
      _splitSpanCell(height,force);
      return SplitResult.SUCCEED_WITH_NULL;
    }
  }
 else {
    return _split(height,force);
  }
}

Fixed version (ground truth):
public SplitResult split(int height,boolean force) throws BirtException {
  if (force) {
    return _split(height,force);
  }
 else   if (isPageBreakInsideAvoid()) {
    if (isPageBreakBeforeAvoid()) {
      return SplitResult.BEFORE_AVOID_WITH_NULL;
    }
 else {
      _splitSpanCell(height,force);
      needResolveBorder=true;
      return SplitResult.SUCCEED_WITH_NULL;
    }
  }
 else {
    return _split(height,force);
  }
}
Program: 70402
Project: 70402
Buggy source:
protected SplitResult _split(int height,boolean force) throws BirtException {
  RowArea result=null;
  for (int i=0; i < cells.length; i++) {
    if (cells[i] != null) {
      SplitResult splitCell=cells[i].split(height,force);
      CellArea cell=(CellArea)splitCell.getResult();
      if (cell != null) {
        if (result == null) {
          result=cloneArea();
        }
        result.addChild(cell);
        result.setCell(cell);
      }
      i=cells[i].getColSpan() + i - 1;
    }
  }
  if (result != null) {
    result.updateRow(this);
    updateRow();
    return new SplitResult(result,SplitResult.SPLIT_SUCCEED_WITH_PART);
  }
 else {
    updateRow();
    return SplitResult.SUCCEED_WITH_NULL;
  }
}

Fixed version (ground truth):
protected SplitResult _split(int height,boolean force) throws BirtException {
  RowArea result=null;
  for (int i=0; i < cells.length; i++) {
    if (cells[i] != null) {
      SplitResult splitCell=cells[i].split(height,force);
      CellArea cell=(CellArea)splitCell.getResult();
      if (cell != null) {
        if (result == null) {
          result=cloneArea();
        }
        result.addChild(cell);
        result.setCell(cell);
      }
      i=cells[i].getColSpan() + i - 1;
    }
  }
  if (result != null) {
    result.updateRow(this);
    result.needResolveBorder=true;
    updateRow();
    needResolveBorder=true;
    return new SplitResult(result,SplitResult.SPLIT_SUCCEED_WITH_PART);
  }
 else {
    updateRow();
    needResolveBorder=true;
    return SplitResult.SUCCEED_WITH_NULL;
  }
}
Program: 70403
Project: 70403
Buggy source:
public SplitResult split(int height,boolean force) throws BirtException {
  SplitResult result=super.split(height,force);
  if (result.getResult() != null) {
    TableArea tableResult=(TableArea)result.getResult();
    int h=tableResult.layout.resolveAll();
    if (h > 0) {
      tableResult.setHeight(tableResult.getHeight() + h);
    }
    tableResult.resolveBottomBorder();
    resolveTopBorder();
  }
  return result;
}

Fixed version (ground truth):
public SplitResult split(int height,boolean force) throws BirtException {
  SplitResult result=super.split(height,force);
  if (result.getResult() != null) {
    TableArea tableResult=(TableArea)result.getResult();
    int h=tableResult.layout.resolveAll();
    if (h > 0) {
      tableResult.setHeight(tableResult.getHeight() + h);
    }
    tableResult.resolveBottomBorder();
    relayoutChildren();
  }
  return result;
}
Program: 70404
Project: 70404
Buggy source:
protected void addRows(ContainerArea container,TableLayout layout){
  if (container instanceof RowArea) {
    layout.addRow((RowArea)container,context.isFixedLayout());
  }
 else {
    java.util.Iterator<IArea> iter=container.getChildren();
    while (iter.hasNext()) {
      ContainerArea child=(ContainerArea)iter.next();
      addRows(child,layout);
    }
  }
}

Fixed version (ground truth):
protected void addRows(ContainerArea container,TableLayout layout) throws BirtException {
  if (container instanceof RowArea) {
    RowArea row=(RowArea)container;
    if (row.needResolveBorder) {
      int size=row.getChildrenCount();
      for (int i=0; i < size; i++) {
        CellArea cell=(CellArea)row.getChild(i);
        int ch=cell.getContentHeight();
        cell.boxStyle.clearBorder();
        layout.resolveBorderConflict(cell,true);
        cell.setContentHeight(ch);
      }
      row.needResolveBorder=false;
    }
    if (row.finished) {
      layout.addRow((RowArea)container,context.isFixedLayout());
    }
  }
 else {
    int size=container.getChildrenCount();
    for (int i=0; i < size; i++) {
      ContainerArea child=(ContainerArea)container.getChild(i);
      addRows(child,layout);
      child.updateChildrenPosition();
    }
  }
}
Program: 70406
Project: 70406
Buggy source:
private void doLayout_tmp(IDisplayServer xs,Chart cm,Bounds boFull,RunTimeContext rtc) throws ChartException {
  rtc.putState(RunTimeContext.StateKey.LABEL_LIMITER_LOOKUP_KEY,new HashMap<Label,LabelLimiter>());
  Legend lg=cm.getLegend();
  Position lgPos=lg.getPosition();
  new ChartLayout(xs,cm,boFull,rtc).compute(lgPos);
  Block bl=cm.getBlock();
  bl.setBounds(boFull);
  Plot pl=cm.getPlot();
  TitleBlock tb=cm.getTitle();
  for (Iterator itr=bl.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=(Block)itr.next();
    if (cbl != lg && cbl != pl && cbl != tb) {
      layoutBlock(xs,cm,bl.getBounds(),bl.getInsets(),cbl,rtc);
    }
  }
  for (Iterator itr=lg.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=(Block)itr.next();
    layoutBlock(xs,cm,lg.getBounds(),lg.getInsets(),cbl,rtc);
  }
  for (Iterator itr=tb.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=(Block)itr.next();
    layoutBlock(xs,cm,tb.getBounds(),tb.getInsets(),cbl,rtc);
  }
  for (Iterator itr=pl.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=(Block)itr.next();
    layoutBlock(xs,cm,pl.getBounds(),pl.getInsets(),cbl,rtc);
  }
}

Fixed version (ground truth):
private void doLayout_tmp(IDisplayServer xs,Chart cm,Bounds boFull,RunTimeContext rtc) throws ChartException {
  rtc.putState(RunTimeContext.StateKey.LABEL_LIMITER_LOOKUP_KEY,new HashMap<Label,LabelLimiter>());
  Legend lg=cm.getLegend();
  Position lgPos=lg.getPosition();
  new ChartLayout(xs,cm,boFull,rtc).compute(lgPos);
  Block bl=cm.getBlock();
  bl.setBounds(boFull);
  Plot pl=cm.getPlot();
  TitleBlock tb=cm.getTitle();
  for (Iterator<Block> itr=bl.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=itr.next();
    if (cbl != lg && cbl != pl && cbl != tb) {
      layoutBlock(xs,cm,bl.getBounds(),bl.getInsets(),cbl,rtc);
    }
  }
  for (Iterator<Block> itr=lg.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=itr.next();
    layoutBlock(xs,cm,lg.getBounds(),lg.getInsets(),cbl,rtc);
  }
  for (Iterator<Block> itr=tb.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=itr.next();
    layoutBlock(xs,cm,tb.getBounds(),tb.getInsets(),cbl,rtc);
  }
  for (Iterator<Block> itr=pl.getChildren().iterator(); itr.hasNext(); ) {
    Block cbl=itr.next();
    layoutBlock(xs,cm,pl.getBounds(),pl.getInsets(),cbl,rtc);
  }
}
Program: 70407
Project: 70407
Buggy source:
private void initTitleSizeLimit(IDisplayServer xs,Chart cm,RunTimeContext rtc,Bounds bo){
  final double dPercent=0.5;
  bo=bo.scaledInstance(xs.getDpiResolution() / 72d);
  bo.adjust(cm.getTitle().getInsets());
  LabelLimiter lbLimiter=new LabelLimiter(bo.getWidth(),bo.getHeight() * dPercent,0);
  Map<Label,LabelLimiter> mapLimiter=rtc.getState(RunTimeContext.StateKey.LABEL_LIMITER_LOOKUP_KEY);
  mapLimiter.put(cm.getTitle().getLabel(),lbLimiter);
}

Fixed version (ground truth):
private void initTitleSizeLimit(IDisplayServer xs,Chart cm,RunTimeContext rtc,Bounds bo){
  final double dPercent=0.5;
  bo=bo.scaledInstance(xs.getDpiResolution() / 72d);
  bo.adjust(cm.getTitle().getInsets());
  int iTitleAnchor=cm.getTitle().getAnchor().getValue();
  LabelLimiter lbLimiter=null;
  if (iTitleAnchor == Anchor.EAST || iTitleAnchor == Anchor.WEST) {
    lbLimiter=new LabelLimiter(bo.getWidth() * dPercent,bo.getHeight(),0);
  }
 else {
    lbLimiter=new LabelLimiter(bo.getWidth(),bo.getHeight() * dPercent,0);
  }
  Map<Label,LabelLimiter> mapLimiter=rtc.getState(RunTimeContext.StateKey.LABEL_LIMITER_LOOKUP_KEY);
  mapLimiter.put(cm.getTitle().getLabel(),lbLimiter);
}