nus-yam/ex-repair huggingface dataset:
Program: 79872
Project: 79872
Buggy source:
/** 
 * Changes the state of the session to ACTIVE after creation.
 * @param userDN 
 * @return <code> true </code> if the session is successfully activated after creation , <code>false</code> otherwise
 */
public boolean activate(String userDN){
  if (userDN == null) {
    return false;
  }
  if ((SessionService.getActiveSessions() >= SessionService.maxSessions) && (!userDN.equalsIgnoreCase(superUserDN))) {
    SessionService.getSessionService().logSystemMessage(LOG_MSG_SESSION_MAX_LIMIT_REACHED,java.util.logging.Level.INFO);
    return false;
  }
  if ((SessionService.isSessionConstraintEnabled()) && !shouldIgnoreSessionQuotaChecking(userDN)) {
    if (SessionConstraint.checkQuotaAndPerformAction(this)) {
      if (DEBUG.messageEnabled()) {
        DEBUG.message("String_Node_Str" + "String_Node_Str");
      }
      SessionService.getSessionService().logEvent(this,SessionEvent.QUOTA_EXHAUSTED);
      return false;
    }
  }
  setLatestAccessTime();
  setState(Session.VALID);
  if (reschedulePossible) {
    reschedule();
  }
  SessionService.getSessionService().logEvent(this,SessionEvent.SESSION_CREATION);
  SessionService.getSessionService().sendEvent(this,SessionEvent.SESSION_CREATION);
  if (!isAppSession() || SessionService.returnAppSession) {
    SessionService.incrementActiveSessions();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Changes the state of the session to ACTIVE after creation.
 * @param userDN 
 * @return <code> true </code> if the session is successfully activated after creation , <code>false</code> otherwise
 */
public boolean activate(String userDN){
  if (userDN == null) {
    return false;
  }
  if ((SessionService.getActiveSessions() >= SessionService.maxSessions) && (!userDN.equalsIgnoreCase(superUserDN))) {
    SessionService.getSessionService().logSystemMessage(LOG_MSG_SESSION_MAX_LIMIT_REACHED,java.util.logging.Level.INFO);
    return false;
  }
  if ((SessionService.isSessionConstraintEnabled()) && !shouldIgnoreSessionQuotaChecking(userDN)) {
    if (SessionConstraint.checkQuotaAndPerformAction(this)) {
      if (debug.messageEnabled()) {
        debug.message("String_Node_Str" + "String_Node_Str");
      }
      SessionService.getSessionService().logEvent(this,SessionEvent.QUOTA_EXHAUSTED);
      return false;
    }
  }
  setLatestAccessTime();
  setState(Session.VALID);
  if (reschedulePossible) {
    reschedule();
  }
  SessionService.getSessionService().logEvent(this,SessionEvent.SESSION_CREATION);
  SessionService.getSessionService().sendEvent(this,SessionEvent.SESSION_CREATION);
  if (!isAppSession() || SessionService.returnAppSession) {
    SessionService.incrementActiveSessions();
  }
  return true;
}
Program: 79873
Project: 79873
Buggy source:
/** 
 * Default constructor required for deserialisation.
 */
public InternalSession(){
  this(null,SessionService.getSessionService(),SessionService.sessionDebug);
}

Fixed version (ground truth):
/** 
 * Default constructor required for deserialisation.
 */
public InternalSession(){
}
Program: 79874
Project: 79874
Buggy source:
/** 
 * Sets the key-value pair in the Internal Session property table.
 * @param key Property key
 * @param value Property value for the key
 */
protected void internalPutProperty(String key,String value){
  if (key.equals(HOST_NAME) || key.equals(HOST)) {
    if (value == null || value.length() == 0) {
      return;
    }
    if (isEnableHostLookUp) {
      try {
        InetAddress address=java.net.InetAddress.getByName(value);
        String hostName=address.getHostName();
        sessionProperties.put(HOST_NAME,hostName);
        sessionProperties.put(HOST,value);
      }
 catch (      UnknownHostException uhe) {
        DEBUG.error("String_Node_Str" + "String_Node_Str" + value + "String_Node_Str",uhe);
      }
    }
 else {
      sessionProperties.put(HOST_NAME,value);
      sessionProperties.put(HOST,value);
    }
  }
 else   if (key.equals(AM_MAX_IDLE_TIME)) {
    setMaxIdleTime(Long.parseLong(value));
  }
 else {
    sessionProperties.put(key,value);
  }
  if (sessionState == Session.VALID && SessionService.isSendPropertyNotification(key)) {
    SessionService.getSessionService().sendEvent(this,SessionEvent.PROPERTY_CHANGED);
    SessionService.getSessionService().logEvent(this,SessionEvent.PROPERTY_CHANGED);
  }
  updateForFailover();
}

Fixed version (ground truth):
/** 
 * Sets the key-value pair in the Internal Session property table.
 * @param key Property key
 * @param value Property value for the key
 */
protected void internalPutProperty(String key,String value){
  if (key.equals(HOST_NAME) || key.equals(HOST)) {
    if (value == null || value.length() == 0) {
      return;
    }
    if (isEnableHostLookUp) {
      try {
        InetAddress address=java.net.InetAddress.getByName(value);
        String hostName=address.getHostName();
        sessionProperties.put(HOST_NAME,hostName);
        sessionProperties.put(HOST,value);
      }
 catch (      UnknownHostException uhe) {
        debug.error("String_Node_Str" + "String_Node_Str" + value + "String_Node_Str",uhe);
      }
    }
 else {
      sessionProperties.put(HOST_NAME,value);
      sessionProperties.put(HOST,value);
    }
  }
 else   if (key.equals(AM_MAX_IDLE_TIME)) {
    setMaxIdleTime(Long.parseLong(value));
  }
 else {
    sessionProperties.put(key,value);
  }
  if (sessionState == Session.VALID && SessionService.isSendPropertyNotification(key)) {
    SessionService.getSessionService().sendEvent(this,SessionEvent.PROPERTY_CHANGED);
    SessionService.getSessionService().logEvent(this,SessionEvent.PROPERTY_CHANGED);
  }
  updateForFailover();
}
Program: 79875
Project: 79875
Buggy source:
/** 
 * Checks whether the sesion should be destroyed or not.
 */
boolean shouldDestroy(){
  if (willExpireFlag == false) {
    return false;
  }
  if (!isTimedOut()) {
    if (sessionState == Session.INVALID) {
      if (checkInvalidSessionDefaultIdleTime()) {
        setState(Session.DESTROYED);
        ss.sendEvent(this,SessionEvent.DESTROY);
        return true;
      }
 else {
        return false;
      }
    }
    if (getTimeLeft() == 0) {
      changeStateAndNotify(SessionEvent.MAX_TIMEOUT);
      return false;
    }
    if (getIdleTime() >= maxIdleTime * 60 && sessionState != Session.INACTIVE) {
      changeStateAndNotify(SessionEvent.IDLE_TIMEOUT);
      return false;
    }
    return false;
  }
 else {
    if (getTimeLeftBeforePurge() <= 0) {
      SessionService.getSessionService().logEvent(this,SessionEvent.DESTROY);
      setState(Session.DESTROYED);
      SessionService.getSessionService().sendEvent(this,SessionEvent.DESTROY);
      return true;
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
/** 
 * Checks whether the sesion should be destroyed or not.
 */
boolean shouldDestroy(){
  if (willExpireFlag == false) {
    return false;
  }
  if (!isTimedOut()) {
    if (isInvalid()) {
      if (checkInvalidSessionDefaultIdleTime()) {
        setState(Session.DESTROYED);
        ss.sendEvent(this,SessionEvent.DESTROY);
        return true;
      }
 else {
        return false;
      }
    }
    if (getTimeLeft() == 0) {
      changeStateAndNotify(SessionEvent.MAX_TIMEOUT);
      return false;
    }
    if (getIdleTime() >= maxIdleTime * 60 && sessionState != Session.INACTIVE) {
      changeStateAndNotify(SessionEvent.IDLE_TIMEOUT);
      return false;
    }
    return false;
  }
 else {
    if (getTimeLeftBeforePurge() <= 0) {
      SessionService.getSessionService().logEvent(this,SessionEvent.DESTROY);
      setState(Session.DESTROYED);
      SessionService.getSessionService().sendEvent(this,SessionEvent.DESTROY);
      return true;
    }
 else {
      return false;
    }
  }
}
Program: 79877
Project: 79877
Buggy source:
/** 
 * Removes the Internal Session from the Internal Session table.
 * @param sid Session ID
 */
InternalSession removeInternalSession(SessionID sid){
  boolean isSessionStored=true;
  if (sid == null)   return null;
  InternalSession session=(InternalSession)sessionTable.remove(sid);
  if (session != null) {
    remoteSessionSet.remove(sid);
    session.cancel();
    removeSessionHandle(session);
    removeRestrictedTokens(session);
    isSessionStored=session.getIsISstored();
    if (session.getState() == Session.VALID) {
      decrementActiveSessions();
      SessionCount.decrementSessionCount(session);
    }
  }
  if (isSessionFailoverEnabled && isSessionStored) {
    if (getUseInternalRequestRouting()) {
      try {
        String tokenId=tokenIdFactory.toSessionTokenId(session);
        getRepository().delete(tokenId);
      }
 catch (      Exception e) {
        sessionDebug.error("String_Node_Str",e);
      }
    }
 else {
      invalidateHttpSession(sid);
    }
  }
  return session;
}

Fixed version (ground truth):
/** 
 * Removes the Internal Session from the Internal Session table.
 * @param sid Session ID
 */
InternalSession removeInternalSession(SessionID sid){
  boolean isSessionStored=false;
  if (sid == null)   return null;
  InternalSession session=(InternalSession)sessionTable.remove(sid);
  if (session != null) {
    remoteSessionSet.remove(sid);
    session.cancel();
    removeSessionHandle(session);
    removeRestrictedTokens(session);
    isSessionStored=session.getIsISstored();
    if (session.getState() == Session.VALID) {
      decrementActiveSessions();
      SessionCount.decrementSessionCount(session);
    }
  }
  if (isSessionFailoverEnabled && isSessionStored) {
    if (getUseInternalRequestRouting()) {
      try {
        String tokenId=tokenIdFactory.toSessionTokenId(session);
        getRepository().delete(tokenId);
      }
 catch (      Exception e) {
        sessionDebug.error("String_Node_Str",e);
      }
    }
 else {
      invalidateHttpSession(sid);
    }
  }
  return session;
}
Program: 79881
Project: 79881
Buggy source:
/** 
 * Creates a default instance with dependencies defined.
 * @param tokenIdFactory Non null.
 * @param config Non null.
 * @param serialisation Non null.
 * @param blobUtils
 */
@Inject public SessionAdapter(TokenIdFactory tokenIdFactory,CoreTokenConfig config,JSONSerialisation serialisation,LDAPDataConversion dataConversion,TokenBlobUtils blobUtils){
  this.tokenIdFactory=tokenIdFactory;
  this.config=config;
  this.serialisation=serialisation;
  this.dataConversion=dataConversion;
  this.blobUtils=blobUtils;
}

Fixed version (ground truth):
/** 
 * Creates a default instance with dependencies defined.
 * @param tokenIdFactory Non null.
 * @param config Non null.
 * @param serialisation Non null.
 * @param blobUtils A collection of Binary Object utilities.
 */
@Inject public SessionAdapter(TokenIdFactory tokenIdFactory,CoreTokenConfig config,JSONSerialisation serialisation,LDAPDataConversion dataConversion,TokenBlobUtils blobUtils){
  this.tokenIdFactory=tokenIdFactory;
  this.config=config;
  this.serialisation=serialisation;
  this.dataConversion=dataConversion;
  this.blobUtils=blobUtils;
}
Program: 79882
Project: 79882
Buggy source:
@Post("String_Node_Str") public Representation represent(Representation entity){
  Representation rep=null;
  client=getAuthenticatedClient();
  if (client.getClient().getClientType().equals(ClientApplication.ClientType.PUBLIC)) {
    OAuth2Utils.DEBUG.warning("String_Node_Str");
    throw OAuthProblemException.OAuthError.INVALID_CLIENT.handle(getRequest(),"String_Node_Str");
  }
  String scope_before=OAuth2Utils.getRequestParameter(getRequest(),OAuth2Constants.Params.SCOPE,String.class);
  Set<String> checkedScope=executeAccessTokenScopePlugin(scope_before);
  CoreToken token=createAccessToken(checkedScope);
  Map<String,Object> response=token.convertToMap();
  Map<String,String> data=new HashMap<String,String>();
  response.putAll(executeExtraDataScopePlugin(data,token));
  if (checkedScope != null && !checkedScope.isEmpty()) {
    response.put(OAuth2Constants.Params.SCOPE,OAuth2Utils.join(checkedScope,OAuth2Utils.getScopeDelimiter(getContext())));
  }
  return new JacksonRepresentation<Map>(response);
}

Fixed version (ground truth):
@Post("String_Node_Str") public Representation represent(Representation entity){
  Representation rep=null;
  client=getAuthenticatedClient();
  if (client.getClient().getClientType().equals(ClientApplication.ClientType.PUBLIC)) {
    OAuth2Utils.DEBUG.warning("String_Node_Str");
    throw OAuthProblemException.OAuthError.UNAUTHORIZED_CLIENT.handle(getRequest(),"String_Node_Str");
  }
  String scope_before=OAuth2Utils.getRequestParameter(getRequest(),OAuth2Constants.Params.SCOPE,String.class);
  Set<String> checkedScope=executeAccessTokenScopePlugin(scope_before);
  CoreToken token=createAccessToken(checkedScope);
  Map<String,Object> response=token.convertToMap();
  Map<String,String> data=new HashMap<String,String>();
  response.putAll(executeExtraDataScopePlugin(data,token));
  if (checkedScope != null && !checkedScope.isEmpty()) {
    response.put(OAuth2Constants.Params.SCOPE,OAuth2Utils.join(checkedScope,OAuth2Utils.getScopeDelimiter(getContext())));
  }
  return new JacksonRepresentation<Map>(response);
}
Program: 79883
Project: 79883
Buggy source:
private String getPasswordFromHeader(ServerContext context){
  return RestUtils.getCookieFromServerContext(context);
}

Fixed version (ground truth):
private String getPasswordFromHeader(ServerContext context){
  List<String> headerList=null;
  String oldUserPasswordHeaderName="String_Node_Str";
  HttpContext header=null;
  try {
    header=context.asContext(HttpContext.class);
    if (header == null) {
      RestDispatcher.debug.error("String_Node_Str" + "String_Node_Str");
      return null;
    }
    headerList=header.getHeaders().get(oldUserPasswordHeaderName.toLowerCase());
    if (headerList != null && !headerList.isEmpty()) {
      for (      String s : headerList) {
        return (s != null && !s.isEmpty()) ? s : null;
      }
    }
  }
 catch (  Exception e) {
    RestDispatcher.debug.error("String_Node_Str" + "String_Node_Str" + e);
  }
  return null;
}
Program: 79885
Project: 79885
Buggy source:
/** 
 * Update an existing Token in the store. If the Token does not exist in the store then a Token is created. If the Token did exist in the store then it is updated. Not all fields on the Token can be updated, see the Token class for more details.
 * @see Token
 * @param token Non null Token to update.
 * @throws CoreTokenException If there was a non-recoverable error during the operation.
 */
public void update(Token token) throws CoreTokenException {
  try {
    strategy.perfom(token);
  }
 catch (  TokenStrategyFailedException e) {
    throw new CoreTokenException("String_Node_Str",e);
  }
  getAdapter().update(token);
  if (DEBUG.messageEnabled()) {
    DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str",token.getTokenId()));
  }
}

Fixed version (ground truth):
/** 
 * Update an existing Token in the store. If the Token does not exist in the store then a Token is created. If the Token did exist in the store then it is updated. Not all fields on the Token can be updated, see the Token class for more details.
 * @see Token
 * @param token Non null Token to update.
 * @throws CoreTokenException If there was a non-recoverable error during the operation.
 */
public void update(Token token) throws CoreTokenException {
  try {
    strategy.perfom(token);
  }
 catch (  TokenStrategyFailedException e) {
    throw new CoreTokenException("String_Node_Str",e);
  }
  adapter.updateOrCreate(token);
  if (DEBUG.messageEnabled()) {
    DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str",token.getTokenId()));
  }
}
Program: 79886
Project: 79886
Buggy source:
/** 
 * Delete a collection of Tokens from the Token Store using a filter to narrow down the Tokens to be deleted. Note: This operation is linear in its execution time so the more Tokens being deleted, the longer it will take.
 * @param query Non null filters which will be combined logically using AND.
 * @return total number of tokens deleted by query.
 * @throws DeleteFailedException If the delete failed for any reason.
 */
public int delete(Map<CoreTokenField,Object> query) throws DeleteFailedException {
  QueryFilter.QueryFilterBuilder queryFilter=getAdapter().buildFilter().and();
  for (  Map.Entry<CoreTokenField,Object> entry : query.entrySet()) {
    CoreTokenField key=entry.getKey();
    Object value=entry.getValue();
    queryFilter=queryFilter.attribute(key,value);
  }
  QueryBuilder builder=getAdapter().query().withFilter(queryFilter.build()).returnTheseAttributes(CoreTokenField.TOKEN_ID);
  Collection<Entry> entries;
  try {
    entries=builder.executeRawResults();
    for (    Entry entry : entries) {
      Attribute attribute=entry.getAttribute(CoreTokenField.TOKEN_ID.toString());
      String tokenId=attribute.firstValueAsString();
      getAdapter().delete(tokenId);
    }
    if (DEBUG.messageEnabled()) {
      DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str",entries.size()));
    }
  }
 catch (  CoreTokenException e) {
    throw new DeleteFailedException(builder,e);
  }
  return entries.size();
}

Fixed version (ground truth):
/** 
 * Delete a collection of Tokens from the Token Store using a filter to narrow down the Tokens to be deleted. Note: This operation is linear in its execution time so the more Tokens being deleted, the longer it will take.
 * @param query Non null filters which will be combined logically using AND.
 * @return total number of tokens deleted by query.
 * @throws DeleteFailedException If the delete failed for any reason.
 */
public int delete(Map<CoreTokenField,Object> query) throws DeleteFailedException {
  QueryFilter.QueryFilterBuilder queryFilter=adapter.buildFilter().and();
  for (  Map.Entry<CoreTokenField,Object> entry : query.entrySet()) {
    CoreTokenField key=entry.getKey();
    Object value=entry.getValue();
    queryFilter=queryFilter.attribute(key,value);
  }
  QueryBuilder builder=adapter.query().withFilter(queryFilter.build()).returnTheseAttributes(CoreTokenField.TOKEN_ID);
  Collection<Entry> entries;
  try {
    entries=builder.executeRawResults();
    for (    Entry entry : entries) {
      Attribute attribute=entry.getAttribute(CoreTokenField.TOKEN_ID.toString());
      String tokenId=attribute.firstValueAsString();
      adapter.delete(tokenId);
    }
    if (DEBUG.messageEnabled()) {
      DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str",entries.size()));
    }
  }
 catch (  CoreTokenException e) {
    throw new DeleteFailedException(builder,e);
  }
  return entries.size();
}
Program: 79887
Project: 79887
Buggy source:
/** 
 * Private restricted to preserve Singleton Instantiation.
 */
@Inject public CTSPersistentStore(CoreTokenConfig coreTokenConfig,LDAPDataConversion dataConversion,DataLayerConnectionFactory connectionFactory,TokenBlobStrategy strategy){
  this.coreTokenConfig=coreTokenConfig;
  this.dataConversion=dataConversion;
  this.strategy=strategy;
  this.connectionFactory=connectionFactory;
  this.DEBUG=SessionService.sessionDebug;
}

Fixed version (ground truth):
/** 
 * Private restricted to preserve Singleton Instantiation.
 */
@Inject public CTSPersistentStore(CoreTokenConfig coreTokenConfig,LDAPDataConversion dataConversion,TokenBlobStrategy strategy,CoreTokenAdapter adapter){
  this.coreTokenConfig=coreTokenConfig;
  this.dataConversion=dataConversion;
  this.strategy=strategy;
  this.adapter=adapter;
  this.DEBUG=SessionService.sessionDebug;
}
Program: 79888
Project: 79888
Buggy source:
/** 
 * Create a Token in the persistent store. If the Token already exists in the store then this function will throw a CoreTokenException. Instead it is recommended to use the update function.
 * @see CTSPersistentStore#update(com.sun.identity.sm.ldap.api.tokens.Token)
 * @param token Non null Token to create.
 * @throws CoreTokenException If there was a non-recoverable error during the operation or ifthe Token already exists in the store.
 */
public void create(Token token) throws CoreTokenException {
  try {
    strategy.perfom(token);
  }
 catch (  TokenStrategyFailedException e) {
    throw new CoreTokenException("String_Node_Str",e);
  }
  getAdapter().create(token);
}

Fixed version (ground truth):
/** 
 * Create a Token in the persistent store. If the Token already exists in the store then this function will throw a CoreTokenException. Instead it is recommended to use the update function.
 * @see CTSPersistentStore#update(com.sun.identity.sm.ldap.api.tokens.Token)
 * @param token Non null Token to create.
 * @throws CoreTokenException If there was a non-recoverable error during the operation or ifthe Token already exists in the store.
 */
public void create(Token token) throws CoreTokenException {
  try {
    strategy.perfom(token);
  }
 catch (  TokenStrategyFailedException e) {
    throw new CoreTokenException("String_Node_Str",e);
  }
  adapter.create(token);
}
Program: 79889
Project: 79889
Buggy source:
/** 
 * Read a Token from the persistent store.
 * @param tokenId The non null Token Id that the Token was created with.
 * @return Null if there was no matching Token. Otherwise a fully populated Token will be returned.
 * @throws CoreTokenException If there was a non-recoverable error during the operation.
 */
public Token read(String tokenId) throws CoreTokenException {
  Token token=getAdapter().read(tokenId);
  try {
    strategy.reverse(token);
  }
 catch (  TokenStrategyFailedException e) {
    throw new CoreTokenException("String_Node_Str",e);
  }
  return token;
}

Fixed version (ground truth):
/** 
 * Read a Token from the persistent store.
 * @param tokenId The non null Token Id that the Token was created with.
 * @return Null if there was no matching Token. Otherwise a fully populated Token will be returned.
 * @throws CoreTokenException If there was a non-recoverable error during the operation.
 */
public Token read(String tokenId) throws CoreTokenException {
  Token token=adapter.read(tokenId);
  try {
    strategy.reverse(token);
  }
 catch (  TokenStrategyFailedException e) {
    throw new CoreTokenException("String_Node_Str",e);
  }
  return token;
}
Program: 79890
Project: 79890
Buggy source:
/** 
 * Returns the expiration information of all sessions belonging to a user. The returned value will be a Map (sid->expiration_time).
 * @param uuid User's universal unique ID.
 * @return Map of all Session for the user
 * @throws Exception if there is any problem with accessing the sessionrepository.
 */
public Map<String,Long> getTokensByUUID(String uuid) throws CoreTokenException {
  Collection<Entry> entries;
  Filter filter=getAdapter().buildFilter().and().userId(uuid).build();
  entries=getAdapter().query().withFilter(filter).returnTheseAttributes(CoreTokenField.TOKEN_ID,CoreTokenField.EXPIRY_DATE).executeRawResults();
  if (DEBUG.messageEnabled()) {
    DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str" + "String_Node_Str",entries.size(),uuid));
  }
  Map<String,Long> sessions=new HashMap<String,Long>();
  for (  Entry entry : entries) {
    String sessionId=entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString();
    String dateString=entry.getAttribute(CoreTokenField.EXPIRY_DATE.toString()).firstValueAsString();
    Calendar timestamp=dataConversion.fromLDAPDate(dateString);
    long epochedSeconds=dataConversion.toEpochedSeconds(timestamp);
    sessions.put(sessionId,epochedSeconds);
  }
  return sessions;
}

Fixed version (ground truth):
/** 
 * Returns the expiration information of all sessions belonging to a user. The returned value will be a Map (sid->expiration_time).
 * @param uuid User's universal unique ID.
 * @return Map of all Session for the user
 * @throws Exception if there is any problem with accessing the sessionrepository.
 */
public Map<String,Long> getTokensByUUID(String uuid) throws CoreTokenException {
  Collection<Entry> entries;
  Filter filter=adapter.buildFilter().and().userId(uuid).build();
  entries=adapter.query().withFilter(filter).returnTheseAttributes(CoreTokenField.TOKEN_ID,CoreTokenField.EXPIRY_DATE).executeRawResults();
  if (DEBUG.messageEnabled()) {
    DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str" + "String_Node_Str",entries.size(),uuid));
  }
  Map<String,Long> sessions=new HashMap<String,Long>();
  for (  Entry entry : entries) {
    String sessionId=entry.getAttribute(CoreTokenField.TOKEN_ID.toString()).firstValueAsString();
    String dateString=entry.getAttribute(CoreTokenField.EXPIRY_DATE.toString()).firstValueAsString();
    Calendar timestamp=dataConversion.fromLDAPDate(dateString);
    long epochedSeconds=dataConversion.toEpochedSeconds(timestamp);
    sessions.put(sessionId,epochedSeconds);
  }
  return sessions;
}
Program: 79891
Project: 79891
Buggy source:
/** 
 * Performs a list operation against the Core Token Service with a predefined filter. This allows more complex filters to be constructed and is intended to be used with the QueryFilter fluent class.
 * @see QueryFilter
 * @param filter A non null OpenDJ LDAP Filter to use to control the results returned.
 * @return A non null, but possible empty collection of Tokens.
 * @throws CoreTokenException If there was an unrecoverable error.
 */
public Collection<Token> list(Filter filter) throws CoreTokenException {
  Collection<Token> tokens=getAdapter().query().withFilter(filter).execute();
  decryptTokens(tokens);
  return tokens;
}

Fixed version (ground truth):
/** 
 * Performs a list operation against the Core Token Service with a predefined filter. This allows more complex filters to be constructed and is intended to be used with the QueryFilter fluent class.
 * @see QueryFilter
 * @param filter A non null OpenDJ LDAP Filter to use to control the results returned.
 * @return A non null, but possible empty collection of Tokens.
 * @throws CoreTokenException If there was an unrecoverable error.
 */
public Collection<Token> list(Filter filter) throws CoreTokenException {
  Collection<Token> tokens=adapter.query().withFilter(filter).execute();
  decryptTokens(tokens);
  return tokens;
}
Program: 79892
Project: 79892
Buggy source:
/** 
 * Delete all Expired Sessions, within Default Limits.
 * @return True if there are more tokens to delete.
 * @throws CoreTokenException If there was a problem performing the delete.
 */
private boolean deleteExpired() throws CoreTokenException {
  Calendar nowTimestamp=Calendar.getInstance();
  Filter filter=getAdapter().buildFilter().and().beforeDate(nowTimestamp).build();
  Collection<Entry> entries=getAdapter().query().withFilter(filter).limitResultsTo(coreTokenConfig.getExpiredSessionsSearchLimit()).returnTheseAttributes(CoreTokenField.TOKEN_ID).executeRawResults();
  for (  Entry entry : entries) {
    Attribute attribute=entry.getAttribute(CoreTokenField.TOKEN_ID.toString());
    String tokenId=attribute.firstValueAsString();
    delete(tokenId);
  }
  if (DEBUG.messageEnabled()) {
    DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str",entries.size()));
  }
  return entries.size() == coreTokenConfig.getExpiredSessionsSearchLimit();
}

Fixed version (ground truth):
/** 
 * Delete all Expired Sessions, within Default Limits.
 * @return True if there are more tokens to delete.
 * @throws CoreTokenException If there was a problem performing the delete.
 */
private boolean deleteExpired() throws CoreTokenException {
  Calendar nowTimestamp=Calendar.getInstance();
  Filter filter=adapter.buildFilter().and().beforeDate(nowTimestamp).build();
  Collection<Entry> entries=adapter.query().withFilter(filter).limitResultsTo(coreTokenConfig.getExpiredSessionsSearchLimit()).returnTheseAttributes(CoreTokenField.TOKEN_ID).executeRawResults();
  for (  Entry entry : entries) {
    Attribute attribute=entry.getAttribute(CoreTokenField.TOKEN_ID.toString());
    String tokenId=attribute.firstValueAsString();
    delete(tokenId);
  }
  if (DEBUG.messageEnabled()) {
    DEBUG.message(MessageFormat.format(CoreTokenConstants.DEBUG_HEADER + "String_Node_Str",entries.size()));
  }
  return entries.size() == coreTokenConfig.getExpiredSessionsSearchLimit();
}
Program: 79893
Project: 79893
Buggy source:
/** 
 * Provide Service Instance Access to our Singleton
 * @return CTSPersistentStore Singleton Instance.
 */
public static final CTSPersistentStore getInstance(){
synchronized (CTSPersistentStore.class) {
    if (instance == null) {
      instance=new CTSPersistentStore(InjectorHolder.getInstance(CoreTokenConfig.class),InjectorHolder.getInstance(LDAPDataConversion.class),InjectorHolder.getInstance(DataLayerConnectionFactory.class),InjectorHolder.getInstance(TokenBlobStrategy.class));
      try {
        initialize();
      }
 catch (      StoreException se) {
        DEBUG.error("String_Node_Str" + se.getMessage());
        DEBUG.error("String_Node_Str");
      }
    }
  }
  return instance;
}

Fixed version (ground truth):
/** 
 * Provide Service Instance Access to our Singleton
 * @return CTSPersistentStore Singleton Instance.
 */
public static final CTSPersistentStore getInstance(){
synchronized (CTSPersistentStore.class) {
    if (instance == null) {
      instance=new CTSPersistentStore(InjectorHolder.getInstance(CoreTokenConfig.class),InjectorHolder.getInstance(LDAPDataConversion.class),InjectorHolder.getInstance(TokenBlobStrategy.class),InjectorHolder.getInstance(CoreTokenAdapter.class));
      try {
        initialize();
      }
 catch (      StoreException se) {
        DEBUG.error("String_Node_Str" + se.getMessage());
        DEBUG.error("String_Node_Str");
      }
    }
  }
  return instance;
}
Program: 79894
Project: 79894
Buggy source:
public QueryFailedException(Connection connection,DN dn,Filter filter,Throwable e){
  super(MessageFormat.format("String_Node_Str" + CoreTokenConstants.DEBUG_HEADER + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",dn,connection,filter),e);
}

Fixed version (ground truth):
/** 
 * Creates a formatted exception based on the values provided.
 * @param connection Connection used to make the query.
 * @param dn May be null. DN which was used in the query.
 * @param filter May be null. Filter used in query.
 * @param e Reason for the exception.
 */
public QueryFailedException(Connection connection,DN dn,Filter filter,Throwable e){
  super(MessageFormat.format("String_Node_Str" + CoreTokenConstants.DEBUG_HEADER + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",dn,connection,filter),e);
}
Program: 79895
Project: 79895
Buggy source:
public SetFailedException(Token token,ModifyRequest diff,Throwable e){
  super(MessageFormat.format("String_Node_Str" + CoreTokenConstants.DEBUG_HEADER + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",token,diff),e);
}

Fixed version (ground truth):
public SetFailedException(Token token,Throwable e){
  super(MessageFormat.format("String_Node_Str" + CoreTokenConstants.DEBUG_HEADER + "String_Node_Str"+ "String_Node_Str",token),e);
}
Program: 79897
Project: 79897
Buggy source:
/** 
 * Common Get Instance method to obtain access to Service Methods.
 * @return AMTokenRepository Singleton Instance.
 * @throws Exception
 */
public static AMTokenRepository getInstance() throws Exception {
  if (amTokenRepository == null) {
    if (CTS_REPOSITORY_CLASS_NAME.equals(CTSPersistentStore.class.getName())) {
      amTokenRepository=CTSPersistentStore.getInstance();
    }
 else     if (CTS_REPOSITORY_CLASS_NAME.equals(com.sun.identity.sm.mq.JMQSessionRepository.class.getName())) {
      amTokenRepository=com.sun.identity.sm.mq.JMQSessionRepository.getInstance();
    }
 else {
      throw new IllegalAccessException("String_Node_Str" + CTS_REPOSITORY_CLASS_NAME + "String_Node_Str");
    }
  }
  return amTokenRepository;
}

Fixed version (ground truth):
/** 
 * Common Get Instance method to obtain access to Service Methods.
 * @return AMTokenRepository Singleton Instance.
 * @throws Exception
 */
public static AMTokenRepository getInstance() throws Exception {
  if (amTokenRepository == null) {
    if (CTS_REPOSITORY_CLASS_NAME.equals(CTSPersistentStore.class.getName())) {
      amTokenRepository=CTSPersistentStore.getInstance();
    }
 else     if (CTS_REPOSITORY_CLASS_NAME.equals(com.sun.identity.sm.mq.JMQSessionRepository.class.getName())) {
      amTokenRepository=com.sun.identity.sm.mq.JMQSessionRepository.getInstance();
    }
 else {
      throw new IllegalAccessException("String_Node_Str" + CTS_REPOSITORY_CLASS_NAME + "String_Node_Str");
    }
  }
  if (amTokenRepository == null) {
    throw new IllegalAccessError("String_Node_Str" + CTS_REPOSITORY_CLASS_NAME + "String_Node_Str");
  }
  return amTokenRepository;
}
Program: 79898
Project: 79898
Buggy source:
private void setErrorMessage(Exception e){
  String authErrorCode=null;
  if ((e != null) && (e instanceof L10NMessage)) {
    L10NMessage l10nE=(L10NMessage)e;
    authErrorCode=l10nE.getErrorCode();
    if (authErrorCode != null) {
      errorCode=authErrorCode;
      ErrorMessage=l10nE.getL10NMessage(com.sun.identity.shared.locale.Locale.getLocale(AuthUtils.getLocale(ac)));
    }
 else {
      if (ac != null) {
        ErrorMessage=ac.getErrorMessage();
        errorCode=ac.getErrorCode();
      }
    }
  }
  if (errorCode == null || errorCode.isEmpty()) {
    errorCode=AMAuthErrorCode.AUTH_ERROR;
    ErrorMessage=AuthUtils.getErrorMessage(errorCode);
  }
  if (ac != null) {
    errorTemplate=ac.getErrorTemplate();
  }
 else {
    errorTemplate=AuthUtils.getErrorTemplate(errorCode);
  }
  if (loginURL != null && errorCode.equals("String_Node_Str") && loginURL.isEmpty()) {
    setDisplayFieldValue(LOGIN_URL,AuthUtils.constructLoginURL(request));
  }
  if (loginDebug.messageEnabled()) {
    loginDebug.message("String_Node_Str" + ErrorMessage);
    loginDebug.message("String_Node_Str" + errorTemplate);
    loginDebug.message("String_Node_Str" + errorCode);
  }
  response.setHeader("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
private void setErrorMessage(Exception e){
  String authErrorCode=null;
  if ((e != null) && (e instanceof L10NMessage)) {
    L10NMessage l10nE=(L10NMessage)e;
    authErrorCode=l10nE.getErrorCode();
    if (authErrorCode != null) {
      errorCode=authErrorCode;
      ErrorMessage=l10nE.getL10NMessage(com.sun.identity.shared.locale.Locale.getLocale(AuthUtils.getLocale(ac)));
    }
  }
  if (authErrorCode == null) {
    if (ac != null) {
      errorCode=ac.getErrorCode();
      ErrorMessage=ac.getErrorMessage();
    }
  }
  if (errorCode == null || errorCode.isEmpty()) {
    errorCode=AMAuthErrorCode.AUTH_ERROR;
  }
  if (ErrorMessage == null || ErrorMessage.isEmpty()) {
    ErrorMessage=AuthUtils.getErrorMessage(errorCode);
  }
  if (ac != null) {
    errorTemplate=ac.getErrorTemplate();
  }
 else {
    errorTemplate=AuthUtils.getErrorTemplate(errorCode);
  }
  if (loginURL != null && errorCode.equals("String_Node_Str") && loginURL.isEmpty()) {
    setDisplayFieldValue(LOGIN_URL,AuthUtils.constructLoginURL(request));
  }
  if (loginDebug.messageEnabled()) {
    loginDebug.message("String_Node_Str" + ErrorMessage);
    loginDebug.message("String_Node_Str" + errorTemplate);
    loginDebug.message("String_Node_Str" + errorCode);
  }
  response.setHeader("String_Node_Str","String_Node_Str");
}
Program: 79902
Project: 79902
Buggy source:
@Override public void onResume(){
  super.onResume();
  Fragment fragment=getFragmentManager().findFragmentById(R.id.fragment_container);
  if (fragment instanceof ChooserFragment)   launchSelectionFragment(Source.WUNDERGROUND);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  Fragment fragment=getFragmentManager().findFragmentById(R.id.fragment_container);
  if (fragment instanceof ChooserFragment)   launchSelectionFragment(Source.WUNDERGROUND);
  Boolean needKey=!settings.getBoolean("String_Node_Str",false);
  if (fragment instanceof SelectWundergroundFragment && needKey)   launchSelectionFragment(Source.WUNDERGROUND);
}
Program: 79903
Project: 79903
Buggy source:
@Override public void onClick(View view){
  int used=settings.getInt("String_Node_Str",0);
  if (used >= limit)   Toast.makeText(getActivity().getApplicationContext(),getString(R.string.passed_limit_error),Toast.LENGTH_LONG).show();
 else   if (callback != null)   callback.testWunderground();
}

Fixed version (ground truth):
@Override public void onClick(View view){
  int used=settings.getInt("String_Node_Str",0);
  if (settings.getBoolean("String_Node_Str",false) && used >= limit)   Toast.makeText(getActivity().getApplicationContext(),getString(R.string.passed_limit_error),Toast.LENGTH_LONG).show();
 else   if (callback != null)   callback.testWunderground();
}
Program: 79905
Project: 79905
Buggy source:
private void launchChooser(TreeMap<String,String> options,String type,Boolean loop,int distance){
  setTitle(R.string.chooser_title);
  ChooserFragment chooserFragment=new ChooserFragment();
  getFragmentManager().beginTransaction().replace(R.id.fragment_container,chooserFragment).commit();
  getFragmentManager().executePendingTransactions();
  chooserFragment.populateList(options,type,loop,distance);
}

Fixed version (ground truth):
private void launchChooser(TreeMap<String,String> options,String type,Boolean loop,int distance){
  setTitle(R.string.chooser_title);
  ChooserFragment chooserFragment=new ChooserFragment();
  getFragmentManager().beginTransaction().replace(R.id.fragment_container,chooserFragment).addToBackStack(null).commit();
  getFragmentManager().executePendingTransactions();
  chooserFragment.populateList(options,type,loop,distance);
}
Program: 79906
Project: 79906
Buggy source:
private void viewWunderground(){
  String location=locationEditText.getText().toString();
  Boolean loop=loopSwitch.isChecked();
  int distance=Integer.parseInt(radiusNumber.getText().toString());
  String type=getResources().getStringArray(R.array.wunderground_type_values)[typeSpinner.getSelectedItemPosition()];
  callback.onWundergroundSelected(location,type,loop,distance);
}

Fixed version (ground truth):
private void viewWunderground(){
  String location=locationEditText.getText().toString();
  Boolean loop=loopSwitch.isChecked();
  int distance=Integer.parseInt(radiusNumber.getText().toString());
  String type=getResources().getStringArray(R.array.wunderground_type_values)[typeSpinner.getSelectedItemPosition()];
  if (!location.equals("String_Node_Str")) {
    callback.onWundergroundSelected(location,type,loop,distance);
    viewButton.setText(R.string.loading);
    viewButton.setEnabled(false);
  }
 else   locationEditText.setError(getString(R.string.empty_location_error));
}
Program: 79907
Project: 79907
Buggy source:
@Override public void onClick(View view){
  viewWunderground();
  viewButton.setText(R.string.loading);
  viewButton.setEnabled(false);
}

Fixed version (ground truth):
@Override public void onClick(View view){
  viewWunderground();
}
Program: 79910
Project: 79910
Buggy source:
private void scheduleRefresh(){
  if (timer != null) {
    timer.cancel();
    timer=null;
  }
  timer=new Timer();
  refreshed=true;
  timer.scheduleAtFixedRate(new TimerTask(){
    @Override public void run(){
      refreshed=false;
    }
  }
,1000 * 60 * 5,1000 * 60 * 5);
}

Fixed version (ground truth):
private void scheduleRefresh(){
  if (timer != null) {
    timer.cancel();
    timer=null;
  }
  timer=new Timer();
  refreshed=true;
  timer.schedule(new TimerTask(){
    @Override public void run(){
      refreshed=false;
      if (settings.getBoolean("String_Node_Str",false) && !paused) {
        runOnUiThread(new Runnable(){
          @Override public void run(){
            if (radarFragment != null)             radarFragment.refreshRadar();
            scheduleRefresh();
          }
        }
);
      }
    }
  }
,1000 * 60 * 5);
}
Program: 79911
Project: 79911
Buggy source:
@Override public void run(){
  refreshed=false;
}

Fixed version (ground truth):
@Override public void run(){
  if (radarFragment != null)   radarFragment.refreshRadar();
  scheduleRefresh();
}
Program: 79912
Project: 79912
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (source != Source.WUNDERGROUND || settings.getBoolean("String_Node_Str",false)) {
    if (!refreshed && !(loop && source == Source.MOSAIC)) {
      if (radarFragment != null)       radarFragment.refreshRadar();
      scheduleRefresh();
    }
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  paused=false;
  if (lastPause != null) {
    Date now=Calendar.getInstance().getTime();
    long seconds=(now.getTime() - lastPause.getTime()) / 1000;
    if (seconds > 60 * 5)     refreshed=false;
  }
  if (source != Source.WUNDERGROUND || settings.getBoolean("String_Node_Str",false)) {
    if (!refreshed && !(loop && source == Source.MOSAIC)) {
      if (settings.getBoolean("String_Node_Str",false)) {
        if (radarFragment != null)         radarFragment.refreshRadar();
        scheduleRefresh();
      }
    }
  }
}
Program: 79916
Project: 79916
Buggy source:
@Override public void onSuccess(int status,cz.msebera.android.httpclient.Header[] headers,JSONObject json){
  try {
    String responseString=json.getString("String_Node_Str");
    JSONObject response=new JSONObject(responseString);
    String featuresString=response.getString("String_Node_Str");
    JSONObject features=new JSONObject(featuresString);
    String success=features.getString("String_Node_Str");
    if (success != null) {
      SharedPreferences.Editor editor=settings.edit();
      editor.putBoolean("String_Node_Str",true);
      editor.apply();
      Toast.makeText(context,R.string.api_key_activated,Toast.LENGTH_LONG).show();
      checkApiKeyStatus(settings,false);
    }
  }
 catch (  JSONException e) {
    Toast.makeText(context,R.string.api_key_failed,Toast.LENGTH_LONG).show();
    SharedPreferences.Editor editor=settings.edit();
    editor.putBoolean("String_Node_Str",false);
    editor.apply();
    checkApiKeyStatus(settings,true);
  }
}

Fixed version (ground truth):
@Override public void onSuccess(int status,cz.msebera.android.httpclient.Header[] headers,JSONObject json){
  try {
    String responseString=json.getString("String_Node_Str");
    JSONObject response=new JSONObject(responseString);
    String featuresString=response.getString("String_Node_Str");
    JSONObject features=new JSONObject(featuresString);
    String success=features.getString("String_Node_Str");
    if (success != null) {
      SharedPreferences.Editor editor=settings.edit();
      editor.putBoolean("String_Node_Str",true);
      editor.apply();
      Toast.makeText(context,R.string.api_key_activated,Toast.LENGTH_LONG).show();
      checkApiKeyStatus(settings,false,true);
    }
  }
 catch (  JSONException e) {
    Toast.makeText(context,R.string.api_key_failed,Toast.LENGTH_LONG).show();
    SharedPreferences.Editor editor=settings.edit();
    editor.putBoolean("String_Node_Str",false);
    editor.apply();
    checkApiKeyStatus(settings,true,true);
  }
}
Program: 79918
Project: 79918
Buggy source:
public Drawable getDrawable(String source){
  Drawable d=getResources().getDrawable(R.mipmap.wunderground);
  int viewWidth=about.getWidth();
  int width=Math.round(viewWidth * 4 / 5);
  Float ratio=(float)d.getIntrinsicHeight() / d.getIntrinsicWidth();
  int height=Math.round(width * ratio);
  d.setBounds(0,0,width,height);
  return d;
}

Fixed version (ground truth):
public Drawable getDrawable(String source){
  Drawable d=getResources().getDrawable(R.mipmap.wunderground);
  int viewWidth=about.getWidth();
  int width=Math.round(viewWidth * 4 / 5);
  if (width > 770)   width=770;
  Float ratio=(float)d.getIntrinsicHeight() / d.getIntrinsicWidth();
  int height=Math.round(width * ratio);
  d.setBounds(0,0,width,height);
  return d;
}
Program: 79919
Project: 79919
Buggy source:
@Override public void onGlobalLayout(){
  Html.ImageGetter imageGetter=new Html.ImageGetter(){
    public Drawable getDrawable(    String source){
      Drawable d=getResources().getDrawable(R.mipmap.wunderground);
      int viewWidth=about.getWidth();
      int width=Math.round(viewWidth * 4 / 5);
      Float ratio=(float)d.getIntrinsicHeight() / d.getIntrinsicWidth();
      int height=Math.round(width * ratio);
      d.setBounds(0,0,width,height);
      return d;
    }
  }
;
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
    about.setText(Html.fromHtml(html.toString(),Html.FROM_HTML_MODE_LEGACY,imageGetter,null));
  }
 else {
    about.setText(Html.fromHtml(html.toString(),imageGetter,null));
  }
  about.setMovementMethod(LinkMovementMethod.getInstance());
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  Html.ImageGetter imageGetter=new Html.ImageGetter(){
    public Drawable getDrawable(    String source){
      Drawable d=getResources().getDrawable(R.mipmap.wunderground);
      int viewWidth=about.getWidth();
      int width=Math.round(viewWidth * 4 / 5);
      if (width > 770)       width=770;
      Float ratio=(float)d.getIntrinsicHeight() / d.getIntrinsicWidth();
      int height=Math.round(width * ratio);
      d.setBounds(0,0,width,height);
      return d;
    }
  }
;
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
    about.setText(Html.fromHtml(html.toString(),Html.FROM_HTML_MODE_LEGACY,imageGetter,null));
  }
 else {
    about.setText(Html.fromHtml(html.toString(),imageGetter,null));
  }
  about.setMovementMethod(LinkMovementMethod.getInstance());
}
Program: 79920
Project: 79920
Buggy source:
@Override protected void onResume(){
  super.onResume();
  if (settings.getBoolean("String_Node_Str",false)) {
    viewButton.setText(R.string.view_wunderground_image);
    viewButton.setEnabled(true);
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  if (settings.getBoolean("String_Node_Str",false) && viewButton != null) {
    viewButton.setText(R.string.view_wunderground_image);
    viewButton.setEnabled(true);
  }
}
Program: 79921
Project: 79921
Buggy source:
@Override public void onClick(View view){
  Intent settingsIntent=new Intent(getActivity(),SettingsActivity.class);
  startActivityForResult(settingsIntent,1);
}

Fixed version (ground truth):
@Override public void onClick(View view){
  if (callback != null)   callback.openSettings();
}
Program: 79922
Project: 79922
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_key_missing,container,false);
  Button needKey=view.findViewById(R.id.needKeyButton);
  needKey.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent browser=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str"));
      startActivity(browser);
    }
  }
);
  Button openSettings=view.findViewById(R.id.openSettingsButton);
  openSettings.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent settingsIntent=new Intent(getActivity(),SettingsActivity.class);
      startActivityForResult(settingsIntent,1);
    }
  }
);
  return view;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View view=inflater.inflate(R.layout.fragment_key_missing,container,false);
  Button needKey=view.findViewById(R.id.needKeyButton);
  needKey.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent browser=new Intent(Intent.ACTION_VIEW,Uri.parse("String_Node_Str"));
      startActivity(browser);
    }
  }
);
  Button openSettings=view.findViewById(R.id.openSettingsButton);
  openSettings.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (callback != null)       callback.openSettings();
    }
  }
);
  return view;
}