nus-yam/ex-repair huggingface dataset:
Program: 76880
Project: 76880
Buggy source:
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    if (RowSaveUtil.EXCEPTION_INDICATOR.equals(exprValue))     continue;
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
private Map getValueMap() throws IOException {
  Map valueMap=new HashMap();
  int exprCount=IOUtil.readInt(rowExprsDis);
  for (int i=0; i < exprCount; i++) {
    String exprID=this.exprKeys.get(i).toString();
    Object exprValue=IOUtil.readObject(rowExprsDis);
    if (RowSaveUtil.EXCEPTION_INDICATOR.equals(exprValue))     exprValue=null;
    valueMap.put(exprID,exprValue);
  }
  return valueMap;
}
Program: 76881
Project: 76881
Buggy source:
public CellInstance(ICellContent cell,ExecutionContext context,boolean fromGrid){
  super(cell,context);
  this.cell=cell;
  this.fromGrid=fromGrid;
}

Fixed version (ground truth):
public CellInstance(ICellContent cell,ExecutionContext context,boolean fromGrid){
  super(cell,context);
  this.cell=cell;
}
Program: 76882
Project: 76882
Buggy source:
/** 
 * initial dataset control
 */
private void initializeControl(){
  DEFAULT_MESSAGE=JdbcPlugin.getResourceString("String_Node_Str");
  setMessage(DEFAULT_MESSAGE,IMessageProvider.NONE);
  refreshPage();
  prepareUI();
}

Fixed version (ground truth):
/** 
 * initial dataset control
 */
private void initializeControl(){
  isPageInitialization=true;
  initializeSchemaPrefetchConfig();
  DEFAULT_MESSAGE=JdbcPlugin.getResourceString("String_Node_Str");
  setMessage(DEFAULT_MESSAGE,IMessageProvider.NONE);
  refreshPage();
  prepareUI();
}
Program: 76885
Project: 76885
Buggy source:
/** 
 * @throws DataException
 */
private void doSave(Map valueMap,boolean finish) throws DataException {
  if (needsSaveToDoc() == false)   return;
  if (isBasicSaved == false) {
    isBasicSaved=true;
    this.getRdSave().saveResultIterator(this.odiResult,this.idInfo.getGroupLevel(),this.idInfo.getSubQueryInfo());
  }
  if (finish == false)   this.rdSave.saveExprValue(odiResult.getCurrentResultIndex(),valueMap);
 else   this.rdSave.saveFinish(odiResult.getCurrentResultIndex());
}

Fixed version (ground truth):
/** 
 * @throws DataException
 */
private void doSave(Map valueMap,boolean finish) throws DataException {
  if (needsSaveToDoc() == false)   return;
  if (isBasicSaved == false) {
    isBasicSaved=true;
    this.getRdSave().saveResultIterator(this.odiResult,this.idInfo.getGroupLevel(),this.idInfo.getSubQueryInfo());
  }
  if (finish == false)   this.rdSave.saveExprValue(odiResult.getCurrentResultIndex(),valueMap);
 else {
    this.rdSave.saveFinish(odiResult.getRowCount() - 1);
  }
}
Program: 76888
Project: 76888
Buggy source:
public IResultSet executeQuery() throws OdaException {
  logger.logp(java.util.logging.Level.FINE,CallStatement.class.getName(),"String_Node_Str","String_Node_Str");
  try {
    if (!maxRowsUpToDate) {
      try {
        assertNotNull(callStat);
        callStat.setMaxRows(maxrows);
      }
 catch (      SQLException e1) {
      }
      maxRowsUpToDate=true;
    }
    registerOutputParameter();
    this.callStat.execute();
    if (this.callStat.getResultSet() != null)     return new ResultSet(this.callStat.getResultSet());
 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");
  try {
    if (!maxRowsUpToDate) {
      try {
        assertNotNull(callStat);
        callStat.setMaxRows(maxrows);
      }
 catch (      SQLException e1) {
      }
      maxRowsUpToDate=true;
    }
    registerOutputParameter();
    this.callStat.execute();
    if (this.callStat.getResultSet() != null)     return new ResultSet(this.callStat.getResultSet());
    java.sql.ResultSet resultSet=getOutputParamResultSet();
    return resultSet != null ? new ResultSet(resultSet) : new SPResultSet(null);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_CANNOT_RETURN,e);
  }
}
Program: 76889
Project: 76889
Buggy source:
/** 
 * get paremeter metadata for callableStatement, if metadata is null or data mode is unknown or SQLException is thrown, register output parameter on DatabaseMetadata, else register output paremeter on statement's metadata.
 * @throws OdaException
 */
