nus-yam/ex-repair huggingface dataset:
Program: 77162
Project: 77162
Buggy source:
public boolean onBroughtToTop(IReportEditorPage page){
  GraphicalViewer view=getGraphicalViewer();
  if (view != null) {
    UIUtil.resetViewSelection(view,true);
  }
  return true;
}

Fixed version (ground truth):
public boolean onBroughtToTop(IReportEditorPage page){
  ModuleHandle model=getProvider().getReportModuleHandle(getEditorInput());
  if (model != null && getModel() != model) {
    Object oldModel=getModel();
    setModel(model);
    rebuildReportDesign(oldModel);
    if (getModel() != null) {
      this.getGraphicalViewer().setContents(getModel());
      hookModelEventManager(getModel());
      markPageStale(IPageStaleType.NONE);
    }
    updateStackActions();
  }
  GraphicalViewer view=getGraphicalViewer();
  if (view != null) {
    UIUtil.resetViewSelection(view,true);
  }
  return true;
}
Program: 77163
Project: 77163
Buggy source:
/** 
 * Gets the index of the current group at the specified group level. The index starts at 0  
 */
public int getCurrentGroupIndex(int groupLevel) throws DataException {
  checkHasCurrentRow();
  if (groupLevel < 0 || groupLevel > groups.length)   throw new DataException(ResourceConstants.INVALID_GROUP_LEVEL,new Integer(groupLevel));
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level > groupLevel - 1; level--) {
    GroupInfo currentGroup=findGroup(level,currentGroupIdx);
    currentGroupIdx=currentGroup.parent;
  }
  return currentGroupIdx;
}

Fixed version (ground truth):
/** 
 * Gets the index of the current group at the specified group level. The index starts at 0  
 */
public int getCurrentGroupIndex(int groupLevel) throws DataException {
  checkHasCurrentRow();
  if (groupLevel == 0)   return 0;
  if (groupLevel < 0 || groupLevel > groups.length)   throw new DataException(ResourceConstants.INVALID_GROUP_LEVEL,new Integer(groupLevel));
  int currentGroupIdx=leafGroupIdx;
  int level;
  for (level=groups.length - 1; level > groupLevel - 1; level--) {
    GroupInfo currentGroup=findGroup(level,currentGroupIdx);
    currentGroupIdx=currentGroup.parent;
  }
  return currentGroupIdx;
}
Program: 77164
Project: 77164
Buggy source:
public static int getLineHeight(String lineHeight){
  try {
    if (lineHeight.equalsIgnoreCase("String_Node_Str")) {
      return 0;
    }
    return Integer.parseInt(lineHeight);
  }
 catch (  NumberFormatException ex) {
    logger.log(Level.WARNING,"String_Node_Str",lineHeight);
    return 0;
  }
}

Fixed version (ground truth):
public static int getLineHeight(String lineHeight){
  try {
    if (lineHeight.equalsIgnoreCase("String_Node_Str")) {
      return 0;
    }
    return (int)Float.parseFloat(lineHeight);
  }
 catch (  NumberFormatException ex) {
    logger.log(Level.WARNING,"String_Node_Str",lineHeight);
    return 0;
  }
}
Program: 77165
Project: 77165
Buggy source:
public void setGroupName(String name){
  if (name != null)   this.groupName=name;
 else   this.groupName=GROUP_OVERALL;
}

Fixed version (ground truth):
public void setGroupName(String name){
  if (name != null && name.trim().length() != 0)   this.groupName=name;
 else   this.groupName=GROUP_OVERALL;
}
Program: 77166
Project: 77166
Buggy source:
protected void createActions(){
  super.createActions();
  IAction contentAssistAction=new TextOperationAction(Messages.RESOURCE_BUNDLE,"String_Node_Str",this,ISourceViewer.CONTENTASSIST_PROPOSALS,true);
  contentAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
  setAction("String_Node_Str",contentAssistAction);
}

Fixed version (ground truth):
protected void createActions(){
  super.createActions();
  IAction contentAssistAction=new TextOperationAction(Messages.getReportResourceBundle(),"String_Node_Str",this,ISourceViewer.CONTENTASSIST_PROPOSALS,true);
  contentAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
  setAction("String_Node_Str",contentAssistAction);
}
Program: 77167
Project: 77167
Buggy source:
protected void createActions(){
  super.createActions();
}

Fixed version (ground truth):
protected void createActions(){
  super.createActions();
  IAction contentAssistAction=new TextOperationAction(Messages.RESOURCE_BUNDLE,"String_Node_Str",this,ISourceViewer.CONTENTASSIST_PROPOSALS,true);
  contentAssistAction.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
  setAction("String_Node_Str",contentAssistAction);
}
Program: 77168
Project: 77168
Buggy source:
protected void readGroupField(DataInputStream in,GroupDesign group,short fieldType) throws IOException {
switch (fieldType) {
case FIELD_GROUP_LEVEL:
    int groupLevel=IOUtil.readInt(in);
  group.setGroupLevel(groupLevel);
break;
case FIELD_PAGE_BREAK_BEFORE:
String pageBreakBefore=IOUtil.readString(in);
group.setPageBreakBefore(pageBreakBefore);
break;
case FIELD_PAGE_BREAK_AFTER:
String pageBreakAfter=IOUtil.readString(in);
group.setPageBreakAfter(pageBreakAfter);
break;
case FIELD_HEADER_REPEAT:
boolean hideDetail=IOUtil.readBool(in);
group.setHideDetail(hideDetail);
break;
case FIELD_HIDE_DETAIL:
boolean headerRepeat=IOUtil.readBool(in);
group.setHeaderRepeat(headerRepeat);
break;
default :
readReportItemField(in,group,fieldType);
}
}

