nus-yam/ex-repair huggingface dataset:
Program: 9254
Project: 9254
Buggy source:
protected Map<String,Object> getDataModel(Set<String> scopes){
  Map<String,Object> data=new HashMap<String,Object>(getRequest().getAttributes());
  data.put("String_Node_Str",getRequest().getResourceRef().toString());
  Set<String> displayNames=client.getClient().getDisplayName();
  Set<String> displayDescriptions=client.getClient().getDisplayDescription();
  Set<String> allScopes=client.getClient().getAllowedGrantScopes();
  String locale=OAuth2Utils.getLocale(getRequest());
  String displayName="String_Node_Str";
  String displayDescription="String_Node_Str";
  List<String> displayScope=new ArrayList<String>();
  displayName=getDisplayParameter(locale,displayNames);
  displayDescription=getDisplayParameter(locale,displayDescriptions);
  displayScope=getScopeDescriptionsForLocale(scopes,allScopes,locale);
  data.put("String_Node_Str",displayName);
  data.put("String_Node_Str",displayDescription);
  data.put("String_Node_Str",displayScope);
  return data;
}

Fixed version (ground truth):
protected Map<String,Object> getDataModel(Set<String> scopes){
  Map<String,Object> data=new HashMap<String,Object>(getRequest().getAttributes());
  data.put("String_Node_Str",getRequest().getResourceRef().toString());
  Set<String> displayNames=client.getClient().getDisplayName();
  Set<String> displayDescriptions=client.getClient().getDisplayDescription();
  Set<String> allScopes=client.getClient().getAllowedGrantScopes();
  String locale=OAuth2Utils.getLocale(getRequest());
  String displayName="String_Node_Str";
  String displayDescription="String_Node_Str";
  List<String> displayScope=null;
  displayName=getDisplayParameter(locale,displayNames);
  displayDescription=getDisplayParameter(locale,displayDescriptions);
  displayScope=getScopeDescriptionsForLocale(scopes,allScopes,locale);
  data.put("String_Node_Str",ESAPI.encoder().encodeForHTML(displayName));
  data.put("String_Node_Str",ESAPI.encoder().encodeForHTML(displayDescription));
  data.put("String_Node_Str",encodeListForHTML(displayScope));
  return data;
}
Program: 9255
Project: 9255
Buggy source:
/** 
 * The function to run when timeout.
 */
public void run(){
  if (!isTimedOut()) {
    if (sessionState == Session.INVALID) {
      setState(Session.DESTROYED);
      ss.removeInternalSession(sessionID);
      ss.sendEvent(this,SessionEvent.DESTROY);
    }
 else {
      long timeLeft=getTimeLeft();
      if (timeLeft == 0) {
        changeStateAndNotify(SessionEvent.MAX_TIMEOUT);
        if (timerPool != null) {
          if (purgeDelay > 0) {
            timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
          }
        }
      }
 else {
        long idleTimeLeft=(maxIdleTime * 60) - getIdleTime();
        if (idleTimeLeft <= 0 && sessionState != Session.INACTIVE) {
          changeStateAndNotify(SessionEvent.IDLE_TIMEOUT);
          if (timerPool != null) {
            if (purgeDelay > 0) {
              timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
            }
          }
        }
 else {
          long timeToWait=Math.min(timeLeft,idleTimeLeft);
          if (timerPool != null) {
            timerPool.schedule(this,new Date(((System.currentTimeMillis() / 1000) + timeToWait) * 1000));
          }
        }
      }
    }
  }
 else {
    ss.logEvent(this,SessionEvent.DESTROY);
    setState(Session.DESTROYED);
    ss.removeInternalSession(sessionID);
    ss.sendEvent(this,SessionEvent.DESTROY);
  }
}

Fixed version (ground truth):
/** 
 * The function to run when timeout.
 */