private void registerOutputParameter() throws OdaException {
  if (parameterDefn != null) {
    for (int i=0; i < parameterDefn.getParameterCount(); i++) {
      if (parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeOut || parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeInOut) {
        registerOutParameter(i + 1,parameterDefn.getParameterType(i));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * get paremeter metadata for callableStatement, if metadata is null or data mode is unknown or SQLException is thrown, register output parameter on DatabaseMetadata, else register output paremeter on statement's metadata.
 * @throws OdaException
 */
private void registerOutputParameter() throws OdaException {
  if (parameterDefn != null) {
    for (int i=0; i < parameterDefn.getParameterCount(); i++) {
      if (parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeOut || parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeInOut) {
        registerOutParameter(i + 1,getParameterType(i));
      }
    }
  }
}
Program: 76890
Project: 76890
Buggy source:
/** 
 * temporary solution for driver specific problem: Oracle
 * @param parameterDefn
 */
private void correctParamType(ParameterDefn parameterDefn){
  String parameterName=parameterDefn.getParamTypeName().toUpperCase();
  if (parameterName.equals("String_Node_Str"))   parameterDefn.setParamType(Types.FLOAT);
 else   if (parameterName.equals("String_Node_Str") || parameterName.equals("String_Node_Str"))   parameterDefn.setParamType(Types.VARCHAR);
 else   parameterDefn.setParamType(Types.VARCHAR);
}

Fixed version (ground truth):
private void correctParamType(ParameterDefn parameterDefn){
  String parameterName=parameterDefn.getParamTypeName().toUpperCase();
  if (parameterName.equals(ORACLE_FLOAT_NAME))   parameterDefn.setParamType(Types.FLOAT);
 else   if (parameterName.equals(ORACLE_CURSOR_NAME))   parameterDefn.setParamType(ORACLE_CURSOR_TYPE);
 else   parameterDefn.setParamType(Types.VARCHAR);
}
Program: 76891
Project: 76891
Buggy source:
private String getInputControlType(){
  String type=null;
  if (inputParameter.getControlType() == null) {
    type=DesignChoiceConstants.PARAM_CONTROL_TEXT_BOX;
  }
 else   if (DesignChoiceConstants.PARAM_CONTROL_LIST_BOX.equals(inputParameter.getControlType())) {
    if (inputParameter.isMustMatch()) {
      type=PARAM_CONTROL_COMBO;
    }
 else {
      type=PARAM_CONTROL_LIST;
    }
  }
 else {
    type=inputParameter.getControlType();
  }
  return type;
}

Fixed version (ground truth):
private String getInputControlType(){
  String type=null;
  if (inputParameter.getControlType() == null) {
    type=DesignChoiceConstants.PARAM_CONTROL_TEXT_BOX;
  }
 else   if (DesignChoiceConstants.PARAM_CONTROL_LIST_BOX.equals(inputParameter.getControlType())) {
    if (inputParameter.isMustMatch()) {
      type=PARAM_CONTROL_LIST;
    }
 else {
      type=PARAM_CONTROL_COMBO;
    }
  }
 else {
    type=inputParameter.getControlType();
  }
  return type;
}
Program: 76893
Project: 76893
Buggy source:
public void setAppContext(Object context) throws OdaException {
  if (!(context instanceof Map))   throw new OdaException(Messages.getString("String_Node_Str"));
  Map appContext=(Map)context;
  if (appContext.get(Constants.APPCONTEXT_INPUTSTREAM) != null) {
    appContext.put(org.eclipse.datatools.enablement.oda.xml.Constants.APPCONTEXT_INPUTSTREAM,appContext.get(Constants.APPCONTEXT_INPUTSTREAM));
  }
  if (appContext.get(Constants.APPCONTEXT_CLOSEINPUTSTREAM) != null) {
    appContext.put(org.eclipse.datatools.enablement.oda.xml.Constants.APPCONTEXT_CLOSEINPUTSTREAM,appContext.get(Constants.APPCONTEXT_CLOSEINPUTSTREAM));
  }
  super.setAppContext((Map)context);
}

Fixed version (ground truth):
public void setAppContext(Object context) throws OdaException {
  if (!(context instanceof Map))   throw new OdaException(Messages.getString("String_Node_Str"));
  Map appContext=(Map)context;
  if (appContext.get("String_Node_Str") != null) {
    appContext.put(org.eclipse.datatools.enablement.oda.xml.Constants.APPCONTEXT_INPUTSTREAM,appContext.get("String_Node_Str"));
  }
  if (appContext.get("String_Node_Str") != null) {
    appContext.put(org.eclipse.datatools.enablement.oda.xml.Constants.APPCONTEXT_CLOSEINPUTSTREAM,appContext.get("String_Node_Str"));
  }
  super.setAppContext((Map)context);
}
Program: 76894
Project: 76894
Buggy source:
public IResultSet executeQuery() throws OdaException {
  logger.logp(java.util.logging.Level.FINE,CallStatement.class.getName(),"String_Node_Str","String_Node_Str");
  try {
    if (!maxRowsUpToDate) {
      try {
        assertNotNull(callStat);
        callStat.setMaxRows(maxrows);
      }
 catch (      SQLException e1) {
      }
      maxRowsUpToDate=true;
    }
    registerOutputParameter();
    this.callStat.execute();
    if (this.callStat.getResultSet() != null)     return new ResultSet(this.callStat.getResultSet());
    java.sql.ResultSet resultSet=getOutputParamResultSet();
    return resultSet != null ? new ResultSet(resultSet) : 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");
  try {
    if (!maxRowsUpToDate) {
      try {
        assertNotNull(callStat);
        callStat.setMaxRows(maxrows);
      }
 catch (      SQLException e1) {
      }
      maxRowsUpToDate=true;
    }
    registerOutputParameter();
    this.callStat.execute();
    if (this.callStat.getResultSet() != null)     return new ResultSet(this.callStat.getResultSet());
    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: 76895
Project: 76895
Buggy source:
/** 
 * Checks if the text is a data content in table header/footer or table group header/footer and uses the query of the table.
 * @param text the text content.
 */
private boolean isAggregatable(ITextContent text){
  Object generateBy=text.getGenerateBy();
  DataItemDesign data=(DataItemDesign)generateBy;
  if (data.getQuery() != null) {
    return false;
  }
  IElement parent=text.getParent();
  while (parent != null) {
    if (parent instanceof IContent) {
      IContent content=(IContent)parent;
      ReportItemDesign design=(ReportItemDesign)content.getGenerateBy();
      if (design.getQuery() != null) {
        return false;
      }
    }
    if (parent instanceof IBandContent) {
      IBandContent bandContent=(IBandContent)parent;
      BandDesign bandDesing=(BandDesign)bandContent.getGenerateBy();
      if (bandDesing.getBandType() == BandDesign.BAND_HEADER || bandDesing.getBandType() == BandDesign.BAND_FOOTER || bandDesing.getBandType() == BandDesign.GROUP_HEADER || bandDesing.getBandType() == BandDesign.GROUP_FOOTER) {
        IElement bandParent=bandContent.getParent();
        while (bandParent instanceof IGroupContent) {
          bandParent=bandParent.getParent();
        }
        if (bandParent instanceof ITableContent) {
          return true;
        }
      }
    }
    parent=parent.getParent();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if the text is a data content in table header/footer or table group header/footer and uses the query of the table.
 * @param text the text content.
 */
private boolean isAggregatable(ITextContent text){
  Object generateBy=text.getGenerateBy();
  DataItemDesign data=(DataItemDesign)generateBy;
  if (data.getQuery() != null) {
    return false;
  }
  IElement parent=text.getParent();
  while (parent != null) {
    if (parent instanceof IContent) {
      IContent content=(IContent)parent;
      ReportItemDesign design=(ReportItemDesign)content.getGenerateBy();
      if (design != null && design.getQuery() != null) {
        return false;
      }
    }
    if (parent instanceof IBandContent) {
      IBandContent bandContent=(IBandContent)parent;
      BandDesign bandDesing=(BandDesign)bandContent.getGenerateBy();
      if (bandDesing.getBandType() == BandDesign.BAND_HEADER || bandDesing.getBandType() == BandDesign.BAND_FOOTER || bandDesing.getBandType() == BandDesign.GROUP_HEADER || bandDesing.getBandType() == BandDesign.GROUP_FOOTER) {
        IElement bandParent=bandContent.getParent();
        while (bandParent instanceof IGroupContent) {
          bandParent=bandParent.getParent();
        }
        if (bandParent instanceof ITableContent) {
          return true;
        }
      }
    }
    parent=parent.getParent();
  }
  return false;
}
Program: 76896
Project: 76896
Buggy source:
public void testAllowNewValues(){
  scalarParam=(IScalarParameterDefn)gpdTask.getParameterDefn("String_Node_Str");
  assertTrue(scalarParam.allowNewValues());
  scalarParam=(IScalarParameterDefn)gpdTask.getParameterDefn("String_Node_Str");
  assertFalse(scalarParam.allowNewValues());
}

Fixed version (ground truth):
public void testAllowNewValues(){
  scalarParam=(IScalarParameterDefn)gpdTask.getParameterDefn("String_Node_Str");
  assertFalse(scalarParam.allowNewValues());
  scalarParam=(IScalarParameterDefn)gpdTask.getParameterDefn("String_Node_Str");
  assertTrue(scalarParam.allowNewValues());
}
Program: 76899
Project: 76899
Buggy source:
/** 
 * Set parameter metadata in dataset design
 * @param design
 * @param query
 */
private static void setParameterMetaData(DataSetDesign dataSetDesign,IQuery query){
  try {
    IParameterMetaData paramMetaData=query.getParameterMetaData();
    mergeParameterMetaData(dataSetDesign,paramMetaData);
  }
 catch (  OdaException e) {
    dataSetDesign.setParameters(null);
  }
}

Fixed version (ground truth):
/** 
 * Set parameter metadata in dataset design
 * @param design
 * @param query
 */
private static void setParameterMetaData(DataSetDesign dataSetDesign,IQuery query){
  try {
    IParameterMetaData paramMetaData=query.getParameterMetaData();
    mergeParameterMetaData(dataSetDesign,paramMetaData);
  }
 catch (  OdaException e) {
  }
}
Program: 76900
Project: 76900
Buggy source:
protected IContentEmitter createContentEmitter() throws EngineException {
  String format=executionContext.getOutputFormat();
  ExtensionManager extManager=ExtensionManager.getInstance();
  boolean supported=false;
  Collection supportedFormats=extManager.getSupportedFormat();
  Iterator iter=supportedFormats.iterator();
  while (iter.hasNext()) {
    String supportedFormat=(String)iter.next();
    if (supportedFormat != null && supportedFormat.equalsIgnoreCase(format)) {
      supported=true;
      break;
    }
  }
  if (!supported) {
    log.log(Level.SEVERE,MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
    throw new UnsupportedFormatException(MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
  }
  IContentEmitter emitter;
  try {
    emitter=extManager.createEmitter(format,emitterID);
  }
 catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,t);
  }
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION);
  }
  initializePagination(format,extManager);
  if (!ExtensionManager.PAPER_SIZE_PAGINATION.equals(pagination)) {
    emitter=new HTMLTableLayoutNestEmitter(emitter);
  }
  return emitter;
}

Fixed version (ground truth):
protected IContentEmitter createContentEmitter() throws EngineException {
  String format=executionContext.getOutputFormat();
  ExtensionManager extManager=ExtensionManager.getInstance();
  boolean supported=false;
  Collection supportedFormats=extManager.getSupportedFormat();
  Iterator iter=supportedFormats.iterator();
  while (iter.hasNext()) {
    String supportedFormat=(String)iter.next();
    if (supportedFormat != null && supportedFormat.equalsIgnoreCase(format)) {
      supported=true;
      break;
    }
  }
  if (!supported) {
    log.log(Level.SEVERE,MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
    throw new UnsupportedFormatException(MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
  }
  IContentEmitter emitter;
  try {
    emitter=extManager.createEmitter(format,emitterID);
  }
 catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format,t);
  }
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format);
  }
  initializePagination(format,extManager);
  if (!ExtensionManager.PAPER_SIZE_PAGINATION.equals(pagination)) {
    emitter=new HTMLTableLayoutNestEmitter(emitter);
  }
  return emitter;
}
Program: 76901
Project: 76901
Buggy source:
protected IContentEmitter createContentEmitter() throws EngineException {
  String format=executionContext.getOutputFormat();
  ExtensionManager extManager=ExtensionManager.getInstance();
  boolean supported=false;
  Collection supportedFormats=extManager.getSupportedFormat();
  Iterator iter=supportedFormats.iterator();
  while (iter.hasNext()) {
    String supportedFormat=(String)iter.next();
    if (supportedFormat != null && supportedFormat.equalsIgnoreCase(format)) {
      supported=true;
      break;
    }
  }
  if (!supported) {
    log.log(Level.SEVERE,MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
    throw new UnsupportedFormatException(MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
  }
  initializePagination(format,extManager);
  IContentEmitter emitter=null;
  try {
    emitter=extManager.createEmitter(format,emitterID);
  }
 catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,t);
  }
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION);
  }
  return emitter;
}

Fixed version (ground truth):
protected IContentEmitter createContentEmitter() throws EngineException {
  String format=executionContext.getOutputFormat();
  ExtensionManager extManager=ExtensionManager.getInstance();
  boolean supported=false;
  Collection supportedFormats=extManager.getSupportedFormat();
  Iterator iter=supportedFormats.iterator();
  while (iter.hasNext()) {
    String supportedFormat=(String)iter.next();
    if (supportedFormat != null && supportedFormat.equalsIgnoreCase(format)) {
      supported=true;
      break;
    }
  }
  if (!supported) {
    log.log(Level.SEVERE,MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
    throw new UnsupportedFormatException(MessageConstants.FORMAT_NOT_SUPPORTED_EXCEPTION,format);
  }
  initializePagination(format,extManager);
  IContentEmitter emitter=null;
  try {
    emitter=extManager.createEmitter(format,emitterID);
  }
 catch (  Throwable t) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format,t);
  }
  if (emitter == null) {
    log.log(Level.SEVERE,"String_Node_Str",format);
    throw new EngineException(MessageConstants.CANNOT_CREATE_EMITTER_EXCEPTION,format);
  }
  return emitter;
}
Program: 76904
Project: 76904
Buggy source:
protected void handleFileImage(String imageFile,IImageContent imageContent){
  ReportDesignHandle reportDesign=context.getDesign();
  if (reportDesign != null) {
    URL url=reportDesign.findResource(imageFile,IResourceLocator.IMAGE);
    if (url != null) {
      String fileName=url.getFile();
      if (fileName != null) {
        imageFile=fileName;
      }
    }
  }
  imageContent.setURI(imageFile);
  imageContent.setImageSource(IImageContent.IMAGE_FILE);
  imageContent.setExtension(FileUtil.getExtFromFileName(imageFile));
  if (imageFile == null) {
    logger.log(Level.SEVERE,"String_Node_Str");
    context.addException(design.getHandle(),new EngineException(MessageConstants.MISSING_IMAGE_FILE_ERROR));
  }
}

Fixed version (ground truth):
protected void handleFileImage(String imageFile,IImageContent imageContent){
  ReportDesignHandle reportDesign=context.getDesign();
  if (reportDesign != null) {
    URL url=reportDesign.findResource(imageFile,IResourceLocator.IMAGE);
    if (url != null) {
      imageFile=url.toString();
    }
  }
  imageContent.setURI(imageFile);
  imageContent.setImageSource(IImageContent.IMAGE_FILE);
  imageContent.setExtension(FileUtil.getExtFromFileName(imageFile));
  if (imageFile == null) {
    logger.log(Level.SEVERE,"String_Node_Str");
    context.addException(design.getHandle(),new EngineException(MessageConstants.MISSING_IMAGE_FILE_ERROR));
  }
}
Program: 76905
Project: 76905
Buggy source:
/** 
 * get intrinsic dimension of image in pixels. Now only support png, bmp, jpg, gif.
 * @param in
 * @return
 * @throws IOException
 * @throws MalformedURLException
 * @throws BadElementException
 */
protected Dimension getIntrinsicDimension(IImageContent content) throws BadElementException, MalformedURLException, IOException {
  Image image=null;
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
    image=Image.getInstance(content.getURI());
  break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
image=Image.getInstance(content.getData());
break;
case IImageContent.IMAGE_URL:
image=Image.getInstance(new URL(content.getURI()));
break;
default :
assert(false);
}
if (image != null) {
Object design=content.getGenerateBy();
int resolution=96;
if (design instanceof ExtendedItemDesign) {
resolution=192;
}
return new Dimension((int)(image.plainWidth() * 1000 / resolution * 72),(int)(image.plainHeight() * 1000 / resolution * 72));
}
return null;
}

Fixed version (ground truth):
/** 
 * get intrinsic dimension of image in pixels. Now only support png, bmp, jpg, gif.
 * @param in
 * @return
 * @throws IOException
 * @throws MalformedURLException
 * @throws BadElementException
 */
protected Dimension getIntrinsicDimension(IImageContent content) throws BadElementException, MalformedURLException, IOException {
  Image image=null;
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
    URL url=new URL(content.getURI());
  InputStream in=url.openStream();
try {
  byte[] buffer=new byte[in.available()];
  in.read(buffer);
  image=Image.getInstance(buffer);
}
 catch (Exception ex) {
  logger.log(Level.WARNING,ex.getMessage(),ex);
}
 finally {
  in.close();
}
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
image=Image.getInstance(content.getData());
break;
case IImageContent.IMAGE_URL:
image=Image.getInstance(new URL(content.getURI()));
break;
default :
assert(false);
}
if (image != null) {
Object design=content.getGenerateBy();
int resolution=96;
if (design instanceof ExtendedItemDesign) {
resolution=192;
}
return new Dimension((int)(image.plainWidth() * 1000 / resolution * 72),(int)(image.plainHeight() * 1000 / resolution * 72));
}
return null;
}
Program: 76906
Project: 76906
Buggy source:
/** 
 * Adapts base data set properties
 */
