nus-yam/ex-repair huggingface dataset:
Program: 135745
Project: 135745
Buggy source:
private Token getToken(String verb,List<Object> statement,int index,Map<String,Object> namespace,Set<TokenStorageType> storageTypes,Set<TokenType> tokenTypes){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size()));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  if (storageTypes != null) {
    if (!storageTypes.contains(token.storageType)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,storageTypes,statement));
    }
  }
  if (tokenTypes != null) {
    token.load();
    if (!tokenTypes.contains(token.type)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,statement));
    }
  }
  return token;
}

Fixed version (ground truth):
private Token getToken(String verb,List<Object> statement,int index,Map<String,Object> namespace,Set<TokenStorageType> storageTypes,Set<TokenType> tokenTypes){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size(),e));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  if (storageTypes != null) {
    if (!storageTypes.contains(token.storageType)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,storageTypes,statement));
    }
  }
  if (tokenTypes != null) {
    token.load();
    if (!tokenTypes.contains(token.type)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,statement));
    }
  }
  return token;
}
Program: 135749
Project: 135749
Buggy source:
@Override public void updated(Dictionary<String,?> props) throws ConfigurationException {
  if (props == null) {
    configs.clear();
    configs.putAll(defaults);
  }
 else {
    try {
      Enumeration<String> keys=props.keys();
      while (keys.hasMoreElements()) {
        String key=keys.nextElement();
        configs.put(key,(String)props.get(key));
      }
    }
 catch (    Throwable t) {
      throw new ConfigurationException(null,FEDERATION_CONFIG_ERR);
    }
  }
}

Fixed version (ground truth):
@Override public void updated(Dictionary<String,?> props) throws ConfigurationException {
  if (props == null) {
    configs.clear();
    configs.putAll(defaults);
  }
 else {
    try {
      Enumeration<String> keys=props.keys();
      while (keys.hasMoreElements()) {
        String key=keys.nextElement();
        configs.put(key,(String)props.get(key));
      }
    }
 catch (    Throwable t) {
      throw new ConfigurationException(null,FEDERATION_CONFIG_ERR,t);
    }
  }
}
Program: 135750
Project: 135750
Buggy source:
/** 
 * Authenticate user. This implementation tracks IUserManager and delegates the decision to it. If the service is not available, IllegalStateException is thrown.
 */
@Override public synchronized boolean authenticated(final String username,final String password){
  if (nullableCredService == null) {
    logger.warn("String_Node_Str",username);
    throw new IllegalStateException("String_Node_Str");
  }
  Claim claim;
  try {
    claim=nullableCredService.authenticate(new PasswordCredentialsWrapper(username,password),DOMAIN);
  }
 catch (  AuthenticationException e) {
    logger.debug("String_Node_Str",username);
    return false;
  }
  logger.debug("String_Node_Str",username,claim.domain());
  return true;
}

Fixed version (ground truth):
/** 
 * Authenticate user. This implementation tracks IUserManager and delegates the decision to it. If the service is not available, IllegalStateException is thrown.
 */
@Override public synchronized boolean authenticated(final String username,final String password){
  if (nullableCredService == null) {
    logger.warn("String_Node_Str",username);
    throw new IllegalStateException("String_Node_Str");
  }
  Claim claim;
  try {
    claim=nullableCredService.authenticate(new PasswordCredentialsWrapper(username,password),DOMAIN);
  }
 catch (  AuthenticationException e) {
    logger.debug("String_Node_Str",username,e);
    return false;
  }
  logger.debug("String_Node_Str",username,claim.domain());
  return true;
}
Program: 135751
Project: 135751
Buggy source:
private void reconfig(@SuppressWarnings("String_Node_Str") Dictionary props) throws ConfigurationException {
  cacheLock.lock();
  try {
    long secsToIdle=Long.parseLong(props.get(SECS_TO_IDLE).toString());
    long secsToLive=Long.parseLong(props.get(SECS_TO_LIVE).toString());
    int maxMem=Integer.parseInt(props.get(MAX_CACHED_MEMORY).toString());
    int maxDisk=Integer.parseInt(props.get(MAX_CACHED_DISK).toString());
    CacheConfiguration config=tokens.getCacheConfiguration();
    config.setTimeToIdleSeconds(secsToIdle);
    config.setTimeToLiveSeconds(secsToLive);
    config.maxEntriesLocalHeap(maxMem);
    config.maxEntriesLocalDisk(maxDisk);
  }
 catch (  Throwable t) {
    throw new ConfigurationException(null,TOKEN_STORE_CONFIG_ERR);
  }
 finally {
    cacheLock.unlock();
  }
}

Fixed version (ground truth):
private void reconfig(@SuppressWarnings("String_Node_Str") Dictionary props) throws ConfigurationException {
  cacheLock.lock();
  try {
    long secsToIdle=Long.parseLong(props.get(SECS_TO_IDLE).toString());
    long secsToLive=Long.parseLong(props.get(SECS_TO_LIVE).toString());
    int maxMem=Integer.parseInt(props.get(MAX_CACHED_MEMORY).toString());
    int maxDisk=Integer.parseInt(props.get(MAX_CACHED_DISK).toString());
    CacheConfiguration config=tokens.getCacheConfiguration();
    config.setTimeToIdleSeconds(secsToIdle);
    config.setTimeToLiveSeconds(secsToLive);
    config.maxEntriesLocalHeap(maxMem);
    config.maxEntriesLocalDisk(maxDisk);
  }
 catch (  Throwable t) {
    throw new ConfigurationException(null,TOKEN_STORE_CONFIG_ERR,t);
  }
 finally {
    cacheLock.unlock();
  }
}
Program: 135752
Project: 135752
Buggy source:
@Override public List<String> listDomains(String userId){
  debug("String_Node_Str" + userId);
  List<String> domains=new ArrayList<String>();
  long uid=0;
  try {
    uid=Long.parseLong(userId);
  }
 catch (  NumberFormatException nfe) {
    logger.warn("String_Node_Str" + userId);
    return domains;
  }
  try {
    Grants grants=grantStore.getGrants(uid);
    List<Grant> grantList=grants.getGrants();
    for (int z=0; z < grantList.size(); z++) {
      Grant grant=grantList.get(z);
      Domain domain=domainStore.getDomain(grant.getDomainid());
      domains.add(domain.getName());
    }
    return domains;
  }
 catch (  StoreException se) {
    logger.warn("String_Node_Str" + se.toString());
    return domains;
  }
}