public void run(){
  if (!isTimedOut()) {
    if (isInvalid()) {
      removeSession();
    }
 else {
      long timeLeft=getTimeLeft();
      if (timeLeft == 0) {
        changeStateAndNotify(SessionEvent.MAX_TIMEOUT);
        if (timerPool != null) {
          if (purgeDelay > 0) {
            timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
          }
        }
      }
 else {
        long idleTimeLeft=(maxIdleTime * 60) - getIdleTime();
        if (idleTimeLeft <= 0 && sessionState != Session.INACTIVE) {
          changeStateAndNotify(SessionEvent.IDLE_TIMEOUT);
          if (timerPool != null) {
            if (purgeDelay > 0) {
              timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
            }
          }
        }
 else {
          long timeToWait=Math.min(timeLeft,idleTimeLeft);
          if (timerPool != null) {
            timerPool.schedule(this,new Date(((System.currentTimeMillis() / 1000) + timeToWait) * 1000));
          }
        }
      }
    }
  }
 else {
    removeSession();
  }
}
Program: 9256
Project: 9256
Buggy source:
/** 
 * Returns true if cookies are supported.
 * @return true if cookie supported;
 */
private boolean getCookieSupport(){
  boolean cookieSupport=false;
  try {
    if (sessionID.getCookieMode() != null) {
      cookieSupport=sessionID.getCookieMode().booleanValue();
    }
 else     if (this.cookieMode != null) {
      cookieSupport=this.cookieMode.booleanValue();
    }
  }
 catch (  Exception ex) {
    DEBUG.error("String_Node_Str",ex);
    cookieSupport=true;
  }
  if (DEBUG.messageEnabled()) {
    DEBUG.message("String_Node_Str" + cookieSupport);
  }
  return cookieSupport;
}

Fixed version (ground truth):
/** 
 * Returns true if cookies are supported.
 * @return true if cookie supported;
 */
private boolean getCookieSupport(){
  boolean cookieSupport=false;
  try {
    if (sessionID.getCookieMode() != null) {
      cookieSupport=sessionID.getCookieMode().booleanValue();
    }
 else     if (this.cookieMode != null) {
      cookieSupport=this.cookieMode.booleanValue();
    }
  }
 catch (  Exception ex) {
    debug.error("String_Node_Str",ex);
    cookieSupport=true;
  }
  if (debug.messageEnabled()) {
    debug.message("String_Node_Str" + cookieSupport);
  }
  return cookieSupport;
}
Program: 9257
Project: 9257
Buggy source:
/** 
 * Transfers the info about the Internal Session to Session Info.
 * @return SessionInfo
 */
public SessionInfo toSessionInfo(){
  SessionInfo info=new SessionInfo();
  info.sid=sessionID.toString();
  if (sessionType == Session.USER_SESSION) {
    info.stype="String_Node_Str";
  }
 else   if (sessionType == Session.APPLICATION_SESSION) {
    info.stype="String_Node_Str";
  }
  info.cid=clientID;
  info.cdomain=clientDomain;
  info.maxtime=Long.toString(getMaxSessionTime());
  info.maxidle=Long.toString(getMaxIdleTime());
  info.maxcaching=Long.toString(getMaxCachingTime());
  if (willExpireFlag == true) {
    info.timeidle=Long.toString(getIdleTime());
    info.timeleft=Long.toString(getTimeLeft());
  }
 else {
    info.timeidle=Long.toString(0);
    info.timeleft=Long.toString(Long.MAX_VALUE / 60);
  }
  if (sessionState == Session.INVALID) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.VALID) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.INACTIVE) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.DESTROYED) {
    info.state="String_Node_Str";
  }
  info.properties=(Properties)sessionProperties.clone();
  return info;
}

Fixed version (ground truth):
/** 
 * Transfers the info about the Internal Session to Session Info.
 * @return SessionInfo
 */
public SessionInfo toSessionInfo(){
  SessionInfo info=new SessionInfo();
  info.sid=sessionID.toString();
  if (sessionType == Session.USER_SESSION) {
    info.stype="String_Node_Str";
  }
 else   if (sessionType == Session.APPLICATION_SESSION) {
    info.stype="String_Node_Str";
  }
  info.cid=clientID;
  info.cdomain=clientDomain;
  info.maxtime=Long.toString(getMaxSessionTime());
  info.maxidle=Long.toString(getMaxIdleTime());
  info.maxcaching=Long.toString(getMaxCachingTime());
  if (willExpireFlag == true) {
    info.timeidle=Long.toString(getIdleTime());
    info.timeleft=Long.toString(getTimeLeft());
  }
 else {
    info.timeidle=Long.toString(0);
    info.timeleft=Long.toString(Long.MAX_VALUE / 60);
  }
  if (isInvalid()) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.VALID) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.INACTIVE) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.DESTROYED) {
    info.state="String_Node_Str";
  }
  info.properties=(Properties)sessionProperties.clone();
  return info;
}
Program: 9258
Project: 9258
Buggy source:
/** 
 * set the cookieMode based on whether the request has cookies or not. This method is called from createSSOToken(request) method in SSOTokenManager.
 * @param cookieMode ,Boolean value whether request has cookies or not.
 */