public static void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null) {
    throw new AdapterException(ResourceConstants.DATASOURCE_NULL_ERROR);
  }
  if (!(modelDataSet instanceof JointDataSetHandle)) {
    dteDataSet.setDataSource(modelDataSet.getDataSource().getQualifiedName());
    dteDataSet.setBeforeOpenScript(modelDataSet.getBeforeOpen());
    dteDataSet.setAfterOpenScript(modelDataSet.getAfterOpen());
    dteDataSet.setOnFetchScript(modelDataSet.getOnFetch());
    dteDataSet.setBeforeCloseScript(modelDataSet.getBeforeClose());
    dteDataSet.setAfterCloseScript(modelDataSet.getAfterClose());
    dteDataSet.setCacheRowCount(modelDataSet.getCachedRowCount());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  mergeHints(modelDataSet,dteDataSet);
}

Fixed version (ground truth):
/** 
 * Adapts base data set properties
 */
public static void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null) {
    throw new AdapterException(ResourceConstants.DATASOURCE_NULL_ERROR);
  }
  if (!(modelDataSet instanceof JointDataSetHandle)) {
    dteDataSet.setDataSource(modelDataSet.getDataSource().getQualifiedName());
    dteDataSet.setBeforeOpenScript(modelDataSet.getBeforeOpen());
    dteDataSet.setAfterOpenScript(modelDataSet.getAfterOpen());
    dteDataSet.setOnFetchScript(modelDataSet.getOnFetch());
    dteDataSet.setBeforeCloseScript(modelDataSet.getBeforeClose());
    dteDataSet.setAfterCloseScript(modelDataSet.getAfterClose());
    dteDataSet.setCacheRowCount(modelDataSet.getCachedRowCount());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  dteDataSet.setRowFetchLimit(modelDataSet.getRowFetchLimit());
  mergeHints(modelDataSet,dteDataSet);
}
Program: 76907
Project: 76907
Buggy source:
void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null)   throw new EngineException("String_Node_Str");
  if (!(modelDataSet instanceof JointDataSetHandle)) {
    dteDataSet.setDataSource(modelDataSet.getDataSource().getQualifiedName());
    dteDataSet.setBeforeOpenScript(modelDataSet.getBeforeOpen());
    dteDataSet.setAfterOpenScript(modelDataSet.getAfterOpen());
    dteDataSet.setOnFetchScript(modelDataSet.getOnFetch());
    dteDataSet.setBeforeCloseScript(modelDataSet.getBeforeClose());
    dteDataSet.setAfterCloseScript(modelDataSet.getAfterClose());
    dteDataSet.setCacheRowCount(modelDataSet.getCachedRowCount());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  mergeHints(modelDataSet,dteDataSet);
}