Fixed version (ground truth):
protected void readGroupField(DataInputStream in,GroupDesign group,short fieldType) throws IOException {
switch (fieldType) {
case FIELD_GROUP_LEVEL:
    int groupLevel=IOUtil.readInt(in);
  group.setGroupLevel(groupLevel);
break;
case FIELD_PAGE_BREAK_BEFORE:
String pageBreakBefore=IOUtil.readString(in);
group.setPageBreakBefore(pageBreakBefore);
break;
case FIELD_PAGE_BREAK_AFTER:
String pageBreakAfter=IOUtil.readString(in);
group.setPageBreakAfter(pageBreakAfter);
break;
case FIELD_HIDE_DETAIL:
boolean hideDetail=IOUtil.readBool(in);
group.setHideDetail(hideDetail);
break;
case FIELD_HEADER_REPEAT:
boolean headerRepeat=IOUtil.readBool(in);
group.setHeaderRepeat(headerRepeat);
break;
default :
readReportItemField(in,group,fieldType);
}
}
Program: 77169
Project: 77169
Buggy source:
private TableLayoutInfo resolveTableLayoutInfo(TableArea area){
  assert(parent != null);
  int avaWidth=parent.getMaxAvaWidth() - parent.getCurrentIP();
  int parentMaxWidth=parent.getMaxAvaWidth();
  IStyle style=area.getStyle();
  validateBoxProperty(style);
  int marginWidth=getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_LEFT)) + getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_RIGHT));
  int specifiedWidth=getDimensionValue(tableContent.getWidth(),parentMaxWidth);
  if (specifiedWidth + marginWidth > parentMaxWidth) {
    specifiedWidth=0;
  }
  boolean isInline=PropertyUtil.isInlineElement(content);
  if (specifiedWidth == 0) {
    if (isInline) {
      if (avaWidth - marginWidth > parentMaxWidth / 4) {
        tableWidth=avaWidth - marginWidth;
      }
 else {
        tableWidth=parentMaxWidth - marginWidth;
      }
    }
 else {
      tableWidth=avaWidth - marginWidth;
    }
    return new TableLayoutInfo(columnWidthResolver.resolve(tableWidth,tableWidth));
  }
 else {
    if (!isInline) {
      tableWidth=Math.min(specifiedWidth,avaWidth - marginWidth);
      return new TableLayoutInfo(handleColummVisibity(columnWidthResolver.resolve(tableWidth,avaWidth - marginWidth)));
    }
 else {
      tableWidth=Math.min(specifiedWidth,parentMaxWidth - marginWidth);
      return new TableLayoutInfo(handleColummVisibity(columnWidthResolver.resolve(tableWidth,parentMaxWidth - marginWidth)));
    }
  }
}

Fixed version (ground truth):
private TableLayoutInfo resolveTableLayoutInfo(TableArea area){
  assert(parent != null);
  int avaWidth=parent.getMaxAvaWidth() - parent.getCurrentIP();
  int parentMaxWidth=parent.getMaxAvaWidth();
  IStyle style=area.getStyle();
  validateBoxProperty(style);
  int marginWidth=getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_LEFT)) + getDimensionValue(style.getProperty(StyleConstants.STYLE_MARGIN_RIGHT));
  int specifiedWidth=getDimensionValue(tableContent.getWidth(),parentMaxWidth);
  if (specifiedWidth + marginWidth > parentMaxWidth) {
    specifiedWidth=0;
  }
  boolean isInline=PropertyUtil.isInlineElement(content);
  if (specifiedWidth == 0) {
    if (isInline) {
      if (avaWidth - marginWidth > parentMaxWidth / 4) {
        tableWidth=avaWidth - marginWidth;
      }
 else {
        tableWidth=parentMaxWidth - marginWidth;
      }
    }
 else {
      tableWidth=avaWidth - marginWidth;
    }
    return new TableLayoutInfo(handleColummVisibity(columnWidthResolver.resolve(tableWidth,tableWidth)));
  }
 else {
    if (!isInline) {
      tableWidth=Math.min(specifiedWidth,avaWidth - marginWidth);
      return new TableLayoutInfo(handleColummVisibity(columnWidthResolver.resolve(tableWidth,avaWidth - marginWidth)));
    }
 else {
      tableWidth=Math.min(specifiedWidth,parentMaxWidth - marginWidth);
      return new TableLayoutInfo(handleColummVisibity(columnWidthResolver.resolve(tableWidth,parentMaxWidth - marginWidth)));
    }
  }
}
Program: 77170
Project: 77170
Buggy source:
public void actionPerformed(ActionEvent e){
  int i=jcbModels.getSelectedIndex();
  cm=null;
switch (i) {
case 0:
    cm=DataCharts.createMinSliceChart();
  break;
case 1:
cm=DataCharts.createMulitYSeriesChart();
break;
case 2:
cm=DataCharts.createMultiYAxisChart();
break;
}
bNeedsGeneration=true;
dcv.repaint();
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  int i=jcbModels.getSelectedIndex();
  cm=null;
switch (i) {
case 0:
    cm=DataCharts.createMinSliceChart();
  break;
case 1:
cm=DataCharts.createMultiYSeriesChart();
break;
case 2:
cm=DataCharts.createMultiYAxisChart();
break;
}
bNeedsGeneration=true;
dcv.repaint();
}
Program: 77171
Project: 77171
Buggy source:
public boolean onBroughtToTop(IReportEditorPage prePage){
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  if (prePage.isDirty() || prePage.getStaleType() != IPageStaleType.NONE) {
    prePage.doSave(null);
    prePage.markPageStale(IPageStaleType.NONE);
    refreshDocument();
    markPageStale(IPageStaleType.NONE);
  }
  ReportRequest request=new ReportRequest(ReportXMLSourceEditorFormPage.this);
  List list=new ArrayList();
  request.setSelectionObject(list);
  request.setType(ReportRequest.SELECTION);
  SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
  return true;
}

