nus-yam/ex-repair huggingface dataset:
Program: 90626
Project: 90626
Buggy source:
public void addPublicRenderParameter(QName qn,String identifier,String[] values){
  LOGGER.debug("String_Node_Str" + qn.toString() + "String_Node_Str"+ identifier+ "String_Node_Str"+ Arrays.toString(values));
  PortalURLPublicParameter pupp=new PortalURLPublicParameter(window,identifier,qn,values);
  prpSet.add(pupp);
}

Fixed version (ground truth):
public void addPublicRenderParameter(QName qn,String identifier,String[] values){
  if (isDebug) {
    StringBuilder txt=new StringBuilder("String_Node_Str");
    txt.append(qn.toString()).append("String_Node_Str").append(identifier).append("String_Node_Str").append(Arrays.toString(values));
    LOGGER.debug(txt.toString());
  }
  PortalURLPublicParameter pupp=new PortalURLPublicParameter(window,identifier,qn,values);
  prpSet.add(pupp);
}
Program: 90627
Project: 90627
Buggy source:
public PortalURL apply(){
  PortalURL url=this.url.clone();
  if (PortletURLProvider.TYPE.ACTION == type) {
    url.setTargetWindow(window);
    url.setType(URLType.Action);
  }
 else   if (PortletURLProvider.TYPE.RESOURCE == type) {
    url.setTargetWindow(window);
    url.setType(URLType.Resource);
    url.clearResourceParameters(window);
  }
 else {
    url.setTargetWindow(window);
    url.setType(URLType.Render);
    url.clearParameters(window);
  }
  if (portletMode != null) {
    url.setPortletMode(window,portletMode);
  }
  if (windowState != null) {
    url.setWindowState(window,windowState);
  }
  if (renderParameters != null) {
    for (    Map.Entry<String,String[]> entry : renderParameters.entrySet()) {
      if (!isPRP(entry.getKey())) {
        url.addParameter(new PortalURLParameter(window,entry.getKey(),entry.getValue()));
      }
    }
  }
  for (  PortalURLPublicParameter prp : prpSet) {
    url.addPublicRenderParameter(prp);
  }
  url.setResourceID(resourceID);
  url.setCacheability(cacheLevel);
  return url;
}

Fixed version (ground truth):
public PortalURL apply(){
  if (PortletURLProvider.TYPE.ACTION == type) {
    url.setTargetWindow(window);
    url.setType(URLType.Action);
  }
 else   if (PortletURLProvider.TYPE.RESOURCE == type) {
    url.setTargetWindow(window);
    url.setType(URLType.Resource);
    url.clearResourceParameters(window);
  }
 else {
    url.setTargetWindow(window);
    url.setType(URLType.Render);
    url.clearParameters(window);
  }
  if (portletMode != null) {
    url.setPortletMode(window,portletMode);
  }
  if (windowState != null) {
    url.setWindowState(window,windowState);
  }
  if (renderParameters != null) {
    for (    Map.Entry<String,String[]> entry : renderParameters.entrySet()) {
      if (!isPRP(entry.getKey())) {
        url.addParameter(new PortalURLParameter(window,entry.getKey(),entry.getValue()));
      }
    }
  }
  for (  PortalURLPublicParameter prp : prpSet) {
    url.addPublicRenderParameter(prp);
  }
  url.setResourceID(resourceID);
  url.setCacheability(cacheLevel);
  return url;
}
Program: 90628
Project: 90628
Buggy source:
public PortletURLProviderImpl(PortalURL url,TYPE type,PortletWindow portletWindow){
  this.url=url;
  this.type=type;
  this.window=portletWindow.getId().getStringId();
}

Fixed version (ground truth):
public PortletURLProviderImpl(PortalURL url,TYPE type,PortletWindow portletWindow){
  this.url=url.clone();
  this.type=type;
  this.window=portletWindow.getId().getStringId();
}
Program: 90629
Project: 90629
Buggy source:
public void removePublicRenderParameter(QName qn,String identifier){
  LOGGER.debug("String_Node_Str" + qn.toString());
  PortalURLPublicParameter pupp=new PortalURLPublicParameter(window,identifier,qn);
  pupp.setRemoved(true);
  prpSet.add(pupp);
}

Fixed version (ground truth):
public void removePublicRenderParameter(QName qn,String identifier){
  if (isDebug) {
    LOGGER.debug("String_Node_Str" + qn.toString());
  }
  PortalURLPublicParameter pupp=new PortalURLPublicParameter(window,identifier,qn);
  pupp.setRemoved(true);
  prpSet.add(pupp);
}
Program: 90633
Project: 90633
Buggy source:
public List<PortalURLPublicParameter> getPublicParameterGroup(int index){
  List<PortalURLPublicParameter> oprps=new ArrayList<PortalURLPublicParameter>();
  for (  PortalURLPublicParameter prp : qn2PRP.get(qnList.get(index))) {
    PortalURLPublicParameter p=prp.clone();
    if (!prp.isRemoved()) {
      p.setValues(prp.getValues().clone());
      oprps.add(p);
    }
  }
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("String_Node_Str" + oprps.size() + "String_Node_Str");
  }
  return oprps;
}

