nus-yam/ex-repair huggingface dataset:
Program: 74775
Project: 74775
Buggy source:
/** 
 * @param dimLevel
 * @param queryDefn
 * @return
 */
private int getAxisQualifierEdgeType(DimLevel dimLevel,ICubeQueryDefinition queryDefn){
  IEdgeDefinition edge=queryDefn.getEdge(ICubeQueryDefinition.COLUMN_EDGE);
  if (edge == null)   return ICubeQueryDefinition.ROW_EDGE;
  List dims=edge.getDimensions();
  for (int i=0; i < dims.size(); i++) {
    IDimensionDefinition dim=(IDimensionDefinition)dims.get(i);
    if (dim.getName().equals(dimLevel.getDimensionName())) {
      return ICubeQueryDefinition.ROW_EDGE;
    }
  }
  return ICubeQueryDefinition.COLUMN_EDGE;
}

Fixed version (ground truth):
/** 
 * @param dimLevel
 * @param queryDefn
 * @return
 */
private int getAxisQualifierEdgeType(DimLevel dimLevel,ICubeQueryDefinition queryDefn){
  IEdgeDefinition edge=queryDefn.getEdge(ICubeQueryDefinition.COLUMN_EDGE);
  if (edge != null) {
    List dims=edge.getDimensions();
    for (int i=0; i < dims.size(); i++) {
      IDimensionDefinition dim=(IDimensionDefinition)dims.get(i);
      if (dim.getName().equals(dimLevel.getDimensionName())) {
        return ICubeQueryDefinition.ROW_EDGE;
      }
    }
  }
  edge=queryDefn.getEdge(ICubeQueryDefinition.ROW_EDGE);
  if (edge != null) {
    List dims=edge.getDimensions();
    for (int i=0; i < dims.size(); i++) {
      IDimensionDefinition dim=(IDimensionDefinition)dims.get(i);
      if (dim.getName().equals(dimLevel.getDimensionName())) {
        return ICubeQueryDefinition.COLUMN_EDGE;
      }
    }
  }
  return -1;
}
Program: 74778
Project: 74778
Buggy source:
public IReportItemExecutor getNextChild(){
  if (childContent != null) {
    IReportItemExecutor ret=new ItemExecutorWrapper(childExecutor,childContent);
    childContent=null;
    childExecutor=null;
    needUpdate=true;
    return ret;
  }
  if (currentRunIn != null) {
    needUpdate=true;
    IReportItemExecutor runInChild=currentRunIn.getNextChild();
    if (runInChild != null) {
      IContent runInContent=runInChild.execute();
      if (firstChild) {
        transferPageBreak(currentRunInContent,runInContent);
        firstChild=false;
      }
      if (runInContent != null && (runInContent.getChildren() == null || runInContent.getChildren().size() == 0)) {
        execute(runInChild,runInContent);
        runInChild.close();
        runInChild=new DOMReportItemExecutor(runInContent);
      }
    }
    return runInChild;
  }
  assert(false);
  return null;
}

Fixed version (ground truth):
public IReportItemExecutor getNextChild(){
  if (childContent != null) {
    IReportItemExecutor ret=new ItemExecutorWrapper(childExecutor,childContent);
    childContent=null;
    childExecutor=null;
    needUpdate=true;
    return ret;
  }
  if (currentRunIn != null) {
    needUpdate=true;
    if (currentRunIn.hasNextChild()) {
      return currentRunIn.getNextChild();
    }
  }
  return null;
}
Program: 74779
Project: 74779
Buggy source:
public boolean hasNextChild(){
  if (!needUpdate) {
    return hasNext;
  }
  if (currentRunIn != null) {
    if (currentRunIn.hasNextChild()) {
      hasNext=true;
      needUpdate=false;
      return hasNext;
    }
 else {
      currentRunIn.close();
    }
  }
  currentRunIn=null;
  while (executor.hasNextChild()) {
    IReportItemExecutor next=executor.getNextChild();
    IContent nextContent=next.execute();
    if (nextContent instanceof IListBandContent) {
      IListBandContent band=(IListBandContent)nextContent;
      if (repeat && (band.getBandType() == IBandContent.BAND_HEADER || band.getBandType() == IBandContent.BAND_GROUP_HEADER)) {
        executeHeader(next,nextContent);
        next.close();
        next=new DOMReportItemExecutor(nextContent);
        next.execute();
        add(nextContent.getParent().getChildren(),nextContent);
      }
      if (next.hasNextChild()) {
        currentRunIn=next;
        currentRunInContent=nextContent;
        firstChild=true;
        break;
      }
    }
 else {
      childExecutor=next;
      childContent=nextContent;
      break;
    }
  }
  if (currentRunIn != null || childContent != null) {
    hasNext=true;
  }
 else {
    hasNext=false;
  }
  needUpdate=false;
  return hasNext;
}

Fixed version (ground truth):
public boolean hasNextChild(){
  if (!needUpdate) {
    return hasNext;
  }
  if (currentRunIn != null) {
    if (currentRunIn.hasNextChild()) {
      hasNext=true;
      needUpdate=false;
      return hasNext;
    }
 else {
      currentRunIn.close();
    }
  }
  currentRunIn=null;
  while (executor.hasNextChild()) {
    IReportItemExecutor next=executor.getNextChild();
    IContent nextContent=next.execute();
    if (nextContent instanceof IListBandContent) {
      IListBandContent band=(IListBandContent)nextContent;
      if (repeat && (band.getBandType() == IBandContent.BAND_HEADER || band.getBandType() == IBandContent.BAND_GROUP_HEADER)) {
        executeHeader(next,nextContent);
        next.close();
        next=new DOMReportItemExecutor(nextContent);
        next.execute();
        add(nextContent.getParent().getChildren(),nextContent);
      }
 else {
        next=new RunInContainerExecutor(next,nextContent);
      }
      if (next.hasNextChild()) {
        currentRunIn=next;
        currentRunInContent=nextContent;
        break;
      }
    }
 else {
      childExecutor=next;
      childContent=nextContent;
      break;
    }
  }
  if (currentRunIn != null || childContent != null) {
    hasNext=true;
  }
 else {
    hasNext=false;
  }
  needUpdate=false;
  return hasNext;
}
Program: 74780
Project: 74780
Buggy source:
/** 
 * Prepare the report parameters
 * @param request
 * @throws Exception
 */