Fixed version (ground truth):
public boolean onBroughtToTop(IReportEditorPage prePage){
  if (getEditorInput() != prePage.getEditorInput()) {
    setInput(prePage.getEditorInput());
  }
  if (prePage != this && (prePage.isDirty() || prePage.getStaleType() != IPageStaleType.NONE)) {
    prePage.doSave(null);
    prePage.markPageStale(IPageStaleType.NONE);
    refreshDocument();
    markPageStale(IPageStaleType.NONE);
  }
  ReportRequest request=new ReportRequest(ReportXMLSourceEditorFormPage.this);
  List list=new ArrayList();
  request.setSelectionObject(list);
  request.setType(ReportRequest.SELECTION);
  SessionHandleAdapter.getInstance().getMediator().notifyRequest(request);
  return true;
}
Program: 77172
Project: 77172
Buggy source:
protected boolean allowPageBreak(){
  IBandContent band=(IBandContent)content;
  int type=band.getBandType();
  if (type == IBandContent.BAND_HEADER) {
    IElement listContent=band.getParent();
    if (listContent instanceof IListContent) {
      return !((IListContent)listContent).isHeaderRepeat();
    }
  }
 else   if (type == IBandContent.BAND_GROUP_HEADER) {
    IElement groupContent=band.getParent();
    if (groupContent instanceof IGroupContent) {
      return !((IGroupContent)groupContent).isHeaderRepeat();
    }
  }
  return true;
}

Fixed version (ground truth):
protected boolean allowPageBreak(){
  IBandContent band=(IBandContent)content;
  int type=band.getBandType();
  if (type == IBandContent.BAND_HEADER) {
    if (IStyle.SOFT_VALUE.equals(content.getStyle().getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE))) {
      return true;
    }
    IElement listContent=band.getParent();
    if (listContent instanceof IListContent) {
      return !((IListContent)listContent).isHeaderRepeat();
    }
  }
 else   if (type == IBandContent.BAND_GROUP_HEADER) {
    if (IStyle.SOFT_VALUE.equals(content.getStyle().getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE))) {
      return true;
    }
    IElement groupContent=band.getParent();
    if (groupContent instanceof IGroupContent) {
      return !((IGroupContent)groupContent).isHeaderRepeat();
    }
  }
  return true;
}
Program: 77173
Project: 77173
Buggy source:
private boolean canPageBreak(){
  if (!context.allowPageBreak()) {
    return false;
  }
  PDFAbstractLM p=parent;
  while (p != null) {
    if (!p.allowPageBreak()) {
      return false;
    }
    p=p.getParent();
  }
  return true;
}

Fixed version (ground truth):
protected boolean canPageBreak(){
  if (!context.allowPageBreak()) {
    return false;
  }
  PDFAbstractLM p=parent;
  while (p != null) {
    if (!p.allowPageBreak()) {
      return false;
    }
    p=p.getParent();
  }
  return true;
}
Program: 77174
Project: 77174
Buggy source:
protected boolean allowPageBreak(){
  if (type == IBandContent.BAND_GROUP_HEADER || type == IBandContent.BAND_HEADER) {
    return !repeatHeader;
  }
  return true;
}

Fixed version (ground truth):
protected boolean allowPageBreak(){
  if (type == IBandContent.BAND_GROUP_HEADER || type == IBandContent.BAND_HEADER) {
    if (!repeatHeader) {
      return true;
    }
 else {
      if (IStyle.SOFT_VALUE.equals(content.getStyle().getProperty(IStyle.STYLE_PAGE_BREAK_BEFORE))) {
        return true;
      }
      return false;
    }
  }
  return true;
}
Program: 77175
Project: 77175
Buggy source:
public boolean addArea(IArea area){
  return parent.addArea(area);
}

Fixed version (ground truth):
public boolean addArea(IArea area){
  if (firstRow) {
    firstRow=false;
    IArea tocAnchor=AreaFactory.createTableGroupArea((IGroupContent)content);
    tableLM.addArea(tocAnchor);
    tableLM.setRepeatCount(tableLM.getRepeatCount() + 1);
  }
  return parent.addArea(area);
}
Program: 77177
Project: 77177
Buggy source:
/** 
 * convert String with ISO8601 date format to java.util.Date
 * @param source the String to be convert
 * @param locate the locate of the string
 * @return result Date
 */
private static Date toDateISO8601(String source) throws BirtException {
  Date resultDate=null;
  source=source.replaceFirst("String_Node_Str","String_Node_Str");
  for (int i=0; i < simpleDateFormatter.length - 1; i++) {
    try {
      resultDate=simpleDateFormatter[i].parse(source);
      return resultDate;
    }
 catch (    ParseException e1) {
    }
  }
  if (source.length() <= 4 && source.matches("String_Node_Str")) {
    try {
      resultDate=simpleDateFormatter[simpleDateFormatter.length - 1].parse(source);
      return resultDate;
    }
 catch (    ParseException e1) {
    }
  }
  if (resultDate == null) {
    throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
  }
  return resultDate;
}

Fixed version (ground truth):
/** 
 * convert String with ISO8601 date format to java.util.Date
 * @param source the String to be convert
 * @param locate the locate of the string
 * @return result Date
 */
