Program: 9918
Project: 9918
Buggy source:
public String renderURL(ContainerURL containerURL,URLFormat format){
  Map<String,String[]> queryParameters=url.getQueryParameters();
  if (queryParameters != null) {
    queryParameters.clear();
  }
  String type;
  if (containerURL instanceof RenderURL) {
    type=Constants.PORTAL_RENDER;
  }
 else   if (containerURL instanceof ResourceURL) {
    type=Constants.PORTAL_SERVE_RESOURCE;
  }
 else   if (containerURL instanceof ActionURL) {
    type=Constants.PORTAL_PROCESS_ACTION;
  }
 else {
    throw new Error("String_Node_Str");
  }
  if (!type.equals(Constants.PORTAL_RENDER)) {
    url.setQueryParameterValue(Constants.TYPE_PARAMETER,type);
  }
  if (format != null && format.getWantSecure() != null) {
    url.setQueryParameterValue(Constants.SECURE_PARAMETER,format.getWantSecure().toString());
  }
  if (containerURL instanceof ActionURL) {
    ActionURL actionURL=(ActionURL)containerURL;
    StateString state=actionURL.getInteractionState();
    if (state != null && !state.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(INTERACTION_STATE_PARAM_NAME,state.getStringValue());
    }
    state=actionURL.getNavigationalState();
    if (state != null && !state.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(NAVIGATIONAL_STATE_PARAM_NAME,state.getStringValue());
    }
    WindowState windowState=actionURL.getWindowState();
    if (windowState != null) {
      url.setQueryParameterValue(Constants.WINDOW_STATE_PARAMETER,windowState.toString());
    }
    Mode mode=actionURL.getMode();
    if (mode != null) {
      url.setQueryParameterValue(Constants.PORTLET_MODE_PARAMETER,mode.toString());
    }
  }
 else   if (containerURL instanceof ResourceURL) {
    ResourceURL resourceURL=(ResourceURL)containerURL;
    url.setQueryParameterValue(Constants.RESOURCE_ID_PARAMETER,resourceURL.getResourceId());
    CacheLevel cachability=resourceURL.getCacheability();
    if (cachability != null) {
      url.setQueryParameterValue(Constants.CACHELEVEL_PARAMETER,cachability.name());
    }
    StateString resourceState=resourceURL.getResourceState();
    if (resourceState != null && !resourceState.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(RESOURCE_STATE_PARAM_NAME,resourceState.getStringValue());
    }
    resourceState=resourceURL.getNavigationalState();
    if (resourceState != null && !resourceState.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(NAVIGATIONAL_STATE_PARAM_NAME,resourceState.getStringValue());
    }
    WindowState windowState=resourceURL.getWindowState();
    if (windowState != null) {
      url.setQueryParameterValue(Constants.WINDOW_STATE_PARAMETER,windowState.toString());
    }
    Mode mode=resourceURL.getMode();
    if (mode != null) {
      url.setQueryParameterValue(Constants.PORTLET_MODE_PARAMETER,mode.toString());
    }
  }
 else {
    RenderURL renderURL=(RenderURL)containerURL;
    WindowState windowState=renderURL.getWindowState();
    if (windowState != null) {
      url.setQueryParameterValue(Constants.WINDOW_STATE_PARAMETER,windowState.toString());
    }
    Mode mode=renderURL.getMode();
    if (mode != null) {
      url.setQueryParameterValue(Constants.PORTLET_MODE_PARAMETER,mode.toString());
    }
    Map<String,String[]> publicNSChanges=renderURL.getPublicNavigationalStateChanges();
    if (ParameterValidation.existsAndIsNotEmpty(publicNSChanges)) {
      for (      String key : publicNSChanges.keySet()) {
        String[] values=publicNSChanges.get(key);
        if (values != null && values.length > 0) {
          for (          String value : values) {
            url.setQueryParameterValue(key,value);
          }
        }
 else {
          url.setQueryParameterValue("String_Node_Str",key);
        }
      }
    }
    StateString state=renderURL.getNavigationalState();
    if (state != null && !state.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(NAVIGATIONAL_STATE_PARAM_NAME,state.getStringValue());
    }
  }
  Map<String,String> props=containerURL.getProperties();
  String lang=props.get("String_Node_Str");
  if (lang != null) {
    if (lang.length() == 0) {
      url.setLocale(null);
    }
 else {
      try {
        Locale locale=I18N.parseJavaIdentifier(lang);
        url.setLocale(locale);
      }
 catch (      IllegalArgumentException e) {
        log.debug("String_Node_Str" + lang,e);
      }
    }
  }
  url.setAjax("String_Node_Str".equals(props.get("String_Node_Str")));
  url.setConfirm(props.get("String_Node_Str"));
  return url.toString();
}