protected void __initParameters(HttpServletRequest request) throws Exception {
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  options.setOption(InputOptions.OPT_RTL,new Boolean(rtl));
  this.parameterDefList=getReportService().getParameterDefinitions(this.reportDesignHandle,options,false);
  if (this.isDesigner && !IBirtConstants.SERVLET_PATH_FRAMESET.equalsIgnoreCase(request.getServletPath()))   parseConfigVars(request,parameterDefList);
  this.parametersAsString=getParsedParametersAsString(parameterDefList,request,options);
  if (documentInUrl)   this.missingParameter=false;
 else   this.missingParameter=BirtUtility.validateParameters(parameterDefList,this.parametersAsString);
  this.isShowParameterPage=checkShowParameterPage(request);
  this.defaultValues=getDefaultValues(this.reportDesignHandle,parameterDefList,request,options);
  this.displayTexts=BirtUtility.getDisplayTexts(this.parameterDefList,this.displayTexts,request);
  this.locParams=BirtUtility.getLocParams(this.locParams,request);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterDefList,request,options);
  this.parametersAsString=getParsedParametersAsStringWithDefaultValue(this.parametersAsString,parameterDefList,request,options);
}

Fixed version (ground truth):
/** 
 * Prepare the report parameters
 * @param request
 * @throws Exception
 */
protected void __initParameters(HttpServletRequest request) throws Exception {
  InputOptions options=new InputOptions();
  options.setOption(InputOptions.OPT_REQUEST,request);
  options.setOption(InputOptions.OPT_LOCALE,locale);
  options.setOption(InputOptions.OPT_RTL,new Boolean(rtl));
  this.parameterDefList=getReportService().getParameterDefinitions(this.reportDesignHandle,options,false);
  if (this.isDesigner && (IBirtConstants.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath()) || IBirtConstants.SERVLET_PATH_PARAMETER.equalsIgnoreCase(request.getServletPath())) && !ParameterAccessor.HEADER_REQUEST_TYPE_SOAP.equalsIgnoreCase(this.requestType))   parseConfigVars(request,parameterDefList);
  this.parametersAsString=getParsedParametersAsString(parameterDefList,request,options);
  if (documentInUrl)   this.missingParameter=false;
 else   this.missingParameter=BirtUtility.validateParameters(parameterDefList,this.parametersAsString);
  this.isShowParameterPage=checkShowParameterPage(request);
  this.defaultValues=getDefaultValues(this.reportDesignHandle,parameterDefList,request,options);
  this.displayTexts=BirtUtility.getDisplayTexts(this.parameterDefList,this.displayTexts,request);
  this.locParams=BirtUtility.getLocParams(this.locParams,request);
  this.parameters=(HashMap)getParsedParameters(this.reportDesignHandle,parameterDefList,request,options);
  this.parametersAsString=getParsedParametersAsStringWithDefaultValue(this.parametersAsString,parameterDefList,request,options);
}
Program: 74782
Project: 74782
Buggy source:
/** 
 * Check the passed String whether be contained in list
 * @param values
 * @param value
 * @return
 */
public static boolean contain(List values,String value){
  if (values == null)   return false;
  for (Iterator it=values.iterator(); it.hasNext(); ) {
    Object obj=it.next();
    if (obj == null) {
      if (value == null)       return true;
      continue;
    }
    if (obj instanceof String && ((String)obj).equals(value))     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check the passed String whether be contained in list
 * @param values
 * @param value
 * @param ifDelete
 * @return
 */
public static boolean contain(List values,String value,boolean ifDelete){
  if (values == null)   return false;
  for (Iterator it=values.iterator(); it.hasNext(); ) {
    Object obj=it.next();
    if (obj == null) {
      if (value == null) {
        if (ifDelete)         values.remove(obj);
        return true;
      }
      continue;
    }
    if (obj instanceof String && ((String)obj).equals(value)) {
      if (ifDelete)       values.remove(obj);
      return true;
    }
  }
  return false;
}
Program: 74783
Project: 74783
Buggy source:
public IResultSet executeQuery() throws OdaException {
  logger.logp(java.util.logging.Level.FINE,CallStatement.class.getName(),"String_Node_Str","String_Node_Str");
  if (this.cachedResultSet != null) {
    IResultSet ret=this.cachedResultSet;
    this.cachedResultSet=null;
    return ret;
  }
  try {
    if (!maxRowsUpToDate) {
      try {
        assertNotNull(callStat);
        callStat.setMaxRows(maxrows);
      }
 catch (      SQLException e1) {
      }
      maxRowsUpToDate=true;
    }
    registerOutputParameter();
    java.sql.ResultSet rs=this.callStat.executeQuery();
    if (rs != null)     return new ResultSet(rs);
    java.sql.ResultSet resultSet=getOutputParamResultSet();
    if (resultSet != null)     return new ResultSet(resultSet);
 else     return new SPResultSet(null);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_RETURN,e);
  }
}

Fixed version (ground truth):
public IResultSet executeQuery() throws OdaException {
  logger.logp(java.util.logging.Level.FINE,CallStatement.class.getName(),"String_Node_Str","String_Node_Str");
  if (this.cachedResultSet != null) {
    IResultSet ret=this.cachedResultSet;
    this.cachedResultSet=null;
    return ret;
  }
  if (!maxRowsUpToDate) {
    try {
      assertNotNull(callStat);
      callStat.setMaxRows(maxrows);
    }
 catch (    SQLException e1) {
    }
    maxRowsUpToDate=true;
  }
  registerOutputParameter();
  java.sql.ResultSet rs=null;
  try {
    this.callStat.execute();
    rs=this.callStat.getResultSet();
    while (rs == null && this.callStat.getMoreResults()) {
      rs=this.callStat.getResultSet();
    }
    if (rs != null)     return new ResultSet(rs);
    java.sql.ResultSet resultSet=getOutputParamResultSet();
    if (resultSet != null)     return new ResultSet(resultSet);
 else     return new SPResultSet(null);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_RETURN,e);
  }
}
Program: 74785
Project: 74785
Buggy source:
/** 
 * @param cubeHandle
 * @return
 */