public void setCookieMode(Boolean cookieMode){
  DEBUG.message("String_Node_Str" + cookieMode);
  if (cookieMode != null) {
    this.cookieMode=cookieMode;
  }
}

Fixed version (ground truth):
/** 
 * set the cookieMode based on whether the request has cookies or not. This method is called from createSSOToken(request) method in SSOTokenManager.
 * @param cookieMode ,Boolean value whether request has cookies or not.
 */
public void setCookieMode(Boolean cookieMode){
  debug.message("String_Node_Str" + cookieMode);
  if (cookieMode != null) {
    this.cookieMode=cookieMode;
  }
}
Program: 9260
Project: 9260
Buggy source:
/** 
 * Sets the key-value pair in the InternalSession property table if it is not protected. If it is protected client should have permission to set it. This method is to be used in conjuction with SessionRequestHandler/SessionService invocation path If the property is protected, an attempt to remotely set a protected property is logged and the method throws an Exception. Otherwise invocation is delegated to internalPutProperty() Note that package default access is being used
 * @param clientToken Token of the client setting external property.
 * @param key Property key
 * @param value Property value for the key
 * @exception SessionException is thrown if the key is protected property.
 */
void putExternalProperty(SSOToken clientToken,String key,String value) throws SessionException {
  try {
    SessionUtils.checkPermissionToSetProperty(clientToken,key,value);
  }
 catch (  SessionException se) {
    SessionService.getSessionService().logIt(this,"String_Node_Str");
    throw se;
  }
  internalPutProperty(key,value);
  if (DEBUG.messageEnabled()) {
    DEBUG.message("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets the key-value pair in the InternalSession property table if it is not protected. If it is protected client should have permission to set it. This method is to be used in conjuction with SessionRequestHandler/SessionService invocation path If the property is protected, an attempt to remotely set a protected property is logged and the method throws an Exception. Otherwise invocation is delegated to internalPutProperty() Note that package default access is being used
 * @param clientToken Token of the client setting external property.
 * @param key Property key
 * @param value Property value for the key
 * @exception SessionException is thrown if the key is protected property.
 */
void putExternalProperty(SSOToken clientToken,String key,String value) throws SessionException {
  try {
    SessionUtils.checkPermissionToSetProperty(clientToken,key,value);
  }
 catch (  SessionException se) {
    SessionService.getSessionService().logIt(this,"String_Node_Str");
    throw se;
  }
  internalPutProperty(key,value);
  if (debug.messageEnabled()) {
    debug.message("String_Node_Str" + "String_Node_Str");
  }
}
Program: 9261
Project: 9261
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: 9262
Project: 9262
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: 9263
Project: 9263
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: 9264
Project: 9264
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: 9266
Project: 9266
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: 9270
Project: 9270
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: 9271
Project: 9271
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: 9273
Project: 9273
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: 9274
Project: 9274
Buggy source:
/** 
 * The function to run when timeout.
 */
public void run(){
  if (!isTimedOut()) {
    if (sessionState == Session.INVALID) {
      setState(Session.DESTROYED);
      ss.removeInternalSession(sessionID);
      ss.sendEvent(this,SessionEvent.DESTROY);
    }
 else {
      long timeLeft=getTimeLeft();
      if (timeLeft == 0) {
        changeStateAndNotify(SessionEvent.MAX_TIMEOUT);
        if (timerPool != null) {
          if (purgeDelay > 0) {
            timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
          }
        }
      }
 else {
        long idleTimeLeft=(maxIdleTime * 60) - getIdleTime();
        if (idleTimeLeft <= 0 && sessionState != Session.INACTIVE) {
          changeStateAndNotify(SessionEvent.IDLE_TIMEOUT);
          if (timerPool != null) {
            if (purgeDelay > 0) {
              timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
            }
          }
        }
 else {
          long timeToWait=Math.min(timeLeft,idleTimeLeft);
          if (timerPool != null) {
            timerPool.schedule(this,new Date(((System.currentTimeMillis() / 1000) + timeToWait) * 1000));
          }
        }
      }
    }
  }
 else {
    ss.logEvent(this,SessionEvent.DESTROY);
    setState(Session.DESTROYED);
    ss.removeInternalSession(sessionID);
    ss.sendEvent(this,SessionEvent.DESTROY);
  }
}

Fixed version (ground truth):
/** 
 * The function to run when timeout.
 */
public void run(){
  if (!isTimedOut()) {
    if (isInvalid()) {
      removeSession();
    }
 else {
      long timeLeft=getTimeLeft();
      if (timeLeft == 0) {
        changeStateAndNotify(SessionEvent.MAX_TIMEOUT);
        if (timerPool != null) {
          if (purgeDelay > 0) {
            timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
          }
        }
      }
 else {
        long idleTimeLeft=(maxIdleTime * 60) - getIdleTime();
        if (idleTimeLeft <= 0 && sessionState != Session.INACTIVE) {
          changeStateAndNotify(SessionEvent.IDLE_TIMEOUT);
          if (timerPool != null) {
            if (purgeDelay > 0) {
              timerPool.schedule(this,new Date((timedOutAt + (purgeDelay * 60)) * 1000));
            }
          }
        }
 else {
          long timeToWait=Math.min(timeLeft,idleTimeLeft);
          if (timerPool != null) {
            timerPool.schedule(this,new Date(((System.currentTimeMillis() / 1000) + timeToWait) * 1000));
          }
        }
      }
    }
  }
 else {
    removeSession();
  }
}
Program: 9275
Project: 9275
Buggy source:
/** 
 * Returns true if cookies are supported.
 * @return true if cookie supported;
 */
private boolean getCookieSupport(){
  boolean cookieSupport=false;
  try {
    if (sessionID.getCookieMode() != null) {
      cookieSupport=sessionID.getCookieMode().booleanValue();
    }
 else     if (this.cookieMode != null) {
      cookieSupport=this.cookieMode.booleanValue();
    }
  }
 catch (  Exception ex) {
    DEBUG.error("String_Node_Str",ex);
    cookieSupport=true;
  }
  if (DEBUG.messageEnabled()) {
    DEBUG.message("String_Node_Str" + cookieSupport);
  }
  return cookieSupport;
}

Fixed version (ground truth):
/** 
 * Returns true if cookies are supported.
 * @return true if cookie supported;
 */
private boolean getCookieSupport(){
  boolean cookieSupport=false;
  try {
    if (sessionID.getCookieMode() != null) {
      cookieSupport=sessionID.getCookieMode().booleanValue();
    }
 else     if (this.cookieMode != null) {
      cookieSupport=this.cookieMode.booleanValue();
    }
  }
 catch (  Exception ex) {
    debug.error("String_Node_Str",ex);
    cookieSupport=true;
  }
  if (debug.messageEnabled()) {
    debug.message("String_Node_Str" + cookieSupport);
  }
  return cookieSupport;
}
Program: 9276
Project: 9276
Buggy source:
/** 
 * Transfers the info about the Internal Session to Session Info.
 * @return SessionInfo
 */
public SessionInfo toSessionInfo(){
  SessionInfo info=new SessionInfo();
  info.sid=sessionID.toString();
  if (sessionType == Session.USER_SESSION) {
    info.stype="String_Node_Str";
  }
 else   if (sessionType == Session.APPLICATION_SESSION) {
    info.stype="String_Node_Str";
  }
  info.cid=clientID;
  info.cdomain=clientDomain;
  info.maxtime=Long.toString(getMaxSessionTime());
  info.maxidle=Long.toString(getMaxIdleTime());
  info.maxcaching=Long.toString(getMaxCachingTime());
  if (willExpireFlag == true) {
    info.timeidle=Long.toString(getIdleTime());
    info.timeleft=Long.toString(getTimeLeft());
  }
 else {
    info.timeidle=Long.toString(0);
    info.timeleft=Long.toString(Long.MAX_VALUE / 60);
  }
  if (sessionState == Session.INVALID) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.VALID) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.INACTIVE) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.DESTROYED) {
    info.state="String_Node_Str";
  }
  info.properties=(Properties)sessionProperties.clone();
  return info;
}