Fixed version (ground truth):
@Override public List<String> listDomains(String userId){
  debug("String_Node_Str" + userId);
  List<String> domains=new ArrayList<String>();
  long uid=0;
  try {
    uid=Long.parseLong(userId);
  }
 catch (  NumberFormatException nfe) {
    logger.warn("String_Node_Str",userId,nfe);
    return domains;
  }
  try {
    Grants grants=grantStore.getGrants(uid);
    List<Grant> grantList=grants.getGrants();
    for (int z=0; z < grantList.size(); z++) {
      Grant grant=grantList.get(z);
      Domain domain=domainStore.getDomain(grant.getDomainid());
      domains.add(domain.getName());
    }
    return domains;
  }
 catch (  StoreException se) {
    logger.warn("String_Node_Str",se.toString(),se);
    return domains;
  }
}
Program: 135753
Project: 135753
Buggy source:
@Override public String getUserId(String userName){
  debug("String_Node_Str" + userName);
  try {
    Users users=userStore.getUsers(userName);
    List<User> userList=users.getUsers();
    if (userList.size() == 0) {
      return null;
    }
    User user=userList.get(0);
    return user.getUserid().toString();
  }
 catch (  StoreException se) {
    logger.warn("String_Node_Str" + se.toString());
    return null;
  }
}

Fixed version (ground truth):
@Override public String getUserId(String userName){
  debug("String_Node_Str" + userName);
  try {
    Users users=userStore.getUsers(userName);
    List<User> userList=users.getUsers();
    if (userList.size() == 0) {
      return null;
    }
    User user=userList.get(0);
    return user.getUserid().toString();
  }
 catch (  StoreException se) {
    logger.warn("String_Node_Str",se.toString(),se);
    return null;
  }
}
Program: 135755
Project: 135755
Buggy source:
@Override public List<String> listRoles(String userId,String domainName){
  debug("String_Node_Str");
  List<String> roles=new ArrayList<String>();
  try {
    Domains domains=domainStore.getDomains(domainName);
    List<Domain> domainList=domains.getDomains();
    if (domainList.size() == 0) {
      debug("String_Node_Str" + domainName + "String_Node_Str");
      return roles;
    }
    long did=domainList.get(0).getDomainid();
    long uid=0;
    try {
      uid=Long.parseLong(userId);
    }
 catch (    NumberFormatException nfe) {
      logger.warn("String_Node_Str" + userId);
      return roles;
    }
    Grants grants=grantStore.getGrants(did,uid);
    List<Grant> grantList=grants.getGrants();
    for (int z=0; z < grantList.size(); z++) {
      Grant grant=grantList.get(z);
      Role role=roleStore.getRole(grant.getRoleid());
      roles.add(role.getName());
    }
    return roles;
  }
 catch (  StoreException se) {
    logger.warn("String_Node_Str" + se.toString());
    return roles;
  }
}

Fixed version (ground truth):
@Override public List<String> listRoles(String userId,String domainName){
  debug("String_Node_Str");
  List<String> roles=new ArrayList<String>();
  try {
    Domains domains=domainStore.getDomains(domainName);
    List<Domain> domainList=domains.getDomains();
    if (domainList.size() == 0) {
      debug("String_Node_Str" + domainName + "String_Node_Str");
      return roles;
    }
    long did=domainList.get(0).getDomainid();
    long uid=0;
    try {
      uid=Long.parseLong(userId);
    }
 catch (    NumberFormatException nfe) {
      logger.warn("String_Node_Str",userId,nfe);
      return roles;
    }
    Grants grants=grantStore.getGrants(did,uid);
    List<Grant> grantList=grants.getGrants();
    for (int z=0; z < grantList.size(); z++) {
      Grant grant=grantList.get(z);
      Role role=roleStore.getRole(grant.getRoleid());
      roles.add(role.getName());
    }
    return roles;
  }
 catch (  StoreException se) {
    logger.warn("String_Node_Str",se.toString(),se);
    return roles;
  }
}
Program: 135757
Project: 135757
Buggy source:
private Object getRawParameter(String verb,List<Object> statement,int index,Set<TokenType> tokenTypes){
  Object item;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size()));
  }
  if (tokenTypes != null) {
    TokenType itemType=Token.classify(item);
    if (!tokenTypes.contains(itemType)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,statement));
    }
  }
  return item;
}

Fixed version (ground truth):
private Object getRawParameter(String verb,List<Object> statement,int index,Set<TokenType> tokenTypes){
  Object item;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size(),e));
  }
  if (tokenTypes != null) {
    TokenType itemType=Token.classify(item);
    if (!tokenTypes.contains(itemType)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,statement));
    }
  }
  return item;
}
Program: 135758
Project: 135758
Buggy source:
private Token getParameter(String verb,List<Object> statement,int index,Map<String,Object> namespace,Set<TokenType> tokenTypes){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size()));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  token.load();
  if (tokenTypes != null) {
    try {
      token.get();
    }
 catch (    UndefinedValueException e) {
    }
    if (!tokenTypes.contains(token.type)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,item.getClass().getSimpleName(),statement));
    }
  }
  return token;
}