private boolean needCachedDataSetToEnhancePerformance(TabularCubeHandle cubeHandle){
  DataSetHandle dsHandle=cubeHandle.getDataSet();
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  for (int i=0; i < dimHandles.size(); i++) {
    DimensionHandle dimHandle=(DimensionHandle)dimHandles.get(i);
    List hiers=dimHandle.getContents(DimensionHandle.HIERARCHIES_PROP);
    TabularHierarchyHandle hierHandle=(TabularHierarchyHandle)hiers.get(0);
    if (!dsHandle.equals(hierHandle.getDataSet()))     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param cubeHandle
 * @return
 */
private boolean needCachedDataSetToEnhancePerformance(TabularCubeHandle cubeHandle){
  DataSetHandle dsHandle=cubeHandle.getDataSet();
  List dimHandles=cubeHandle.getContents(CubeHandle.DIMENSIONS_PROP);
  for (int i=0; i < dimHandles.size(); i++) {
    DimensionHandle dimHandle=(DimensionHandle)dimHandles.get(i);
    List hiers=dimHandle.getContents(DimensionHandle.HIERARCHIES_PROP);
    TabularHierarchyHandle hierHandle=(TabularHierarchyHandle)hiers.get(0);
    if (hierHandle.getDataSet() != null)     return false;
  }
  return true;
}
Program: 74787
Project: 74787
Buggy source:
public void setUp(){
  copyResource(REPORT_DESIGN_SOURCE,REPORT_DESIGN);
}

Fixed version (ground truth):
public void setUp() throws Exception {
  super.setUp();
  copyResource(REPORT_DESIGN_SOURCE,REPORT_DESIGN);
}
Program: 74788
Project: 74788
Buggy source:
ResultSetColumnInfo(OdaResultSetColumn column,ColumnHint hint){
  this.column=column;
  this.hint=hint;
}

Fixed version (ground truth):
/** 
 * @param column
 * @param hint
 */
ResultSetColumnInfo(OdaResultSetColumn column,ColumnHint hint){
  this.column=column;
  this.hint=hint;
}
Program: 74789
Project: 74789
Buggy source:
/** 
 * Updates column hint values by given data element attributes.
 * @param dataAttrs the latest data element attributes
 * @param cachedDataAttrs the last(cached) data element attributes
 * @param newHint the column hint
 */
private void updateColumnHintFromDataAttrs(DataElementAttributes dataAttrs,DataElementAttributes cachedDataAttrs,ColumnHint newHint){
  if (dataAttrs == null)   return;
  Object oldValue=cachedDataAttrs == null ? null : cachedDataAttrs.getName();
  Object newValue=dataAttrs.getName();
  if (oldValue == null || !oldValue.equals(newValue))   newHint.setProperty(ColumnHint.COLUMN_NAME_MEMBER,newValue);
  DataElementUIHints dataUIHints=dataAttrs.getUiHints();
  if (dataUIHints == null)   return;
  DataElementUIHints cachedDataUIHints=cachedDataAttrs == null ? null : cachedDataAttrs.getUiHints();
  oldValue=cachedDataUIHints == null ? null : cachedDataUIHints.getDisplayName();
  newValue=dataUIHints.getDisplayName();
  if (oldValue == null || !oldValue.equals(newValue)) {
    newHint.setProperty(ColumnHint.DISPLAY_NAME_MEMBER,newValue);
  }
}

Fixed version (ground truth):
/** 
 * Updates column hint values by given data element attributes.
 * @param dataAttrs the latest data element attributes
 * @param cachedDataAttrs the last(cached) data element attributes
 * @param newHint the column hint
 */
private void updateColumnHintFromDataAttrs(DataElementAttributes dataAttrs,DataElementAttributes cachedDataAttrs,ColumnHint newHint){
  if (dataAttrs == null)   return;
  Object oldValue=cachedDataAttrs == null ? null : cachedDataAttrs.getName();
  Object newValue=dataAttrs.getName();
  if (oldValue == null || !oldValue.equals(newValue))   newHint.setProperty(ColumnHint.COLUMN_NAME_MEMBER,newValue);
  DataElementUIHints dataUIHints=dataAttrs.getUiHints();
  if (dataUIHints == null)   return;
  DataElementUIHints cachedDataUIHints=cachedDataAttrs == null ? null : cachedDataAttrs.getUiHints();
  oldValue=cachedDataUIHints == null ? null : cachedDataUIHints.getDisplayName();
  newValue=dataUIHints.getDisplayName();
  String handleValue=(String)newHint.getLocalProperty(null,ColumnHint.DISPLAY_NAME_MEMBER);
  if (handleValue != null && !handleValue.equals(oldValue))   return;
  if (oldValue == null || !oldValue.equals(newValue)) {
    newHint.setProperty(ColumnHint.DISPLAY_NAME_MEMBER,newValue);
  }
}
Program: 74791
Project: 74791
Buggy source:
/** 
 * Get Display Text of select parameters
 * @param parameters
 * @param displayTexts
 * @param request
 * @return Map
 */
public static Map getDisplayTexts(Collection parameters,Map displayTexts,HttpServletRequest request){
  if (displayTexts == null)   displayTexts=new HashMap();
  Enumeration params=request.getParameterNames();
  while (params != null && params.hasMoreElements()) {
    String param=DataUtil.getString(params.nextElement());
    String paramName=ParameterAccessor.isDisplayText(param);
    if (paramName != null) {
      ParameterDefinition parameter=findParameterDefinition(parameters,paramName);
      if (parameter != null && !parameter.isMultiValue())       displayTexts.put(paramName,ParameterAccessor.getParameter(request,param));
    }
  }
  return displayTexts;
}

Fixed version (ground truth):
/** 
 * Get Display Text of select parameters
 * @param parameters
 * @param displayTexts
 * @param request
 * @return Map
 */
public static Map getDisplayTexts(Collection parameters,Map displayTexts,HttpServletRequest request){
  if (displayTexts == null)   displayTexts=new HashMap();
  Enumeration params=request.getParameterNames();
  while (params != null && params.hasMoreElements()) {
    String param=DataUtil.getString(params.nextElement());
    String paramName=ParameterAccessor.isDisplayText(param);
    if (paramName != null) {
      ParameterDefinition parameter=findParameterDefinition(parameters,paramName);
      if (parameter != null) {
        if (parameter.isMultiValue())         displayTexts.put(paramName,null);
 else         displayTexts.put(paramName,ParameterAccessor.getParameter(request,param));
      }
    }
  }
  return displayTexts;
}
Program: 74793
Project: 74793
Buggy source:
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
  if (isFirstContent) {
    startPageContent(content);
    isFirstContent=false;
  }
  if (emitter != null) {
    if (content.getContentType() == IContent.PAGE_CONTENT) {
      ContentEmitterUtil.endContent(pageContent,emitter);
    }
 else {
      ContentEmitterUtil.endContent(content,emitter);
    }
  }
}

Fixed version (ground truth):
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
  if (!visible) {
    return;
  }
  if (isFirstContent) {
    startPageContent(content);
    isFirstContent=false;
  }
  if (emitter != null) {
    if (content.getContentType() == IContent.PAGE_CONTENT) {
      ContentEmitterUtil.endContent(pageContent,emitter);
    }
 else {
      ContentEmitterUtil.endContent(content,emitter);
    }
  }
}
Program: 74795
Project: 74795
Buggy source:
/** 
 * Boolean -> BigDecimal true 	-> 1 others 	-> 0  Date -> BigDecimal Date.getTime(); String -> BigDecimal new BigDecimal(String);
 * @param source
 * @return
 * @throws BirtException
 */