Fixed version (ground truth):
public List<PortalURLPublicParameter> getPublicParameterGroup(int index){
  List<PortalURLPublicParameter> oprps=new ArrayList<PortalURLPublicParameter>();
  QName qn=qnList.get(index);
  for (  PortalURLPublicParameter prp : qn2PRP.get(qn)) {
    PortalURLPublicParameter p=prp.clone();
    String[] vals=(prp.getValues() == null) ? null : prp.getValues().clone();
    p.setValues(vals);
    oprps.add(p);
  }
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("String_Node_Str" + index + "String_Node_Str"+ qn+ "String_Node_Str"+ oprps.size());
  }
  return oprps;
}
Program: 90634
Project: 90634
Buggy source:
@Override public Object getAttribute(String name){
  if (pathInfoAttributes.contains(name)) {
    if (includedPathInfo != null && !includedPathInfo.isNamedRequestDispatcher()) {
      if (INCLUDE_CONTEXT_PATH.equals(name)) {
        return getContextPath();
      }
 else       if (INCLUDE_PATH_INFO.equals(name)) {
        return includedPathInfo.getPathInfo();
      }
 else       if (INCLUDE_QUERY_STRING.equals(name)) {
        return includedPathInfo.getQueryString();
      }
 else       if (INCLUDE_REQUEST_URI.equals(name)) {
        return includedPathInfo.getRequestURI();
      }
 else       if (INCLUDE_SERVLET_PATH.equals(name)) {
        return includedPathInfo.getServletPath();
      }
    }
    if (forwardedPathInfo != null && !forwardedPathInfo.isNamedRequestDispatcher()) {
      if (FORWARD_CONTEXT_PATH.equals(name)) {
        return getContextPath();
      }
 else       if (FORWARD_PATH_INFO.equals(name)) {
        return forwardedPathInfo.getPathInfo();
      }
 else       if (FORWARD_QUERY_STRING.equals(name)) {
        return forwardedPathInfo.getQueryString();
      }
 else       if (FORWARD_REQUEST_URI.equals(name)) {
        return forwardedPathInfo.getRequestURI();
      }
 else       if (FORWARD_SERVLET_PATH.equals(name)) {
        return forwardedPathInfo.getServletPath();
      }
    }
    return null;
  }
  Object value=getRequest().getAttribute(name);
  return value != null ? value : portletRequest.getAttribute(name);
}

Fixed version (ground truth):
@Override public Object getAttribute(String name){
  Object value=(dispatching ? getRequest().getAttribute(name) : null);
  if (value == null && pathInfoAttributes.contains(name)) {
    if (includedPathInfo != null && !includedPathInfo.isNamedRequestDispatcher()) {
      if (INCLUDE_CONTEXT_PATH.equals(name)) {
        return getContextPath();
      }
 else       if (INCLUDE_PATH_INFO.equals(name)) {
        return includedPathInfo.getPathInfo();
      }
 else       if (INCLUDE_QUERY_STRING.equals(name)) {
        return includedPathInfo.getQueryString();
      }
 else       if (INCLUDE_REQUEST_URI.equals(name)) {
        return includedPathInfo.getRequestURI();
      }
 else       if (INCLUDE_SERVLET_PATH.equals(name)) {
        return includedPathInfo.getServletPath();
      }
    }
    if (forwardedPathInfo != null && !forwardedPathInfo.isNamedRequestDispatcher()) {
      if (FORWARD_CONTEXT_PATH.equals(name)) {
        return getContextPath();
      }
 else       if (FORWARD_PATH_INFO.equals(name)) {
        return forwardedPathInfo.getPathInfo();
      }
 else       if (FORWARD_QUERY_STRING.equals(name)) {
        return forwardedPathInfo.getQueryString();
      }
 else       if (FORWARD_REQUEST_URI.equals(name)) {
        return forwardedPathInfo.getRequestURI();
      }
 else       if (FORWARD_SERVLET_PATH.equals(name)) {
        return forwardedPathInfo.getServletPath();
      }
    }
    return null;
  }
  if (value == null && !dispatching) {
    value=getRequest().getAttribute(name);
  }
  return value != null ? value : portletRequest.getAttribute(name);
}
Program: 90635
Project: 90635
Buggy source:
public RequestDispatcherPathInfo getPathInfo(String contextPath,String path){
  String servletPath=null;
  String pathInfo=null;
  String queryString=null;
  int index=path.indexOf('?');
  if (index != -1) {
    queryString=path.substring(index + 1,path.length());
    path=path.substring(0,index);
  }
  if (exactServletMappingURLPatterns.contains(path)) {
    servletPath=path;
  }
 else   if (path.length() == 1 && defaultServletMapping) {
    servletPath=path;
  }
 else {
    String sub=path;
    index=path.lastIndexOf('/');
    while (index > 0) {
      sub=sub.substring(0,index);
      if (pathServletMappingURLPatterns.contains(sub)) {
        servletPath=sub;
        if (sub.length() < path.length()) {
          pathInfo=path.substring(sub.length());
        }
        break;
      }
      index=sub.lastIndexOf('/');
    }
  }
  if (servletPath == null) {
    index=path.lastIndexOf('/');
    int ext=path.indexOf('.',index);
    if (ext != -1 && ext < path.length() - 1 && extServletMappingURLPatterns.contains(path.substring(ext))) {
      servletPath=index > 0 ? path.substring(0,index) : "String_Node_Str";
      pathInfo=path.substring(index);
    }
  }
  if (servletPath == null) {
    servletPath=path;
  }
  return new RequestDispatcherPathInfoImpl(contextPath,servletPath,pathInfo,queryString);
}