Fixed version (ground truth):
private Token getParameter(String verb,List<Object> statement,int index,Map<String,Object> namespace,Set<TokenType> tokenTypes){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size(),e));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  token.load();
  if (tokenTypes != null) {
    try {
      token.get();
    }
 catch (    UndefinedValueException e) {
    }
    if (!tokenTypes.contains(token.type)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,item.getClass().getSimpleName(),statement));
    }
  }
  return token;
}
Program: 135759
Project: 135759
Buggy source:
Map<String,Object> getMapping(Map<String,Object> namespace,Map<String,Object> rule){
  Map<String,Object> mapping=null;
  String mappingName=null;
  try {
    @SuppressWarnings("String_Node_Str") Map<String,Object> map=(Map<String,Object>)rule.get("String_Node_Str");
    mapping=map;
  }
 catch (  java.lang.ClassCastException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace)));
  }
  if (mapping != null) {
    return mapping;
  }
  try {
    mappingName=(String)rule.get("String_Node_Str");
  }
 catch (  java.lang.ClassCastException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace)));
  }
  if (mappingName == null) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace)));
  }
  mapping=this.mappings.get(mappingName);
  if (mapping == null) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace)));
  }
  logger.debug(String.format("String_Node_Str",mappingName,this.ruleId(namespace),mapping));
  return mapping;
}

Fixed version (ground truth):
Map<String,Object> getMapping(Map<String,Object> namespace,Map<String,Object> rule){
  Map<String,Object> mapping=null;
  String mappingName=null;
  try {
    @SuppressWarnings("String_Node_Str") Map<String,Object> map=(Map<String,Object>)rule.get("String_Node_Str");
    mapping=map;
  }
 catch (  java.lang.ClassCastException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace),e));
  }
  if (mapping != null) {
    return mapping;
  }
  try {
    mappingName=(String)rule.get("String_Node_Str");
  }
 catch (  java.lang.ClassCastException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace),e));
  }
  if (mappingName == null) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace)));
  }
  mapping=this.mappings.get(mappingName);
  if (mapping == null) {
    throw new InvalidRuleException(String.format("String_Node_Str",this.ruleId(namespace)));
  }
  logger.debug(String.format("String_Node_Str",mappingName,this.ruleId(namespace),mapping));
  return mapping;
}
Program: 135761
Project: 135761
Buggy source:
private Token getVariable(String verb,List<Object> statement,int index,Map<String,Object> namespace){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size()));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  if (token.storageType != TokenStorageType.VARIABLE) {
    throw new InvalidTypeException(String.format("String_Node_Str",verb,index,token.storageType,statement));
  }
  return token;
}

Fixed version (ground truth):
private Token getVariable(String verb,List<Object> statement,int index,Map<String,Object> namespace){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size(),e));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  if (token.storageType != TokenStorageType.VARIABLE) {
    throw new InvalidTypeException(String.format("String_Node_Str",verb,index,token.storageType,statement));
  }
  return token;
}
Program: 135762
Project: 135762
Buggy source:
private Token getToken(String verb,List<Object> statement,int index,Map<String,Object> namespace,Set<TokenStorageType> storageTypes,Set<TokenType> tokenTypes){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size()));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  if (storageTypes != null) {
    if (!storageTypes.contains(token.storageType)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,storageTypes,statement));
    }
  }
  if (tokenTypes != null) {
    token.load();
    if (!tokenTypes.contains(token.type)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,statement));
    }
  }
  return token;
}

Fixed version (ground truth):
private Token getToken(String verb,List<Object> statement,int index,Map<String,Object> namespace,Set<TokenStorageType> storageTypes,Set<TokenType> tokenTypes){
  Object item;
  Token token;
  try {
    item=statement.get(index);
  }
 catch (  IndexOutOfBoundsException e) {
    throw new InvalidRuleException(String.format("String_Node_Str",verb,index + 1,statement.size(),e));
  }
  try {
    token=new Token(item,namespace);
  }
 catch (  Exception e) {
    throw new StatementErrorException(String.format("String_Node_Str",index,e));
  }
  if (storageTypes != null) {
    if (!storageTypes.contains(token.storageType)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,storageTypes,statement));
    }
  }
  if (tokenTypes != null) {
    token.load();
    if (!tokenTypes.contains(token.type)) {
      throw new InvalidTypeException(String.format("String_Node_Str",verb,index,tokenTypes,statement));
    }
  }
  return token;
}
Program: 135765
Project: 135765
Buggy source:
@Override public void updated(Dictionary<String,?> properties) throws ConfigurationException {
  try {
    authEnabled=Boolean.valueOf((String)properties.get(AUTH_ENABLED));
  }
 catch (  Throwable t) {
    throw new ConfigurationException(AUTH_ENABLED,AUTH_ENABLED_ERR);
  }
}

Fixed version (ground truth):
@Override public void updated(Dictionary<String,?> properties) throws ConfigurationException {
  if (properties == null) {
    return;
  }
  String propertyValue=(String)properties.get(AUTH_ENABLED);
  boolean isTrueString=Boolean.parseBoolean(propertyValue);
  if (!isTrueString && !"String_Node_Str".equalsIgnoreCase(propertyValue)) {
    throw new ConfigurationException(AUTH_ENABLED,AUTH_ENABLED_ERR);
  }
  authEnabled=isTrueString;
}
Program: 135766
Project: 135766
Buggy source:
@Override public Authentication call() throws Exception {
  return as.get();
}

Fixed version (ground truth):
@Override public Authentication call() throws Exception {
  AuthenticationService as=AuthenticationManager.instance();
  return as.get();
}
Program: 135767
Project: 135767
Buggy source:
@Override public ContainerRequest filter(ContainerRequest request){
  if (ServiceLocator.INSTANCE.as == null)   throw UNAVAILABLE_EX;
  if (ServiceLocator.INSTANCE.as.isAuthEnabled()) {
    Map<String,List<String>> headers=request.getRequestHeaders();
    for (    TokenAuth ta : ServiceLocator.INSTANCE.ta) {
      try {
        Authentication auth=ta.validate(headers);
        if (auth != null) {
          ServiceLocator.INSTANCE.as.set(auth);
          return request;
        }
      }
 catch (      AuthenticationException ae) {
        throw unauthorized();
      }
    }
    try {
      OAuthAccessResourceRequest or=new OAuthAccessResourceRequest(httpRequest,ParameterStyle.HEADER);
      validate(or.getAccessToken());
    }
 catch (    OAuthSystemException|OAuthProblemException e) {
      throw unauthorized();
    }
  }
  return request;
}