Fixed version (ground truth):
/** 
 * Transfers the info about the Internal Session to Session Info.
 * @return SessionInfo
 */
public SessionInfo toSessionInfo(){
  SessionInfo info=new SessionInfo();
  info.sid=sessionID.toString();
  if (sessionType == Session.USER_SESSION) {
    info.stype="String_Node_Str";
  }
 else   if (sessionType == Session.APPLICATION_SESSION) {
    info.stype="String_Node_Str";
  }
  info.cid=clientID;
  info.cdomain=clientDomain;
  info.maxtime=Long.toString(getMaxSessionTime());
  info.maxidle=Long.toString(getMaxIdleTime());
  info.maxcaching=Long.toString(getMaxCachingTime());
  if (willExpireFlag == true) {
    info.timeidle=Long.toString(getIdleTime());
    info.timeleft=Long.toString(getTimeLeft());
  }
 else {
    info.timeidle=Long.toString(0);
    info.timeleft=Long.toString(Long.MAX_VALUE / 60);
  }
  if (isInvalid()) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.VALID) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.INACTIVE) {
    info.state="String_Node_Str";
  }
 else   if (sessionState == Session.DESTROYED) {
    info.state="String_Node_Str";
  }
  info.properties=(Properties)sessionProperties.clone();
  return info;
}
Program: 9277
Project: 9277
Buggy source:
/** 
 * set the cookieMode based on whether the request has cookies or not. This method is called from createSSOToken(request) method in SSOTokenManager.
 * @param cookieMode ,Boolean value whether request has cookies or not.
 */