Fixed version (ground truth):
public RequestDispatcherPathInfo getPathInfo(String contextPath,String path){
  String servletPath=null;
  String pathInfo=null;
  String queryString=null;
  int index=path.indexOf('?');
  if (index != -1) {
    queryString=path.substring(index + 1,path.length());
    path=path.substring(0,index);
  }
  if (exactServletMappingURLPatterns.contains(path)) {
    servletPath=path;
  }
 else   if (path.length() == 1 && defaultServletMapping) {
    servletPath=path;
  }
 else {
    String sub=path;
    index=path.lastIndexOf('/');
    while (index > 0) {
      sub=sub.substring(0,index);
      if (pathServletMappingURLPatterns.contains(sub)) {
        servletPath=sub;
        if (sub.length() < path.length()) {
          pathInfo=path.substring(sub.length());
        }
        break;
      }
      index=sub.lastIndexOf('/');
    }
  }
  if (servletPath == null) {
    servletPath=path;
  }
  return new RequestDispatcherPathInfoImpl(contextPath,servletPath,pathInfo,queryString);
}
Program: 90636
Project: 90636
Buggy source:
private RequestDispatcherPathInfoProviderImpl(Set<String> servletMappingURLPatterns){
  for (  String pat : servletMappingURLPatterns) {
    if (pat.startsWith("String_Node_Str")) {
      if (pat.equals("String_Node_Str") || pat.equals("String_Node_Str")) {
        defaultServletMapping=true;
      }
 else       if (pat.endsWith("String_Node_Str")) {
        pathServletMappingURLPatterns.add(pat.substring(0,pat.length() - 2));
      }
 else {
        exactServletMappingURLPatterns.add(pat);
      }
    }
 else     if (pat.startsWith("String_Node_Str")) {
      extServletMappingURLPatterns.add(pat.substring(1));
    }
 else {
      exactServletMappingURLPatterns.add(pat);
    }
  }
}