public static BigDecimal toBigDecimal(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof BigDecimal) {
    return (BigDecimal)source;
  }
 else   if (source instanceof Number) {
    String str=((Number)source).toString();
    try {
      return new BigDecimal(str);
    }
 catch (    NumberFormatException e) {
      throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{str,"String_Node_Str"});
    }
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new BigDecimal(1d);
    return new BigDecimal(0d);
  }
 else   if (source instanceof Date) {
    long longValue=((Date)source).getTime();
    return new BigDecimal(longValue);
  }
 else   if (source instanceof String) {
    try {
      return new BigDecimal((String)source);
    }
 catch (    NumberFormatException e) {
      throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
    }
  }
 else {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
}

Fixed version (ground truth):
/** 
 * Boolean -> BigDecimal true 	-> 1 others 	-> 0  Date -> BigDecimal Date.getTime(); String -> BigDecimal new BigDecimal(String);
 * @param source
 * @return
 * @throws BirtException
 */
public static BigDecimal toBigDecimal(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof BigDecimal) {
    return (BigDecimal)source;
  }
 else   if (source instanceof Number) {
    String str=((Number)source).toString();
    try {
      return new BigDecimal(str);
    }
 catch (    NumberFormatException e) {
      throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{str,"String_Node_Str"});
    }
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new BigDecimal(1d);
    return new BigDecimal(0d);
  }
 else   if (source instanceof Date) {
    long longValue=((Date)source).getTime();
    return new BigDecimal(longValue);
  }
 else   if (source instanceof String) {
    try {
      return new BigDecimal((String)source);
    }
 catch (    NumberFormatException e) {
      try {
        Number number=NumberFormat.getInstance(ULocale.getDefault()).parse((String)source);
        if (number != null)         return new BigDecimal(number.toString());
        throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
      }
 catch (      ParseException e1) {
        throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
      }
    }
  }
 else {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
}
Program: 74796
Project: 74796
Buggy source:
/** 
 * Boolean -> Integer true 	-> 1 others 	-> 0  Date -> Integer Date.getTime(); String -> Integer Integer.valueOf();
 * @param source
 * @return
 * @throws BirtException
 */
public static Integer toInteger(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Integer) {
    return (Integer)source;
  }
 else   if (source instanceof Number) {
    int intValue=((Number)source).intValue();
    return new Integer(intValue);
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new Integer(1);
    return new Integer(0);
  }
 else   if (source instanceof Date) {
    long longValue=((Date)source).getTime();
    return new Integer((int)longValue);
  }
 else   if (source instanceof String) {
    try {
      return new Integer(Double.valueOf((String)source).intValue());
    }
 catch (    NumberFormatException e) {
      throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
    }
  }
 else {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
}

Fixed version (ground truth):
/** 
 * Boolean -> Integer true 	-> 1 others 	-> 0  Date -> Integer Date.getTime(); String -> Integer Integer.valueOf();
 * @param source
 * @return
 * @throws BirtException
 */
public static Integer toInteger(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Integer) {
    return (Integer)source;
  }
 else   if (source instanceof Number) {
    int intValue=((Number)source).intValue();
    return new Integer(intValue);
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new Integer(1);
    return new Integer(0);
  }
 else   if (source instanceof Date) {
    long longValue=((Date)source).getTime();
    return new Integer((int)longValue);
  }
 else   if (source instanceof String) {
    try {
      return new Integer(Double.valueOf((String)source).intValue());
    }
 catch (    NumberFormatException e) {
      try {
        Number number=NumberFormat.getInstance(ULocale.getDefault()).parse((String)source);
        if (number != null)         return new Integer(number.intValue());
        throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
      }
 catch (      ParseException e1) {
        throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
      }
    }
  }
 else {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
}
Program: 74797
Project: 74797
Buggy source:
/** 
 * Boolean -> Double true 	-> 1 others 	-> 0  Date -> Double Date.getTime(); String -> Double Double.valueOf(String);
 * @param source
 * @return
 * @throws BirtException
 */