public void setCookieMode(Boolean cookieMode){
  DEBUG.message("String_Node_Str" + cookieMode);
  if (cookieMode != null) {
    this.cookieMode=cookieMode;
  }
}

Fixed version (ground truth):
/** 
 * set the cookieMode based on whether the request has cookies or not. This method is called from createSSOToken(request) method in SSOTokenManager.
 * @param cookieMode ,Boolean value whether request has cookies or not.
 */
public void setCookieMode(Boolean cookieMode){
  debug.message("String_Node_Str" + cookieMode);
  if (cookieMode != null) {
    this.cookieMode=cookieMode;
  }
}
Program: 9279
Project: 9279
Buggy source:
/** 
 * Sets the key-value pair in the InternalSession property table if it is not protected. If it is protected client should have permission to set it. This method is to be used in conjuction with SessionRequestHandler/SessionService invocation path If the property is protected, an attempt to remotely set a protected property is logged and the method throws an Exception. Otherwise invocation is delegated to internalPutProperty() Note that package default access is being used
 * @param clientToken Token of the client setting external property.
 * @param key Property key
 * @param value Property value for the key
 * @exception SessionException is thrown if the key is protected property.
 */
void putExternalProperty(SSOToken clientToken,String key,String value) throws SessionException {
  try {
    SessionUtils.checkPermissionToSetProperty(clientToken,key,value);
  }
 catch (  SessionException se) {
    SessionService.getSessionService().logIt(this,"String_Node_Str");
    throw se;
  }
  internalPutProperty(key,value);
  if (DEBUG.messageEnabled()) {
    DEBUG.message("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets the key-value pair in the InternalSession property table if it is not protected. If it is protected client should have permission to set it. This method is to be used in conjuction with SessionRequestHandler/SessionService invocation path If the property is protected, an attempt to remotely set a protected property is logged and the method throws an Exception. Otherwise invocation is delegated to internalPutProperty() Note that package default access is being used
 * @param clientToken Token of the client setting external property.
 * @param key Property key
 * @param value Property value for the key
 * @exception SessionException is thrown if the key is protected property.
 */
void putExternalProperty(SSOToken clientToken,String key,String value) throws SessionException {
  try {
    SessionUtils.checkPermissionToSetProperty(clientToken,key,value);
  }
 catch (  SessionException se) {
    SessionService.getSessionService().logIt(this,"String_Node_Str");
    throw se;
  }
  internalPutProperty(key,value);
  if (debug.messageEnabled()) {
    debug.message("String_Node_Str" + "String_Node_Str");
  }
}
Program: 9280
Project: 9280
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: 9281
Project: 9281
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: 9282
Project: 9282
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: 9283
Project: 9283
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: 9285
Project: 9285
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: 9289
Project: 9289
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: 9290
Project: 9290
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);
}