Fixed version (ground truth):
void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null)   throw new EngineException("String_Node_Str");
  if (!(modelDataSet instanceof JointDataSetHandle)) {
    dteDataSet.setDataSource(modelDataSet.getDataSource().getQualifiedName());
    dteDataSet.setBeforeOpenScript(modelDataSet.getBeforeOpen());
    dteDataSet.setAfterOpenScript(modelDataSet.getAfterOpen());
    dteDataSet.setOnFetchScript(modelDataSet.getOnFetch());
    dteDataSet.setBeforeCloseScript(modelDataSet.getBeforeClose());
    dteDataSet.setAfterCloseScript(modelDataSet.getAfterClose());
    dteDataSet.setCacheRowCount(modelDataSet.getCachedRowCount());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  dteDataSet.setRowFetchLimit(modelDataSet.getRowFetchLimit());
  mergeHints(modelDataSet,dteDataSet);
}
Program: 76908
Project: 76908
Buggy source:
/** 
 * @return the test
 */
public static Test suite(){
  TestSuite test=new TestSuite();
  test.addTestSuite(DesignLoadLibraryTest.class);
  test.addTestSuite(LibraryChangeChartDataSetTest.class);
  test.addTestSuite(LibraryCommandTest.class);
  test.addTestSuite(LibraryCompoundElementTest.class);
  test.addTestSuite(LibraryHandleTest.class);
  test.addTestSuite(LibraryJointDataSetTest.class);
  test.addTestSuite(LibraryParseTest.class);
  test.addTestSuite(LibraryStructureTest.class);
  test.addTestSuite(LibraryThemeTest.class);
  test.addTestSuite(LibraryWithPropertyBinding.class);
  test.addTestSuite(LibraryWithTableTest.class);
  test.addTestSuite(ReferenceValueUtilTest.class);
  return test;
}