private static Date toDateISO8601(String source) throws BirtException {
  Date resultDate=null;
  try {
    resultDate=DateFormatISO8601.parse(source);
    return resultDate;
  }
 catch (  ParseException e1) {
    throw new BirtException(pluginId,ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"},resourceBundle);
  }
}
Program: 77178
Project: 77178
Buggy source:
/** 
 * Sets the column name.
 * @param columnName the column name to set.
 * @throws SemanticException if the new column name duplicates with the existed ones.
 */
public void setName(String columnName) throws SemanticException {
  List resultList=ColumnBindingNameValidator.getInstance().validateForReplacing(getElementHandle(),getPropertyDefn(),getStructure(),columnName);
  if (resultList.size() > 0) {
    throw (PropertyValueException)resultList.get(0);
  }
  setProperty(ComputedColumn.NAME_MEMBER,columnName);
}

Fixed version (ground truth):
/** 
 * Sets the column name.
 * @param columnName the column name to set.
 * @throws SemanticException if the new column name duplicates with the existed ones.
 */
public void setName(String columnName) throws SemanticException {
  setProperty(ComputedColumn.NAME_MEMBER,columnName);
}
Program: 77181
Project: 77181
Buggy source:
protected boolean outputErrors(List errors){
  if (errors != null && !errors.isEmpty()) {
    writer.writeCode("String_Node_Str");
    writer.writeCode("String_Node_Str");
    writer.writeCode("String_Node_Str");
    writer.text(EngineResourceHandle.getInstance().getMessage(MessageConstants.ERRORS_ON_REPORT_PAGE),false);
    writer.writeCode("String_Node_Str");
    writer.writeCode("String_Node_Str");
    Iterator it=errors.iterator();
    int index=0;
    while (it.hasNext()) {
      appendErrorMessage(index++,(ElementExceptionInfo)it.next());
    }
    writer.writeCode("String_Node_Str");
    return true;
  }
  return false;
}

Fixed version (ground truth):
protected boolean outputErrors(List errors){
  if (errors != null && !errors.isEmpty()) {
    writer.writeCode("String_Node_Str");
    writer.writeCode("String_Node_Str");
    writer.writeCode("String_Node_Str");
    Locale locale=reportContext.getLocale();
    if (locale == null) {
      locale=Locale.getDefault();
    }
    EngineResourceHandle rc=new EngineResourceHandle(locale);
    writer.text(rc.getMessage(MessageConstants.ERRORS_ON_REPORT_PAGE),false);
    writer.writeCode("String_Node_Str");
    writer.writeCode("String_Node_Str");
    Iterator it=errors.iterator();
    int index=0;
    while (it.hasNext()) {
      appendErrorMessage(rc,index++,(ElementExceptionInfo)it.next());
    }
    writer.writeCode("String_Node_Str");
    return true;
  }
  return false;
}
Program: 77182
Project: 77182
Buggy source:
public URL findResource(ModuleHandle moduleHandle,String fileName,int type){
  if (fileName == null)   return null;
  try {
    File f=new File(fileName);
    if (f.isAbsolute())     return f.exists() && f.isFile() ? f.getCanonicalFile().toURL() : null;
  }
 catch (  IOException e) {
    return null;
  }
  try {
    URL objURI=new URL(fileName);
    if (isGlobalResource(objURI))     return objURI;
    return tryLocalResourceSearch(objURI);
  }
 catch (  MalformedURLException e) {
  }
  if (moduleHandle == null)   return tryFragmentSearch(fileName);
  String resourcePath=moduleHandle.getModule().getSession().getResourceFolder();
  if (resourcePath == null)   resourcePath=moduleHandle.getResourceFolder();
  if (resourcePath != null) {
    File f=new File(resourcePath,fileName);
    try {
      if (f.exists() && f.isFile())       return f.getCanonicalFile().toURL();
    }
 catch (    IOException e) {
    }
  }
  URL url=tryFragmentSearch(fileName);
  if (url != null)   return url;
  URL systemId=moduleHandle.getModule().getSystemId();
  if (systemId == null)   return null;
  try {
    url=new URL(systemId,URIUtil.convertFileNameToURLString(fileName));
    if (isGlobalResource(url))     return url;
    return tryLocalResourceSearch(url);
  }
 catch (  MalformedURLException e) {
  }
  return null;
}

Fixed version (ground truth):
public URL findResource(ModuleHandle moduleHandle,String fileName,int type){
  URL u=null;
  if (fileName == null)   return u;
switch (type) {
case IResourceLocator.MESSAGE_FILE:
    u=getMessageFile(moduleHandle,fileName);
  break;
default :
u=getResource(moduleHandle,fileName);
break;
}
return u;
}
Program: 77183
Project: 77183
Buggy source:
/** 
 * Searches the file by the given file name. The actual search algorithm will be different in different environment. The file type is just helpful when different file searching steps for different files are required. Because new file type will be added if design file includes new file, the default searching steps are encouraged for unknown file type to improve robustness.
 * @param moduleHandle The module to tell the search context. This could be null if the search algorithm does not need the design. It can be the instance of one of <code>ReportDesignHandle</code> and <code>LibraryHandle</code>.
 * @param filename The file name to be searched. This could be an absolute path or a relative path.
 * @param type The type of the file to search. The value must be one of <code>IMAGE</code>,<code>LIBRARY</code> and <code>CASCADING_STYLE_SHEET</code>.
 * @return The <code>URL</code> object. <code>null</code> if the filecan not be found.
 */
public URL findResource(ModuleHandle moduleHandle,String filename,int type);

Fixed version (ground truth):
/** 
 * Searches the file by the given file name. The actual search algorithm will be different in different environment. The file type is just helpful when different file searching steps for different files are required. Because new file type will be added if design file includes new file, the default searching steps are encouraged for unknown file type to improve robustness.
 * @param moduleHandle The module to tell the search context. This could be null if the search algorithm does not need the design. It can be the instance of one of <code>ReportDesignHandle</code> and <code>LibraryHandle</code>.
 * @param filename The file name to be searched. This could be an absolute path or a relative path.
 * @param type The type of the file to search. The value must be one of <code>IMAGE</code>,<code>LIBRARY</code> , <code>CASCADING_STYLE_SHEET</code> and <code>MESSAGEFILE</code>.
 * @return The <code>URL</code> object. <code>null</code> if the filecan not be found.
 */
public URL findResource(ModuleHandle moduleHandle,String filename,int type);
Program: 77184
Project: 77184
Buggy source:
/** 
 * Returns the <code>URL</code> object if the file with <code>fileName</code> exists. This method takes the following search steps: <ul> <li>Search file taking <code>fileName</code> as absolute file name; <li>Search file taking <code>fileName</code> as relative file name and basing "base" property of report design; <li>Search file with the file locator (<code>IResourceLocator</code>) in session. </ul>
 * @param fileName file name to search
 * @param fileType file type. The value should be one of: <ul> <li><code>IResourceLocator.IMAGE</code> <li><code>IResourceLocator.LIBRARY</code> </ul> Any invalid value will be treated as <code>IResourceLocator.IMAGE</code>.
 * @return the <code>URL</code> object if the file with<code>fileName</code> is found, or null otherwise.
 */
public URL findResource(String fileName,int fileType){
  return module.findResource(fileName,fileType);
}

Fixed version (ground truth):
/** 
 * Returns the <code>URL</code> object if the file with <code>fileName</code> exists. This method takes the following search steps: <ul> <li>Search file taking <code>fileName</code> as absolute file name; <li>Search file taking <code>fileName</code> as relative file name and basing "base" property of report design; <li>Search file with the file locator (<code>IResourceLocator</code>) in session. </ul>
 * @param fileName file name to search
 * @param fileType file type. The value should be one of: <ul> <li><code>IResourceLocator.IMAGE</code> <li><code>IResourceLocator.LIBRARY</code> <li><code>IResourceLocator.MESSAGEFILE</code> </ul> Any invalid value will be treated as <code>IResourceLocator.IMAGE</code>.
 * @return the <code>URL</code> object if the file with<code>fileName</code> is found, or null otherwise.
 */
public URL findResource(String fileName,int fileType){
  return module.findResource(fileName,fileType);
}
Program: 77185
Project: 77185
Buggy source:
/** 
 * Returns the <code>URL</code> object if the file with <code>fileName</code> exists. This method takes the following search steps: <ul> <li>Search file taking <code>fileName</code> as absolute file name; <li>Search file taking <code>fileName</code> as relative file name and basing "base" property of module; <li>Search file with the file locator (<code>IResourceLocator</code>) in session. </ul>
 * @param fileName file name to search
 * @param fileType file type. The value should be one of: <ul> <li><code>IResourceLocator.IMAGE</code> <li><code>IResourceLocator.LIBRARY</code> </ul> Any invalid value will be treated as <code>IResourceLocator.IMAGE</code>.
 * @return the <code>URL</code> object if the file with<code>fileName</code> is found, or null otherwise.
 */
public URL findResource(String fileName,int fileType){
  URL url=getSession().getResourceLocator().findResource((ModuleHandle)getHandle(this),fileName,fileType);
  return url;
}

Fixed version (ground truth):
/** 
 * Returns the <code>URL</code> object if the file with <code>fileName</code> exists. This method takes the following search steps: <ul> <li>Search file taking <code>fileName</code> as absolute file name; <li>Search file taking <code>fileName</code> as relative file name and basing "base" property of module; <li>Search file with the file locator (<code>IResourceLocator</code>) in session. </ul>
 * @param fileName file name to search
 * @param fileType file type. The value should be one of: <ul> <li><code>IResourceLocator.IMAGE</code> <li><code>IResourceLocator.LIBRARY</code> <li><code>IResourceLocator.MESSAGEFILE</code> </ul> Any invalid value will be treated as <code>IResourceLocator.IMAGE</code>.
 * @return the <code>URL</code> object if the file with<code>fileName</code> is found, or null otherwise.
 */
public URL findResource(String fileName,int fileType){
  URL url=getSession().getResourceLocator().findResource((ModuleHandle)getHandle(this),fileName,fileType);
  return url;
}
Program: 77186
Project: 77186
Buggy source:
/** 
 * clear unused column hints
 * @throws BirtException 
 */
private final void clearUnusedColumnHints(DataSetHandle dataSetHandle,IResultMetaData metaData) throws BirtException {
  PropertyHandle handle=dataSetHandle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
  ArrayList list=handle.getListValue();
  if (list != null) {
    int count=list.size();
    for (int n=count - 1; n >= 0; n--) {
      ColumnHint hint=(ColumnHint)list.get(n);
      String columnName=(String)hint.getProperty(handle.getDesign(),ColumnHint.COLUMN_NAME_MEMBER);
      boolean found=false;
      if (!isEmpty(hint,handle.getModule().getModuleHandle())) {
        for (int m=0; m < metaData.getColumnCount() && !found; m++) {
          found=columnName.equals(metaData.getColumnName(m + 1));
        }
      }
      if (!found) {
        try {
          handle.removeItem(hint);
        }
 catch (        PropertyValueException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * clear unused column hints
 * @throws BirtException 
 */
private final void clearUnusedColumnHints(DataSetHandle dataSetHandle,IResultMetaData metaData) throws BirtException {
  PropertyHandle handle=dataSetHandle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
  if (handle != null && handle.getListValue() != null) {
    ArrayList list=handle.getListValue();
    int count=list.size();
    for (int n=count - 1; n >= 0; n--) {
      ColumnHint hint=(ColumnHint)list.get(n);
      String columnName=(String)hint.getProperty(handle.getDesign(),ColumnHint.COLUMN_NAME_MEMBER);
      boolean found=false;
      if (!isEmpty(hint,handle.getModule().getModuleHandle())) {
        for (int m=0; m < metaData.getColumnCount() && !found; m++) {
          found=columnName.equals(metaData.getColumnName(m + 1));
        }
      }
      if (!found) {
        try {
          handle.removeItem(hint);
        }
 catch (        PropertyValueException e) {
        }
      }
    }
  }
}
Program: 77187
Project: 77187
Buggy source:
/** 
 * @param dataSetName
 * @return
 * @throws BirtException
 */
private IResultMetaData getRealMetaData(DataSetHandle dataSetHandle) throws BirtException {
  QueryDefinition query=new QueryDefinition();
  query.setDataSetName(dataSetHandle.getQualifiedName());
  query.setMaxRows(1);
  IResultMetaData metaData=MetaDataPopulator.retrieveResultMetaData(dataSetHandle);
  if (metaData == null) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,false).executeQuery(query).getResultMetaData();
    if (dataSetHandle.canEdit())     addResultSetColumn(dataSetHandle,metaData);
  }
  if (needsUseResultHint(dataSetHandle,metaData)) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,true).executeQuery(query).getResultMetaData();
  }
  if (!(dataSetHandle instanceof ScriptDataSetHandle))   clearUnusedData(dataSetHandle,metaData);
  return metaData;
}

Fixed version (ground truth):
/** 
 * @param dataSetName
 * @return
 * @throws BirtException
 */
private IResultMetaData getRealMetaData(DataSetHandle dataSetHandle) throws BirtException {
  QueryDefinition query=new QueryDefinition();
  query.setDataSetName(dataSetHandle.getQualifiedName());
  query.setMaxRows(1);
  IResultMetaData metaData=MetaDataPopulator.retrieveResultMetaData(dataSetHandle);
  if (metaData == null) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,false).executeQuery(query).getResultMetaData();
    if (dataSetHandle.canEdit())     addResultSetColumn(dataSetHandle,metaData);
    if (MetaDataPopulator.needsUseResultHint(dataSetHandle,metaData)) {
      metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,sessionContext,true).executeQuery(query).getResultMetaData();
    }
  }
  if (!(dataSetHandle instanceof ScriptDataSetHandle))   clearUnusedData(dataSetHandle,metaData);
  return metaData;
}
Program: 77188
Project: 77188
Buggy source:
/** 
 * handle the page-break-before of group. AUTO: page-break-always-excluding_fist for top level group, none for others. PAGE_BREAK_BEFORE_ALWAYS: always create page break PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST: create page-break for all groups except the first one.
 * @param bandDesign
 */