Fixed version (ground truth):
@Override public ContainerRequest filter(ContainerRequest request){
  if (checkCORSOptionRequest(request)) {
    return request;
  }
  if (ServiceLocator.INSTANCE.as == null)   throw UNAVAILABLE_EX;
  if (ServiceLocator.INSTANCE.as.isAuthEnabled()) {
    Map<String,List<String>> headers=request.getRequestHeaders();
    for (    TokenAuth ta : ServiceLocator.INSTANCE.ta) {
      try {
        Authentication auth=ta.validate(headers);
        if (auth != null) {
          ServiceLocator.INSTANCE.as.set(auth);
          return request;
        }
      }
 catch (      AuthenticationException ae) {
        throw unauthorized();
      }
    }
    try {
      OAuthAccessResourceRequest or=new OAuthAccessResourceRequest(httpRequest,ParameterStyle.HEADER);
      validate(or.getAccessToken());
    }
 catch (    OAuthSystemException|OAuthProblemException e) {
      throw unauthorized();
    }
  }
  return request;
}
Program: 135768
Project: 135768
Buggy source:
@Override public ContainerRequest filter(ContainerRequest request){
  if (ServiceLocator.INSTANCE.as == null)   throw UNAVAILABLE_EX;
  if (ServiceLocator.INSTANCE.as.isAuthEnabled()) {
    Map<String,List<String>> headers=request.getRequestHeaders();
    for (    TokenAuth ta : ServiceLocator.INSTANCE.ta) {
      try {
        Authentication auth=ta.validate(headers);
        if (auth != null) {
          ServiceLocator.INSTANCE.as.set(auth);
          return request;
        }
      }
 catch (      AuthenticationException ae) {
        throw unauthorized();
      }
    }
    try {
      OAuthAccessResourceRequest or=new OAuthAccessResourceRequest(httpRequest,ParameterStyle.HEADER);
      validate(or.getAccessToken());
    }
 catch (    OAuthSystemException|OAuthProblemException e) {
      throw unauthorized();
    }
  }
  return request;
}

Fixed version (ground truth):
@Override public ContainerRequest filter(ContainerRequest request){
  if (checkCORSOptionRequest(request)) {
    return request;
  }
  if (ServiceLocator.INSTANCE.as == null)   throw UNAVAILABLE_EX;
  if (ServiceLocator.INSTANCE.as.isAuthEnabled()) {
    Map<String,List<String>> headers=request.getRequestHeaders();
    for (    TokenAuth ta : ServiceLocator.INSTANCE.ta) {
      try {
        Authentication auth=ta.validate(headers);
        if (auth != null) {
          ServiceLocator.INSTANCE.as.set(auth);
          return request;
        }
      }
 catch (      AuthenticationException ae) {
        throw unauthorized();
      }
    }
    try {
      OAuthAccessResourceRequest or=new OAuthAccessResourceRequest(httpRequest,ParameterStyle.HEADER);
      validate(or.getAccessToken());
    }
 catch (    OAuthSystemException|OAuthProblemException e) {
      throw unauthorized();
    }
  }
  return request;
}
Program: 135769
Project: 135769
Buggy source:
public void windowClosing(WindowEvent e){
  if (rtspControl != null)   rtspControl.RTSPTeardown();
  System.exit(0);
}

Fixed version (ground truth):
public void windowClosing(WindowEvent e){
  System.exit(0);
}
Program: 135771
Project: 135771
Buggy source:
protected void initAssetEntry(Locale locale) throws PortalException, SystemException {
  try {
    _assetEntry=AssetEntryServiceUtil.getEntry(_assetEntryId);
  }
 catch (  Exception e) {
    if (_log.isDebugEnabled()) {
      _log.debug(e);
    }
    return;
  }
  _assetClassName=_assetEntry.getClassName();
  _assetClassPK=_assetEntry.getClassPK();
  _assetRendererFactory=AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(_assetEntry.getClassName());
  _assetRenderer=_assetRendererFactory.getAssetRenderer(_assetClassPK);
  _assetTitle=_assetEntry.getTitle(locale);
  _assetType=_assetRendererFactory.getTypeName(locale,true);
}

Fixed version (ground truth):
protected void initAssetEntry(Locale locale) throws PortalException, SystemException {
  try {
    _assetEntry=AssetEntryServiceUtil.getEntry(_assetEntryId);
  }
 catch (  Exception e) {
    if (_log.isDebugEnabled()) {
      _log.debug(e);
    }
    return;
  }
  if (!_assetEntry.isVisible()) {
    return;
  }
  _assetClassName=_assetEntry.getClassName();
  _assetClassPK=_assetEntry.getClassPK();
  _assetRendererFactory=AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(_assetEntry.getClassName());
  _assetRenderer=_assetRendererFactory.getAssetRenderer(_assetClassPK);
  _assetTitle=_assetEntry.getTitle(locale);
  _assetType=_assetRendererFactory.getTypeName(locale,true);
}
Program: 135772
Project: 135772
Buggy source:
protected void addCampaignTrackingActionsTotalFromAnalyticsWithClassName(long campaignId,Date date) throws PortalException, SystemException {
  List<Object[]> campaignTrackingActionTotalAnalyticsList=campaignTrackingActionTotalFinder.findByAnalyticsWithClassName(date);
  for (  Object[] campaignTrackingActionTotalAnalytics : campaignTrackingActionTotalAnalyticsList) {
    String className=(String)campaignTrackingActionTotalAnalytics[0];
    long classPK=(Long)campaignTrackingActionTotalAnalytics[1];
    String eventType=(String)campaignTrackingActionTotalAnalytics[2];
    int count=(Integer)campaignTrackingActionTotalAnalytics[3];
    List<TrackingActionInstance> trackingActionInstances=_trackingActionInstaceLocalService.getTrackingActionInstances(campaignId,className,classPK,eventType);
    if (!trackingActionInstances.isEmpty()) {
      continue;
    }
    TrackingActionInstance trackingActionInstance=trackingActionInstances.get(0);
    addCampaignTrackingActionTotal(campaignId,trackingActionInstance.getAlias(),className,classPK,eventType,count);
  }
}