public static Double toDouble(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Double) {
    return (Double)source;
  }
 else   if (source instanceof Number) {
    double doubleValue=((Number)source).doubleValue();
    return new Double(doubleValue);
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new Double(1d);
    return new Double(0d);
  }
 else   if (source instanceof Date) {
    double doubleValue=((Date)source).getTime();
    return new Double(doubleValue);
  }
 else   if (source instanceof String) {
    try {
      return Double.valueOf((String)source);
    }
 catch (    NumberFormatException e) {
      throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
    }
  }
 else {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
}

Fixed version (ground truth):
/** 
 * Boolean -> Double true 	-> 1 others 	-> 0  Date -> Double Date.getTime(); String -> Double Double.valueOf(String);
 * @param source
 * @return
 * @throws BirtException
 */
public static Double toDouble(Object source) throws BirtException {
  if (source == null)   return null;
  if (source instanceof Double) {
    return (Double)source;
  }
 else   if (source instanceof Number) {
    double doubleValue=((Number)source).doubleValue();
    return new Double(doubleValue);
  }
 else   if (source instanceof Boolean) {
    if (true == ((Boolean)source).booleanValue())     return new Double(1d);
    return new Double(0d);
  }
 else   if (source instanceof Date) {
    double doubleValue=((Date)source).getTime();
    return new Double(doubleValue);
  }
 else   if (source instanceof String) {
    try {
      return Double.valueOf((String)source);
    }
 catch (    NumberFormatException e) {
      try {
        Number number=NumberFormat.getInstance(ULocale.getDefault()).parse((String)source);
        if (number != null)         return new Double(number.doubleValue());
        throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
      }
 catch (      ParseException e1) {
        throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
      }
    }
  }
 else {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
}
Program: 74798
Project: 74798
Buggy source:
/** 
 * @throws Exception
 */
public void testWrongDataType() throws Exception {
  ccName=new String[]{"String_Node_Str","String_Node_Str"};
  ccExpr=new String[]{"String_Node_Str","String_Node_Str"};
  for (int i=0; i < ccName.length; i++) {
    ComputedColumn computedColumn=new ComputedColumn(ccName[i],ccExpr[i],DataType.INTEGER_TYPE);
    ((BaseDataSetDesign)this.dataSet).addComputedColumn(computedColumn);
  }
  String[] bindingNameRow=new String[6];
  bindingNameRow[0]="String_Node_Str";
  bindingNameRow[1]="String_Node_Str";
  bindingNameRow[2]="String_Node_Str";
  bindingNameRow[3]="String_Node_Str";
  bindingNameRow[4]="String_Node_Str";
  bindingNameRow[5]="String_Node_Str";
  ScriptExpression[] bindingExprRow=new ScriptExpression[]{new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + ccName[0],0),new ScriptExpression("String_Node_Str" + ccName[1],0)};
  try {
    this.executeQuery(this.createQuery(null,null,null,null,null,null,null,null,null,bindingNameRow,bindingExprRow));
  }
 catch (  DataException e) {
    return;
  }
  fail("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @throws Exception
 */
public void testWrongDataType() throws Exception {
  ccName=new String[]{"String_Node_Str","String_Node_Str"};
  ccExpr=new String[]{"String_Node_Str","String_Node_Str"};
  for (int i=0; i < ccName.length; i++) {
    ComputedColumn computedColumn=new ComputedColumn(ccName[i],ccExpr[i],DataType.INTEGER_TYPE);
    ((BaseDataSetDesign)this.dataSet).addComputedColumn(computedColumn);
  }
  String[] bindingNameRow=new String[6];
  bindingNameRow[0]="String_Node_Str";
  bindingNameRow[1]="String_Node_Str";
  bindingNameRow[2]="String_Node_Str";
  bindingNameRow[3]="String_Node_Str";
  bindingNameRow[4]="String_Node_Str";
  bindingNameRow[5]="String_Node_Str";
  ScriptExpression[] bindingExprRow=new ScriptExpression[]{new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + "String_Node_Str",0),new ScriptExpression("String_Node_Str" + ccName[0],0),new ScriptExpression("String_Node_Str" + ccName[1],0)};
  try {
    Object o=this.executeQuery(this.createQuery(null,null,null,null,null,null,null,null,null,bindingNameRow,bindingExprRow));
    System.out.println(o);
  }
 catch (  DataException e) {
    return;
  }
  fail("String_Node_Str");
}
Program: 74799
Project: 74799
Buggy source:
/** 
 * get the top/bottom filter selected dimension positions.
 * @param dimension
 * @param dimPosition
 * @param topBottomfilterList 
 * @return
 * @throws IOException 
 * @throws DataException 
 */
private IDiskArray getTopbottomFilterPositions(Dimension dimension,IDiskArray dimPosition,List filterList) throws IOException, DataException {
  IDiskArray result=dimPosition;
  ILevel[] levels=dimension.getHierarchy().getLevels();
  for (int i=0; i < filterList.size(); i++) {
    IJSTopBottomFilterHelper filter=(IJSTopBottomFilterHelper)filterList.get(i);
    List dimValueArrayList=evaluateFilter(dimension,dimPosition,levels,filter);
    IDiskArray dimPositionArray=fetchDimPositions(dimValueArrayList,filter);
    result=getIntersection(result,dimPositionArray);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * get the top/bottom filter selected dimension positions.
 * @param dimension
 * @param dimPosition
 * @param topBottomfilterList 
 * @return
 * @throws IOException 
 * @throws DataException 
 */
private IDiskArray getTopbottomFilterPositions(Dimension dimension,IDiskArray dimPosition,List filterList) throws IOException, DataException {
  IDiskArray result=null;
  ILevel[] levels=dimension.getHierarchy().getLevels();
  for (int i=0; i < filterList.size(); i++) {
    IJSTopBottomFilterHelper filter=(IJSTopBottomFilterHelper)filterList.get(i);
    List dimValueArrayList=evaluateFilter(dimension,dimPosition,levels,filter);
    IDiskArray dimPositionArray=fetchDimPositions(dimValueArrayList,filter);
    if (result == null) {
      result=dimPositionArray;
    }
 else {
      result=getIntersection(result,dimPositionArray);
    }
  }
  return result == null ? dimPosition : result;
}
Program: 74800
Project: 74800
Buggy source:
/** 
 * @throws DataException
 */
private void populateDataSet() throws DataException {
  int originalMaxRows=this.populator.getQuery().getMaxRows();
  boolean changeMaxRows=filterByRow == null ? false : filterByRow.getFilterList(FilterByRow.QUERY_FILTER).size() + filterByRow.getFilterList(FilterByRow.GROUP_FILTER).size() > 0;
  if (changeMaxRows)   this.populator.getQuery().setMaxRows(0);
  List aggCCList=prepareComputedColumns(TransformationConstants.DATA_SET_MODEL);
  doDataSetFilter(changeMaxRows);
  populateAggrCCs(this.getAggrComputedColumns(aggCCList,true));
  removeAvailableComputedColumns();
  populateComputedColumns(this.getAggrComputedColumns(aggCCList,false));
  this.populator.getQuery().setMaxRows(originalMaxRows);
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
private void populateDataSet() throws DataException {
  int originalMaxRows=this.populator.getQuery().getMaxRows();
  boolean changeMaxRows=filterByRow == null ? false : filterByRow.getFilterList(FilterByRow.QUERY_FILTER).size() + filterByRow.getFilterList(FilterByRow.GROUP_FILTER).size() > 0;
  if (changeMaxRows)   this.populator.getQuery().setMaxRows(0);
  if (this.computedColumnHelper != null)   this.computedColumnHelper.setModel(TransformationConstants.NONE_MODEL);
  doDataSetFilter(changeMaxRows);
  List aggCCList=prepareComputedColumns(TransformationConstants.DATA_SET_MODEL);
  populateAggrCCs(this.getAggrComputedColumns(aggCCList,true));
  removeAvailableComputedColumns();
  populateComputedColumns(this.getAggrComputedColumns(aggCCList,false));
  this.populator.getQuery().setMaxRows(originalMaxRows);
}
Program: 74801
Project: 74801
Buggy source:
public void testToStringObject(){
  String result;
  for (int i=0; i < testObject.length; i++) {
    try {
      result=DataTypeUtil.toString(testObject[i]);
      if (resultString[i] instanceof Exception)       fail("String_Node_Str");
      assertEquals(result,resultString[i]);
    }
 catch (    BirtException e) {
      if (!(resultString[i] instanceof Exception))       fail("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void testToStringObject(){
  String result;
  for (int i=0; i < testObject.length; i++) {
    try {
      result=DataTypeUtil.toString(testObject[i]);
      if (resultString[i] instanceof Exception)       fail("String_Node_Str");
      if (testObject[i] instanceof Double) {
        result=DataTypeUtil.toDouble(result).toString();
      }
 else       if (testObject[i] instanceof Integer || testObject[i] instanceof BigDecimal) {
        result=DataTypeUtil.toInteger(result).toString();
      }
      assertEquals(result,resultString[i]);
    }
 catch (    BirtException e) {
      if (!(resultString[i] instanceof Exception))       fail("String_Node_Str");
    }
  }
}
Program: 74805
Project: 74805
Buggy source:
/** 
 * execute the executor, drip all its children contents.
 * @param executor
 */
private void traverse(IReportItemExecutor executor){
}

Fixed version (ground truth):
/** 
 * execute the executor, drip all its children contents.
 * @param executor
 */
private void traverse(IReportItemExecutor executor,IContent content){
}
Program: 74806
Project: 74806
Buggy source:
protected void start(boolean isFirst){
  if (emitter != null) {
    context.getPageBufferManager().startContent(content,emitter);
  }
}

Fixed version (ground truth):
protected void start(boolean isFirst){
  if (emitter != null) {
    context.getPageBufferManager().startContent(content,emitter,true);
  }
}
Program: 74807
Project: 74807
Buggy source:
protected void start(boolean isFirst){
  MasterPageDesign pageDesign=getMasterPage(report);
  pageContent=ReportExecutorUtil.executeMasterPage(reportExecutor,context.getPageNumber(),pageDesign);
  if (emitter != null) {
    context.getPageBufferManager().startContainer(pageContent,isFirst,emitter);
  }
}

Fixed version (ground truth):
protected void start(boolean isFirst){
  MasterPageDesign pageDesign=getMasterPage(report);
  pageContent=ReportExecutorUtil.executeMasterPage(reportExecutor,context.getPageNumber(),pageDesign);
  if (emitter != null) {
    context.getPageBufferManager().startContainer(pageContent,isFirst,emitter,true);
  }
}
Program: 74808
Project: 74808
Buggy source:
protected void end(boolean finished){
  if (emitter != null) {
    context.getPageBufferManager().endContainer(pageContent,finished,emitter);
  }
}

Fixed version (ground truth):
protected void end(boolean finished){
  if (emitter != null) {
    context.getPageBufferManager().endContainer(pageContent,finished,emitter,true);
  }
}
Program: 74809
Project: 74809
Buggy source:
protected void start(boolean isFirst){
  if (emitter != null) {
    context.getPageBufferManager().startContainer(content,isFirst,emitter);
  }
}

Fixed version (ground truth):
protected void start(boolean isFirst){
  if (emitter != null) {
    context.getPageBufferManager().startContainer(content,isFirst,emitter,true);
  }
}
Program: 74810
Project: 74810
Buggy source:
protected void end(boolean finished){
  if (emitter != null) {
    context.getPageBufferManager().endContainer(content,finished,emitter);
  }
}

Fixed version (ground truth):
protected void end(boolean finished){
  if (emitter != null) {
    context.getPageBufferManager().endContainer(content,finished,emitter,true);
  }
}
Program: 74811
Project: 74811
Buggy source:
protected void start(boolean isFirst){
  context.getPageBufferManager().startContainer(content,isFirst,tableEmitter);
}

Fixed version (ground truth):
protected void start(boolean isFirst){
  context.getPageBufferManager().startContainer(content,isFirst,tableEmitter,true);
}
Program: 74812
Project: 74812
Buggy source:
protected void end(boolean finished){
  context.getPageBufferManager().endContainer(content,finished,tableEmitter);
}

Fixed version (ground truth):
protected void end(boolean finished){
  context.getPageBufferManager().endContainer(content,finished,tableEmitter,true);
}
Program: 74813
Project: 74813
Buggy source:
public void startContent(IContent content,IContentEmitter emitter){
  if (isFirstContent) {
    startPageContent(content);
    isFirstContent=false;
  }
  if (emitter != null) {
    ContentEmitterUtil.startContent(content,emitter);
    ContentEmitterUtil.endContent(content,emitter);
  }
}

Fixed version (ground truth):
public void startContent(IContent content,IContentEmitter emitter,boolean visible){
  if (!visible) {
    return;
  }
  if (isFirstContent) {
    startPageContent(content);
    isFirstContent=false;
  }
  if (emitter != null) {
    ContentEmitterUtil.startContent(content,emitter);
    ContentEmitterUtil.endContent(content,emitter);
  }
}
Program: 74814
Project: 74814
Buggy source:
public void endContainer(IContent content,boolean finished,IContentEmitter emitter){
  if (isFirstContent) {
    startPageContent(content);
    isFirstContent=false;
  }
  if (emitter != null) {
    if (content.getContentType() == IContent.PAGE_CONTENT) {
      ContentEmitterUtil.endContent(pageContent,emitter);
    }
 else {
      ContentEmitterUtil.endContent(content,emitter);
    }
  }
}

Fixed version (ground truth):
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
  if (isFirstContent) {
    startPageContent(content);
    isFirstContent=false;
  }
  if (emitter != null) {
    if (content.getContentType() == IContent.PAGE_CONTENT) {
      ContentEmitterUtil.endContent(pageContent,emitter);
    }
 else {
      ContentEmitterUtil.endContent(content,emitter);
    }
  }
}
Program: 74815
Project: 74815
Buggy source:
public void startContainer(IContent content,boolean isFirst,IContentEmitter emitter){
  if (content.getContentType() == IContent.PAGE_CONTENT) {
    isFirstContent=true;
    pageContent=content;
    pageEmitter=emitter;
  }
 else {
    if (isFirstContent) {
      startPageContent(content);
      isFirstContent=false;
    }
    if (emitter != null) {
      ContentEmitterUtil.startContent(content,emitter);
    }
  }
}

Fixed version (ground truth):
public void startContainer(IContent content,boolean isFirst,IContentEmitter emitter,boolean visible){
  if (!visible) {
    return;
  }
  if (content.getContentType() == IContent.PAGE_CONTENT) {
    isFirstContent=true;
    pageContent=content;
    pageEmitter=emitter;
  }
 else {
    if (isFirstContent) {
      startPageContent(content);
      isFirstContent=false;
    }
    if (emitter != null) {
      ContentEmitterUtil.startContent(content,emitter);
    }
  }
}
Program: 74816
Project: 74816
Buggy source:
public void startContent(IContent content,IContentEmitter emitter){
  if (isRepeated) {
    LeafBufferNode leafNode=new LeafBufferNode(content,emitter,generator);
    setup(leafNode,true);
    currentNode.addChild(leafNode);
  }
 else {
    currentNode.start();
    ContentEmitterUtil.startContent(content,emitter);
    generator.start(content,true);
    generator.end(content,true);
  }
}

Fixed version (ground truth):
public void startContent(IContent content,IContentEmitter emitter,boolean visible){
  if (isRepeated || (!visible && !isPageStarted())) {
    LeafBufferNode leafNode=new LeafBufferNode(content,emitter,generator);
    setup(leafNode,true);
  }
 else {
    LeafBufferNode leafNode=new LeafBufferNode(content,emitter,generator);
    setup(leafNode,true);
    currentNode.start();
    ContentEmitterUtil.startContent(content,emitter);
    generator.start(content,true);
    generator.end(content,true);
    currentNode.removeChildren();
  }
}
Program: 74817
Project: 74817
Buggy source:
protected void endCell(IContent content,boolean finished,IContentEmitter emitter){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
  }
  currentNode=currentNode.getParent();
}

Fixed version (ground truth):
protected void endCell(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
  }
  currentNode=currentNode.getParent();
}
Program: 74818
Project: 74818
Buggy source:
public void endContainer(IContent content,boolean finished,IContentEmitter emitter){
  int type=content.getContentType();
switch (type) {
case IContent.TABLE_BAND_CONTENT:
case IContent.LIST_BAND_CONTENT:
    boolean isFinished=finished && !isRepeated;
  _endContainer(content,isFinished,emitter);
break;
case IContent.PAGE_CONTENT:
endPage(content,finished,emitter);
break;
case IContent.CELL_CONTENT:
endCell(content,finished,emitter);
break;
default :
_endContainer(content,finished,emitter);
break;
}
}

Fixed version (ground truth):
public void endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
  int type=content.getContentType();
switch (type) {
case IContent.TABLE_BAND_CONTENT:
case IContent.LIST_BAND_CONTENT:
    boolean isFinished=finished && !isRepeated;
  _endContainer(content,isFinished,emitter,visible);
break;
case IContent.PAGE_CONTENT:
endPage(content,finished,emitter);
break;
case IContent.CELL_CONTENT:
endCell(content,finished,emitter,visible);
break;
default :
_endContainer(content,finished,emitter,visible);
break;
}
}
Program: 74819
Project: 74819
Buggy source:
private void _endContainer(IContent content,boolean finished,IContentEmitter emitter){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
  }
 else {
    if (finished && !isRepeated) {
      currentNode.flush();
    }
  }
  currentNode=currentNode.getParent();
  if (currentNode != null && !isRepeated) {
    currentNode.removeChildren();
  }
}

Fixed version (ground truth):
private void _endContainer(IContent content,boolean finished,IContentEmitter emitter,boolean visible){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
  }
 else {
    if (finished && !isRepeated) {
      if (visible) {
        currentNode.flush();
      }
 else       if (isPageStarted()) {
        currentNode.flush();
      }
    }
  }
  currentNode=currentNode.getParent();
  if (currentNode != null && finished && !isRepeated) {
    if (visible) {
      currentNode.removeChildren();
    }
 else     if (isPageStarted()) {
      currentNode.removeChildren();
    }
  }
}
Program: 74820
Project: 74820
Buggy source:
public void endPage(IContent content,boolean finished,IContentEmitter emitter){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
    pageBreakEvent();
    if (!finished) {
      context.setPageNumber(context.getPageNumber() + 1);
    }
  }
 else {
    if (finished && context.getPageNumber() == 1) {
      currentNode.flush();
      pageBreakEvent();
    }
  }
  generator.reset();
  context.removeLayoutHint();
  context.clearPageHint();
  currentNode=null;
}

