nus-yam/ex-repair huggingface dataset:
Program: 9889
Project: 9889
Buggy source:
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws ServletException {
  ConversationState state=ConversationState.getCurrent();
  try {
    if (state != null && !state.getIdentity().getUserId().equals(IdentityConstants.ANONIM)) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str");
      if (state.getAttribute(USER_PROFILE) == null) {
        OrganizationService orgService=(OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);
        begin(orgService);
        User user=orgService.getUserHandler().findUserByName(state.getIdentity().getUserId(),UserStatus.DISABLED);
        end(orgService);
        state.setAttribute(USER_PROFILE,user);
      }
    }
    chain.doFilter(request,response);
  }
 catch (  Exception e) {
    log.warn("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws ServletException {
  ConversationState state=ConversationState.getCurrent();
  try {
    if (state != null && !state.getIdentity().getUserId().equals(IdentityConstants.ANONIM)) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str");
      if (state.getAttribute(USER_PROFILE) == null) {
        OrganizationService orgService=(OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);
        begin(orgService);
        User user=orgService.getUserHandler().findUserByName(state.getIdentity().getUserId(),UserStatus.BOTH);
        end(orgService);
        state.setAttribute(USER_PROFILE,user);
      }
    }
    chain.doFilter(request,response);
  }
 catch (  Exception e) {
    log.warn("String_Node_Str",e);
  }
}
Program: 9890
Project: 9890
Buggy source:
@Override public boolean login() throws LoginException {
  log.debug("String_Node_Str");
  try {
    Callback[] callbacks=new Callback[]{new NameCallback("String_Node_Str")};
    callbackHandler.handle(callbacks);
    String username=((NameCallback)callbacks[0]).getName();
    if (username != null) {
      OrganizationService service=(OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);
      UserHandler uHandler=service.getUserHandler();
      User user=uHandler.findUserByName(username,UserStatus.DISABLED);
      if (user == null) {
        log.debug("String_Node_Str",username);
      }
 else       if (user instanceof UserImpl && !((UserImpl)user).isEnabled()) {
        HttpServletRequest request=getCurrentHttpServletRequest();
        if (request != null) {
          request.setAttribute(DISABLED_USER_NAME,username);
        }
        throw new LoginException("String_Node_Str" + username + "String_Node_Str");
      }
    }
 else {
      log.debug("String_Node_Str");
    }
    return true;
  }
 catch (  final Exception e) {
    log.warn(e.getMessage());
    throw new LoginException(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public boolean login() throws LoginException {
  log.debug("String_Node_Str");
  try {
    Callback[] callbacks=new Callback[]{new NameCallback("String_Node_Str")};
    callbackHandler.handle(callbacks);
    String username=((NameCallback)callbacks[0]).getName();
    if (username != null) {
      OrganizationService service=(OrganizationService)getContainer().getComponentInstanceOfType(OrganizationService.class);
      UserHandler uHandler=service.getUserHandler();
      User user=uHandler.findUserByName(username,UserStatus.BOTH);
      if (user == null) {
        log.debug("String_Node_Str",username);
      }
 else       if (user instanceof UserImpl && !((UserImpl)user).isEnabled()) {
        HttpServletRequest request=getCurrentHttpServletRequest();
        if (request != null) {
          request.setAttribute(DISABLED_USER_NAME,username);
        }
        throw new LoginException("String_Node_Str" + username + "String_Node_Str");
      }
    }
 else {
      log.debug("String_Node_Str");
    }
    return true;
  }
 catch (  final Exception e) {
    log.warn(e.getMessage());
    throw new LoginException(e.getMessage());
  }
}
Program: 9891
Project: 9891
Buggy source:
public void setSharedLayout(String type){
  setProperty(PortalProperties.SHARED_LAYOUT,PortalProperties.SHARED_LAYOUT_ALL);
}

Fixed version (ground truth):
public void setSharedLayout(String type){
  if (type.equals(PortalProperties.SHARED_LAYOUT_ADMINS)) {
    setProperty(PortalProperties.SHARED_LAYOUT,PortalProperties.SHARED_LAYOUT_ADMINS);
  }
 else {
    setProperty(PortalProperties.SHARED_LAYOUT,PortalProperties.SHARED_LAYOUT_ALL);
  }
}
Program: 9892
Project: 9892
Buggy source:
public void setSharedLayout(String type){
  setProperty(PortalProperties.SHARED_LAYOUT,type);
}

Fixed version (ground truth):
public void setSharedLayout(String type){
  if (type.equals(PortalProperties.SHARED_LAYOUT_ADMINS)) {
    setProperty(PortalProperties.SHARED_LAYOUT,PortalProperties.SHARED_LAYOUT_ADMINS);
  }
 else {
    setProperty(PortalProperties.SHARED_LAYOUT,PortalProperties.SHARED_LAYOUT_ALL);
  }
}
Program: 9893
Project: 9893
Buggy source:
private void handleErrorResponse(ErrorResponse response) throws Exception {
  throw (Exception)response.getCause();
}

Fixed version (ground truth):
private void handleErrorResponse(ErrorResponse response) throws Exception {
  throw new Exception(response.getCause());
}
Program: 9894
Project: 9894
Buggy source:
public UIComponent setId(String id){
  if (id == null) {
    this.id=Integer.toString(hashCode());
  }
 else {
    this.id=id;
  }
  return this;
}

Fixed version (ground truth):
public UIComponent setId(String id){
  if (id == null) {
    this.id=Integer.toString(Math.abs(hashCode()));
  }
 else {
    this.id=id;
  }
  return this;
}
Program: 9895
Project: 9895
Buggy source:
private static void insertColumn(UIColumnContainer selectedColumn,boolean isInsertAfter) throws Exception {
  UIContainer uiParent=selectedColumn.getParent();
  UIColumnContainer uiNewColumn=uiParent.addChild(UIColumnContainer.class,null,null);
  uiNewColumn.setTemplate(selectedColumn.getTemplate());
  uiNewColumn.setFactoryId(selectedColumn.getFactoryId());
  uiNewColumn.setId(String.valueOf(uiNewColumn.hashCode()));
  List<UIComponent> listColumn=uiParent.getChildren();
  int position=listColumn.indexOf(selectedColumn);
  if (isInsertAfter) {
    position+=1;
  }
  Collections.rotate(listColumn.subList(position,listColumn.size()),1);
}

Fixed version (ground truth):
private static void insertColumn(UIColumnContainer selectedColumn,boolean isInsertAfter) throws Exception {
  UIContainer uiParent=selectedColumn.getParent();
  UIColumnContainer uiNewColumn=uiParent.addChild(UIColumnContainer.class,null,null);
  uiNewColumn.setTemplate(selectedColumn.getTemplate());
  uiNewColumn.setFactoryId(selectedColumn.getFactoryId());
  uiNewColumn.setId(String.valueOf(Math.abs(uiNewColumn.hashCode())));
  List<UIComponent> listColumn=uiParent.getChildren();
  int position=listColumn.indexOf(selectedColumn);
  if (isInsertAfter) {
    position+=1;
  }
  Collections.rotate(listColumn.subList(position,listColumn.size()),1);
}
Program: 9896
Project: 9896
Buggy source:
@Override public void execute(Event<UITabContainer> event) throws Exception {
  UITabContainer container=event.getSource();
  PortalRequestContext pcontext=(PortalRequestContext)event.getRequestContext();
  if (container == null) {
    return;
  }
  List<UIComponent> children=container.getChildren();
  for (  UIComponent child : children) {
    if (child.isRendered() && child instanceof UIContainer) {
      UIContainer newTabContainer=container.addChild(UIContainer.class,null,null);
      newTabContainer.setTemplate(child.getTemplate());
      child.setRendered(false);
      newTabContainer.setRendered(true);
      newTabContainer.setId(String.valueOf(newTabContainer.hashCode()));
      pcontext.addUIComponentToUpdateByAjax(container);
      pcontext.ignoreAJAXUpdateOnPortlets(true);
      pcontext.getJavascriptManager().require("String_Node_Str","String_Node_Str").addScripts("String_Node_Str");
      return;
    }
  }
}

Fixed version (ground truth):
@Override public void execute(Event<UITabContainer> event) throws Exception {
  UITabContainer container=event.getSource();
  PortalRequestContext pcontext=(PortalRequestContext)event.getRequestContext();
  if (container == null) {
    return;
  }
  List<UIComponent> children=container.getChildren();
  for (  UIComponent child : children) {
    if (child.isRendered() && child instanceof UIContainer) {
      UIContainer newTabContainer=container.addChild(UIContainer.class,null,null);
      newTabContainer.setTemplate(child.getTemplate());
      child.setRendered(false);
      newTabContainer.setRendered(true);
      newTabContainer.setId(String.valueOf(Math.abs(newTabContainer.hashCode())));
      pcontext.addUIComponentToUpdateByAjax(container);
      pcontext.ignoreAJAXUpdateOnPortlets(true);
      pcontext.getJavascriptManager().require("String_Node_Str","String_Node_Str").addScripts("String_Node_Str");
      return;
    }
  }
}
Program: 9897
Project: 9897
Buggy source:
public void setProperty(String name,String value){
  if (name == null || properties == null)   throw new NullPointerException();
  if (value == null)   properties.remove(name);
 else   properties.setProperty(name,value);
}

Fixed version (ground truth):
public void setProperty(String name,String value){
  if (name == null || properties == null)   throw new NullPointerException();
  properties.setProperty(name,value);
}
Program: 9898
Project: 9898
Buggy source:
public void setProperty(String name,String value){
  if (name == null || properties == null)   throw new NullPointerException();
  if (value == null)   properties.remove(name);
 else   properties.setProperty(name,value);
}

Fixed version (ground truth):
public void setProperty(String name,String value){
  if (name == null || properties == null)   throw new NullPointerException();
  properties.setProperty(name,value);
}
Program: 9899
Project: 9899
Buggy source:
public void removeProperty(String name){
  if (name == null || properties == null)   throw new NullPointerException();
  properties.remove(name);
}

Fixed version (ground truth):
public void removeProperty(String name){
  if (name == null)   throw new NullPointerException();
  properties.setProperty(name,null);
}
Program: 9900
Project: 9900
Buggy source:
public ArrayList<PortalRedirect> getPortalRedirects(){
  return portalRedirects;
}

Fixed version (ground truth):
public ArrayList<PortalRedirect> getPortalRedirects(){
  if (portalRedirects == null) {
    portalRedirects=new ArrayList<PortalRedirect>();
  }
  return portalRedirects;
}
Program: 9901
Project: 9901
Buggy source:
@Override public String getRedirectPath(String origin,String redirect,String originRequestPath){
  try {
    if (mapper != null) {
      if (originRequestPath == null || originRequestPath.isEmpty()) {
        originRequestPath="String_Node_Str";
      }
      PortalConfig pConfig=dataStorage.getPortalConfig(origin);
      if (pConfig == null) {
        log.warn("String_Node_Str" + origin + "String_Node_Str");
        return null;
      }
      PortalRedirect pRedirect=null;
      for (      PortalRedirect portalRedirect : pConfig.getPortalRedirects()) {
        if (portalRedirect.getRedirectSite().equals(redirect)) {
          pRedirect=portalRedirect;
          break;
        }
      }
      if (pRedirect != null) {
        String redirectPath=mapper.getRedirectPath(origin,redirect,originRequestPath,pRedirect.getMappings());
        if (redirectPath != null && redirectPath.equals("String_Node_Str")) {
          return "String_Node_Str";
        }
 else {
          return redirectPath;
        }
      }
 else {
        log.debug("String_Node_Str" + origin + "String_Node_Str"+ redirect+ "String_Node_Str");
        return null;
      }
    }
 else {
      log.debug("String_Node_Str");
      return null;
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
@Override public String getRedirectPath(String origin,String redirect,String originRequestPath){
  try {
    if (mapper != null) {
      if (originRequestPath == null || originRequestPath.isEmpty()) {
        originRequestPath="String_Node_Str";
      }
      PortalConfig pConfig=dataStorage.getPortalConfig(origin);
      if (pConfig == null || pConfig.getPortalRedirects() == null) {
        log.warn("String_Node_Str" + origin + "String_Node_Str");
        return null;
      }
      PortalRedirect pRedirect=null;
      for (      PortalRedirect portalRedirect : pConfig.getPortalRedirects()) {
        if (portalRedirect.getRedirectSite().equals(redirect)) {
          pRedirect=portalRedirect;
          break;
        }
      }
      if (pRedirect != null) {
        String redirectPath=mapper.getRedirectPath(origin,redirect,originRequestPath,pRedirect.getMappings());
        if (redirectPath != null && redirectPath.equals("String_Node_Str")) {
          return "String_Node_Str";
        }
 else {
          return redirectPath;
        }
      }
 else {
        log.debug("String_Node_Str" + origin + "String_Node_Str"+ redirect+ "String_Node_Str");
        return null;
      }
    }
 else {
      log.debug("String_Node_Str");
      return null;
    }
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    return null;
  }
}
Program: 9902
Project: 9902
Buggy source:
/** 
 * Create and configure cacheManager, which will be used to create infinispan caches.
 * @param configStream stream with infinispan configuration
 * @return cacheManager
 * @throws Exception
 */
private static EmbeddedCacheManager getSharedCacheManager(InputStream configStream) throws Exception {
  if (cacheManager == null) {
    EmbeddedCacheManager cacheManager=new DefaultCacheManager(configStream,false);
    GlobalConfiguration globalConfigFromXml=cacheManager.getCacheManagerConfiguration();
    ConfigurationBuilderHolder builderHolder=new ConfigurationBuilderHolder();
    builderHolder.getGlobalConfigurationBuilder().read(globalConfigFromXml);
    Configuration configFromXml=cacheManager.getDefaultCacheConfiguration();
    ConfigurationBuilder configBuilder=builderHolder.getDefaultConfigurationBuilder().read(configFromXml);
    TransactionManagerLookup tmLookup=configFromXml.transaction().transactionManagerLookup();
    if (tmLookup == null) {
      tmLookup=getTransactionManagerLookup();
      configBuilder.transaction().transactionManagerLookup(tmLookup);
    }
    log.debug("String_Node_Str" + tmLookup);
    cacheManager=new DefaultCacheManager(builderHolder,true);
    PicketLinkIDMServiceImpl.cacheManager=cacheManager;
  }
  return cacheManager;
}

Fixed version (ground truth):
/** 
 * Create and configure cacheManager, which will be used to create infinispan caches.
 * @param configStream stream with infinispan configuration
 * @return cacheManager
 * @throws Exception
 */
private static EmbeddedCacheManager getSharedCacheManager(InputStream configStream) throws Exception {
  if (cacheManager == null) {
    EmbeddedCacheManager cacheManager=new DefaultCacheManager(configStream,false);
    GlobalConfiguration globalConfigFromXml=cacheManager.getCacheManagerConfiguration();
    GlobalConfigurationBuilder globalConfigBuilder=new GlobalConfigurationBuilder();
    globalConfigBuilder.read(globalConfigFromXml);
    Configuration configFromXml=cacheManager.getDefaultCacheConfiguration();
    ConfigurationBuilder configBuilder=new ConfigurationBuilder().read(configFromXml);
    TransactionManagerLookup tmLookup=configFromXml.transaction().transactionManagerLookup();
    if (tmLookup == null) {
      tmLookup=getTransactionManagerLookup();
      configBuilder.transaction().transactionManagerLookup(tmLookup);
    }
    log.debug("String_Node_Str" + tmLookup);
    cacheManager=new DefaultCacheManager(globalConfigBuilder.build(),configBuilder.build(),true);
    PicketLinkIDMServiceImpl.cacheManager=cacheManager;
  }
  return cacheManager;
}
Program: 9903
Project: 9903
Buggy source:
public WSRPSessionLifeCycle(){
  try {
    ExoContainer container=ExoContainerContext.getCurrentContainer();
    RepositoryService repoService=(RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
    repository=repoService.getRepository(REPOSITORY_NAME);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
  provider=SessionProvider.createSystemProvider();
}

Fixed version (ground truth):
public WSRPSessionLifeCycle(){
  try {
    ExoContainer container=ExoContainerContext.getCurrentContainer();
    RepositoryService repoService=(RepositoryService)container.getComponentInstanceOfType(RepositoryService.class);
    repository=repoService.getRepository(REPOSITORY_NAME);
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 9904
Project: 9904
Buggy source:
public boolean isExpired(){
  return false;
}

Fixed version (ground truth):
public boolean isExpired(){
  return System.currentTimeMillis() > getExpirationTimeMillis();
}
Program: 9905
Project: 9905
Buggy source:
public GadgetToken saveToken(BasicOAuthStoreTokenIndex tokenKey,TokenInfo tokenInfo){
  Map<String,GadgetTokenEntry> tokens=getGadgetTokens();
  GadgetTokenEntry entry=null;
  for (  GadgetTokenEntry item : tokens.values()) {
    BasicOAuthStoreTokenIndex key=item.getKey();
    if (tokenKey.equals(key)) {
      entry=item;
    }
  }
  if (entry == null) {
    entry=createGadgetToken();
    tokens.put("String_Node_Str" + System.currentTimeMillis(),entry);
  }
  entry.setGadgetUri(tokenKey.getGadgetUri());
  entry.setModuleId(tokenKey.getModuleId());
  entry.setServiceName(tokenKey.getServiceName());
  entry.setTokenName(tokenKey.getTokenName());
  entry.setUserId(tokenKey.getUserId());
  entry.setAccessToken(tokenInfo.getAccessToken());
  entry.setTokenSecret(tokenInfo.getTokenSecret());
  entry.setSessionHandle(tokenInfo.getSessionHandle() == null ? "String_Node_Str" : tokenInfo.getSessionHandle());
  entry.setTokenExpireMillis(tokenInfo.getTokenExpireMillis());
  return entry.getToken();
}

Fixed version (ground truth):
public GadgetToken saveToken(BasicOAuthStoreTokenIndex tokenKey,TokenInfo tokenInfo,long expirationTime){
  Map<String,GadgetTokenEntry> tokens=getGadgetTokens();
  GadgetTokenEntry entry=null;
  for (  GadgetTokenEntry item : tokens.values()) {
    BasicOAuthStoreTokenIndex key=item.getKey();
    if (tokenKey.equals(key)) {
      entry=item;
    }
  }
  if (entry == null) {
    entry=createGadgetToken();
    tokens.put("String_Node_Str" + System.currentTimeMillis(),entry);
  }
  entry.setGadgetUri(tokenKey.getGadgetUri());
  entry.setModuleId(tokenKey.getModuleId());
  entry.setServiceName(tokenKey.getServiceName());
  entry.setTokenName(tokenKey.getTokenName());
  entry.setUserId(tokenKey.getUserId());
  entry.setAccessToken(tokenInfo.getAccessToken());
  entry.setTokenSecret(tokenInfo.getTokenSecret());
  entry.setSessionHandle(tokenInfo.getSessionHandle() == null ? "String_Node_Str" : tokenInfo.getSessionHandle());
  entry.setTokenExpireMillis(expirationTime);
  return entry.getToken();
}
Program: 9906
Project: 9906
Buggy source:
public GadgetToken removeToken(BasicOAuthStoreTokenIndex tokenKey){
  Map<String,GadgetTokenEntry> tokens=getGadgetTokens();
  for (  GadgetTokenEntry tokenEntry : tokens.values()) {
    BasicOAuthStoreTokenIndex key=tokenEntry.getKey();
    if (tokenKey.equals(key)) {
      tokenEntry.remove();
      return tokenEntry.getToken();
    }
  }
  return null;
}

Fixed version (ground truth):
public GadgetToken removeToken(BasicOAuthStoreTokenIndex tokenKey){
  Map<String,GadgetTokenEntry> tokens=getGadgetTokens();
  for (  GadgetTokenEntry tokenEntry : tokens.values()) {
    BasicOAuthStoreTokenIndex key=tokenEntry.getKey();
    if (tokenKey.equals(key)) {
      GadgetToken token=tokenEntry.getToken();
      tokenEntry.remove();
      return token;
    }
  }
  return null;
}
Program: 9907
Project: 9907
Buggy source:
public GadgetToken getToken(){
  return new GadgetToken(getAccessToken(),getTokenSecret(),getServiceName(),getTokenExpireMillis());
}

Fixed version (ground truth):
public GadgetToken getToken(){
  return new GadgetToken(getAccessToken(),getTokenSecret(),getSessionHandle(),getTokenExpireMillis());
}
Program: 9908
Project: 9908
Buggy source:
@Override public BasicOAuthStoreTokenIndex[] getAllTokens(){
  return new TokenTask<BasicOAuthStoreTokenIndex[]>(){
    @Override protected BasicOAuthStoreTokenIndex[] execute(){
      GadgetTokenContainer container=getGadgetTokenContainer();
      Collection<GadgetTokenEntry> tokens=container.getGadgetTokens().values();
      BasicOAuthStoreTokenIndex[] gadgetTokens=new BasicOAuthStoreTokenIndex[9];
      int count=0;
      for (      GadgetTokenEntry tokenEntry : tokens) {
        gadgetTokens[count++]=tokenEntry.getKey();
      }
      return gadgetTokens;
    }
  }
.executeWith(chromatticLifeCycle);
}

Fixed version (ground truth):
@Override public BasicOAuthStoreTokenIndex[] getAllTokens(){
  return new TokenTask<BasicOAuthStoreTokenIndex[]>(){
    @Override protected BasicOAuthStoreTokenIndex[] execute(){
      GadgetTokenContainer container=getGadgetTokenContainer();
      Collection<GadgetTokenEntry> tokenEntries=container.getGadgetTokens().values();
      List<BasicOAuthStoreTokenIndex> tokenHolder=new ArrayList<BasicOAuthStoreTokenIndex>();
      for (      GadgetTokenEntry tokenEntry : tokenEntries) {
        tokenHolder.add(tokenEntry.getKey());
      }
      return tokenHolder.toArray(new BasicOAuthStoreTokenIndex[tokenHolder.size()]);
    }
  }
.executeWith(chromatticLifeCycle);
}
Program: 9910
Project: 9910
Buggy source:
public UIFormInputIconSelector(String name,String bindingField) throws Exception {
  super(name,bindingField,String.class);
  setComponentConfig(UIFormInputIconSelector.class,null);
  addChild(UIDropDownControl.class,null,null);
  this.setValues(paramDefault);
  selectType="String_Node_Str";
}

Fixed version (ground truth):
public UIFormInputIconSelector(String name,String bindingField) throws Exception {
  super(name,bindingField,String.class);
  setComponentConfig(UIFormInputIconSelector.class,null);
  addChild(UIDropDownControl.class,"String_Node_Str",null);
  this.setValues(paramDefault);
  selectType="String_Node_Str";
}
Program: 9911
Project: 9911
Buggy source:
public void execute(Event<UIFormInputIconSelector> event) throws Exception {
  UIFormInputIconSelector uiIconSelector=event.getSource();
  String iconName=event.getRequestContext().getRequestParameter(OBJECTID);
  if (iconName.equals("String_Node_Str")) {
    uiIconSelector.setSelectedIcon("String_Node_Str");
    for (    IconSet set : uiIconSelector.getListIconSet()) {
      if (set.getName().equals("String_Node_Str")) {
        uiIconSelector.setSelectedIconSet(set);
      }
    }
    UIForm uiForm=uiIconSelector.getAncestorOfType(UIForm.class);
    event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
    return;
  }
  uiIconSelector.setSelectedIcon(iconName);
  UIForm uiForm=uiIconSelector.getAncestorOfType(UIForm.class);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiForm);
}

Fixed version (ground truth):
public void execute(Event<UIDropDownControl> event) throws Exception {
  UIDropDownControl uiDropDown=event.getSource();
  event.getRequestContext().addUIComponentToUpdateByAjax(uiDropDown);
}
Program: 9913
Project: 9913
Buggy source:
public Map<String,FetchMode> resolveURLs(ControllerContext controllerContext,Map<ResourceId,FetchMode> ids,boolean merge,boolean minified,Locale locale) throws IOException {
  Map<String,FetchMode> urls=new LinkedHashMap<String,FetchMode>();
  StringBuilder buffer=new StringBuilder();
  URIWriter writer=new URIWriter(buffer);
  Map<ScriptResource,FetchMode> resources=scripts.resolve(ids);
  for (  Map.Entry<ScriptResource,FetchMode> entry : resources.entrySet()) {
    ScriptResource resource=entry.getKey();
    if (!resource.isEmpty()) {
      controllerContext.renderURL(resource.getParameters(minified,locale),writer);
      urls.put(buffer.toString(),entry.getValue());
      buffer.setLength(0);
      writer.reset(buffer);
    }
  }
  return urls;
}

Fixed version (ground truth):
public Map<String,FetchMode> resolveURLs(ControllerContext controllerContext,Map<ResourceId,FetchMode> ids,boolean merge,boolean minified,Locale locale) throws IOException {
  Map<String,FetchMode> urls=new LinkedHashMap<String,FetchMode>();
  StringBuilder buffer=new StringBuilder();
  URIWriter writer=new URIWriter(buffer);
  Map<ScriptResource,FetchMode> resources=scripts.resolve(ids);
  for (  Map.Entry<ScriptResource,FetchMode> entry : resources.entrySet()) {
    ScriptResource resource=entry.getKey();
    if (!resource.isEmpty()) {
      FetchMode mode=entry.getValue();
      for (      Module module : resource.getModules()) {
        if (module instanceof Module.Remote) {
          urls.put(((Module.Remote)module).getURI(),mode);
        }
      }
      controllerContext.renderURL(resource.getParameters(minified,locale),writer);
      urls.put(buffer.toString(),mode);
      buffer.setLength(0);
      writer.reset(buffer);
    }
  }
  return urls;
}
Program: 9914
Project: 9914
Buggy source:
protected String trimmedValueOrNullIfBypassed(String value,UIFormInput uiInput,boolean exceptionOnMissingMandatory,boolean trimValue) throws Exception {
  if (value != null) {
    String tmp=value.trim();
    if (trimValue) {
      value=tmp;
    }
    value=tmp.isEmpty() ? null : value;
  }
  if (exceptionOnMissingMandatory && value == null) {
    throw createMessageException("String_Node_Str",uiInput);
  }
  return value;
}

Fixed version (ground truth):
protected String trimmedValueOrNullIfBypassed(String value,UIFormInput uiInput,boolean exceptionOnMissingMandatory,boolean trimValue) throws Exception {
  if (value != null) {
    String tmp=value.trim();
    if (trimValue) {
      value=tmp;
    }
    value=tmp.isEmpty() ? null : value;
  }
  if (exceptionOnMissingMandatory && value == null) {
    throw createMessageException(value,uiInput,"String_Node_Str");
  }
  return value;
}
Program: 9915
Project: 9915
Buggy source:
protected MessageException createMessageException(String value,UIFormInput uiInput) throws Exception {
  return new MessageException(new ApplicationMessage(getMessageLocalizationKey(),getMessageArgs(value,uiInput),ApplicationMessage.WARNING));
}

Fixed version (ground truth):
protected MessageException createMessageException(String value,UIFormInput uiInput,String localizationKey) throws Exception {
  return new MessageException(new ApplicationMessage(localizationKey,getMessageArgs(value,uiInput),ApplicationMessage.WARNING));
}
Program: 9916
Project: 9916
Buggy source:
public void addMessage(String messageKey,Object[] args,int type){
  messages.add(new ApplicationMessage(messageKey,args,type));
}

Fixed version (ground truth):
public void addMessage(String messageKey,Object[] args){
  messages.add(new ApplicationMessage(messageKey,args,AbstractApplicationMessage.WARNING));
}
Program: 9917
Project: 9917
Buggy source:
public CompoundApplicationMessage(AbstractApplicationMessage initialMessage){
  if (initialMessage != null) {
    messages.add(initialMessage);
  }
}

Fixed version (ground truth):
public CompoundApplicationMessage(AbstractApplicationMessage initialMessage){
  if (initialMessage != null) {
    messages.add(initialMessage);
  }
  setType(AbstractApplicationMessage.WARNING);
}
Program: 9919
Project: 9919
Buggy source:
public static ParentChildPair searchParentChildPairUnderNode(PageNode rootNode,String uri){
  if (uri.equals(rootNode.getUri())) {
    return new ParentChildPair(null,rootNode);
  }
  List<PageNode> nodes=rootNode.getNodes();
  if (nodes == null) {
    return null;
  }
  for (  PageNode node : nodes) {
    ParentChildPair parentChildPair=searchParentChildPairUnderNode(node,uri);
    if (parentChildPair != null) {
      parentChildPair.setParentNode(node);
      return parentChildPair;
    }
  }
  return null;
}

Fixed version (ground truth):
public static ParentChildPair searchParentChildPairUnderNode(PageNode rootNode,String uri){
  if (uri.equals(rootNode.getUri())) {
    return new ParentChildPair(null,rootNode);
  }
  List<PageNode> nodes=rootNode.getNodes();
  if (nodes == null) {
    return null;
  }
  for (  PageNode node : nodes) {
    ParentChildPair parentChildPair=searchParentChildPairUnderNode(node,uri);
    if (parentChildPair != null) {
      if (parentChildPair.getParentNode() == null) {
        parentChildPair.setParentNode(rootNode);
      }
      return parentChildPair;
    }
  }
  return null;
}
Program: 9920
Project: 9920
Buggy source:
public String getDescription(){
  return mType.getDescription();
}

Fixed version (ground truth):
public String getDescription(){
  return (mType.getDescription() != null ? mType.getDescription() : "String_Node_Str");
}
Program: 9921
Project: 9921
Buggy source:
public void execute(Event<UIPageNodeForm2> event) throws Exception {
  UIPageNodeForm2 uiPageNodeForm=event.getSource();
  UIGroupNavigationManagement uiGroupNavigation=uiPageNodeForm.getAncestorOfType(UIGroupNavigationManagement.class);
  PageNavigation selectedNavigation=uiGroupNavigation.getSelectedNavigation();
  UIPopupWindow uiNavigationPopup=uiGroupNavigation.getChild(UIPopupWindow.class);
  UINavigationManagement pageManager=uiPageNodeForm.createUIComponent(UINavigationManagement.class,null,null);
  pageManager.setOwner(selectedNavigation.getOwnerId());
  UINavigationNodeSelector selector=pageManager.getChild(UINavigationNodeSelector.class);
  ArrayList<PageNavigation> navis=new ArrayList<PageNavigation>();
  navis.add(selectedNavigation);
  selector.initNavigations(navis);
  if (uiPageNodeForm.getSelectedParent() instanceof PageNode) {
    PageNode selectedParent=(PageNode)uiPageNodeForm.getSelectedParent();
    selector.selectPageNodeByUri(selectedParent.getUri());
  }
  uiNavigationPopup.setUIComponent(pageManager);
  uiNavigationPopup.setWindowSize(400,400);
  uiNavigationPopup.setRendered(true);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
}

Fixed version (ground truth):
public void execute(Event<UIPageNodeForm2> event) throws Exception {
  UIPageNodeForm2 uiPageNodeForm=event.getSource();
  UIGroupNavigationManagement uiGroupNavigation=uiPageNodeForm.getAncestorOfType(UIGroupNavigationManagement.class);
  PageNavigation selectedNavigation=uiGroupNavigation.getSelectedNavigation();
  UIPopupWindow uiNavigationPopup=uiGroupNavigation.getChild(UIPopupWindow.class);
  UINavigationManagement pageManager=uiPageNodeForm.createUIComponent(UINavigationManagement.class,null,null);
  pageManager.setOwner(selectedNavigation.getOwnerId());
  UINavigationNodeSelector selector=pageManager.getChild(UINavigationNodeSelector.class);
  if (uiPageNodeForm.getSelectedParent() instanceof PageNode) {
    PageNode selectedParent=(PageNode)uiPageNodeForm.getSelectedParent();
    selector.selectPageNodeByUri(selectedParent.getUri());
  }
  uiNavigationPopup.setUIComponent(pageManager);
  uiNavigationPopup.setWindowSize(400,400);
  uiNavigationPopup.setRendered(true);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
}
Program: 9922
Project: 9922
Buggy source:
public void execute(Event<UIPageNodeForm2> event) throws Exception {
  UIPageNodeForm2 uiPageNodeForm=event.getSource();
  UISiteManagement uiSiteManagement=uiPageNodeForm.getAncestorOfType(UISiteManagement.class);
  PageNavigation selectedNavigation=uiSiteManagement.getOriginalSelectedNavigation();
  UIPopupWindow uiNavigationPopup=uiSiteManagement.getChild(UIPopupWindow.class);
  UINavigationManagement pageManager=uiPageNodeForm.createUIComponent(UINavigationManagement.class,null,null);
  pageManager.setOwner(selectedNavigation.getOwnerId());
  UINavigationNodeSelector selector=pageManager.getChild(UINavigationNodeSelector.class);
  ArrayList<PageNavigation> navis=new ArrayList<PageNavigation>();
  navis.add(selectedNavigation);
  selector.initNavigations(navis);
  uiNavigationPopup.setUIComponent(pageManager);
  uiNavigationPopup.setWindowSize(400,400);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
}

Fixed version (ground truth):
public void execute(Event<UIPageNodeForm2> event) throws Exception {
  UIPageNodeForm2 uiPageNodeForm=event.getSource();
  UISiteManagement uiSiteManagement=uiPageNodeForm.getAncestorOfType(UISiteManagement.class);
  PageNavigation selectedNavigation=uiSiteManagement.getOriginalSelectedNavigation();
  UIPopupWindow uiNavigationPopup=uiSiteManagement.getChild(UIPopupWindow.class);
  UINavigationManagement pageManager=uiPageNodeForm.createUIComponent(UINavigationManagement.class,null,null);
  pageManager.setOwner(selectedNavigation.getOwnerId());
  UINavigationNodeSelector selector=pageManager.getChild(UINavigationNodeSelector.class);
  uiNavigationPopup.setUIComponent(pageManager);
  uiNavigationPopup.setWindowSize(400,400);
  event.getRequestContext().addUIComponentToUpdateByAjax(uiNavigationPopup.getParent());
}
Program: 9923
Project: 9923
Buggy source:
private boolean isInPublicationDate(){
  if (startPublicationDate != null && endPublicationDate != null) {
    Date currentDate=new Date();
    return currentDate.compareTo(startPublicationDate) >= 0 && currentDate.compareTo(endPublicationDate) <= 0;
  }
 else   return startPublicationDate == null && endPublicationDate == null;
}

Fixed version (ground truth):
private boolean isInPublicationDate(){
  Date currentDate=new Date();
  boolean case1=(startPublicationDate != null) && (endPublicationDate != null) && (currentDate.compareTo(startPublicationDate) >= 0 && currentDate.compareTo(endPublicationDate) <= 0);
  boolean case2=(startPublicationDate == null) && (endPublicationDate != null) && (currentDate.compareTo(endPublicationDate) <= 0);
  boolean case3=(startPublicationDate != null) && (endPublicationDate == null) && (currentDate.compareTo(startPublicationDate) >= 0);
  boolean case4=(startPublicationDate == null) && (endPublicationDate == null);
  return case1 || case2 || case3|| case4;
}
Program: 9924
Project: 9924
Buggy source:
@Override public Reader read(){
  return new StringReader(sb.toString());
}

Fixed version (ground truth):
@Override public Reader read(){
  return new CharSequenceReader(sb);
}
Program: 9925
Project: 9925
Buggy source:
public Resource resolve(String path){
  if (path.startsWith("String_Node_Str" + portalContainerName + "String_Node_Str") && path.endsWith("String_Node_Str")) {
    final StringBuffer sb=new StringBuffer();
    String encoded=path.substring(("String_Node_Str" + portalContainerName + "String_Node_Str").length());
    String blah[]=encoded.split("String_Node_Str");
    int len=(blah.length >> 1) << 1;
    for (int i=0; i < len; i+=2) {
      String name=Codec.decode(blah[i]);
      String module=Codec.decode(blah[i + 1]);
      SkinKey key=new SkinKey(module,name);
      SkinConfig skin=skins.get(key);
      if (skin != null) {
        sb.append("String_Node_Str").append(skin.getCSSPath()).append("String_Node_Str").append("String_Node_Str");
      }
    }
    return new Resource(path){
      @Override public Reader read(){
        return new StringReader(sb.toString());
      }
    }
;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Resource resolve(String path){
  if (path == null) {
    throw new NullPointerException("String_Node_Str");
  }
  if (path.startsWith(prefix) && path.endsWith("String_Node_Str")) {
    final StringBuilder sb=new StringBuilder();
    String encoded=path.substring(prefix.length());
    String blah[]=encoded.split("String_Node_Str");
    int len=(blah.length >> 1) << 1;
    for (int i=0; i < len; i+=2) {
      String name=Codec.decode(blah[i]);
      String module=Codec.decode(blah[i + 1]);
      SkinKey key=new SkinKey(module,name);
      SkinConfig skin=skins.get(key);
      if (skin != null) {
        sb.append("String_Node_Str").append(skin.getCSSPath()).append("String_Node_Str").append("String_Node_Str");
      }
    }
    return new Resource(path){
      @Override public Reader read(){
        return new CharSequenceReader(sb);
      }
    }
;
  }
 else {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    return null;
  }
}
Program: 9926
Project: 9926
Buggy source:
public CompositeResourceResolver(String portalContainerName,Map<SkinKey,SkinConfig> skins){
  this.portalContainerName=portalContainerName;
  this.skins=skins;
}

Fixed version (ground truth):
public CompositeResourceResolver(String portalContainerName,Map<SkinKey,SkinConfig> skins){
  this.portalContainerName=portalContainerName;
  this.skins=skins;
  this.prefix="String_Node_Str" + portalContainerName + "String_Node_Str";
}
Program: 9927
Project: 9927
Buggy source:
public Resource resolve(String path){
  for (  ResourceResolver resolver : resolvers) {
    Resource res=resolver.resolve(path);
    if (res != null) {
      return res;
    }
  }
  int i1=path.indexOf("String_Node_Str",2);
  String targetedContextPath=path.substring(0,i1);
  SimpleResourceContext context=contexts.get(targetedContextPath);
  return context.getResource(path.substring(i1));
}

Fixed version (ground truth):
public Resource resolve(String path){
  if (path == null) {
    throw new NullPointerException("String_Node_Str");
  }
  for (  ResourceResolver resolver : resolvers) {
    Resource res=resolver.resolve(path);
    if (res != null) {
      return res;
    }
  }
  int i1=path.indexOf("String_Node_Str",2);
  String targetedContextPath=path.substring(0,i1);
  SimpleResourceContext context=contexts.get(targetedContextPath);
  if (context == null) {
    log.warn("String_Node_Str" + targetedContextPath + "String_Node_Str"+ path);
    return null;
  }
 else {
    return context.getResource(path.substring(i1));
  }
}
Program: 9928
Project: 9928
Buggy source:
/** 
 * Returns a reader for the provided path or null if the resource cannot be resolved.
 * @param path the path
 * @return a reader 
 */
Resource resolve(String path);

Fixed version (ground truth):
/** 
 * Returns a   {@link org.exoplatform.portal.resource.Resource} for the provided path or null if the resource cannot be resolved.
 * @param path the path
 * @return a reader
 * @throws NullPointerException if the path argument is null
 * @throws IllegalStateException when
 */
Resource resolve(String path) throws NullPointerException ;
Program: 9929
Project: 9929
Buggy source:
@OneToMany(type=RelationshipType.PATH) @MappedBy("String_Node_Str") public abstract List<RegistrationMapping> getRegistrations();

Fixed version (ground truth):
@OneToMany public abstract List<RegistrationMapping> getRegistrations();
Program: 9930
Project: 9930
Buggy source:
@ManyToOne(type=RelationshipType.PATH) @MappedBy("String_Node_Str") public abstract ConsumerMapping getConsumer();

Fixed version (ground truth):
@ManyToOne public abstract ConsumerMapping getConsumer();
Program: 9931
Project: 9931
Buggy source:
private static List<PageNode> findPath(PageNavigation nav,String[] pathNodes){
  List<PageNode> nodes=new ArrayList<PageNode>(4);
  if (pathNodes.length == 0) {
    nodes.add(nav.getNodes().get(0));
    return nodes;
  }
  PageNode startNode=nav.getNode(pathNodes[0]);
  if (startNode == null) {
    return nodes;
  }
  nodes.add(startNode);
  for (int i=1; i < pathNodes.length; i++) {
    if (startNode == null) {
      break;
    }
 else {
      nodes.add(startNode);
      startNode=startNode.getChild(pathNodes[i]);
    }
  }
  return nodes;
}

Fixed version (ground truth):
private static List<PageNode> findPath(PageNavigation nav,String[] pathNodes){
  List<PageNode> nodes=new ArrayList<PageNode>(4);
  if (pathNodes.length == 0) {
    nodes.add(nav.getNodes().get(0));
    return nodes;
  }
  PageNode startNode=nav.getNode(pathNodes[0]);
  if (startNode == null) {
    return nodes;
  }
  nodes.add(startNode);
  for (int i=1; i < pathNodes.length; i++) {
    startNode=startNode.getChild(pathNodes[i]);
    if (startNode == null) {
      break;
    }
 else {
      nodes.add(startNode);
    }
  }
  return nodes;
}
Program: 9932
Project: 9932
Buggy source:
/** 
 * Refresh the UIPage under UIPortal 
 * @throws Exception
 */
public void refreshUIPage() throws Exception {
  if (selectedNode_ == null) {
    selectedNode_=navigation.getNodes().get(0);
  }
  UIPageBody uiPageBody=findFirstComponentOfType(UIPageBody.class);
  if (uiPageBody == null) {
    return;
  }
  if (uiPageBody.getMaximizedUIComponent() != null) {
    UIPortlet currentPortlet=(UIPortlet)uiPageBody.getMaximizedUIComponent();
    currentPortlet.setCurrentWindowState(WindowState.NORMAL);
    uiPageBody.setMaximizedUIComponent(null);
  }
  uiPageBody.setPageBody(selectedNode_,this);
  Locale locale=Util.getUIPortalApplication().getLocale();
  refreshNavigation(locale);
}

Fixed version (ground truth):
/** 
 * Refresh the UIPage under UIPortal 
 * @throws Exception
 */
public void refreshUIPage() throws Exception {
  if (selectedNode_ == null) {
    selectedNode_=navigation.getNodes().get(0);
  }
  UIPageBody uiPageBody=findFirstComponentOfType(UIPageBody.class);
  if (uiPageBody == null) {
    return;
  }
  if (uiPageBody.getMaximizedUIComponent() != null) {
    UIPortlet currentPortlet=(UIPortlet)uiPageBody.getMaximizedUIComponent();
    currentPortlet.setCurrentWindowState(WindowState.NORMAL);
    uiPageBody.setMaximizedUIComponent(null);
  }
  uiPageBody.setPageBody(selectedNode_,this);
  Locale locale=Util.getUIPortalApplication().getLocale();
  localizePageNavigation(navigation,locale);
}
Program: 9935
Project: 9935
Buggy source:
protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  String username=req.getParameter("String_Node_Str");
  String password=req.getParameter("String_Node_Str");
  if (username == null) {
    resp.sendError(HttpServletResponse.SC_BAD_REQUEST,"String_Node_Str");
  }
  if (password == null) {
    resp.sendError(HttpServletResponse.SC_BAD_REQUEST,"String_Node_Str");
  }
  Credentials credentials=new Credentials(username,password);
  req.getSession().setAttribute(InitiateLoginServlet.CREDENTIALS,credentials);
  String uri=req.getParameter("String_Node_Str");
  if (uri == null || uri.length() == 0) {
    uri=req.getContextPath() + "String_Node_Str";
  }
  String rememberme=req.getParameter("String_Node_Str");
  if ("String_Node_Str".equals(rememberme)) {
    boolean isRemember="String_Node_Str".equals(req.getParameter(InitiateLoginServlet.COOKIE_NAME));
    if (isRemember) {
      AbstractTokenService tokenService=AbstractTokenService.getInstance(CookieTokenService.class);
      String cookieToken=tokenService.createToken(credentials);
      Cookie cookie=new Cookie(InitiateLoginServlet.COOKIE_NAME,cookieToken);
      cookie.setPath(req.getContextPath());
      cookie.setMaxAge((int)tokenService.getValidityTime() / 1000);
      resp.addCookie(cookie);
    }
  }
  resp.sendRedirect(uri);
}

Fixed version (ground truth):
protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  String username=req.getParameter("String_Node_Str");
  String password=req.getParameter("String_Node_Str");
  if (username == null) {
    log.error("String_Node_Str");
    resp.sendError(HttpServletResponse.SC_BAD_REQUEST,"String_Node_Str");
  }
  if (password == null) {
    log.error("String_Node_Str");
    resp.sendError(HttpServletResponse.SC_BAD_REQUEST,"String_Node_Str");
  }
  log.debug("String_Node_Str");
  Credentials credentials=new Credentials(username,password);
  req.getSession().setAttribute(InitiateLoginServlet.CREDENTIALS,credentials);
  String uri=req.getParameter("String_Node_Str");
  if (uri == null || uri.length() == 0) {
    uri=req.getContextPath() + "String_Node_Str";
    log.debug("String_Node_Str" + uri + "String_Node_Str");
  }
 else {
    log.debug("String_Node_Str" + uri);
  }
  String rememberme=req.getParameter("String_Node_Str");
  if ("String_Node_Str".equals(rememberme)) {
    boolean isRemember="String_Node_Str".equals(req.getParameter(InitiateLoginServlet.COOKIE_NAME));
    if (isRemember) {
      AbstractTokenService tokenService=AbstractTokenService.getInstance(CookieTokenService.class);
      String cookieToken=tokenService.createToken(credentials);
      log.debug("String_Node_Str" + cookieToken + "String_Node_Str"+ "String_Node_Str");
      Cookie cookie=new Cookie(InitiateLoginServlet.COOKIE_NAME,cookieToken);
      cookie.setPath(req.getContextPath());
      cookie.setMaxAge((int)tokenService.getValidityTime() / 1000);
      resp.addCookie(cookie);
    }
  }
  resp.sendRedirect(uri);
}
Program: 9936
Project: 9936
Buggy source:
private <K extends Serializable,V>V create(POMSession session,CacheableDataTask<K,V> task) throws Exception {
  return super.execute(session,task);
}

Fixed version (ground truth):
private <K extends Serializable,V>V create(POMSession session,CacheableDataTask<K,V> task) throws Exception {
  K key=task.getKey();
  session.scheduleForEviction(key);
  return super.execute(session,task);
}
Program: 9937
Project: 9937
Buggy source:
public List<PageNavigation> getNavigations() throws Exception {
  WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
  List<PageNavigation> result=new ArrayList<PageNavigation>();
  if (context.getRemoteUser() != null) {
    result.add(PageNavigationUtils.filter(getSelectedNavigation(),context.getRemoteUser()));
  }
 else {
    for (    PageNavigation nav : Util.getUIPortal().getNavigations()) {
      if (!showUserNavigation && nav.getOwnerType().equals("String_Node_Str"))       continue;
      result.add(PageNavigationUtils.filter(nav,null));
    }
  }
  return result;
}

Fixed version (ground truth):
public List<PageNavigation> getNavigations() throws Exception {
  WebuiRequestContext context=WebuiRequestContext.getCurrentInstance();
  List<PageNavigation> result=new ArrayList<PageNavigation>();
  if (context.getRemoteUser() != null) {
    result.add(PageNavigationUtils.filter(getSelectedNavigation(),context.getRemoteUser()));
  }
 else {
    for (    PageNavigation nav : Util.getUIPortalApplication().getNavigations()) {
      if (!showUserNavigation && nav.getOwnerType().equals("String_Node_Str"))       continue;
      result.add(PageNavigationUtils.filter(nav,null));
    }
  }
  return result;
}