Fixed version (ground truth):
protected void addCampaignTrackingActionsTotalFromAnalyticsWithClassName(long campaignId,Date date) throws PortalException, SystemException {
  List<Object[]> campaignTrackingActionTotalAnalyticsList=campaignTrackingActionTotalFinder.findByAnalyticsWithClassName(date);
  for (  Object[] campaignTrackingActionTotalAnalytics : campaignTrackingActionTotalAnalyticsList) {
    String className=(String)campaignTrackingActionTotalAnalytics[0];
    long classPK=(Long)campaignTrackingActionTotalAnalytics[1];
    String eventType=(String)campaignTrackingActionTotalAnalytics[2];
    int count=(Integer)campaignTrackingActionTotalAnalytics[3];
    List<TrackingActionInstance> trackingActionInstances=_trackingActionInstaceLocalService.getTrackingActionInstances(campaignId,className,classPK,eventType);
    if (trackingActionInstances.isEmpty()) {
      continue;
    }
    TrackingActionInstance trackingActionInstance=trackingActionInstances.get(0);
    addCampaignTrackingActionTotal(campaignId,trackingActionInstance.getAlias(),className,classPK,eventType,count);
  }
}
Program: 135773
Project: 135773
Buggy source:
protected void addCampaignTrackingActionsTotalFromAnalyticsWithElementId(long campaignId,Date date) throws PortalException, SystemException {
  if (date == null) {
    date=_analyticsEventLocalService.getMaxAge();
  }
  List<Object[]> campaignTrackingActionTotalAnalyticsList=campaignTrackingActionTotalFinder.findByAnalyticsWithElementId(date);
  for (  Object[] campaignTrackingActionTotalAnalytics : campaignTrackingActionTotalAnalyticsList) {
    String elementId=(String)campaignTrackingActionTotalAnalytics[0];
    String eventType=(String)campaignTrackingActionTotalAnalytics[1];
    int count=(Integer)campaignTrackingActionTotalAnalytics[2];
    List<TrackingActionInstance> trackingActionInstances=_trackingActionInstaceLocalService.getTrackingActionInstances(campaignId,elementId,eventType);
    if (!trackingActionInstances.isEmpty()) {
      continue;
    }
    TrackingActionInstance trackingActionInstance=trackingActionInstances.get(0);
    addCampaignTrackingActionTotal(campaignId,trackingActionInstance.getAlias(),elementId,eventType,count);
  }
}

Fixed version (ground truth):
protected void addCampaignTrackingActionsTotalFromAnalyticsWithElementId(long campaignId,Date date) throws PortalException, SystemException {
  if (date == null) {
    date=_analyticsEventLocalService.getMaxAge();
  }
  List<Object[]> campaignTrackingActionTotalAnalyticsList=campaignTrackingActionTotalFinder.findByAnalyticsWithElementId(date);
  for (  Object[] campaignTrackingActionTotalAnalytics : campaignTrackingActionTotalAnalyticsList) {
    String elementId=(String)campaignTrackingActionTotalAnalytics[0];
    String eventType=(String)campaignTrackingActionTotalAnalytics[1];
    int count=(Integer)campaignTrackingActionTotalAnalytics[2];
    List<TrackingActionInstance> trackingActionInstances=_trackingActionInstaceLocalService.getTrackingActionInstances(campaignId,elementId,eventType);
    if (trackingActionInstances.isEmpty()) {
      continue;
    }
    TrackingActionInstance trackingActionInstance=trackingActionInstances.get(0);
    addCampaignTrackingActionTotal(campaignId,trackingActionInstance.getAlias(),elementId,eventType,count);
  }
}
Program: 135774
Project: 135774
Buggy source:
protected AssetCategory addUserSegmentCategory(long userId,Map<Locale,String> titleMap,Map<Locale,String> descriptionMap,ServiceContext serviceContext) throws PortalException, SystemException {
  long vocabularyId=UserSegmentUtil.getAssetVocabularyId(userId,serviceContext);
  serviceContext.setAddGroupPermissions(true);
  serviceContext.setAddGuestPermissions(true);
  AssetCategory assetCategory=AssetCategoryLocalServiceUtil.addCategory(userId,AssetCategoryConstants.DEFAULT_PARENT_CATEGORY_ID,titleMap,descriptionMap,vocabularyId,null,serviceContext);
  return assetCategory;
}

Fixed version (ground truth):
protected AssetCategory addUserSegmentCategory(long userId,Map<Locale,String> titleMap,Map<Locale,String> descriptionMap,ServiceContext serviceContext) throws PortalException, SystemException {
  long vocabularyId=UserSegmentUtil.getAssetVocabularyId(userId,serviceContext);
  serviceContext.setAddGroupPermissions(true);
  serviceContext.setAddGuestPermissions(true);
  AssetCategory assetCategory=null;
  try {
    assetCategory=AssetCategoryLocalServiceUtil.addCategory(userId,AssetCategoryConstants.DEFAULT_PARENT_CATEGORY_ID,titleMap,descriptionMap,vocabularyId,null,serviceContext);
  }
 catch (  DuplicateCategoryException dce) {
    throw new InvalidNameException();
  }
  return assetCategory;
}
Program: 135775
Project: 135775
Buggy source:
protected void populateContext(String path,PortletRequest portletRequest,PortletResponse portletResponse,Template template) throws Exception {
  BeansWrapper wrapper=BeansWrapper.getDefaultInstance();
  TemplateHashModel staticModels=wrapper.getStaticModels();
  template.put("String_Node_Str",Campaign.class);
  template.put("String_Node_Str",staticModels.get(CampaignConstants.class.getName()));
  template.put("String_Node_Str",staticModels.get(ContentTargetingPath.class.getName()));
  template.put("String_Node_Str",PortalUtil.getCurrentURL(portletRequest));
  template.put("String_Node_Str",LiferayWindowState.POP_UP);
  template.put("String_Node_Str",getPortletContext());
  template.put("String_Node_Str",ParamUtil.getString(portletRequest,"String_Node_Str"));
  template.put("String_Node_Str",ParamUtil.getString(portletRequest,"String_Node_Str","String_Node_Str"));
  template.put("String_Node_Str",portletRequest.getAttribute(PortletRequest.USER_INFO));
  template.put("String_Node_Str",UserSegment.class);
  populateViewContext(path,portletRequest,portletResponse,template,staticModels);
}