Fixed version (ground truth):
public void endPage(IContent content,boolean finished,IContentEmitter emitter){
  ((AbstractNode)currentNode).setFinished(finished);
  if (currentNode.isStarted()) {
    currentNode.end();
    pageBreakEvent();
    if (!finished) {
      context.setPageNumber(context.getPageNumber() + 1);
    }
  }
 else {
    if (finished) {
      if (context.getPageNumber() == 1) {
        currentNode.flush();
        pageBreakEvent();
      }
 else {
        context.setPageNumber(context.getPageNumber() - 1);
      }
    }
  }
  generator.reset();
  context.removeLayoutHint();
  context.clearPageHint();
  currentNode=null;
}
Program: 74821
Project: 74821
Buggy source:
public void startContainer(IContent content,boolean isFirst,IContentEmitter emitter){
  int type=content.getContentType();
switch (type) {
case IContent.TABLE_BAND_CONTENT:
case IContent.LIST_BAND_CONTENT:
    boolean first=isFirst && !isRepeated;
  ContainerBufferNode bandNode=new ContainerBufferNode(content,emitter,generator);
setup(bandNode,first);
currentNode=bandNode;
break;
case IContent.CELL_CONTENT:
ContainerBufferNode cellNode=new ContainerBufferNode(content,emitter,generator);
setup(cellNode,isFirst);
if (currentNode.isStarted()) {
cellNode.start();
}
currentNode=cellNode;
break;
case IContent.PAGE_CONTENT:
PageNode pageNode=new PageNode(content,emitter,generator);
setup(pageNode,isFirst);
currentNode=pageNode;
break;
default :
ContainerBufferNode node=new ContainerBufferNode(content,emitter,generator);
setup(node,isFirst);
currentNode=node;
break;
}
}

