Buggy code:
public class Sessions { public static final class SessionDatas implements Serializable { private final String key ; private final Map < String , Sessions . SessionData > sessionMetadatas ; public SessionDatas ( String key , Map < String , Sessions . SessionData > sessionMetadatas ) { } public String getKey ( ) { } public Sessions . SessionData getSessionData ( String sessionKey ) { } public boolean containsSessionKey ( String sessionKey ) { } public Map < String , Sessions . SessionData > getSessionMetadatas ( ) { } private Sessions . SessionDatas touch ( String sessionKey , Sessions . SessionData sessionData ) { } public String toString ( ) { } } public static final class SessionData implements Serializable , Comparable < Sessions . SessionData > { private final String sessionKey ; private final long expires ; private final long firstAccess ; private final long lastAccess ; private final long lastAccessNano ; private final Map < String , String > metadata ; public SessionData ( String sessionKey , long expires , long firstAccess , long lastAccess , long lastAccessNano , Map < String , String > metadata ) { } public String getSessionKey ( ) { } public long getExpires ( ) { } public long getFirstAccess ( ) { } public long getLastAccess ( ) { } public long getLastAccessNano ( ) { } public Map < String , String > getMetadata ( ) { } private Sessions . SessionData touch ( long expires , Map < String , String > metadata ) { } private Sessions . SessionData touch ( Map < String , String > metadata ) { } public boolean equals ( Object o ) { } public int hashCode ( ) { } public String toString ( ) { } public int compareTo ( Sessions . SessionData o ) { } } private final Map < String , Sessions . SessionDatas > sessions = new ConcurrentHashMap < String , Sessions . SessionDatas > ( ) ; private final int expires ; private final int limit ; public static final String ADDRESS_KEY = "_address" ; public static final String AGENT_KEY = "_agent" ; public Sessions ( int expires , int limit ) { } public void remove ( String key , String sessionKey ) { } public Sessions . SessionDatas getSessions ( String key ) { } private void saveSessions ( String key , Sessions . SessionDatas sessionDatas ) { } public Sessions . SessionDatas touch ( String key , String sessionKey , Map < String , String > metadata ) { } public Sessions . SessionDatas touch ( String key , String sessionKey , Map < String , String > metadata , long expires ) { if ( expires == ( - 1 ) ) return touch ( key , sessionKey , metadata ) ; Sessions . SessionDatas sessionDatas = getSessions ( key ) ; Map < String , Sessions . SessionData > sessionMetadatas ; Sessions . SessionDatas updatedSessionDatas ; Sessions . SessionData sessionData ; long access = System . currentTimeMillis ( ) ; if ( sessionDatas != null ) { sessionMetadatas = sessionDatas . getSessionMetadatas ( ) ; <START_BUG> sessionData = sessionMetadatas . get ( sessionKey ) ; <END_BUG> if ( sessionData != null ) { updatedSessionDatas = sessionDatas . touch ( sessionKey , sessionData . touch ( expires , metadata ) ) ; } else { updatedSessionDatas = sessionDatas . touch ( sessionKey , new Sessions . SessionData ( sessionKey , expires , access , access , System . nanoTime ( ) , metadata ) ) ; } } else { sessionMetadatas = new ConcurrentHashMap < String , Sessions . SessionData > ( ) ; sessionMetadatas . put ( sessionKey , new Sessions . SessionData ( sessionKey , expires , access , access , System . nanoTime ( ) , metadata ) ) ; updatedSessionDatas = new Sessions . SessionDatas ( key , sessionMetadatas ) ; } while ( ( sessionMetadatas . size ( ) ) > ( limit ) ) { removeOldest ( sessionMetadatas ) ; } saveSessions ( key , updatedSessionDatas ) ; return updatedSessionDatas ; } private void removeTimeout ( Map < String , Sessions . SessionData > sessionMetadatas ) { } private void removeOldest ( Map < String , Sessions . SessionData > sessionMetadatas ) { } }

Fix:
sessionData = ( ( sessionMetadatas != null ) && ( ( sessionMetadatas . size ( ) ) > 0 ) ) ? sessionMetadatas . get ( sessionKey ) : null ;