protected void handlePageBreakBeforeOfGroup(){
  boolean needPageBreak=false;
  GroupDesign groupDesign=(GroupDesign)design;
  if (groupDesign != null) {
    String pageBreakBefore=groupDesign.getPageBreakBefore();
    int groupLevel=groupDesign.getGroupLevel();
    if (DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS.equals(pageBreakBefore)) {
      needPageBreak=true;
    }
    if (DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST.equals(pageBreakBefore)) {
      if (rset.getStartingGroupLevel() > groupLevel) {
        needPageBreak=true;
      }
    }
    if (DesignChoiceConstants.PAGE_BREAK_BEFORE_AUTO.equals(pageBreakBefore) && groupLevel == 0) {
      if (isTopLevelListing()) {
        int startGroupLevel=rset.getStartingGroupLevel();
        if (startGroupLevel > 0) {
          needPageBreak=true;
        }
      }
    }
    if (needPageBreak) {
      content.getStyle().setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.ALWAYS_VALUE);
    }
  }
}

Fixed version (ground truth):
/** 
 * handle the page-break-before of group. AUTO: page-break-always-excluding_fist for top level group, none for others. PAGE_BREAK_BEFORE_ALWAYS: always create page break PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST: create page-break for all groups except the first one.
 * @param bandDesign
 */