Fixed version (ground truth):
private RequestDispatcherPathInfoProviderImpl(Set<String> servletMappingURLPatterns){
  for (  String pat : servletMappingURLPatterns) {
    if (pat.startsWith("String_Node_Str")) {
      if (pat.equals("String_Node_Str") || pat.equals("String_Node_Str")) {
        defaultServletMapping=true;
      }
 else       if (pat.endsWith("String_Node_Str")) {
        pathServletMappingURLPatterns.add(pat.substring(0,pat.length() - 2));
      }
 else {
        exactServletMappingURLPatterns.add(pat);
      }
    }
 else     if (pat.startsWith("String_Node_Str")) {
    }
 else {
      exactServletMappingURLPatterns.add(pat);
    }
  }
}
Program: 90637
Project: 90637
Buggy source:
protected boolean isPortletModeAllowedByPortlet(PortletMode mode){
  PortletDefinition dd=getPortletWindow().getPortletEntity().getPortletDefinition();
  Iterator supports=dd.getSupports().iterator();
  while (supports.hasNext()) {
    Supports sup=(Supports)supports.next();
    List<String> portletModes=sup.getPortletModes();
    if (portletModes == null)     return false;
    Iterator modes=portletModes.iterator();
    while (modes.hasNext()) {
      if (modes.next().toString().equalsIgnoreCase(mode.toString())) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean isPortletModeAllowedByPortlet(PortletMode mode){
  if (PortletMode.VIEW.equals(mode))   return true;
  PortletDefinition dd=getPortletWindow().getPortletEntity().getPortletDefinition();
  Iterator supports=dd.getSupports().iterator();
  while (supports.hasNext()) {
    Supports sup=(Supports)supports.next();
    List<String> portletModes=sup.getPortletModes();
    if (portletModes == null)     return false;
    Iterator modes=portletModes.iterator();
    while (modes.hasNext()) {
      if (modes.next().toString().equalsIgnoreCase(mode.toString())) {
        return true;
      }
    }
  }
  return false;
}
Program: 90639
Project: 90639
Buggy source:
protected boolean attemptRegistration(ServletContext context,ClassLoader paClassLoader){
  if (PlutoServices.getServices() != null) {
    contextService=PlutoServices.getServices().getPortletContextService();
    containerInvocationService=PlutoServices.getServices().getContainerInvocationService();
    try {
      ServletConfig sConfig=getServletConfig();
      if (sConfig == null) {
        String msg="String_Node_Str";
        context.log(msg);
        return true;
      }
      String applicationName=contextService.register(sConfig);
      started=true;
      portletContext=(InternalPortletContext)contextService.getPortletContext(applicationName);
      portletConfig=(InternalPortletConfig)contextService.getPortletConfig(applicationName,portletName);
    }
 catch (    PortletContainerException ex) {
      context.log(ex.getMessage(),ex);
      return true;
    }
    PortletDefinition portletDD=portletConfig.getPortletDefinition();
    try {
      Class clazz=paClassLoader.loadClass((portletDD.getPortletClass()));
      portlet=(Portlet)clazz.newInstance();
      portlet.init(portletConfig);
      initializeEventPortlet();
      initializeResourceServingPortlet();
      return true;
    }
 catch (    Exception ex) {
      context.log(ex.getMessage(),ex);
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean attemptRegistration(ServletContext context,ClassLoader paClassLoader){
  if (PlutoServices.getServices() != null) {
    contextService=PlutoServices.getServices().getPortletContextService();
    containerInvocationService=PlutoServices.getServices().getContainerInvocationService();
    try {
      ServletConfig sConfig=getServletConfig();
      if (sConfig == null) {
        String msg="String_Node_Str";
        context.log(msg);
        return true;
      }
      String applicationName=contextService.register(sConfig);
      started=true;
      portletContext=(InternalPortletContext)contextService.getPortletContext(applicationName);
      portletConfig=(InternalPortletConfig)contextService.getPortletConfig(applicationName,portletName);
    }
 catch (    PortletContainerException ex) {
      context.log(ex.getMessage(),ex);
      return true;
    }
    PortletDefinition portletDD=portletConfig.getPortletDefinition();
    try {
      Class clazz=paClassLoader.loadClass((portletDD.getPortletClass()));
      portlet=(Portlet)clazz.newInstance();
      portlet.init(portletConfig);
      initializeEventPortlet();
      initializeResourceServingPortlet();
      return true;
    }
 catch (    Exception ex) {
      context.log(ex.getMessage(),ex);
      portlet=null;
      portletConfig=null;
      return true;
    }
  }
  return false;
}
Program: 90640
Project: 90640
Buggy source:
public void destroy(){
synchronized (getServletContext()) {
    if (startTimer != null) {
      startTimer.cancel();
      startTimer=null;
    }
 else     if (started && portletContext != null) {
      started=false;
      contextService.unregister(portletContext);
      if (portlet != null) {
        portlet.destroy();
      }
    }
    super.destroy();
  }
}

Fixed version (ground truth):
public void destroy(){
synchronized (getServletContext()) {
    if (startTimer != null) {
      startTimer.cancel();
      startTimer=null;
    }
 else     if (started && portletContext != null) {
      started=false;
      contextService.unregister(portletContext);
      if (portlet != null) {
        try {
          portlet.destroy();
        }
 catch (        Exception e) {
        }
        portlet=null;
      }
    }
    super.destroy();
  }
}
Program: 90643
Project: 90643
Buggy source:
public void setParameters(Map<String,String[]> parameters){
  if (parameters == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  for (Iterator iter=parameters.entrySet().iterator(); iter.hasNext(); ) {
    Map.Entry entry=(Map.Entry)iter.next();
    if (!(entry.getKey() instanceof String)) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    if (!(entry.getValue() instanceof String[])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  this.parameters.clear();
  this.publicRenderParameters.clear();
  List<String> publicPortletRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  if (parameters.keySet() != null) {
    for (    Object key : parameters.keySet()) {
      if (publicPortletRenderParameterNames == null)       this.setParameter((String)key,(String[])parameters.get(key));
 else {
        if (publicPortletRenderParameterNames.contains(key))         publicRenderParameters.put((String)key,(String[])parameters.get(key));
 else         this.setParameter((String)key,(String[])parameters.get(key));
      }
    }
  }
}

Fixed version (ground truth):
public void setParameters(Map<String,String[]> parameters){
  if (parameters == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  for (Iterator iter=parameters.entrySet().iterator(); iter.hasNext(); ) {
    Map.Entry entry=(Map.Entry)iter.next();
    if (!(entry.getKey() instanceof String)) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    if (!(entry.getValue() instanceof String[])) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  this.parameters.clear();
  this.publicRenderParameters.clear();
  List<String> publicPortletRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  if (parameters.keySet() != null) {
    for (    Object key : parameters.keySet()) {
      if (publicPortletRenderParameterNames == null)       this.setParameter((String)key,(String[])parameters.get(key));
 else {
        if (publicPortletRenderParameterNames.contains(key) && !this.isAction && !this.isResourceServing)         publicRenderParameters.put((String)key,(String[])parameters.get(key));
 else         this.setParameter((String)key,(String[])parameters.get(key));
      }
    }
  }
}
Program: 90644
Project: 90644
Buggy source:
public void setParameter(String name,String[] values){
  if (name == null || values == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<String> publicRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  if (publicRenderParameterNames == null) {
    parameters.put(name,StringUtils.copy(values));
  }
 else {
    if (publicRenderParameterNames.contains(name)) {
      publicRenderParameters.put(name,StringUtils.copy(values));
    }
 else {
      parameters.put(name,StringUtils.copy(values));
    }
  }
}

Fixed version (ground truth):
public void setParameter(String name,String[] values){
  if (name == null || values == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<String> publicRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  if (publicRenderParameterNames == null) {
    parameters.put(name,StringUtils.copy(values));
  }
 else {
    if (publicRenderParameterNames.contains(name) && !this.isAction && !this.isResourceServing) {
      publicRenderParameters.put(name,StringUtils.copy(values));
    }
 else {
      parameters.put(name,StringUtils.copy(values));
    }
  }
}
Program: 90645
Project: 90645
Buggy source:
public Map<String,String[]> getPublicParameterMap(){
  Map<String,String[]> map=new HashMap<String,String[]>();
  PortletURLProvider urlProvider=container.getRequiredContainerServices().getPortalCallbackService().getPortletURLProvider(getHttpServletRequest(),internalPortletWindow);
  List<String> publicRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  String[] values=null;
  for (  String string : publicRenderParameterNames) {
    values=urlProvider.getPublicRenderParameters(string);
    if (values != null) {
      map.put(string,values);
    }
  }
  return Collections.unmodifiableMap(map);
}

Fixed version (ground truth):
public Map<String,String[]> getPublicParameterMap(){
  Map<String,String[]> map=new HashMap<String,String[]>();
  PortletURLProvider urlProvider=container.getRequiredContainerServices().getPortalCallbackService().getPortletURLProvider(getHttpServletRequest(),internalPortletWindow);
  List<String> publicRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  String[] values=null;
  if (publicRenderParameterNames != null) {
    for (    String string : publicRenderParameterNames) {
      values=urlProvider.getPublicRenderParameters(string);
      if (values != null) {
        map.put(string,values);
      }
    }
  }
  return Collections.unmodifiableMap(map);
}
Program: 90646
Project: 90646
Buggy source:
public void removePublicRenderParameter(String name){
  List<String> publicRenderParameterNames=super.getInternalPortletWindow().getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  if (publicRenderParameterNames != null) {
    if (publicRenderParameterNames.contains(name)) {
      publicRenderParameter.put(name,new String[]{null});
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void removePublicRenderParameter(String name){
  List<String> publicRenderParameterNames=super.getInternalPortletWindow().getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  if (publicRenderParameterNames != null) {
    if (publicRenderParameterNames.contains(name)) {
      publicRenderParameter.put(name,new String[]{null});
    }
 else {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  redirectAllowed=false;
}
Program: 90647
Project: 90647
Buggy source:
public void setEvent(String name,Serializable value){
  String contextPath=getInternalPortletWindow().getContextPath();
  String defaultNamespace;
  try {
    defaultNamespace=getContainer().getPortletApplicationDescriptor(contextPath).getDefaultNamespace();
  }
 catch (  PortletContainerException e) {
    LOG.error(contextPath,e);
    defaultNamespace=XMLConstants.NULL_NS_URI;
  }
  QName qname=new QName(defaultNamespace,name);
  setEvent(qname,value);
}

Fixed version (ground truth):
public void setEvent(String name,Serializable value){
  String contextPath=getInternalPortletWindow().getContextPath();
  String defaultNamespace;
  try {
    defaultNamespace=getContainer().getPortletApplicationDescriptor(contextPath).getDefaultNamespace();
  }
 catch (  PortletContainerException e) {
    LOG.error(contextPath,e);
    defaultNamespace=XMLConstants.NULL_NS_URI;
  }
  QName qname=new QName(defaultNamespace,name);
  setEvent(qname,value);
  redirectAllowed=false;
}
Program: 90649
Project: 90649
Buggy source:
/** 
 * Clear parameters of the specified window.
 * @param windowId  the window ID.
 */
public void clearParameters(String windowId){
  for (Iterator it=parameters.entrySet().iterator(); it.hasNext(); ) {
    Map.Entry entry=(Map.Entry)it.next();
    PortalURLParameter param=(PortalURLParameter)entry.getValue();
    if (param.getWindowId().equals(windowId)) {
      it.remove();
    }
  }
}

Fixed version (ground truth):
/** 
 * Clear parameters of the specified window.
 * @param windowId  the window ID.
 */
public void clearParameters(String windowId){
  for (Iterator it=parameters.entrySet().iterator(); it.hasNext(); ) {
    Map.Entry entry=(Map.Entry)it.next();
    PortalURLParameter param=(PortalURLParameter)entry.getValue();
    if (param.getWindowId() != null) {
      if (param.getWindowId().equals(windowId)) {
        it.remove();
      }
    }
  }
}
Program: 90651
Project: 90651
Buggy source:
/** 
 * @param name The name to set.
 */
public void setName(QName qname){
  this.qname=qname;
}

Fixed version (ground truth):
/** 
 * @param name The qName to set.
 */
public void setName(String name){
  this.name=name;
}
Program: 90652
Project: 90652
Buggy source:
/** 
 * @return Returns the name.
 */
public QName getName(){
  return (qname == null) ? new QName(name) : qname;
}

Fixed version (ground truth):
/** 
 * @return Returns the name.
 */
public String getName(){
  return name;
}
Program: 90653
Project: 90653
Buggy source:
private boolean isValueInstanceOfDefinedClass(QName qname,Serializable value){
  PortletAppDD portletAppDD=null;
  try {
    portletAppDD=container.getPortletApplicationDescriptor(portletWindow.getContextPath());
    if (portletAppDD.getEvents() != null) {
      for (      EventDefinitionDD event : portletAppDD.getEvents()) {
        if (event.getName().toString().equals(qname.toString())) {
          return value.getClass().getName().equals(event.getJavaClass());
        }
      }
    }
  }
 catch (  PortletContainerException e) {
    LOG.error(qname,e);
  }
  return true;
}

Fixed version (ground truth):
private boolean isValueInstanceOfDefinedClass(QName qname,Serializable value){
  PortletAppDD portletAppDD=null;
  try {
    portletAppDD=container.getPortletApplicationDescriptor(portletWindow.getContextPath());
    if (portletAppDD.getEvents() != null) {
      for (      EventDefinitionDD def : portletAppDD.getEvents()) {
        if (def.getQName() != null) {
          if (def.getQName().equals(qname))           return value.getClass().getName().equals(def.getJavaClass());
        }
 else {
          QName tmp=new QName(portletAppDD.getDefaultNamespace(),def.getName());
          if (tmp.equals(qname))           return value.getClass().getName().equals(def.getJavaClass());
        }
      }
    }
  }
 catch (  PortletContainerException e) {
    LOG.error(qname,e);
  }
  return true;
}
Program: 90654
Project: 90654
Buggy source:
private List<QName> getAllAliases(QName eventName,PortletAppDD portletAppDD){
  if (portletAppDD.getEvents() != null) {
    for (    EventDefinitionDD eventDefinition : portletAppDD.getEvents()) {
      if (eventName.toString().equals(eventDefinition.getName().toString())) {
        return eventDefinition.getAlias();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private List<QName> getAllAliases(QName eventName,PortletAppDD portletAppDD){
  if (portletAppDD.getEvents() != null) {
    for (    EventDefinitionDD def : portletAppDD.getEvents()) {
      if (def.getQName() != null) {
        if (def.getQName().equals(eventName))         return def.getAlias();
      }
 else {
        QName tmp=new QName(portletAppDD.getDefaultNamespace(),def.getName());
        if (tmp.equals(eventName))         return def.getAlias();
      }
    }
  }
  return null;
}
Program: 90655
Project: 90655
Buggy source:
private EventDefinitionDD getEventDefintion(QName name) throws PortletContainerException {
  PortalRequestContext context=PortalRequestContext.getContext(eventProvider.getRequest());
  ServletContext servletContext=context.getServletContext();
  PortletContainer container=(PortletContainer)servletContext.getAttribute(AttributeKeys.PORTLET_CONTAINER);
  PortletAppDD appDD=container.getPortletApplicationDescriptor(portletWindow.getContextPath());
  for (  EventDefinitionDD def : appDD.getEvents()) {
    if (def.getName().equals(name)) {
      return def;
    }
  }
  throw new IllegalStateException();
}

Fixed version (ground truth):
private EventDefinitionDD getEventDefintion(QName name) throws PortletContainerException {
  PortalRequestContext context=PortalRequestContext.getContext(eventProvider.getRequest());
  ServletContext servletContext=context.getServletContext();
  PortletContainer container=(PortletContainer)servletContext.getAttribute(AttributeKeys.PORTLET_CONTAINER);
  PortletAppDD appDD=container.getPortletApplicationDescriptor(portletWindow.getContextPath());
  for (  EventDefinitionDD def : appDD.getEvents()) {
    if (def.getQName() != null) {
      if (def.getQName().equals(name))       return def;
    }
 else {
      QName tmp=new QName(appDD.getDefaultNamespace(),def.getName());
      if (tmp.equals(name))       return def;
    }
  }
  throw new IllegalStateException();
}
Program: 90656
Project: 90656
Buggy source:
public Map<String,String[]> getPublicParameterMap(){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public Map<String,String[]> getPublicParameterMap(){
  Map<String,String[]> map=new HashMap<String,String[]>();
  PortletURLProvider urlProvider=container.getRequiredContainerServices().getPortalCallbackService().getPortletURLProvider(getHttpServletRequest(),internalPortletWindow);
  List<String> publicRenderParameterNames=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublicRenderParameter();
  String[] values=null;
  for (  String string : publicRenderParameterNames) {
    values=urlProvider.getPublicRenderParameters(string);
    if (values != null) {
      map.put(string,values);
    }
  }
  return Collections.unmodifiableMap(map);
}
Program: 90658
Project: 90658
Buggy source:
/** 
 * Initialize parameters for this request.  We must be careful to make sure that render parameters are only made available if they were targeted for this specific window.
 */
private void initParameterMap(){
  portletParameters=new HashMap();
  Iterator iterator=url.getParameters().iterator();
  while (iterator.hasNext()) {
    PortalURLParameter param=(PortalURLParameter)iterator.next();
    String name=param.getName();
    String[] values=param.getValues();
    if (param.getWindowId().equals(portletWindow.getId().getStringId())) {
      portletParameters.put(name,values);
    }
  }
  String id=url.getActionWindow();
  if (portletWindow.getId().getStringId().equals(id)) {
    Enumeration params=super.getParameterNames();
    while (params.hasMoreElements()) {
      String name=params.nextElement().toString();
      String[] values=super.getParameterValues(name);
      if (portletParameters.containsKey(name)) {
        String[] temp=(String[])portletParameters.get(name);
        String[] all=new String[values.length + temp.length];
        System.arraycopy(values,0,all,0,values.length);
        System.arraycopy(temp,0,all,values.length,temp.length);
      }
      portletParameters.put(name,values);
    }
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + portletWindow.getId().getStringId() + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Initialize parameters for this request.  We must be careful to make sure that render parameters are only made available if they were targeted for this specific window.
 */
private void initParameterMap(){
  portletParameters=new HashMap();
  Iterator iterator=url.getParameters().iterator();
  while (iterator.hasNext()) {
    PortalURLParameter param=(PortalURLParameter)iterator.next();
    String name=param.getName();
    String[] values=param.getValues();
    if (param.getWindowId() != null) {
      if (param.getWindowId().equals(portletWindow.getId().getStringId())) {
        portletParameters.put(name,values);
      }
    }
  }
  String id=url.getActionWindow();
  if (portletWindow.getId().getStringId().equals(id)) {
    Enumeration params=super.getParameterNames();
    while (params.hasMoreElements()) {
      String name=params.nextElement().toString();
      String[] values=super.getParameterValues(name);
      if (portletParameters.containsKey(name)) {
        String[] temp=(String[])portletParameters.get(name);
        String[] all=new String[values.length + temp.length];
        System.arraycopy(values,0,all,0,values.length);
        System.arraycopy(temp,0,all,values.length,temp.length);
      }
      portletParameters.put(name,values);
    }
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + portletWindow.getId().getStringId() + "String_Node_Str");
  }
}
Program: 90663
Project: 90663
Buggy source:
public void testContainerMinorVersion(){
  assertTrue(Environment.getPortletContainerVersion().endsWith(Environment.getPortletContainerMinorVersion()));
}

Fixed version (ground truth):
public void testContainerMinorVersion(){
}
Program: 90664
Project: 90664
Buggy source:
public void testContainerVersion(){
  assertEquals(props.getProperty("String_Node_Str"),Environment.getPortletContainerVersion());
}

Fixed version (ground truth):
public void testContainerVersion(){
}
Program: 90665
Project: 90665
Buggy source:
public void testServerInfo(){
  assertContains("String_Node_Str",props.getProperty("String_Node_Str"),Environment.getServerInfo());
  assertContains("String_Node_Str",props.getProperty("String_Node_Str"),Environment.getServerInfo());
}

Fixed version (ground truth):
public void testServerInfo(){
}
Program: 90666
Project: 90666
Buggy source:
public void testContainerMajorVersion(){
  assertEquals("String_Node_Str",Environment.getPortletContainerMajorVersion());
}

Fixed version (ground truth):
public void testContainerMajorVersion(){
}
Program: 90667
Project: 90667
Buggy source:
/** 
 */
private Collection<PortletWindowConfig> getAllPortlets(DriverConfiguration driverConfig){
  Collection<PortletApplicationConfig> apps=driverConfig.getPortletApplications();
  Collection<PortletWindowConfig> portlets=new ArrayList<PortletWindowConfig>();
  for (  PortletApplicationConfig app : apps) {
    portlets.addAll(app.getPortlets());
  }
  return portlets;
}

Fixed version (ground truth):
/** 
 */
private Collection<PortletWindowConfig> getAllPortlets(DriverConfiguration driverConfig){
  Collection<PortletWindowConfig> portlets=new ArrayList<PortletWindowConfig>();
  return portlets;
}
Program: 90668
Project: 90668
Buggy source:
/** 
 * Constructs an instance.
 * @param servletContext  the servlet context in which we are contained.
 * @param portletAppDD  the portlet application descriptor.
 */
public PortletContextImpl(String portletApplicationId,ServletContext servletContext,PortletAppDD portletAppDD,String portletName){
  this.servletContext=servletContext;
  this.portletAppDD=portletAppDD;
  this.applicationId=portletApplicationId;
  this.applicationName=servletContext.getServletContextName();
  if (applicationName == null) {
    applicationName=applicationId;
  }
  for (  PortletDD portletDD : (List<PortletDD>)portletAppDD.getPortlets()) {
    if (portletDD.getPortletName().equals(portletName))     this.portletDD=portletDD;
    break;
  }
  assert(portletDD != null);
  init();
}

Fixed version (ground truth):
/** 
 * Constructs an instance.
 * @param servletContext  the servlet context in which we are contained.
 * @param portletAppDD  the portlet application descriptor.
 */
public PortletContextImpl(String portletApplicationId,ServletContext servletContext,PortletAppDD portletAppDD){
  this.servletContext=servletContext;
  this.portletAppDD=portletAppDD;
  this.applicationId=portletApplicationId;
  this.applicationName=servletContext.getServletContextName();
  if (applicationName == null) {
    applicationName=applicationId;
  }
  init();
}
Program: 90669
Project: 90669
Buggy source:
private EventDefinitionDD getEventDefintion(QName name) throws PortletContainerException {
  PortletAppDD appDD=container.getPortletApplicationDescriptor(window.getContextPath());
  for (  EventDefinitionDD def : appDD.getEvents()) {
    if (def.getName().equals(name)) {
      return def;
    }
  }
  return null;
}

Fixed version (ground truth):
private EventDefinitionDD getEventDefintion(QName name) throws PortletContainerException {
  PortletAppDD appDD=container.getPortletApplicationDescriptor(window.getContextPath());
  for (  EventDefinitionDD def : appDD.getEvents()) {
    if (def.getName().equals(name)) {
      return def;
    }
    if (def.getName().getNamespaceURI() != null && (def.getName().getNamespaceURI().equals("String_Node_Str"))) {
      QName qname=new QName(appDD.getDefaultNamespace(),def.getName().getLocalPart());
      if (qname.equals(name))       return def;
    }
  }
  return null;
}
Program: 90670
Project: 90670
Buggy source:
private boolean isDeclaredAsPublishingEvent(QName qname){
  List<QName> events=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublishingEvents();
  return events != null && events.contains(qname);
}

Fixed version (ground truth):
private boolean isDeclaredAsPublishingEvent(QName qname){
  List<QName> events=internalPortletWindow.getPortletEntity().getPortletDefinition().getPublishingEvents();
  List<QName> tempEvents=new ArrayList<QName>();
  if (events == null)   return false;
  for (  QName name : events) {
    if (name.getNamespaceURI() != null && !(name.getNamespaceURI().equals("String_Node_Str")))     tempEvents.add(name);
 else     tempEvents.add(new QName(getDefaultEventNamespace(),name.getLocalPart()));
  }
  return tempEvents.contains(qname);
}
Program: 90671
Project: 90671
Buggy source:
public String getShortTitle(PortletWindow window){
  if (window instanceof InternalPortletWindow) {
    return getPortletDefinition((InternalPortletWindow)window).getPortletInfo().getTitle();
  }
  return null;
}

Fixed version (ground truth):
public String getShortTitle(PortletWindow window){
  if (window instanceof InternalPortletWindow) {
    return getPortletDefinition((InternalPortletWindow)window).getPortletInfo().getShortTitle();
  }
  return null;
}
Program: 90672
Project: 90672
Buggy source:
public String getKeywords(PortletWindow window){
  if (window instanceof InternalPortletWindow) {
    return getPortletDefinition((InternalPortletWindow)window).getPortletInfo().getTitle();
  }
  return null;
}

Fixed version (ground truth):
public String getKeywords(PortletWindow window){
  if (window instanceof InternalPortletWindow) {
    return getPortletDefinition((InternalPortletWindow)window).getPortletInfo().getKeywords();
  }
  return null;
}
Program: 90673
Project: 90673
Buggy source:
public PortalServletRequest(HttpServletRequest request,PortletWindow window){
  super(request);
  this.portletWindow=window;
  url=PortalRequestContext.getPortalEnvironment(request).getRequestedPortalURL();
}

Fixed version (ground truth):
public PortalServletRequest(HttpServletRequest request,PortletWindow window){
  super(request);
  this.portletWindow=window;
  url=PortalRequestContext.getContext(request).getRequestedPortalURL();
}
Program: 90675
Project: 90675
Buggy source:
public PortletSession getPortletSession(boolean create){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + create + "String_Node_Str");
  }
  if (portletContext == null) {
    throw new IllegalStateException(EXCEPTIONS.getString("String_Node_Str"));
  }
  HttpSession httpSession=getHttpServletRequest().getSession(create);
  if (httpSession == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str");
    }
    return null;
  }
  if (portletSession == null) {
    portletSession=new PortletSessionImpl(portletContext,internalPortletWindow,httpSession);
  }
  return portletSession;
}

Fixed version (ground truth):
/** 
 * Returns the portlet session. <p> Note that since portlet request instance is created everytime the portlet container receives an incoming request, the portlet session instance held by the request instance is also re-created for each incoming request. </p>
 */
public PortletSession getPortletSession(boolean create){
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + create + "String_Node_Str");
  }
  if (portletContext == null) {
    throw new IllegalStateException(EXCEPTIONS.getString("String_Node_Str"));
  }
  HttpSession httpSession=getHttpServletRequest().getSession(create);
  if (httpSession != null) {
    long maxInactiveTime=httpSession.getMaxInactiveInterval() * 1000L;
    long currentInactiveTime=System.currentTimeMillis() - httpSession.getLastAccessedTime();
    if (currentInactiveTime > maxInactiveTime) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("String_Node_Str" + "String_Node_Str");
      }
      httpSession.invalidate();
      httpSession=getHttpServletRequest().getSession(create);
    }
  }
  if (httpSession == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + "String_Node_Str");
    }
    return null;
  }
  if (portletSession == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str");
    }
    portletSession=new PortletSessionImpl(portletContext,internalPortletWindow,httpSession);
  }
  return portletSession;
}
Program: 90676
Project: 90676
Buggy source:
public void setMaxInactiveInterval(int interval){
  httpSession.setMaxInactiveInterval(interval);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + interval);
  }
}

Fixed version (ground truth):
/** 
 * Specifies the time, in seconds, between client requests, before the portlet container invalidates this session. A negative time indicates the session should never timeout. <p> [Portlet Spec. PLT. 15.4.] If the PortletSession object is invalidated by a portlet, the portlet container must invalidate the associated HttpSession object. </p>
 * @param interval  an integer specifying the number of seconds.
 */
public void setMaxInactiveInterval(int interval){
  httpSession.setMaxInactiveInterval(interval);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + interval);
  }
}
Program: 90677
Project: 90677
Buggy source:
protected TestResult checkSessionInvalidated(PortletRequest request){
  TestResult result=new TestResult();
  result.setDescription("String_Node_Str" + "String_Node_Str");
  result.setSpecPLT("String_Node_Str");
  String maxInactiveIntervalSet=request.getParameter(MAX_INACTIVE_INTERVAL_SET);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + MAX_INACTIVE_INTERVAL_SET + "String_Node_Str"+ maxInactiveIntervalSet);
  }
  if (Boolean.TRUE.toString().equals(maxInactiveIntervalSet)) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + System.currentTimeMillis() + "String_Node_Str");
    }
    PortletSession session=request.getPortletSession(false);
    if (session == null) {
      result.setReturnCode(TestResult.PASSED);
    }
 else {
      result.setReturnCode(TestResult.FAILED);
      result.setResultMessage("String_Node_Str" + "String_Node_Str");
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + "String_Node_Str" + System.currentTimeMillis() + "String_Node_Str");
    }
    PortletSession session=request.getPortletSession(true);
    session.setMaxInactiveInterval(5);
    result.setReturnCode(TestResult.WARNING);
    result.setResultMessage("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
protected TestResult checkSessionInvalidated(PortletRequest request){
  TestResult result=new TestResult();
  result.setDescription("String_Node_Str" + "String_Node_Str");
  result.setSpecPLT("String_Node_Str");
  String maxInactiveIntervalSet=request.getParameter(MAX_INACTIVE_INTERVAL_SET);
  if (LOG.isDebugEnabled()) {
    LOG.debug("String_Node_Str" + MAX_INACTIVE_INTERVAL_SET + "String_Node_Str"+ maxInactiveIntervalSet);
  }
  if (Boolean.TRUE.toString().equals(maxInactiveIntervalSet)) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + System.currentTimeMillis() + "String_Node_Str");
    }
    PortletSession session=request.getPortletSession(false);
    if (session == null) {
      result.setReturnCode(TestResult.PASSED);
    }
 else {
      result.setReturnCode(TestResult.FAILED);
      result.setResultMessage("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
  }
 else {
    if (LOG.isDebugEnabled()) {
      LOG.debug("String_Node_Str" + "String_Node_Str" + System.currentTimeMillis() + "String_Node_Str");
    }
    PortletSession session=request.getPortletSession(true);
    session.setMaxInactiveInterval(5);
    result.setReturnCode(TestResult.WARNING);
    result.setResultMessage("String_Node_Str");
  }
  return result;
}
Program: 90678
Project: 90678
Buggy source:
public void setLocale(java.util.Locale loc){
  getHttpServletResponse().setLocale(loc);
}

Fixed version (ground truth):
public void setLocale(Locale locale){
  getHttpServletResponse().setLocale(locale);
}
Program: 90679
Project: 90679
Buggy source:
/** 
 * @todo is it appropriate to throw an illegal state if content type is not set.  how do we set automatically
 * @return
 * @throws IOException
 * @throws IllegalStateException
 */
public OutputStream getPortletOutputStream() throws IOException, IllegalStateException {
  if (currentContentType == null) {
    String message=EXCEPTIONS.getString("String_Node_Str");
    if (LOG.isWarnEnabled()) {
      LOG.warn(message);
    }
  }
  return getOutputStream();
}

Fixed version (ground truth):
public OutputStream getPortletOutputStream() throws IOException, IllegalStateException {
  if (currentContentType == null) {
    String message=EXCEPTIONS.getString("String_Node_Str");
    if (LOG.isWarnEnabled()) {
      LOG.warn("String_Node_Str");
    }
    throw new IllegalStateException(message);
  }
  return getOutputStream();
}
Program: 90680
Project: 90680
Buggy source:
/** 
 * TODO: is it appropriate to throw an illegal state if content type is not set.  how do we set automatically
 */
public PrintWriter getWriter() throws IOException, IllegalStateException {
  if (currentContentType == null) {
    String message=EXCEPTIONS.getString("String_Node_Str");
    if (LOG.isWarnEnabled()) {
      LOG.warn("String_Node_Str" + message);
    }
  }
  return super.getWriter();
}

Fixed version (ground truth):
public PrintWriter getWriter() throws IOException, IllegalStateException {
  if (currentContentType == null) {
    String message=EXCEPTIONS.getString("String_Node_Str");
    if (LOG.isWarnEnabled()) {
      LOG.warn("String_Node_Str");
    }
    throw new IllegalStateException(message);
  }
  return super.getWriter();
}
Program: 90681
Project: 90681
Buggy source:
public void setContentType(String type){
  String mimeType=StringUtils.stringCharacterEncoding(type);
  if (!isValidContentType(mimeType)) {
    throw new IllegalArgumentException(mimeType);
  }
  this.getHttpServletResponse().setContentType(mimeType);
  currentContentType=mimeType;
}

Fixed version (ground truth):
public void setContentType(String type){
  String mimeType=StringUtils.stringCharacterEncoding(type);
  if (!isValidContentType(mimeType)) {
    throw new IllegalArgumentException(mimeType);
  }
  this.getHttpServletResponse().setContentType(mimeType);
  this.currentContentType=mimeType;
}