Fixed version (ground truth):
public String renderURL(ContainerURL containerURL,URLFormat format){
  Map<String,String[]> queryParameters=url.getQueryParameters();
  if (queryParameters != null) {
    queryParameters.clear();
  }
  String type;
  if (containerURL instanceof RenderURL) {
    type=Constants.PORTAL_RENDER;
  }
 else   if (containerURL instanceof ResourceURL) {
    type=Constants.PORTAL_SERVE_RESOURCE;
  }
 else   if (containerURL instanceof ActionURL) {
    type=Constants.PORTAL_PROCESS_ACTION;
  }
 else {
    throw new Error("String_Node_Str");
  }
  if (!type.equals(Constants.PORTAL_RENDER)) {
    url.setQueryParameterValue(Constants.TYPE_PARAMETER,type);
  }
  if (format != null && format.getWantSecure() != null) {
    url.setQueryParameterValue(Constants.SECURE_PARAMETER,format.getWantSecure().toString());
  }
  if (containerURL instanceof ActionURL) {
    ActionURL actionURL=(ActionURL)containerURL;
    StateString state=actionURL.getInteractionState();
    if (state != null && !state.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(INTERACTION_STATE_PARAM_NAME,state.getStringValue());
    }
    state=actionURL.getNavigationalState();
    if (state != null && !state.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(NAVIGATIONAL_STATE_PARAM_NAME,state.getStringValue());
    }
    WindowState windowState=actionURL.getWindowState();
    if (windowState != null) {
      url.setQueryParameterValue(Constants.WINDOW_STATE_PARAMETER,windowState.toString());
    }
    Mode mode=actionURL.getMode();
    if (mode != null) {
      url.setQueryParameterValue(Constants.PORTLET_MODE_PARAMETER,mode.toString());
    }
  }
 else   if (containerURL instanceof ResourceURL) {
    ResourceURL resourceURL=(ResourceURL)containerURL;
    url.setQueryParameterValue(Constants.RESOURCE_ID_PARAMETER,resourceURL.getResourceId());
    CacheLevel cachability=resourceURL.getCacheability();
    if (cachability != null) {
      url.setQueryParameterValue(Constants.CACHELEVEL_PARAMETER,cachability.name());
    }
    StateString resourceState=resourceURL.getResourceState();
    if (resourceState != null && !resourceState.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(RESOURCE_STATE_PARAM_NAME,resourceState.getStringValue());
    }
    resourceState=resourceURL.getNavigationalState();
    if (resourceState != null && !resourceState.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(NAVIGATIONAL_STATE_PARAM_NAME,resourceState.getStringValue());
    }
    WindowState windowState=resourceURL.getWindowState();
    if (windowState != null) {
      url.setQueryParameterValue(Constants.WINDOW_STATE_PARAMETER,windowState.toString());
    }
    Mode mode=resourceURL.getMode();
    if (mode != null) {
      url.setQueryParameterValue(Constants.PORTLET_MODE_PARAMETER,mode.toString());
    }
  }
 else {
    RenderURL renderURL=(RenderURL)containerURL;
    WindowState windowState=renderURL.getWindowState();
    if (windowState != null) {
      url.setQueryParameterValue(Constants.WINDOW_STATE_PARAMETER,windowState.toString());
    }
    Mode mode=renderURL.getMode();
    if (mode != null) {
      url.setQueryParameterValue(Constants.PORTLET_MODE_PARAMETER,mode.toString());
    }
    Map<String,String[]> publicNSChanges=renderURL.getPublicNavigationalStateChanges();
    if (ParameterValidation.existsAndIsNotEmpty(publicNSChanges)) {
      for (      String key : publicNSChanges.keySet()) {
        String[] values=publicNSChanges.get(key);
        if (values != null && values.length > 0) {
          for (          String value : values) {
            url.setQueryParameterValue(key,value);
          }
        }
 else {
          url.setQueryParameterValue("String_Node_Str",key);
        }
      }
    }
    StateString state=renderURL.getNavigationalState();
    if (state != null && !state.getStringValue().equals(StateString.JBPNS_PREFIX)) {
      url.setQueryParameterValue(NAVIGATIONAL_STATE_PARAM_NAME,state.getStringValue());
    }
  }
  Map<String,String> props=containerURL.getProperties();
  String lang=props.get("String_Node_Str");
  if (lang != null) {
    if (lang.length() == 0) {
      url.setLocale(null);
    }
 else {
      try {
        Locale locale=I18N.parseJavaIdentifier(lang);
        url.setLocale(locale);
      }
 catch (      IllegalArgumentException e) {
        log.debug("String_Node_Str" + lang,e);
      }
    }
  }
  url.setAjax("String_Node_Str".equals(props.get("String_Node_Str")));
  url.setConfirm(props.get("String_Node_Str"));
  MimeType mimeType=Boolean.TRUE.equals(format.getWantEscapeXML()) ? MimeType.XHTML : MimeType.PLAIN;
  url.setMimeType(mimeType);
  return url.toString();
}