Fixed version (ground truth):
/** 
 * @return the test
 */
public static Test suite(){
  TestSuite test=new TestSuite();
  test.addTestSuite(DesignLoadLibraryTest.class);
  test.addTestSuite(LibraryChangeChartDataSetTest.class);
  test.addTestSuite(LibraryCommandTest.class);
  test.addTestSuite(LibraryCompoundElementTest.class);
  test.addTestSuite(LibraryHandleTest.class);
  test.addTestSuite(LibraryJointDataSetTest.class);
  test.addTestSuite(LibraryParseTest.class);
  test.addTestSuite(LibraryStructureTest.class);
  test.addTestSuite(LibraryThemeTest.class);
  test.addTestSuite(LibraryWithPropertyBinding.class);
  test.addTestSuite(LibraryWithTableTest.class);
  test.addTestSuite(ReferenceValueUtilTest.class);
  test.addTestSuite(ReloadLibraryTest.class);
  return test;
}
Program: 76909
Project: 76909
Buggy source:
/** 
 * Reloads the library with exceptions.
 * @throws Exception
 */
public void testReloadLibraryWithException() throws Exception {
  openDesign("String_Node_Str");
  openLibrary("String_Node_Str");
  try {
    designHandle.reloadLibrary(libraryHandle);
    fail();
  }
 catch (  SemanticException e) {
    assertEquals(LibraryException.DESIGN_EXCEPTION_LIBRARY_NOT_FOUND,e.getErrorCode());
  }
  recoverOriginalLibrary("String_Node_Str","String_Node_Str");
  openLibrary("String_Node_Str");
  File f=new File(getClassFolder() + INPUT_FOLDER + "String_Node_Str");
  if (f.exists())   f.delete();
  designHandle.reloadLibrary(libraryHandle);
  assertNull(designHandle.findElement("String_Node_Str").getExtends());
  assertNotNull(designHandle.findElement("String_Node_Str").getStringProperty(DesignElementHandle.EXTENDS_PROP));
  File f1=new File(getClassFolder() + INPUT_FOLDER + "String_Node_Str");
  FileInputStream fis=new FileInputStream(f1);
  FileOutputStream fos=new FileOutputStream(f);
  byte[] data=new byte[10000];
  fis.read(data);
  fos.write(data);
  fis.close();
  fos.close();
  try {
    designHandle.reloadLibrary(libraryHandle);
    fail();
  }
 catch (  LibraryException e) {
    save();
  }
  recoverOriginalLibrary("String_Node_Str","String_Node_Str");
  compareTextFile("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Reloads the library with exceptions.
 * @throws Exception
 */
public void testReloadLibraryWithException() throws Exception {
  List fileNames=new ArrayList();
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  List filePaths=dumpDesignAndLibrariesToFile(fileNames);
  String designFilePath=(String)filePaths.get(0);
  openDesign(designFilePath,false);
  String lib1FilePath=(String)filePaths.get(2);
  openLibrary(lib1FilePath,false);
  try {
    designHandle.reloadLibrary(libraryHandle);
    fail();
  }
 catch (  SemanticException e) {
    assertEquals(LibraryException.DESIGN_EXCEPTION_LIBRARY_NOT_FOUND,e.getErrorCode());
  }
  String libFilePath=(String)filePaths.get(1);
  openLibrary(libFilePath,false);
  File f=new File(libFilePath);
  if (f.exists())   f.delete();
  designHandle.reloadLibrary(libraryHandle);
  assertNull(designHandle.findElement("String_Node_Str").getExtends());
  assertNotNull(designHandle.findElement("String_Node_Str").getStringProperty(DesignElementHandle.EXTENDS_PROP));
  InputStream fis=getResourceAStream(INPUT_FOLDER + "String_Node_Str");
  FileOutputStream fos=new FileOutputStream(f);
  byte[] data=new byte[10000];
  fis.read(data);
  fos.write(data);
  fis.close();
  fos.close();
  try {
    designHandle.reloadLibrary(libraryHandle);
    fail();
  }
 catch (  LibraryException e) {
    save();
  }
  compareTextFile("String_Node_Str");
}
Program: 76910
Project: 76910
Buggy source:
/** 
 * Tests needSave method. Only change happens directly on report design, isDirty mark of report design is true. So when library changed, isDirty mark of report design should be false. <ul> <li>reload error library and throw out exception</li> <li>isDirty not changed</li> </ul>
 * @throws Exception
 */
public void testErrorLibraryNeedsSave() throws Exception {
  openDesign("String_Node_Str");
  openLibrary("String_Node_Str");
  LabelHandle labelHandle=designHandle.getElementFactory().newLabel("String_Node_Str");
  designHandle.getBody().add(labelHandle);
  assertTrue(designHandle.needsSave());
  assertTrue(designHandle.getCommandStack().canUndo());
  assertFalse(designHandle.getCommandStack().canRedo());
  ActivityStack stack=(ActivityStack)designHandle.getCommandStack();
  File f=new File(getClassFolder() + INPUT_FOLDER + "String_Node_Str");
  RandomAccessFile raf=new RandomAccessFile(f,"String_Node_Str");
  raf.seek(906);
  raf.writeBytes("String_Node_Str");
  raf.close();
  try {
    designHandle.reloadLibrary(libraryHandle);
    fail();
  }
 catch (  DesignFileException e) {
  }
  assertTrue(stack.canUndo());
  assertFalse(stack.canRedo());
  assertEquals(1,stack.getCurrentTransNo());
  assertTrue(designHandle.needsSave());
  libraryHandle.close();
  recoverOriginalLibrary("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Tests needSave method. Only change happens directly on report design, isDirty mark of report design is true. So when library changed, isDirty mark of report design should be false. <ul> <li>reload error library and throw out exception</li> <li>isDirty not changed</li> </ul>
 * @throws Exception
 */
public void testErrorLibraryNeedsSave() throws Exception {
  List fileNames=new ArrayList();
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  List filePaths=dumpDesignAndLibrariesToFile(fileNames);
  String designFilePath=(String)filePaths.get(0);
  openDesign(designFilePath,false);
  String libFilePath=(String)filePaths.get(1);
  openLibrary(libFilePath,false);
  LabelHandle labelHandle=designHandle.getElementFactory().newLabel("String_Node_Str");
  designHandle.getBody().add(labelHandle);
  assertTrue(designHandle.needsSave());
  assertTrue(designHandle.getCommandStack().canUndo());
  assertFalse(designHandle.getCommandStack().canRedo());
  ActivityStack stack=(ActivityStack)designHandle.getCommandStack();
  File f=new File(libFilePath);
  RandomAccessFile raf=new RandomAccessFile(f,"String_Node_Str");
  raf.seek(906);
  raf.writeBytes("String_Node_Str");
  raf.close();
  try {
    designHandle.reloadLibrary(libraryHandle);
    fail();
  }
 catch (  DesignFileException e) {
  }
  assertTrue(stack.canUndo());
  assertFalse(stack.canRedo());
  assertEquals(1,stack.getCurrentTransNo());
  assertTrue(designHandle.needsSave());
  libraryHandle.close();
  libraryHandle=null;
}
Program: 76912
Project: 76912
Buggy source:
/** 
 * Test cases: <ul> <li>remove the table lib1.libTable1 from the library and add a grid lib1.libTable1. Design.table1 can not be resolved to gri lib1.libTable1. </ul>
 * @throws Exception
 */
public void testReloadLibraryWithInvalidExtends() throws Exception {
  openDesign("String_Node_Str");
  openLibrary("String_Node_Str");
  libraryHandle.findElement("String_Node_Str").drop();
  GridHandle grid=libraryHandle.getElementFactory().newGridItem("String_Node_Str",2,2);
  libraryHandle.getComponents().add(grid);
  libraryHandle.save();
  designHandle.reloadLibrary(libraryHandle);
  TableHandle table2=(TableHandle)designHandle.findElement("String_Node_Str");
  assertNull(table2.getExtends());
  assertEquals("String_Node_Str",table2.getElement().getExtendsName());
  recoverOriginalLibrary("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test cases: <ul> <li>remove the table lib1.libTable1 from the library and add a grid lib1.libTable1. Design.table1 can not be resolved to gri lib1.libTable1. </ul>
 * @throws Exception
 */
public void testReloadLibraryWithInvalidExtends() throws Exception {
  List fileNames=new ArrayList();
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  List filePaths=dumpDesignAndLibrariesToFile(fileNames);
  String designFilePath=(String)filePaths.get(0);
  openDesign(designFilePath,false);
  String libFilePath=(String)filePaths.get(1);
  openLibrary(libFilePath,false);
  libraryHandle.findElement("String_Node_Str").drop();
  GridHandle grid=libraryHandle.getElementFactory().newGridItem("String_Node_Str",2,2);
  libraryHandle.getComponents().add(grid);
  libraryHandle.save();
  designHandle.reloadLibrary(libraryHandle);
  TableHandle table2=(TableHandle)designHandle.findElement("String_Node_Str");
  assertNull(table2.getExtends());
  assertEquals("String_Node_Str",table2.getElement().getExtendsName());
}
Program: 76913
Project: 76913
Buggy source:
/** 
 * Test reloading a library, in which there is only a label. <p> <strong>Case1:</strong> <p> both resource path and report folder has the library file. <p> Changed resource path to null. And try to reload(). No exception. And the library location becomes library in the report folder. <p>
 * @throws Exception
 */
public void testReloadLibrary2() throws Exception {
  String fileName=getClassFolder() + INPUT_FOLDER;
  sessionHandle=new DesignEngine(new DesignConfig()).newSessionHandle(null);
  assertNotNull(sessionHandle);
  sessionHandle.setResourceFolder(getClassFolder() + "String_Node_Str" + INPUT_FOLDER);
  designHandle=sessionHandle.openDesign(fileName + "String_Node_Str");
  design=(ReportDesign)designHandle.getModule();
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  assertNotNull(libraryHandle);
  String location1=libraryHandle.getModule().getLocation();
  sessionHandle.setResourceFolder(null);
  designHandle.reloadLibrary(libraryHandle);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  assertNotNull(libraryHandle);
  String location2=libraryHandle.getModule().getLocation();
  assertFalse(location1.equalsIgnoreCase(location2));
}

Fixed version (ground truth):
/** 
 * Test reloading a library, in which there is only a label. <p> <strong>Case1:</strong> <p> both resource path and report folder has the library file. <p> Changed resource path to null. And try to reload(). No exception. And the library location becomes library in the report folder. <p>
 * @throws Exception
 */
public void testReloadLibrary2() throws Exception {
  List fileNames=new ArrayList();
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add("String_Node_Str" + INPUT_FOLDER + "String_Node_Str");
  sessionHandle=new DesignEngine(new DesignConfig()).newSessionHandle(null);
  assertNotNull(sessionHandle);
  List filePaths=dumpDesignAndLibrariesToFile(fileNames);
  String apiFilePath=(String)filePaths.get(2);
  int lastSlash=apiFilePath.lastIndexOf("String_Node_Str");
  String apiFileDir="String_Node_Str";
  if (lastSlash != -1) {
    apiFileDir=apiFilePath.substring(0,lastSlash + 1);
  }
  sessionHandle.setResourceFolder(apiFileDir);
  String designFilePath=(String)filePaths.get(0);
  designHandle=sessionHandle.openDesign(designFilePath);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  assertNotNull(libraryHandle);
  String location1=libraryHandle.getModule().getLocation();
  sessionHandle.setResourceFolder(null);
  designHandle.reloadLibrary(libraryHandle);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  assertNotNull(libraryHandle);
  String location2=libraryHandle.getModule().getLocation();
  assertFalse(location1.equalsIgnoreCase(location2));
}
Program: 76914
Project: 76914
Buggy source:
/** 
 * Test reloading a library, in which there is only a label. <p> <strong>Case1:</strong> <p> lib1.label1 <p> if change the color and text of the label, after the loading, it should show the effect. <p>
 * @throws Exception
 */
public void testReloadLibrary1() throws Exception {
  openDesign("String_Node_Str");
  LabelHandle label1=(LabelHandle)designHandle.findElement("String_Node_Str");
  assertEquals("String_Node_Str",label1.getText());
  openLibrary("String_Node_Str");
  LabelHandle libLabel1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  libLabel1.setText("String_Node_Str");
  libLabel1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  libLabel1.setText("String_Node_Str");
  libraryHandle.save();
  designHandle.reloadLibrary(libraryHandle);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  libLabel1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  assertEquals("String_Node_Str",libLabel1.getText());
  assertEquals("String_Node_Str",label1.getText());
  SimpleMasterPageHandle page=(SimpleMasterPageHandle)designHandle.findMasterPage("String_Node_Str");
  assertEquals(1,page.getPageHeader().getCount());
  libLabel1=(LabelHandle)page.getPageHeader().get(0);
  assertEquals("String_Node_Str",libLabel1.getText());
  recoverOriginalLibrary("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Test reloading a library, in which there is only a label. <p> <strong>Case1:</strong> <p> lib1.label1 <p> if change the color and text of the label, after the loading, it should show the effect. <p>
 * @throws Exception
 */
public void testReloadLibrary1() throws Exception {
  List fileNames=new ArrayList();
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  fileNames.add(INPUT_FOLDER + "String_Node_Str");
  List filePaths=dumpDesignAndLibrariesToFile(fileNames);
  String designFilePath=(String)filePaths.get(0);
  openDesign(designFilePath,false);
  LabelHandle label1=(LabelHandle)designHandle.findElement("String_Node_Str");
  assertEquals("String_Node_Str",label1.getText());
  String libFilePath=(String)filePaths.get(1);
  openLibrary(libFilePath,false);
  LabelHandle libLabel1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  libLabel1.setText("String_Node_Str");
  libLabel1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  libLabel1.setText("String_Node_Str");
  libraryHandle.save();
  designHandle.reloadLibrary(libraryHandle);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  libLabel1=(LabelHandle)libraryHandle.findElement("String_Node_Str");
  assertEquals("String_Node_Str",libLabel1.getText());
  assertEquals("String_Node_Str",label1.getText());
  SimpleMasterPageHandle page=(SimpleMasterPageHandle)designHandle.findMasterPage("String_Node_Str");
  assertEquals(1,page.getPageHeader().getCount());
  libLabel1=(LabelHandle)page.getPageHeader().get(0);
  assertEquals("String_Node_Str",libLabel1.getText());
}
Program: 76917
Project: 76917
Buggy source:
/** 
 * Returns if the property need to be hiden under some cases.
 * @param propName the property name to check
 * @return true if the property need to be hiden under some cases, falseotherwise.
 */
private boolean needHide(String propName){
  if (!(IReportItemModel.BOOKMARK_PROP.equals(propName) || IReportItemModel.TOC_PROP.equals(propName) || IStyleModel.PAGE_BREAK_AFTER_PROP.equals(propName)|| IStyleModel.PAGE_BREAK_BEFORE_PROP.equals(propName)|| ICellModel.DROP_PROP.equals(propName)))   return false;
  for (int i=0; i < elements.size(); i++) {
    DesignElementHandle current=((DesignElementHandle)elements.get(i));
    DesignElementHandle container=current.getContainer();
    if (ICellModel.DROP_PROP.equals(propName)) {
      if (current instanceof CellHandle) {
        if (container == null) {
          continue;
        }
        if (!(container.getContainer() instanceof GroupHandle))         return true;
      }
    }
 else {
      while (container != null) {
        if (container instanceof MasterPageHandle)         return true;
        container=container.getContainer();
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns if the property need to be hiden under some cases.
 * @param propName the property name to check
 * @return true if the property need to be hiden under some cases, falseotherwise.
 */
private boolean needHide(String propName){
  if (!(IReportItemModel.BOOKMARK_PROP.equals(propName) || IReportItemModel.TOC_PROP.equals(propName) || IStyleModel.PAGE_BREAK_AFTER_PROP.equals(propName)|| IStyleModel.PAGE_BREAK_BEFORE_PROP.equals(propName)|| IStyleModel.PAGE_BREAK_INSIDE_PROP.equals(propName)|| ICellModel.DROP_PROP.equals(propName)))   return false;
  for (int i=0; i < elements.size(); i++) {
    DesignElementHandle current=((DesignElementHandle)elements.get(i));
    DesignElementHandle container=current.getContainer();
    if (ICellModel.DROP_PROP.equals(propName)) {
      if (current instanceof CellHandle) {
        if (container == null) {
          continue;
        }
        if (!(container.getContainer() instanceof GroupHandle))         return true;
      }
    }
 else {
      while (container != null) {
        if (container instanceof MasterPageHandle)         return true;
        container=container.getContainer();
      }
    }
  }
  return false;
}
Program: 76918
Project: 76918
Buggy source:
/** 
 * Sets the page break inside property for block-level elements. The input value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @param value the new page break inside property
 * @throws SemanticException if the value is not one of the above.
 * @deprecated
 */
public void setPageBreakInside(String value) throws SemanticException {
  setStringProperty(Style.PAGE_BREAK_INSIDE_PROP,value);
}

Fixed version (ground truth):
/** 
 * Sets the page break inside property for block-level elements. The input value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @param value the new page break inside property
 * @throws SemanticException if the value is not one of the above.
 */
public void setPageBreakInside(String value) throws SemanticException {
  setStringProperty(Style.PAGE_BREAK_INSIDE_PROP,value);
}
Program: 76919
Project: 76919
Buggy source:
/** 
 * Returns the page break inside property for block-level elements. The return value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @return the page break inside property
 * @deprecated
 */
public String getPageBreakInside(){
  return getStringProperty(Style.PAGE_BREAK_INSIDE_PROP);
}

Fixed version (ground truth):
/** 
 * Returns the page break inside property for block-level elements. The return value is one of constants defined in <code>DesignChoiceConstants</code>: <ul> <li><code>PAGEBREAK_INSIDE_AVOID</code> <li><code>PAGEBREAK_INSIDE_AUTO</code> <li><code>PAGEBREAK_INSIDE_INHERIT</code> </ul>
 * @return the page break inside property
 */
public String getPageBreakInside(){
  return getStringProperty(Style.PAGE_BREAK_INSIDE_PROP);
}