Fixed version (ground truth):
protected void populateContext(String path,PortletRequest portletRequest,PortletResponse portletResponse,Template template) throws Exception {
  BeansWrapper wrapper=BeansWrapper.getDefaultInstance();
  TemplateHashModel staticModels=wrapper.getStaticModels();
  template.put("String_Node_Str",ParamUtil.getString(portletRequest,"String_Node_Str"));
  template.put("String_Node_Str",Campaign.class);
  template.put("String_Node_Str",staticModels.get(CampaignConstants.class.getName()));
  template.put("String_Node_Str",staticModels.get(ContentTargetingPath.class.getName()));
  template.put("String_Node_Str",PortalUtil.getCurrentURL(portletRequest));
  template.put("String_Node_Str",LiferayWindowState.POP_UP);
  template.put("String_Node_Str",getPortletContext());
  template.put("String_Node_Str",ParamUtil.getString(portletRequest,"String_Node_Str"));
  template.put("String_Node_Str",ParamUtil.getString(portletRequest,"String_Node_Str","String_Node_Str"));
  template.put("String_Node_Str",portletRequest.getAttribute(PortletRequest.USER_INFO));
  template.put("String_Node_Str",UserSegment.class);
  populateViewContext(path,portletRequest,portletResponse,template,staticModels);
}
Program: 135779
Project: 135779
Buggy source:
protected List<UserSegmentQueryRule> getUserSegmentQueryRule(PortletPreferences portletPreferences,long assetEntryIdDefault,Locale locale) throws PortalException, SystemException {
  List<UserSegmentQueryRule> userSegmentQueryRules=new ArrayList<UserSegmentQueryRule>();
  int[] queryRulesIndexes=GetterUtil.getIntegerValues(portletPreferences.getValues("String_Node_Str",null),new int[]{0});
  for (  int queryRulesIndex : queryRulesIndexes) {
    UserSegmentQueryRule userSegmentQueryRule=UserSegmentQueryRuleUtil.getQueryRule(portletPreferences,queryRulesIndex,locale);
    userSegmentQueryRules.add(userSegmentQueryRule);
  }
  if (assetEntryIdDefault > 0) {
    UserSegmentQueryRule userSegmentQueryRule=new UserSegmentQueryRule(true,true,assetEntryIdDefault,null,-1,locale);
    userSegmentQueryRules.add(userSegmentQueryRule);
  }
  return userSegmentQueryRules;
}