Fixed version (ground truth):
public void startContainer(IContent content,boolean isFirst,IContentEmitter emitter,boolean visible){
  int type=content.getContentType();
switch (type) {
case IContent.TABLE_BAND_CONTENT:
case IContent.LIST_BAND_CONTENT:
    boolean first=isFirst && !isRepeated;
  ContainerBufferNode bandNode=new ContainerBufferNode(content,emitter,generator);
setup(bandNode,first);
currentNode=bandNode;
break;
case IContent.CELL_CONTENT:
ContainerBufferNode cellNode=new ContainerBufferNode(content,emitter,generator);
setup(cellNode,isFirst);
if (currentNode.isStarted()) {
cellNode.start();
}
currentNode=cellNode;
break;
case IContent.PAGE_CONTENT:
PageNode pageNode=new PageNode(content,emitter,generator);
setup(pageNode,isFirst);
currentNode=pageNode;
this.pageNode=pageNode;
break;
default :
ContainerBufferNode node=new ContainerBufferNode(content,emitter,generator);
setup(node,isFirst);
currentNode=node;
break;
}
}
Program: 74822
Project: 74822
Buggy source:
public void handleEvent(Event event){
  if (event.detail == SWT.DRAG) {
    return;
  }
  Sash sash=(Sash)event.widget;
  int shift=event.x - sash.getBounds().x;
  GridData data=(GridData)left.getLayoutData();
  int newWidthHint=data.widthHint + shift;
  if (newWidthHint < 20) {
    return;
  }
  Point computedSize=parent.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  Point currentSize=parent.getSize();
  boolean customSize=!computedSize.equals(currentSize);
  widthHints[0]=data.widthHint=newWidthHint;
  data=(GridData)right.getLayoutData();
  newWidthHint=data.widthHint - shift;
  widthHints[1]=data.widthHint=newWidthHint;
  parent.layout(true);
  computedSize=parent.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  if (customSize) {
    computedSize.x=Math.max(computedSize.x,currentSize.x);
  }
  computedSize.y=Math.max(computedSize.y,currentSize.y);
  if (computedSize.equals(currentSize)) {
    return;
  }
  parent.setSize(computedSize.x,computedSize.y);
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (event.detail == SWT.DRAG) {
    return;
  }
  Sash sash=(Sash)event.widget;
  int shift=event.x - sash.getBounds().x;
  GridData data=(GridData)left.getLayoutData();
  int newWidthHint=data.widthHint + shift;
  if (newWidthHint < 100) {
    newWidthHint=100;
    shift=100 - data.widthHint;
  }
  widthHints[0]=data.widthHint=newWidthHint;
  data=(GridData)right.getLayoutData();
  newWidthHint=data.widthHint - shift;
  widthHints[1]=data.widthHint=newWidthHint;
  parent.layout();
}