nus-yam/ex-repair huggingface dataset:
Program: 77806
Project: 77806
Buggy source:
/** 
 * @param ds
 * @param columns
 */
public void updateModel(DataSetHandle ds,DataSetViewData[] columns){
  PropertyHandle handle=ds.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
  PropertyHandle resultSetColumnHandle=ds.getPropertyHandle(DataSetHandle.RESULT_SET_PROP);
  Iterator iter=handle.iterator();
  if (iter != null) {
    while (iter.hasNext()) {
      ColumnHintHandle hint=(ColumnHintHandle)iter.next();
      for (int n=0; n < columns.length; n++) {
        String columnName=columns[n].getName();
        if (columnName == null || columnName.trim().length() == 0) {
          Iterator resultIter=resultSetColumnHandle.iterator();
          if (resultIter != null) {
            while (resultIter.hasNext()) {
              ResultSetColumnHandle column=(ResultSetColumnHandle)resultIter.next();
              if (column.getPosition().intValue() == n + 1) {
                columnName=column.getColumnName();
                break;
              }
            }
          }
          if (columnName == null) {
            columnName="String_Node_Str";
          }
          columns[n].setName(columnName);
        }
        if (columns[n].getName().equals(hint.getColumnName())) {
          columns[n].setDisplayName(hint.getDisplayName());
          columns[n].setAlias(hint.getAlias());
          columns[n].setHelpText(hint.getHelpText());
          break;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param ds
 * @param columns
 */
public void updateModel(DataSetHandle ds,DataSetViewData[] columns){
  PropertyHandle handle=ds.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP);
  PropertyHandle resultSetColumnHandle=ds.getPropertyHandle(DataSetHandle.RESULT_SET_HINTS_PROP);
  Iterator iter=handle.iterator();
  if (iter != null) {
    while (iter.hasNext()) {
      ColumnHintHandle hint=(ColumnHintHandle)iter.next();
      for (int n=0; n < columns.length; n++) {
        String columnName=columns[n].getName();
        if (resultSetColumnHandle != null && (columnName == null || columnName.trim().length() == 0)) {
          Iterator resultIter=resultSetColumnHandle.iterator();
          if (resultIter != null) {
            while (resultIter.hasNext()) {
              ResultSetColumnHandle column=(ResultSetColumnHandle)resultIter.next();
              if (column.getPosition().intValue() == n + 1) {
                columnName=column.getColumnName();
                break;
              }
            }
          }
          if (columnName == null) {
            columnName="String_Node_Str";
          }
          columns[n].setName(columnName);
        }
        if (columns[n].getName().equals(hint.getColumnName())) {
          columns[n].setDisplayName(hint.getDisplayName());
          columns[n].setAlias(hint.getAlias());
          columns[n].setHelpText(hint.getHelpText());
          break;
        }
      }
    }
  }
}
Program: 77807
Project: 77807
Buggy source:
/** 
 * Gets all columns in a dataSet.
 * @param handle ReportItem object
 * @return Columns array.
 */
private String[] getDataSetColumns(ReportItemHandle handle){
  DataSetHandle dataSet=handle.getDataSet();
  if (dataSet == null)   return EMPTY;
  Iterator iterator=dataSet.resultSetIterator();
  if (iterator == null)   return EMPTY;
  ArrayList columns=new ArrayList();
  while (iterator.hasNext()) {
    ResultSetColumn resultSetColumn=(ResultSetColumn)iterator.next();
    columns.add(resultSetColumn.getColumnName());
  }
  return (String[])columns.toArray(new String[0]);
}

Fixed version (ground truth):
/** 
 * Gets all columns in a dataSet.
 * @param handle ReportItem object
 * @return Columns array.
 */
private String[] getDataSetColumns(ReportItemHandle handle){
  DataSetHandle dataSet=handle.getDataSet();
  if (dataSet == null)   return EMPTY;
  Iterator iterator=dataSet.resultSetHintsIterator();
  if (iterator == null)   return EMPTY;
  ArrayList columns=new ArrayList();
  while (iterator.hasNext()) {
    ResultSetColumn resultSetColumn=(ResultSetColumn)iterator.next();
    columns.add(resultSetColumn.getColumnName());
  }
  return (String[])columns.toArray(new String[0]);
}
Program: 77810
Project: 77810
Buggy source:
/** 
 * Checks whether <code>filePath</code> is a file protocol if it is not a invalid URI. <p> A invalid URI contains excluded US-ASCII characters: <ul> <li>contro = <US-ASCII coded characters 00-1F and 7F hexadecimal> <li>space = <US-ASCII coded character 20 hexadecimal> <li>delims="<" | ">" | "#" | "%" | <"> <li>unwise="{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" </ul> Details are described at the hyperlink: http://www.ietf.org/rfc/rfc2396.txt.
 * @param uri the input uri
 * @return the file path if <code>uri</code> refers to a file. Otherwisenull.
 */
private static String getLocalFileOfFailedURI(String uri){
  URL objURI=null;
  try {
    objURI=new URL(uri);
    if (objURI.getProtocol().equalsIgnoreCase(FILE_SCHEMA)) {
      return objURI.getAuthority() == null ? objURI.getPath() : objURI.getAuthority() + objURI.getPath();
    }
 else     if (objURI.getProtocol().equalsIgnoreCase(JAR_SCHEMA))     return uri;
 else     return null;
  }
 catch (  MalformedURLException e) {
    File file=new File(uri);
    if (uri.contains(JAR_EXTENTION))     return JAR_SCHEMA + "String_Node_Str" + FILE_SCHEMA+ "String_Node_Str"+ file.getAbsolutePath();
    if (uri.startsWith(FILE_SCHEMA))     return file.toURI().getSchemeSpecificPart();
    return uri;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether <code>filePath</code> is a file protocol if it is not a invalid URI. <p> A invalid URI contains excluded US-ASCII characters: <ul> <li>contro = <US-ASCII coded characters 00-1F and 7F hexadecimal> <li>space = <US-ASCII coded character 20 hexadecimal> <li>delims="<" | ">" | "#" | "%" | <"> <li>unwise="{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" </ul> Details are described at the hyperlink: http://www.ietf.org/rfc/rfc2396.txt.
 * @param uri the input uri
 * @return the file path if <code>uri</code> refers to a file. Otherwisenull.
 */
private static String getLocalFileOfFailedURI(String uri){
  URL objURI=null;
  try {
    objURI=new URL(uri);
    if (objURI.getProtocol().equalsIgnoreCase(FILE_SCHEMA)) {
      return objURI.getAuthority() == null ? objURI.getPath() : objURI.getAuthority() + objURI.getPath();
    }
 else     if (objURI.getProtocol().equalsIgnoreCase(JAR_SCHEMA))     return uri;
 else     return null;
  }
 catch (  MalformedURLException e) {
    File file=new File(uri);
    if (uri.indexOf(JAR_EXTENTION) != 0)     return JAR_SCHEMA + "String_Node_Str" + FILE_SCHEMA+ "String_Node_Str"+ file.getAbsolutePath();
    if (uri.startsWith(FILE_SCHEMA))     return file.toURI().getSchemeSpecificPart();
    return uri;
  }
}
Program: 77811
Project: 77811
Buggy source:
/** 
 * Converts a filename to a valid URL. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk.
 * @param filePath the file name
 * @return a valid URL
 */
public static URL getDirectory(String filePath){
  if (filePath == null)   return null;
  URL url=null;
  try {
    url=new URL(convertFileNameToURLString(filePath));
  }
 catch (  MalformedURLException e) {
    if (filePath.contains(JAR_EXTENTION))     url=getJarDirectory(filePath);
 else     url=getFileDirectory(filePath);
    return url;
  }
  if (FILE_SCHEMA.equalsIgnoreCase(url.getProtocol()))   return getFileDirectory(url.getPath());
 else   if (JAR_SCHEMA.equalsIgnoreCase(url.getProtocol()) && !url.getPath().toLowerCase().startsWith(HTTP_SCHEMA))   return getJarDirectory(url.getPath());
  return getNetDirectory(url);
}

Fixed version (ground truth):
/** 
 * Converts a filename to a valid URL. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk.
 * @param filePath the file name
 * @return a valid URL
 */
public static URL getDirectory(String filePath){
  if (filePath == null)   return null;
  URL url=null;
  try {
    url=new URL(convertFileNameToURLString(filePath));
  }
 catch (  MalformedURLException e) {
    if (filePath.indexOf(JAR_EXTENTION) != 0)     url=getJarDirectory(filePath);
 else     url=getFileDirectory(filePath);
    return url;
  }
  if (FILE_SCHEMA.equalsIgnoreCase(url.getProtocol()))   return getFileDirectory(url.getPath());
 else   if (JAR_SCHEMA.equalsIgnoreCase(url.getProtocol()) && !url.getPath().toLowerCase().startsWith(HTTP_SCHEMA))   return getJarDirectory(url.getPath());
  return getNetDirectory(url);
}
Program: 77813
Project: 77813
Buggy source:
private boolean containValue(SelectionChoice selectedChoice,String newValue,String property){
  for (Iterator iter=choiceList.iterator(); iter.hasNext(); ) {
    SelectionChoice choice=(SelectionChoice)iter.next();
    if (choice != selectedChoice) {
      String value=null;
      if (COLUMN_VALUE.equals(property)) {
        value=choice.getValue();
      }
 else       if (COLUMN_DISPLAY_TEXT.equals(property)) {
        value=choice.getLabel();
        if (value == null) {
          value=choice.getValue();
        }
        if (value == null) {
          value=LABEL_NULL;
        }
      }
      if (isEqual(value,newValue)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean containValue(SelectionChoice selectedChoice,String newValue,String property){
  for (Iterator iter=choiceList.iterator(); iter.hasNext(); ) {
    SelectionChoice choice=(SelectionChoice)iter.next();
    if (choice != selectedChoice) {
      String value=null;
      if (COLUMN_VALUE.equals(property)) {
        value=choice.getValue();
        if (isEqual(value,newValue)) {
          return true;
        }
      }
 else       if (COLUMN_DISPLAY_TEXT.equals(property)) {
        value=choice.getLabel();
        if (value == null) {
          value=choice.getValue();
        }
        if (value == null) {
          value=LABEL_NULL;
        }
        if (value.equals(newValue)) {
          return true;
        }
      }
    }
  }
  return false;
}
Program: 77814
Project: 77814
Buggy source:
private boolean performRevertToTemplateItem(DesignElementHandle handle){
  try {
    handle.revertToTemplate("String_Node_Str");
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean performRevertToTemplateItem(DesignElementHandle handle){
  try {
    handle.revertToTemplate(ReportPlugin.getDefault().getCustomName(ReportDesignConstants.TEMPLATE_REPORT_ITEM));
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return false;
  }
  return true;
}
Program: 77815
Project: 77815
Buggy source:
private boolean checkNameExist(DesignElement element,String name){
  if (name == null || name.length() == 0)   return false;
  ElementDefn metaData=(ElementDefn)element.getDefn();
  int ns=metaData.getNameSpaceID();
  DesignElement existedElement=SessionHandleAdapter.getInstance().getReportDesignHandle().getModule().getNameSpace(ns).getElement(name);
  return (existedElement == null) ? false : true;
}

Fixed version (ground truth):
private boolean checkNameExist(DesignElement element,String name){
  if (name == null || name.length() == 0)   return false;
  ElementDefn metaData=(ElementDefn)element.getDefn();
  int ns=metaData.getNameSpaceID();
  DesignElement existedElement=SessionHandleAdapter.getInstance().getReportDesignHandle().getModule().getNameSpace(ns).getElement(name);
  return (existedElement == null || existedElement == element) ? false : true;
}
Program: 77816
Project: 77816
Buggy source:
private boolean performCreatePlaceHolder(ReportElementHandle handle){
  boolean bIsNameExist=false;
  TemplateElementHandle template=null;
  String name=null;
  String desc=null;
  do {
    try {
      if (template == null) {
        template=handle.createTemplateElement(null);
      }
      if (name == null) {
        name=template.getName();
        name=(name == null) ? "String_Node_Str" : name;
      }
      if (desc == null) {
        desc=template.getDescription();
        desc=(desc == null) ? "String_Node_Str" : desc;
      }
      TemplateReportItemPropertiesDialog dialog=new TemplateReportItemPropertiesDialog(template.getDefaultElement().getDefn().getDisplayName(),name,desc);
      if (dialog.open() == Window.OK) {
        name=(String)dialog.getName().trim();
        desc=(String)dialog.getResult();
        bIsNameExist=checkNameExist(template.getElement(),name);
        if (bIsNameExist == false) {
          template.setDescription(desc);
          template.setName(name);
        }
 else {
          ExceptionHandler.openErrorMessageBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        }
      }
 else {
        return false;
      }
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
      return false;
    }
  }
 while (bIsNameExist == true);
  return true;
}

Fixed version (ground truth):
private boolean performCreatePlaceHolder(ReportElementHandle handle){
  boolean bIsNameExist=false;
  TemplateElementHandle template=null;
  String name=null;
  String desc=null;
  do {
    try {
      if (template == null) {
        template=handle.createTemplateElement(ReportPlugin.getDefault().getCustomName(ReportDesignConstants.TEMPLATE_REPORT_ITEM));
      }
      if (name == null) {
        name=template.getName();
        name=(name == null) ? "String_Node_Str" : name;
      }
      if (desc == null) {
        desc=template.getDescription();
        desc=(desc == null) ? "String_Node_Str" : desc;
      }
      TemplateReportItemPropertiesDialog dialog=new TemplateReportItemPropertiesDialog(template.getDefaultElement().getDefn().getDisplayName(),name,desc);
      if (dialog.open() == Window.OK) {
        name=(String)dialog.getName().trim();
        desc=(String)dialog.getResult();
        bIsNameExist=checkNameExist(template.getElement(),name);
        if (bIsNameExist == false) {
          template.setDescription(desc);
          template.setName(name);
        }
 else {
          ExceptionHandler.openErrorMessageBox(Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
        }
      }
 else {
        return false;
      }
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
      return false;
    }
  }
 while (bIsNameExist == true);
  return true;
}
Program: 77817
Project: 77817
Buggy source:
/** 
 * Set default element names for preference
 * @param store The preference for store
 */
private void setDefaultElementNamePreference(IPreferenceStore store){
  List tmpList;
  tmpList=DesignEngine.getMetaDataDictionary().getElements();
  int i;
  StringBuffer bufferDefaultName=new StringBuffer();
  StringBuffer bufferCustomName=new StringBuffer();
  StringBuffer bufferPreference=new StringBuffer();
  int nameOption;
  IElementDefn elementDefn;
  for (i=0; i < tmpList.size(); i++) {
    elementDefn=(IElementDefn)(tmpList.get(i));
    nameOption=elementDefn.getNameOption();
    if (nameOption == MetaDataConstants.NO_NAME) {
      continue;
    }
    nameCount++;
    bufferDefaultName.append(elementDefn.getName());
    bufferDefaultName.append(PREFERENCE_DELIMITER);
    bufferCustomName.append("String_Node_Str");
    bufferCustomName.append(PREFERENCE_DELIMITER);
    appendDefaultPreference(elementDefn.getName(),bufferPreference);
  }
  store.setDefault(DEFAULT_NAME_PREFERENCE,bufferDefaultName.toString());
  store.setDefault(CUSTOM_NAME_PREFERENCE,bufferCustomName.toString());
  store.setDefault(DESCRIPTION_PREFERENCE,bufferPreference.toString());
}

Fixed version (ground truth):
/** 
 * Set default element names for preference
 * @param store The preference for store
 */
private void setDefaultElementNamePreference(IPreferenceStore store){
  List tmpList=DesignEngine.getMetaDataDictionary().getElements();
  int i;
  StringBuffer bufferDefaultName=new StringBuffer();
  StringBuffer bufferCustomName=new StringBuffer();
  StringBuffer bufferPreference=new StringBuffer();
  int nameOption;
  IElementDefn elementDefn;
  for (i=0; i < tmpList.size(); i++) {
    elementDefn=(IElementDefn)(tmpList.get(i));
    nameOption=elementDefn.getNameOption();
    if (nameOption == MetaDataConstants.NO_NAME || filteName(elementDefn)) {
      continue;
    }
    nameCount++;
    bufferDefaultName.append(elementDefn.getName());
    bufferDefaultName.append(PREFERENCE_DELIMITER);
    bufferCustomName.append("String_Node_Str");
    bufferCustomName.append(PREFERENCE_DELIMITER);
    appendDefaultPreference(elementDefn.getName(),bufferPreference);
  }
  store.setDefault(DEFAULT_NAME_PREFERENCE,bufferDefaultName.toString());
  store.setDefault(CUSTOM_NAME_PREFERENCE,bufferCustomName.toString());
  store.setDefault(DESCRIPTION_PREFERENCE,bufferPreference.toString());
}
Program: 77818
Project: 77818
Buggy source:
/** 
 * Get the custom name preference of specified element name
 * @param defaultName The specified element name
 * @return String The custom name gotten
 */
public String getCustomName(Object defaultName){
  int i;
  String[] defaultNameArray=getDefaultNamePreference();
  String[] customNameArray=getCustomNamePreference();
  if (defaultNameArray.length != customNameArray.length) {
    return null;
  }
  for (i=0; i < defaultNameArray.length; i++) {
    if (defaultNameArray[i].trim().equals(defaultName)) {
      if (customNameArray[i].equals("String_Node_Str")) {
        return null;
      }
      return new String(customNameArray[i]);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the custom name preference of specified element name
 * @param defaultName The specified element name
 * @return String The custom name gotten
 */
public String getCustomName(String defaultName){
  int i;
  String[] defaultNameArray=getDefaultNamePreference();
  String[] customNameArray=getCustomNamePreference();
  if (defaultNameArray.length != customNameArray.length) {
    return null;
  }
  for (i=0; i < defaultNameArray.length; i++) {
    if (defaultNameArray[i].trim().equals(defaultName)) {
      if (customNameArray[i].equals("String_Node_Str")) {
        return null;
      }
      return new String(customNameArray[i]);
    }
  }
  return null;
}
Program: 77819
Project: 77819
Buggy source:
protected Control createContents(Composite parent){
  UIUtil.bindHelp(parent,IHelpContextIds.PREFERENCE_BIRT_ELEMENT_NAMES_ID);
  Composite mainComposite=new Composite(parent,SWT.BORDER);
  GridData data=new GridData(GridData.FILL_HORIZONTAL);
  data.grabExcessHorizontalSpace=true;
  mainComposite.setLayoutData(data);
  GridLayout layout=new GridLayout();
  mainComposite.setLayout(layout);
  createTable(mainComposite);
  createTableViewer();
  tableViewer.setContentProvider(new ContentProvider());
  tableViewer.setLabelProvider(new ElementNameLabelProvider());
  itemContentList=new ItemContentList();
  tableViewer.setInput(itemContentList);
  return mainComposite;
}

Fixed version (ground truth):
protected Control createContents(Composite parent){
  UIUtil.bindHelp(parent,IHelpContextIds.PREFERENCE_BIRT_ELEMENT_NAMES_ID);
  Composite mainComposite=new Composite(parent,SWT.NONE);
  GridData data=new GridData(GridData.FILL_HORIZONTAL);
  data.grabExcessHorizontalSpace=true;
  mainComposite.setLayoutData(data);
  GridLayout layout=new GridLayout();
  mainComposite.setLayout(layout);
  createTable(mainComposite);
  createTableViewer();
  tableViewer.setContentProvider(new ContentProvider());
  tableViewer.setLabelProvider(new ElementNameLabelProvider());
  itemContentList=new ItemContentList();
  tableViewer.setInput(itemContentList);
  return mainComposite;
}
Program: 77821
Project: 77821
Buggy source:
/** 
 * get parsed parameters.
 * @param design IViewerReportDesignHandle
 * @param parameterList Collection
 * @param request HttpServletRequest
 * @param options InputOptions
 * @return Map
 */
protected Map getParsedParameters(IViewerReportDesignHandle design,Collection parameterList,HttpServletRequest request,InputOptions options) throws ReportServiceException {
  Map params=new HashMap();
  if (parameterList == null || this.parametersAsString == null)   return params;
  for (Iterator iter=parameterList.iterator(); iter.hasNext(); ) {
    ScalarParameterHandle parameter=null;
    Object parameterObj=iter.next();
    if (parameterObj instanceof ScalarParameterHandle) {
      parameter=(ScalarParameterHandle)parameterObj;
    }
    if (parameter == null)     continue;
    String paramName=parameter.getName();
    Object paramValueObj=this.parametersAsString.get(paramName);
    if (paramValueObj != null) {
      try {
        paramValueObj=ParameterValidationUtil.validate(parameter.getDataType(),parameter.getPattern(),paramValueObj.toString(),locale);
        params.put(paramName,paramValueObj);
      }
 catch (      ValidationValueException e) {
        if (ParameterAccessor.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath())) {
          this.exception=e;
          break;
        }
      }
    }
 else {
      params.put(paramName,null);
    }
  }
  return params;
}

Fixed version (ground truth):
/** 
 * get parsed parameters.
 * @param design IViewerReportDesignHandle
 * @param parameterList Collection
 * @param request HttpServletRequest
 * @param options InputOptions
 * @return Map
 */
protected Map getParsedParameters(IViewerReportDesignHandle design,Collection parameterList,HttpServletRequest request,InputOptions options) throws ReportServiceException {
  Map params=new HashMap();
  if (parameterList == null || this.parametersAsString == null)   return params;
  for (Iterator iter=parameterList.iterator(); iter.hasNext(); ) {
    ScalarParameterHandle parameter=null;
    Object parameterObj=iter.next();
    if (parameterObj instanceof ScalarParameterHandle) {
      parameter=(ScalarParameterHandle)parameterObj;
    }
    if (parameter == null)     continue;
    String paramName=parameter.getName();
    Object paramValueObj=this.parametersAsString.get(paramName);
    if (paramValueObj != null) {
      try {
        try {
          paramValueObj=ParameterValidationUtil.validate(parameter.getDataType(),parameter.getPattern(),paramValueObj.toString(),locale);
        }
 catch (        ValidationValueException e1) {
          paramValueObj=ParameterValidationUtil.validate(parameter.getDataType(),ParameterValidationUtil.DEFAULT_DATETIME_FORMAT,paramValueObj.toString());
        }
        params.put(paramName,paramValueObj);
      }
 catch (      ValidationValueException e) {
        if (ParameterAccessor.SERVLET_PATH_RUN.equalsIgnoreCase(request.getServletPath())) {
          this.exception=e;
          break;
        }
      }
    }
 else {
      params.put(paramName,null);
    }
  }
  return params;
}
Program: 77823
Project: 77823
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;
    try {
      URL objURI=new URL(fileName);
      if (URIUtil.FILE_SCHEMA.equalsIgnoreCase(objURI.getProtocol())) {
        f=new File(objURI.getPath());
        if (f.isAbsolute())         return f.exists() && f.isFile() ? f.getCanonicalFile().toURL() : null;
      }
    }
 catch (    MalformedURLException e) {
    }
    String resourcePath=moduleHandle.getModule().getSession().getBirtResourcePath();
    if (resourcePath != null) {
      f=new File(resourcePath,fileName);
      if (f.exists() && f.isFile())       return f.getCanonicalFile().toURL();
    }
    if (moduleHandle == null)     return null;
    URL systemId=moduleHandle.getModule().getSystemId();
    if (systemId == null)     return null;
    if (URIUtil.FILE_SCHEMA.equalsIgnoreCase(systemId.getProtocol()))     return tryFileSearch(systemId,fileName);
    return new URL(systemId,URIUtil.convertFileNameToURLString(fileName));
  }
 catch (  MalformedURLException e) {
  }
catch (  IOException e) {
  }
  return null;
}

Fixed version (ground truth):
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;
    try {
      URL objURI=new URL(fileName);
      String protocol=objURI.getProtocol();
      if (URIUtil.FILE_SCHEMA.equalsIgnoreCase(protocol)) {
        f=new File(objURI.getPath());
        if (f.isAbsolute())         return f.exists() && f.isFile() ? f.getCanonicalFile().toURL() : null;
      }
 else       if (URIUtil.JAR_SCHEMA.equalsIgnoreCase(protocol)) {
        URLConnection jarConnection=objURI.openConnection();
        try {
          jarConnection.connect();
          return objURI;
        }
 catch (        IOException e1) {
          return null;
        }
      }
    }
 catch (    MalformedURLException e) {
    }
    String resourcePath=moduleHandle.getModule().getSession().getBirtResourcePath();
    if (resourcePath != null) {
      f=new File(resourcePath,fileName);
      if (f.exists() && f.isFile())       return f.getCanonicalFile().toURL();
    }
    if (moduleHandle == null)     return null;
    URL systemId=moduleHandle.getModule().getSystemId();
    if (systemId == null)     return null;
    if (URIUtil.FILE_SCHEMA.equalsIgnoreCase(systemId.getProtocol()))     return tryFileSearch(systemId,fileName);
 else     if (URIUtil.JAR_SCHEMA.equalsIgnoreCase(systemId.getProtocol()))     return tryJarSearch(systemId,fileName);
    return new URL(systemId,URIUtil.convertFileNameToURLString(fileName));
  }
 catch (  IOException e) {
  }
  return null;
}
Program: 77824
Project: 77824
Buggy source:
/** 
 * Tests whether the input string is a valid resource directory.
 * @param resourceDir the resource directory
 * @return <code>true</code> if the input string is a valid resourcedirectory, <code>false</code> otherwise.
 */
public static boolean isValidResourcePath(String resourceDir){
  if (resourceDir == null)   return false;
  File f=new File(resourceDir);
  if (f.isAbsolute() && f.exists() && f.isDirectory())   return true;
  return false;
}

Fixed version (ground truth):
/** 
 * Tests whether the input string is a valid resource directory.
 * @param resourceDir the resource directory
 * @return <code>true</code> if the input string is a valid resourcedirectory, <code>false</code> otherwise.
 * @throws MalformedURLException
 */
public static boolean isValidResourcePath(String resourceDir){
  if (resourceDir == null)   return false;
  File f=new File(resourceDir);
  if (f.isAbsolute() && f.exists() && f.isDirectory())   return true;
  return false;
}
Program: 77825
Project: 77825
Buggy source:
/** 
 * Checks whether <code>filePath</code> is a file protocol if it is not a invalid URI. <p> A invalid URI contains excluded US-ASCII characters: <ul> <li>contro = <US-ASCII coded characters 00-1F and 7F hexadecimal> <li>space = <US-ASCII coded character 20 hexadecimal> <li>delims="<" | ">" | "#" | "%" | <"> <li>unwise="{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" </ul> Details are described at the hyperlink: http://www.ietf.org/rfc/rfc2396.txt.
 * @param uri the input uri
 * @return the file path if <code>uri</code> refers to a file. Otherwisenull.
 */
private static String getLocalFileOfFailedURI(String uri){
  URL objURI=null;
  try {
    objURI=new URL(uri);
    if (!objURI.getProtocol().equalsIgnoreCase(FILE_SCHEMA))     return null;
    return objURI.getAuthority() == null ? objURI.getPath() : objURI.getAuthority() + objURI.getPath();
  }
 catch (  MalformedURLException e) {
    File file=new File(uri);
    if (uri.startsWith(FILE_SCHEMA))     return file.toURI().getSchemeSpecificPart();
    return uri;
  }
}

Fixed version (ground truth):
/** 
 * Checks whether <code>filePath</code> is a file protocol if it is not a invalid URI. <p> A invalid URI contains excluded US-ASCII characters: <ul> <li>contro = <US-ASCII coded characters 00-1F and 7F hexadecimal> <li>space = <US-ASCII coded character 20 hexadecimal> <li>delims="<" | ">" | "#" | "%" | <"> <li>unwise="{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" </ul> Details are described at the hyperlink: http://www.ietf.org/rfc/rfc2396.txt.
 * @param uri the input uri
 * @return the file path if <code>uri</code> refers to a file. Otherwisenull.
 */
private static String getLocalFileOfFailedURI(String uri){
  URL objURI=null;
  try {
    objURI=new URL(uri);
    if (objURI.getProtocol().equalsIgnoreCase(FILE_SCHEMA)) {
      return objURI.getAuthority() == null ? objURI.getPath() : objURI.getAuthority() + objURI.getPath();
    }
 else     if (objURI.getProtocol().equalsIgnoreCase(JAR_SCHEMA))     return uri;
 else     return null;
  }
 catch (  MalformedURLException e) {
    File file=new File(uri);
    if (uri.contains(JAR_EXTENTION))     return JAR_SCHEMA + "String_Node_Str" + FILE_SCHEMA+ "String_Node_Str"+ file.getAbsolutePath();
    if (uri.startsWith(FILE_SCHEMA))     return file.toURI().getSchemeSpecificPart();
    return uri;
  }
}
Program: 77826
Project: 77826
Buggy source:
/** 
 * Converts a filename to a valid URL. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk.
 * @param filePath the file name
 * @return a valid URL
 */
public static URL getDirectory(String filePath){
  URL url=null;
  try {
    url=new URL(convertFileNameToURLString(filePath));
  }
 catch (  MalformedURLException e) {
  }
  if (url == null)   return getFileDirectory(filePath);
  if (FILE_SCHEMA.equalsIgnoreCase(url.getProtocol()))   return getFileDirectory(url.getPath());
  return getNetDirectory(url);
}

Fixed version (ground truth):
/** 
 * Converts a filename to a valid URL. The filename can include directory information, either relative or absolute directory. And the file should be on the local disk.
 * @param filePath the file name
 * @return a valid URL
 */
public static URL getDirectory(String filePath){
  if (filePath == null)   return null;
  URL url=null;
  try {
    url=new URL(convertFileNameToURLString(filePath));
  }
 catch (  MalformedURLException e) {
    if (filePath.contains(JAR_EXTENTION))     url=getJarDirectory(filePath);
 else     url=getFileDirectory(filePath);
    return url;
  }
  if (FILE_SCHEMA.equalsIgnoreCase(url.getProtocol()))   return getFileDirectory(url.getPath());
 else   if (JAR_SCHEMA.equalsIgnoreCase(url.getProtocol()) && !url.getPath().toLowerCase().startsWith(HTTP_SCHEMA))   return getJarDirectory(url.getPath());
  return getNetDirectory(url);
}
Program: 77827
Project: 77827
Buggy source:
/** 
 * Checks <code>uri</code> is file path. If <code>uri</code> is an absolute uri and refers to a file, removes "file://" and returns the file path. If <code>uri</code> is relative uri and refers to a file, returns the <code>uri</code>. For other cases, returns null. <p> For examples, following uri are supported: <ul> <li>file://C:/disk/test/data.file <li>/C:/disk/test/data.file <li>/usr/local/disk/test/data.file <li>C:\\disk\\test/data.file <li>C:/disk/test/data.file <li>./test/data.file </ul>
 * @param uri the input uri
 * @return the file path if <code>uri</code> refers to a file. Otherwisenull.
 */
public static String getLocalPath(String uri){
  if (uri == null)   return null;
  URI objURI=null;
  try {
    objURI=new URI(uri);
  }
 catch (  URISyntaxException e) {
    return getLocalFileOfFailedURI(uri);
  }
  if (objURI.getScheme() == null) {
    if (isFileProtocol(uri))     return uri;
  }
 else   if (objURI.getScheme().equalsIgnoreCase(FILE_SCHEMA)) {
    return objURI.getSchemeSpecificPart();
  }
 else {
    if (objURI.getScheme().length() == 1) {
      return uri;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Checks <code>uri</code> is file path. If <code>uri</code> is an absolute uri and refers to a file, removes "file://" and returns the file path. If <code>uri</code> is relative uri and refers to a file, returns the <code>uri</code>. For other cases, returns null. <p> For examples, following uri are supported: <ul> <li>file://C:/disk/test/data.file <li>/C:/disk/test/data.file <li>/usr/local/disk/test/data.file <li>C:\\disk\\test/data.file <li>C:/disk/test/data.file <li>./test/data.file </ul>
 * @param uri the input uri
 * @return the file path if <code>uri</code> refers to a file. Otherwisenull.
 */
public static String getLocalPath(String uri){
  if (uri == null)   return null;
  URI objURI=null;
  try {
    objURI=new URI(uri);
  }
 catch (  URISyntaxException e) {
    return getLocalFileOfFailedURI(uri);
  }
  if (objURI.getScheme() == null) {
    if (isFileProtocol(uri))     return uri;
  }
 else   if (objURI.getScheme().equalsIgnoreCase(FILE_SCHEMA)) {
    return objURI.getSchemeSpecificPart();
  }
 else {
    if (objURI.getScheme().length() == 1 || objURI.getScheme().equalsIgnoreCase(JAR_SCHEMA)) {
      return uri;
    }
  }
  return null;
}
Program: 77828
Project: 77828
Buggy source:
/** 
 * @return
 * @throws DataException
 */
private boolean hasOutputParams(){
  Collection collection=null;
  try {
    collection=getParameterMetaData();
  }
 catch (  DataException e) {
    return false;
  }
  boolean hasOutputParam=false;
  if (collection != null) {
    Iterator it=collection.iterator();
    while (it.hasNext()) {
      IParameterMetaData metaData=(IParameterMetaData)it.next();
      if (metaData.isOutputMode().booleanValue()) {
        hasOutputParam=true;
        break;
      }
    }
  }
  return hasOutputParam;
}

Fixed version (ground truth):
/** 
 * whether there is output paramters in data set design
 * @return
 * @throws DataException
 */
private boolean hasOutputParams(){
  boolean hasOutputParam=false;
  if (this.parameterHints != null) {
    Iterator it=this.parameterHints.iterator();
    while (it.hasNext()) {
      ParameterHint hint=(ParameterHint)it.next();
      if (hint.isOutputMode()) {
        hasOutputParam=true;
        break;
      }
    }
  }
  return hasOutputParam;
}
Program: 77829
Project: 77829
Buggy source:
/** 
 * Init the bean.
 * @param request
 * @throws Exception
 */
protected void __init(HttpServletRequest request) throws Exception {
  if (ParameterAccessor.isGetImageOperator(request)) {
    return;
  }
  this.category="String_Node_Str";
  this.masterPageContent=ParameterAccessor.isMasterPageContent(request);
  this.isDesigner=ParameterAccessor.isDesigner(request);
  this.bookmark=ParameterAccessor.getBookmark(request);
  this.reportPage=String.valueOf(ParameterAccessor.getPage(request));
  this.reportDocumentName=ParameterAccessor.getReportDocument(request);
  this.reportDesignName=ParameterAccessor.getReport(request);
  this.format=ParameterAccessor.getFormat(request);
  this.maxRows=ParameterAccessor.getMaxRows(request);
  ReportEngineService.getInstance().setMaxRows(this.maxRows);
  processReport(request);
  String title=null;
  if (title == null || title.trim().length() <= 0) {
    title=BirtResources.getString(ResourceConstants.BIRT_VIEWER_TITLE);
  }
  this.reportTitle=ParameterAccessor.htmlEncode(title);
  this.__initParameters(request);
}

Fixed version (ground truth):
/** 
 * Init the bean.
 * @param request
 * @throws Exception
 */
protected void __init(HttpServletRequest request) throws Exception {
  if (ParameterAccessor.isGetImageOperator(request)) {
    return;
  }
  this.category="String_Node_Str";
  this.masterPageContent=ParameterAccessor.isMasterPageContent(request);
  this.isDesigner=ParameterAccessor.isDesigner(request);
  this.bookmark=ParameterAccessor.getBookmark(request);
  this.reportPage=String.valueOf(ParameterAccessor.getPage(request));
  this.reportDocumentName=ParameterAccessor.getReportDocument(request);
  this.reportDesignName=ParameterAccessor.getReport(request);
  this.format=ParameterAccessor.getFormat(request);
  this.isToc=ParameterAccessor.isToc(request);
  this.maxRows=ParameterAccessor.getMaxRows(request);
  ReportEngineService.getInstance().setMaxRows(this.maxRows);
  processReport(request);
  String title=null;
  if (title == null || title.trim().length() <= 0) {
    title=BirtResources.getString(ResourceConstants.BIRT_VIEWER_TITLE);
  }
  this.reportTitle=ParameterAccessor.htmlEncode(title);
  this.__initParameters(request);
}
Program: 77832
Project: 77832
Buggy source:
/** 
 * @param dataSetHandle
 * @param rsMeta
 * @return
 * @throws BirtException
 */
private boolean needsSetCachedMetaData(DataSetHandle dataSetHandle,IResultMetaData rsMeta) throws BirtException {
  if (dataSetHandle.getCachedMetaDataHandle() == null || rsMeta == null || rsMeta.getColumnCount() == 0)   return true;
  List list=new ArrayList();
  for (Iterator iter=dataSetHandle.getCachedMetaDataHandle().getResultSet().iterator(); iter.hasNext(); ) {
    list.add(iter.next());
  }
  if (list.size() != rsMeta.getColumnCount())   return true;
  for (int i=1; i <= rsMeta.getColumnCount(); i++) {
    ResultSetColumnHandle handle=(ResultSetColumnHandle)list.get(i - 1);
    if (!handle.getColumnName().equals(getColumnName(rsMeta,i)) || !handle.getDataType().equals(toModelDataType(rsMeta.getColumnType(i))))     return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @param dataSetHandle
 * @param rsMeta
 * @return
 * @throws BirtException
 */
private boolean needsSetCachedMetaData(DataSetHandle dataSetHandle,IResultMetaData rsMeta) throws BirtException {
  if (dataSetHandle.getCachedMetaDataHandle() == null || rsMeta == null || rsMeta.getColumnCount() == 0)   return true;
  List list=new ArrayList();
  for (Iterator iter=dataSetHandle.getCachedMetaDataHandle().getResultSet().iterator(); iter.hasNext(); ) {
    list.add(iter.next());
  }
  if (list.size() != rsMeta.getColumnCount())   return true;
  for (int i=1; i <= rsMeta.getColumnCount(); i++) {
    ResultSetColumnHandle handle=(ResultSetColumnHandle)list.get(i - 1);
    if (handle.getColumnName() == null || !handle.getColumnName().equals(getColumnName(rsMeta,i)) || !handle.getDataType().equals(toModelDataType(rsMeta.getColumnType(i))))     return true;
  }
  return false;
}
Program: 77833
Project: 77833
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);
  boolean useResultHints=needsUseResultHint(dataSetHandle);
  return new QueryExecutionHelper(dataEngine,modelAdaptor,moduleHandle,useResultHints).executeQuery(query).getResultMetaData();
}

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=new QueryExecutionHelper(dataEngine,modelAdaptor,moduleHandle,false).executeQuery(query).getResultMetaData();
  if (needsUseResultHint(dataSetHandle,metaData)) {
    metaData=new QueryExecutionHelper(dataEngine,modelAdaptor,moduleHandle,true).executeQuery(query).getResultMetaData();
  }
  return metaData;
}
Program: 77834
Project: 77834
Buggy source:
/** 
 * whether need to use result hint
 * @param dataSetHandle
 * @return
 */
private boolean needsUseResultHint(DataSetHandle dataSetHandle){
  if (dataSetHandle instanceof ScriptDataSetHandle)   return true;
 else   if (dataSetHandle instanceof JointDataSetHandle) {
    List dataSets=((JointDataSetHandle)dataSetHandle).getDataSetNames();
    for (int i=0; i < dataSets.size(); i++) {
      DataSetHandle dsHandle=((JointDataSetHandle)dataSetHandle).getModuleHandle().findDataSet(dataSets.get(i).toString());
      if (dsHandle != null && dsHandle instanceof ScriptDataSetHandle) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Whether need to use resultHint, which stands for resultSetHint, columnHint or both
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
private boolean needsUseResultHint(DataSetHandle dataSetHandle,IResultMetaData metaData) throws BirtException {
  int columnCount=0;
  boolean hasResultSetHint=false;
  boolean hasColumnHint=dataSetHandle.getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP).iterator().hasNext();
  HashSet orgColumnNameSet=new HashSet();
  HashSet uniqueColumnNameSet=new HashSet();
  if (metaData != null)   columnCount=metaData.getColumnCount();
  for (int i=0; i < columnCount; i++) {
    String columnName=metaData.getColumnName(i + 1);
    String uniqueColumnName=getUniqueName(orgColumnNameSet,uniqueColumnNameSet,columnName,i);
    uniqueColumnNameSet.add(uniqueColumnName);
    if (!uniqueColumnName.equals(columnName)) {
      updateModelColumn(dataSetHandle,uniqueColumnName,i + 1);
      if (hasResultSetHint != true)       hasResultSetHint=true;
    }
  }
  return hasResultSetHint || hasColumnHint;
}
Program: 77835
Project: 77835
Buggy source:
/** 
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
IResultMetaData refreshMetaData(DataSetHandle dataSetHandle) throws BirtException {
  IResultMetaData rsMeta=null;
  BirtException e=null;
  try {
    rsMeta=this.getDataSetMetaData(dataSetHandle,false);
  }
 catch (  BirtException e1) {
    e=e1;
  }
  if (needsSetCachedMetaData(dataSetHandle,rsMeta)) {
    dataSetHandle.setCachedMetaData(StructureFactory.createCachedMetaData());
    if (rsMeta != null && rsMeta.getColumnCount() != 0) {
      for (int i=1; i <= rsMeta.getColumnCount(); i++) {
        ResultSetColumn rsc=StructureFactory.createResultSetColumn();
        rsc.setColumnName(getColumnName(rsMeta,i));
        rsc.setDataType(toModelDataType(rsMeta.getColumnType(i)));
        rsc.setPosition(new Integer(i));
        dataSetHandle.getCachedMetaDataHandle().getResultSet().addItem(rsc);
      }
    }
    if (dataSetHandle instanceof ScriptDataSetHandle == false)     dataSetHandle.getPropertyHandle(DataSetHandle.RESULT_SET_PROP).clearValue();
  }
  if (e != null)   throw e;
  return rsMeta;
}

Fixed version (ground truth):
/** 
 * @param dataSetHandle
 * @return
 * @throws BirtException
 */
IResultMetaData refreshMetaData(DataSetHandle dataSetHandle) throws BirtException {
  IResultMetaData rsMeta=null;
  BirtException e=null;
  try {
    rsMeta=this.getDataSetMetaData(dataSetHandle,false);
  }
 catch (  BirtException e1) {
    e=e1;
  }
  if (needsSetCachedMetaData(dataSetHandle,rsMeta)) {
    dataSetHandle.setCachedMetaData(StructureFactory.createCachedMetaData());
    if (rsMeta != null && rsMeta.getColumnCount() != 0) {
      for (int i=1; i <= rsMeta.getColumnCount(); i++) {
        ResultSetColumn rsc=StructureFactory.createResultSetColumn();
        rsc.setColumnName(getColumnName(rsMeta,i));
        rsc.setDataType(toModelDataType(rsMeta.getColumnType(i)));
        rsc.setPosition(new Integer(i));
        dataSetHandle.getCachedMetaDataHandle().getResultSet().addItem(rsc);
      }
    }
  }
  if (e != null)   throw e;
  return rsMeta;
}
Program: 77836
Project: 77836
Buggy source:
public Collection getSelectionList(String name){
  usingParameterValues();
  ReportDesignHandle report=(ReportDesignHandle)this.runnable.getDesignHandle();
  ScalarParameterHandle parameter=(ScalarParameterHandle)report.findParameter(name);
  if (parameter == null) {
    return Collections.EMPTY_LIST;
  }
  String selectionType=parameter.getValueType();
  String dataType=parameter.getDataType();
  boolean fixedOrder=parameter.isFixedOrder();
  if (DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC.equals(selectionType)) {
    if (parameter.getDataSetName() != null) {
      return getChoicesFromParameterQuery(parameter);
    }
 else     if (isCascadingParameter(parameter)) {
      Object[] parameterValuesAhead=getParameterValuesAhead(parameter);
      return getChoicesFromParameterGroup(parameter,parameterValuesAhead);
    }
  }
 else   if (DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC.equals(selectionType)) {
    Iterator iter=parameter.choiceIterator();
    ArrayList choices=new ArrayList();
    while (iter.hasNext()) {
      SelectionChoiceHandle choice=(SelectionChoiceHandle)iter.next();
      String label=report.getMessage(choice.getLabelKey(),locale);
      if (label != null) {
        label=choice.getLabel();
      }
      Object value=getStringValue(choice.getValue(),dataType);
      choices.add(new SelectionChoice(label,value));
    }
    if (!fixedOrder)     Collections.sort(choices,new SelectionChoiceComparator(true,parameter.getPattern(),ULocale.forLocale(locale)));
    return choices;
  }
  return Collections.EMPTY_LIST;
}

Fixed version (ground truth):
public Collection getSelectionList(String name){
  usingParameterValues();
  ReportDesignHandle report=(ReportDesignHandle)this.runnable.getDesignHandle();
  ScalarParameterHandle parameter=(ScalarParameterHandle)report.findParameter(name);
  if (parameter == null) {
    return Collections.EMPTY_LIST;
  }
  String selectionType=parameter.getValueType();
  String dataType=parameter.getDataType();
  boolean fixedOrder=parameter.isFixedOrder();
  if (DesignChoiceConstants.PARAM_VALUE_TYPE_DYNAMIC.equals(selectionType)) {
    if (parameter.getDataSetName() != null) {
      return getChoicesFromParameterQuery(parameter);
    }
 else     if (isCascadingParameter(parameter)) {
      Object[] parameterValuesAhead=getParameterValuesAhead(parameter);
      return getChoicesFromParameterGroup(parameter,parameterValuesAhead);
    }
  }
 else   if (DesignChoiceConstants.PARAM_VALUE_TYPE_STATIC.equals(selectionType)) {
    Iterator iter=parameter.choiceIterator();
    ArrayList choices=new ArrayList();
    while (iter.hasNext()) {
      SelectionChoiceHandle choice=(SelectionChoiceHandle)iter.next();
      String label=report.getMessage(choice.getLabelKey(),locale);
      if (label == null) {
        label=choice.getLabel();
      }
      Object value=getStringValue(choice.getValue(),dataType);
      choices.add(new SelectionChoice(label,value));
    }
    if (!fixedOrder)     Collections.sort(choices,new SelectionChoiceComparator(true,parameter.getPattern(),ULocale.forLocale(locale)));
    return choices;
  }
  return Collections.EMPTY_LIST;
}
Program: 77837
Project: 77837
Buggy source:
/** 
 * Return the relative path for the given <code>resource</code> according to <code>base</code>. Only handle file system. Network protocols such as http, ftp, etc. are not supported. <p> The <code>base</code> value should be directory ONLY and does NOT contain file name and the format can be: <ul> <li>./../hello/ <li>C:\\hello\..\ <li>/C:/../hello/ </ul> The spearator in the return path is platform-depedent.
 * @param base the base directory
 * @param relativePath the relative path
 * @return the absolute path
 */
public static String resolveAbsolutePath(String base,String relativePath){
  String baseDir=getLocalPath(base);
  String relativeDir=getLocalPath(relativePath);
  if (baseDir == null || relativeDir == null)   return relativePath;
  File baseFile=new File(baseDir);
  File resourceFile=new File(baseFile,relativeDir);
  return resourceFile.getPath();
}

Fixed version (ground truth):
/** 
 * Return the relative path for the given <code>resource</code> according to <code>base</code>. Only handle file system. Network protocols such as http, ftp, etc. are not supported. <p> The <code>base</code> value should be directory ONLY and does NOT contain file name and the format can be: <ul> <li>./../hello/ <li>C:\\hello\..\ <li>/C:/../hello/ </ul> The spearator in the return path is platform-depedent.
 * @param base the base directory
 * @param relativePath the relative path
 * @return the absolute path
 */
public static String resolveAbsolutePath(String base,String relativePath){
  File file=new File(relativePath);
  if (file.isAbsolute())   return relativePath;
  String baseDir=getLocalPath(base);
  String relativeDir=getLocalPath(relativePath);
  if (baseDir == null || relativeDir == null)   return relativePath;
  File baseFile=new File(baseDir);
  File resourceFile=new File(baseFile,relativeDir);
  return resourceFile.getPath();
}
Program: 77838
Project: 77838
Buggy source:
private static ScriptExpression newJSExpression(String expr){
  return expr == null ? null : new ScriptExpression(expr);
}

Fixed version (ground truth):
/** 
 * @param expr
 * @return
 */
private static ScriptExpression newJSExpression(String expr){
  return expr == null ? null : new ScriptExpression(expr);
}