protected void handlePageBreakBeforeOfGroup(){
  boolean needPageBreak=false;
  GroupDesign groupDesign=(GroupDesign)design;
  if (groupDesign != null) {
    String pageBreakBefore=groupDesign.getPageBreakBefore();
    int groupLevel=groupDesign.getGroupLevel();
    if (DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS.equals(pageBreakBefore)) {
      needPageBreak=true;
    }
    if (DesignChoiceConstants.PAGE_BREAK_BEFORE_ALWAYS_EXCLUDING_FIRST.equals(pageBreakBefore)) {
      if (rset.getStartingGroupLevel() > groupLevel) {
        needPageBreak=true;
      }
    }
    if (needPageBreak) {
      content.getStyle().setProperty(IStyle.STYLE_PAGE_BREAK_BEFORE,IStyle.ALWAYS_VALUE);
    }
  }
}
Program: 77189
Project: 77189
Buggy source:
private void locateGroupIcon(GroupDesign group){
  GroupHandle groupHandle=(GroupHandle)group.getHandle();
  String keyExpression=groupHandle.getKeyExpr();
  if (keyExpression == null) {
    return;
  }
  keyExpression=keyExpression.trim();
  BandDesign groupHeader=group.getHeader();
  for (int i=0; i < groupHeader.getContentCount(); i++) {
    RowDesign row=(RowDesign)groupHeader.getContent(0);
    for (int j=0; j < row.getCellCount(); j++) {
      CellDesign cell=row.getCell(j);
      for (int k=0; k < cell.getContentCount(); k++) {
        ReportItemDesign item=cell.getContent(k);
        if (item instanceof DataItemDesign) {
          DataItemDesign data=(DataItemDesign)item;
          String value=data.getValue();
          if (value != null && keyExpression.equals(value.trim())) {
            cell.setDisplayGroupIcon(true);
            return;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void locateGroupIcon(GroupDesign group){
  GroupHandle groupHandle=(GroupHandle)group.getHandle();
  String keyExpression=groupHandle.getKeyExpr();
  if (keyExpression == null) {
    return;
  }
  keyExpression=keyExpression.trim();
  BandDesign groupHeader=group.getHeader();
  for (int i=0; i < groupHeader.getContentCount(); i++) {
    RowDesign row=(RowDesign)groupHeader.getContent(0);
    for (int j=0; j < row.getCellCount(); j++) {
      CellDesign cell=row.getCell(j);
      for (int k=0; k < cell.getContentCount(); k++) {
        ReportItemDesign item=cell.getContent(k);
        if (hasExpression(item,keyExpression)) {
          cell.setDisplayGroupIcon(true);
          return;
        }
      }
    }
  }
}
Program: 77191
Project: 77191
Buggy source:
public int getScale(int index) throws OdaException {
  logger.logp(java.util.logging.Level.FINE,ResultSetMetaData.class.getName(),"String_Node_Str","String_Node_Str");
  assertNotNull(rsMetadata);
  try {
    return rsMetadata.getScale(index);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_MEATADATA_SCALE_CANNOT_GET,e);
  }
}

Fixed version (ground truth):
public int getScale(int index) throws OdaException {
  logger.logp(java.util.logging.Level.FINE,ResultSetMetaData.class.getName(),"String_Node_Str","String_Node_Str");
  assertNotNull(rsMetadata);
  try {
    return rsMetadata.getScale(index);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_MEATADATA_SCALE_CANNOT_GET,e);
  }
catch (  RuntimeException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_MEATADATA_SCALE_CANNOT_GET,new SQLException(e.getMessage()));
  }
}
Program: 77192
Project: 77192
Buggy source:
public int getPrecision(int index) throws OdaException {
  logger.logp(java.util.logging.Level.FINE,ResultSetMetaData.class.getName(),"String_Node_Str","String_Node_Str");
  assertNotNull(rsMetadata);
  try {
    return rsMetadata.getPrecision(index);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_METADATA_PRECISION_CANNOT_GET,e);
  }
}

Fixed version (ground truth):
public int getPrecision(int index) throws OdaException {
  logger.logp(java.util.logging.Level.FINE,ResultSetMetaData.class.getName(),"String_Node_Str","String_Node_Str");
  assertNotNull(rsMetadata);
  try {
    return rsMetadata.getPrecision(index);
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_METADATA_PRECISION_CANNOT_GET,e);
  }
catch (  RuntimeException e) {
    throw new JDBCException(ResourceConstants.RESULTSET_METADATA_PRECISION_CANNOT_GET,new SQLException(e.getMessage()));
  }
}
Program: 77193
Project: 77193
Buggy source:
/** 
 * Create a parameter hint based on Parameter definition and value
 * @param paramDefn
 * @param evaValue
 */
private ParameterHint createParameterHint(IParameterDefinition paramDefn,Object paramValue) throws DataException {
}

Fixed version (ground truth):
/** 
 * Create a parameter hint based on Parameter definition and value
 * @param paramDefn
 * @param evaValue
 */
private ParameterHint createParameterHint(IParameterDefinition paramDefn,Object paramValue) throws DataException {
  ParameterHint parameterHint=new ParameterHint(paramDefn.getName(),paramDefn.isInputMode(),paramDefn.isOutputMode());
  if (paramDefn.getPosition() > 0)   parameterHint.setPosition(paramDefn.getPosition());
  Class dataTypeClass=DataType.getClass(paramDefn.getType());
  if (dataTypeClass == DataType.AnyType.class || dataTypeClass == Boolean.class || dataTypeClass == Blob.class) {
    dataTypeClass=String.class;
  }
  parameterHint.setDataType(dataTypeClass);
  parameterHint.setNativeDataType(paramDefn.getNativeType());
  parameterHint.setIsInputOptional(paramDefn.isInputOptional());
  if (parameterHint.isInputMode())   parameterHint.setDefaultInputValue(getParameterValueString(dataTypeClass,paramValue));
  parameterHint.setIsNullable(paramDefn.isNullable());
  return parameterHint;
}
Program: 77194
Project: 77194
Buggy source:
/** 
 * Check whether report design will overwrite report doc or not.
 * @param request
 * @return
 */
public static boolean isOverwrite(HttpServletRequest request){
  boolean overwrite=false;
  if ("String_Node_Str".equalsIgnoreCase(getParameter(request,PARAM_OVERWRITE))) {
    overwrite=true;
  }
  return overwrite;
}

Fixed version (ground truth):
/** 
 * Check whether report design will overwrite report doc or not.
 * @param request
 * @return
 */
public static boolean isOverwrite(HttpServletRequest request){
  boolean overwrite=isOverWrite;
  String urlParam=getParameter(request,PARAM_OVERWRITE);
  if ("String_Node_Str".equalsIgnoreCase(urlParam)) {
    overwrite=true;
  }
 else   if ("String_Node_Str".equalsIgnoreCase(urlParam)) {
    overwrite=false;
  }
  return overwrite;
}
Program: 77195
Project: 77195
Buggy source:
/** 
 * Initial the parameters class. Web.xml is in UTF-8 format. No need to do encoding convertion.
 * @param context Servlet Context
 */
public synchronized static void initParameters(ServletContext context){
  if (isInitContext)   return;
  workingFolder=context.getInitParameter(INIT_PARAM_REPORT_DIR);
  documentFolder=context.getInitParameter(INIT_PARAM_DOCUMENT_FOLDER);
  if (workingFolder == null || workingFolder.trim().length() <= 0) {
    workingFolder=getRealPath(context,"String_Node_Str");
  }
  if (workingFolder != null && workingFolder.trim().endsWith(File.separator)) {
    workingFolder=workingFolder.trim().substring(0,workingFolder.trim().length() - 1);
  }
  if (documentFolder == null || documentFolder.trim().length() <= 0)   documentFolder=workingFolder;
  webAppLocale=getLocaleFromString(context.getInitParameter(INIT_PARAM_LOCALE));
  if (webAppLocale == null)   webAppLocale=Locale.getDefault();
  isDocumentFolderAccessOnly=Boolean.valueOf(context.getInitParameter(INIT_PARAM_DOCUMENT_FOLDER_ACCESS_ONLY)).booleanValue();
  String s_maxRows=context.getInitParameter(INIT_PARAM_VIEWER_MAXROWS);
  try {
    maxRows=Integer.valueOf(s_maxRows).intValue();
  }
 catch (  NumberFormatException e) {
    maxRows=-1;
  }
  birtResourceFolder=context.getInitParameter(INIT_PARAM_BIRT_RESOURCE_PATH);
  clearDocuments();
  isInitContext=true;
}

Fixed version (ground truth):
/** 
 * Initial the parameters class. Web.xml is in UTF-8 format. No need to do encoding convertion.
 * @param context Servlet Context
 */
public synchronized static void initParameters(ServletContext context){
  if (isInitContext)   return;
  workingFolder=context.getInitParameter(INIT_PARAM_REPORT_DIR);
  documentFolder=context.getInitParameter(INIT_PARAM_DOCUMENT_FOLDER);
  if (workingFolder == null || workingFolder.trim().length() <= 0) {
    workingFolder=getRealPath(context,"String_Node_Str");
  }
  if (workingFolder != null && workingFolder.trim().endsWith(File.separator)) {
    workingFolder=workingFolder.trim().substring(0,workingFolder.trim().length() - 1);
  }
  if (documentFolder == null || documentFolder.trim().length() <= 0)   documentFolder=workingFolder;
  webAppLocale=getLocaleFromString(context.getInitParameter(INIT_PARAM_LOCALE));
  if (webAppLocale == null)   webAppLocale=Locale.getDefault();
  isDocumentFolderAccessOnly=Boolean.valueOf(context.getInitParameter(INIT_PARAM_DOCUMENT_FOLDER_ACCESS_ONLY)).booleanValue();
  String s_maxRows=context.getInitParameter(INIT_PARAM_VIEWER_MAXROWS);
  try {
    maxRows=Integer.valueOf(s_maxRows).intValue();
  }
 catch (  NumberFormatException e) {
    maxRows=-1;
  }
  birtResourceFolder=context.getInitParameter(INIT_PARAM_BIRT_RESOURCE_PATH);
  String s_overwrite=context.getInitParameter(INIT_PARAM_OVERWRITE_DOCUMENT);
  if ("String_Node_Str".equalsIgnoreCase(s_overwrite)) {
    isOverWrite=true;
  }
 else {
    isOverWrite=false;
  }
  clearDocuments();
  isInitContext=true;
}
Program: 77198
Project: 77198
Buggy source:
public void addPages(){
  saveAsPage=new WizardSaveAsPage("String_Node_Str");
  saveAsPage.setOriginalFile(orginalFile);
  saveAsPage.setTitle(SaveAsWizardPageTitle);
  saveAsPage.setMessage(SaveAsWizardPageDesc);
  addPage(saveAsPage);
  if (model instanceof ReportDesignHandle) {
    settingPage=new WizardReportSettingPage((ReportDesignHandle)model);
    settingPage.setTitle(ReportSettingPageTitle);
    settingPage.setMessage(Messages.getString("String_Node_Str"));
    addPage(settingPage);
  }
}

Fixed version (ground truth):
public void addPages(){
  saveAsPage=new WizardSaveAsPage("String_Node_Str");
  saveAsPage.setOriginalFile(orginalFile);
  saveAsPage.setTitle(SaveAsWizardPageTitle);
  saveAsPage.setMessage(SaveAsWizardPageDesc);
  addPage(saveAsPage);
  if (model instanceof ReportDesignHandle) {
    settingPage=new WizardReportSettingPage((ReportDesignHandle)model);
    settingPage.setTitle(ReportSettingPageTitle);
    settingPage.setMessage(ReportSettingPageMessage);
    addPage(settingPage);
  }
}
Program: 77201
Project: 77201
Buggy source:
/** 
 * @param intervalStart
 * @param intervalRange
 * @throws BirtException
 */
public StringGroupCalculator(Object intervalStart,double intervalRange) throws BirtException {
  super(intervalStart,intervalRange);
}

Fixed version (ground truth):
/** 
 * @param intervalStart
 * @param intervalRange
 * @throws BirtException
 */
public StringGroupCalculator(Object intervalStart,double intervalRange) throws BirtException {
  super(intervalStart,intervalRange);
  interval=(int)(Math.round(intervalRange));
}
Program: 77202
Project: 77202
Buggy source:
public Object calculate(Object value) throws BirtException {
  if (value == null || value.equals("String_Node_Str")) {
    return value;
  }
  return value.toString().substring(0,(int)(Math.round(intervalRange)));
}

Fixed version (ground truth):
public Object calculate(Object value) throws BirtException {
  if (value == null || value.equals("String_Node_Str")) {
    return value;
  }
  if (value.toString().length() <= interval)   return value;
  return value.toString().substring(0,interval);
}
Program: 77204
Project: 77204
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffDay(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffDay((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffDay((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffDay(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffDay((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffDay((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77205
Project: 77205
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffHour(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffHour((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffHour((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffHour(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffHour((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffHour((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77206
Project: 77206
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMinute(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffMinute((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMinute((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMinute(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffMinute((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMinute((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77207
Project: 77207
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMonth(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffMonth((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMonth((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffMonth(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffMonth((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffMonth((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}
Program: 77208
Project: 77208
Buggy source:
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffQuarter(defaultStart,(Date)value) / intervalRange));
  }
 else {
    if (DateTimeUtil.diffQuarter((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffQuarter((Date)intervalStart,(Date)value) / intervalRange));
    }
  }
}

Fixed version (ground truth):
public Object calculate(Object value){
  if (value == null) {
    return new Double(-1);
  }
  if (intervalStart == null) {
    return new Double(Math.floor(DateTimeUtil.diffQuarter(defaultStart,(Date)value) / getDateIntervalRange()));
  }
 else {
    if (DateTimeUtil.diffQuarter((Date)intervalStart,(Date)value) < 0) {
      return new Double(-1);
    }
 else {
      return new Double(Math.floor(DateTimeUtil.diffQuarter((Date)intervalStart,(Date)value) / getDateIntervalRange()));
    }
  }
}