Fixed version (ground truth):
protected List<UserSegmentQueryRule> getUserSegmentQueryRule(PortletPreferences portletPreferences,long assetEntryIdDefault,Locale locale) throws PortalException, SystemException {
  List<UserSegmentQueryRule> userSegmentQueryRules=new ArrayList<UserSegmentQueryRule>();
  int[] queryRulesIndexes=GetterUtil.getIntegerValues(portletPreferences.getValues("String_Node_Str",null),new int[0]);
  for (  int queryRulesIndex : queryRulesIndexes) {
    UserSegmentQueryRule userSegmentQueryRule=UserSegmentQueryRuleUtil.getQueryRule(portletPreferences,queryRulesIndex,locale);
    if (userSegmentQueryRule.getAssetEntry() != null) {
      userSegmentQueryRules.add(userSegmentQueryRule);
    }
  }
  if (assetEntryIdDefault > 0) {
    UserSegmentQueryRule userSegmentQueryRule=new UserSegmentQueryRule(true,true,assetEntryIdDefault,null,-1,locale);
    userSegmentQueryRules.add(userSegmentQueryRule);
  }
  return userSegmentQueryRules;
}
Program: 135781
Project: 135781
Buggy source:
public static Map<String,Object> getAssetSelectorIconData(HttpServletRequest request,AssetRendererFactory assetRendererFactory,String index) throws Exception {
  ThemeDisplay themeDisplay=(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
  PortletURL assetBrowserURL=getAssetBrowserURL(request,assetRendererFactory.getClassName());
  String typeName=assetRendererFactory.getTypeName(themeDisplay.getLocale(),false);
  Map<String,Object> data=new HashMap<String,Object>();
  data.put("String_Node_Str",String.valueOf(themeDisplay.getScopeGroupId()));
  data.put("String_Node_Str",assetBrowserURL.toString());
  data.put("String_Node_Str",index);
  data.put("String_Node_Str",LanguageUtil.format(themeDisplay.getLocale(),"String_Node_Str",typeName,false));
  data.put("String_Node_Str",typeName);
  return data;
}

Fixed version (ground truth):
public static Map<String,Object> getAssetSelectorIconData(HttpServletRequest request,AssetRendererFactory assetRendererFactory,String index) throws Exception {
  PortletConfig portletConfig=(PortletConfig)request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
  ThemeDisplay themeDisplay=(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
  PortletURL assetBrowserURL=getAssetBrowserURL(request,assetRendererFactory.getClassName());
  String typeName=assetRendererFactory.getTypeName(themeDisplay.getLocale(),false);
  Map<String,Object> data=new HashMap<String,Object>();
  data.put("String_Node_Str",String.valueOf(themeDisplay.getScopeGroupId()));
  data.put("String_Node_Str",assetBrowserURL.toString());
  data.put("String_Node_Str",index);
  data.put("String_Node_Str",LanguageUtil.format(portletConfig,themeDisplay.getLocale(),"String_Node_Str",typeName,false));
  data.put("String_Node_Str",typeName);
  return data;
}
Program: 135782
Project: 135782
Buggy source:
public String getSummary(Locale locale) throws SystemException {
  String userSegmentQueryRuleContains=_contains ? "String_Node_Str" : "String_Node_Str";
  String userSegmentQueryRuleAndOperator=_andOperator ? "String_Node_Str" : "String_Node_Str";
  return UnicodeLanguageUtil.format(locale,"String_Node_Str",new Object[]{userSegmentQueryRuleContains,userSegmentQueryRuleAndOperator,getUserSegmentNames(locale)},true);
}

Fixed version (ground truth):
public String getSummary(PortletConfig portletConfig,Locale locale) throws SystemException {
  String userSegmentQueryRuleContains=_contains ? "String_Node_Str" : "String_Node_Str";
  String userSegmentQueryRuleAndOperator=_andOperator ? "String_Node_Str" : "String_Node_Str";
  return UnicodeLanguageUtil.format(portletConfig,locale,"String_Node_Str",new Object[]{userSegmentQueryRuleContains,userSegmentQueryRuleAndOperator,getUserSegmentNames(locale)},true);
}
Program: 135783
Project: 135783
Buggy source:
protected List<Campaign> doFetchByG_D_A_U(long[] groupIds,Date date,boolean active,long[] userSegmentIds,boolean inlineSQLHelper) throws SystemException {
  Session session=null;
  try {
    session=openSession();
    CustomSQLUtil.reloadCustomSQL();
    String sql=CustomSQLUtil.get(FIND_BY_G_D_A_U);
    sql=StringUtil.replace(sql,"String_Node_Str",getGroupIds(groupIds));
    sql=StringUtil.replace(sql,"String_Node_Str",StringUtil.merge(userSegmentIds));
    if (inlineSQLHelper) {
      sql=InlineSQLHelperUtil.replacePermissionCheck(sql,Campaign.class.getName(),"String_Node_Str",groupIds);
    }
    SQLQuery q=session.createSQLQuery(sql);
    q.addEntity("String_Node_Str",CampaignImpl.class);
    QueryPos qPos=QueryPos.getInstance(q);
    qPos.add(groupIds);
    qPos.add(date);
    qPos.add(date);
    qPos.add(active);
    return q.list();
  }
 catch (  Exception e) {
    throw new SystemException(e);
  }
 finally {
    closeSession(session);
  }
}

Fixed version (ground truth):
protected List<Campaign> doFetchByG_D_A_U(long[] groupIds,Date date,boolean active,long[] userSegmentIds,boolean inlineSQLHelper) throws SystemException {
  if ((userSegmentIds == null) || (userSegmentIds.length == 0)) {
    return Collections.emptyList();
  }
  Session session=null;
  try {
    session=openSession();
    CustomSQLUtil.reloadCustomSQL();
    String sql=CustomSQLUtil.get(FIND_BY_G_D_A_U);
    sql=StringUtil.replace(sql,"String_Node_Str",getGroupIds(groupIds));
    sql=StringUtil.replace(sql,"String_Node_Str",StringUtil.merge(userSegmentIds));
    if (inlineSQLHelper) {
      sql=InlineSQLHelperUtil.replacePermissionCheck(sql,Campaign.class.getName(),"String_Node_Str",groupIds);
    }
    SQLQuery q=session.createSQLQuery(sql);
    q.addEntity("String_Node_Str",CampaignImpl.class);
    QueryPos qPos=QueryPos.getInstance(q);
    qPos.add(groupIds);
    qPos.add(date);
    qPos.add(date);
    qPos.add(active);
    return q.list();
  }
 catch (  Exception e) {
    throw new SystemException(e);
  }
 finally {
    closeSession(session);
  }
}
Program: 135784
Project: 135784
Buggy source:
@Override public int compareTo(com.liferay.geolocation.model.Geolocation geolocation){
  return _geolocation.compareTo(geolocation);
}

Fixed version (ground truth):
@Override public int compareTo(Geolocation geolocation){
  return _geolocation.compareTo(geolocation);
}
Program: 135785
Project: 135785
Buggy source:
@Override public com.liferay.portal.model.CacheModel<com.liferay.geolocation.model.Geolocation> toCacheModel(){
  return _geolocation.toCacheModel();
}

Fixed version (ground truth):
@Override public com.liferay.portal.model.CacheModel<Geolocation> toCacheModel(){
  return _geolocation.toCacheModel();
}
Program: 135786
Project: 135786
Buggy source:
@Override public com.liferay.geolocation.model.Geolocation toUnescapedModel(){
  return new GeolocationWrapper(_geolocation.toUnescapedModel());
}

Fixed version (ground truth):
@Override public Geolocation toUnescapedModel(){
  return new GeolocationWrapper(_geolocation.toUnescapedModel());
}
Program: 135787
Project: 135787
Buggy source:
@Override public com.liferay.geolocation.model.Geolocation toEscapedModel(){
  return new GeolocationWrapper(_geolocation.toEscapedModel());
}

Fixed version (ground truth):
@Override public Geolocation toEscapedModel(){
  return new GeolocationWrapper(_geolocation.toEscapedModel());
}
Program: 135788
Project: 135788
Buggy source:
@Override protected void populateContext(RuleInstance ruleInstance,Map<String,Object> context){
  if (ruleInstance != null) {
    String typeSettings=ruleInstance.getTypeSettings();
    try {
      JSONObject jsonObj=JSONFactoryUtil.createJSONObject(typeSettings);
      context.put("String_Node_Str",jsonObj.getInt("String_Node_Str"));
      Locale locale=(Locale)context.get("String_Node_Str");
      context.put("String_Node_Str",ruleInstance.getUserSegmentName(locale));
    }
 catch (    JSONException jse) {
    }
  }
 else {
    context.put("String_Node_Str",0);
  }
}

Fixed version (ground truth):
@Override protected void populateContext(RuleInstance ruleInstance,Map<String,Object> context){
  if (ruleInstance != null) {
    String typeSettings=ruleInstance.getTypeSettings();
    try {
      JSONObject jsonObj=JSONFactoryUtil.createJSONObject(typeSettings);
      context.put("String_Node_Str",jsonObj.getInt("String_Node_Str"));
    }
 catch (    JSONException jse) {
    }
  }
 else {
    context.put("String_Node_Str",0);
  }
}
Program: 135789
Project: 135789
Buggy source:
public String getAssetImage(PortletRequest portletRequest) throws Exception {
  AssetRendererFactory assetRendererFactory=AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(_assetClassName);
  AssetRenderer assetRenderer=assetRendererFactory.getAssetRenderer(_assetClassPK);
  return assetRenderer.getThumbnailPath(portletRequest);
}

Fixed version (ground truth):
public String getAssetImage(PortletRequest portletRequest) throws Exception {
  if (!isValid()) {
    return StringPool.BLANK;
  }
  AssetRendererFactory assetRendererFactory=AssetRendererFactoryRegistryUtil.getAssetRendererFactoryByClassName(_assetClassName);
  AssetRenderer assetRenderer=assetRendererFactory.getAssetRenderer(_assetClassPK);
  return assetRenderer.getThumbnailPath(portletRequest);
}
Program: 135790
Project: 135790
Buggy source:
@Override public String getSummary(RuleInstance ruleInstance,Locale locale){
  String typeSettings=ruleInstance.getTypeSettings();
  Format format=FastDateFormatFactoryUtil.getSimpleDateFormat(_SIMPLE_DATE_FORMAT_PATTERN,locale);
  StringBundler sb=new StringBundler(4);
  try {
    JSONObject jsonObj=JSONFactoryUtil.createJSONObject(typeSettings);
    Calendar startCalendar=CalendarFactoryUtil.getCalendar(1970,0,1,jsonObj.getInt("String_Node_Str"),jsonObj.getInt("String_Node_Str"));
    Calendar endCalendar=CalendarFactoryUtil.getCalendar(1970,0,1,jsonObj.getInt("String_Node_Str"),jsonObj.getInt("String_Node_Str"));
    sb.append("String_Node_Str");
    sb.append(format.format(startCalendar.getTime()));
    sb.append("String_Node_Str");
    sb.append(format.format(endCalendar.getTime()));
  }
 catch (  JSONException jse) {
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String getSummary(RuleInstance ruleInstance,Locale locale){
  String typeSettings=ruleInstance.getTypeSettings();
  Format format=FastDateFormatFactoryUtil.getSimpleDateFormat(_SIMPLE_DATE_FORMAT_PATTERN,locale);
  StringBundler sb=new StringBundler(4);
  try {
    JSONObject jsonObj=JSONFactoryUtil.createJSONObject(typeSettings);
    int startTimeHour=jsonObj.getInt("String_Node_Str");
    int startTimeMinute=jsonObj.getInt("String_Node_Str");
    int startTimeAmPm=jsonObj.getInt("String_Node_Str");
    if (startTimeAmPm == Calendar.PM) {
      startTimeHour+=12;
    }
    Calendar startCalendar=CalendarFactoryUtil.getCalendar(1970,0,1,startTimeHour,startTimeMinute);
    int endTimeHour=jsonObj.getInt("String_Node_Str");
    int endTimeMinute=jsonObj.getInt("String_Node_Str");
    int endTimeAmPm=jsonObj.getInt("String_Node_Str");
    if (endTimeAmPm == Calendar.PM) {
      endTimeHour+=12;
    }
    Calendar endCalendar=CalendarFactoryUtil.getCalendar(1970,0,1,endTimeHour,endTimeMinute);
    sb.append("String_Node_Str");
    sb.append(format.format(startCalendar.getTime()));
    sb.append("String_Node_Str");
    sb.append(format.format(endCalendar.getTime()));
  }
 catch (  JSONException jse) {
  }
  return sb.toString();
}
Program: 135791
Project: 135791
Buggy source:
protected void populateViewContext(String path,PortletRequest portletRequest,PortletResponse portletResponse,Template template) throws Exception {
  if (Validator.isNull(path) || path.equals(ContentTargetingPath.VIEW)) {
    ThemeDisplay themeDisplay=(ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    List<UserSegment> userSegments=_userSegmentService.getUserSegments(themeDisplay.getScopeGroupId());
    template.put("String_Node_Str",userSegments);
  }
 else   if (path.equals(ContentTargetingPath.EDIT_RULE)) {
  }
 else   if (path.equals(ContentTargetingPath.EDIT_USER_SEGMENT)) {
    template.put("String_Node_Str",UserSegment.class);
    template.put("String_Node_Str",_rulesRegistry.getRules());
    UserSegment userSegment=null;
    long userSegmentId=ParamUtil.getLong(portletRequest,"String_Node_Str");
    if (userSegmentId > 0) {
      userSegment=_userSegmentLocalService.getUserSegment(userSegmentId);
    }
    template.put("String_Node_Str",userSegment);
  }
}

Fixed version (ground truth):
protected void populateViewContext(String path,PortletRequest portletRequest,PortletResponse portletResponse,Template template) throws Exception {
  if (Validator.isNull(path) || path.equals(ContentTargetingPath.VIEW)) {
    ThemeDisplay themeDisplay=(ThemeDisplay)portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
    List<UserSegment> userSegments=_userSegmentService.getUserSegments(themeDisplay.getScopeGroupId());
    template.put("String_Node_Str",userSegments);
  }
 else   if (path.equals(ContentTargetingPath.EDIT_RULE)) {
  }
 else   if (path.equals(ContentTargetingPath.EDIT_USER_SEGMENT)) {
    template.put("String_Node_Str",UserSegment.class);
    Map<String,Rule> rules=_rulesRegistry.getRules();
    template.put("String_Node_Str",rules.values());
    UserSegment userSegment=null;
    long userSegmentId=ParamUtil.getLong(portletRequest,"String_Node_Str");
    if (userSegmentId > 0) {
      userSegment=_userSegmentLocalService.getUserSegment(userSegmentId);
    }
    template.put("String_Node_Str",userSegment);
  }
}