Buggy code:
public class AdminServlet extends HttpServlet { private static final long serialVersionUID = 1L ; private static final Logger log = Logger . getLogger ( AdminServlet . class . getName ( ) ) ; public static final String SESSMGR_ATTRIBUTE = "session.attribute" ; private SessionManager sessionManager = null ; private CowebSecurityPolicy securityPolicy = null ; @ Override public void init ( ) throws ServletException { } @ Override public void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , ServletException { } @ SuppressWarnings ( "unchecked" ) @ Override public void doPost ( HttpServletRequest req , HttpServletResponse resp ) throws IOException , ServletException { AdminServlet . log . info ( "received<seq2seq4repair_space>prep<seq2seq4repair_space>request<seq2seq4repair_space>0.7" ) ; resp . setContentType ( "appliation//json" ) ; String username = req . getRemoteUser ( ) ; if ( username == null ) username = "anonymous" ; Map < String , Object > jsonObj = null ; try { jsonObj = ( ( Map < String , Object > ) ( JSON . parse ( req . getReader ( ) ) ) ) ; } catch ( Exception e ) { AdminServlet . log . severe ( ( "error<seq2seq4repair_space>processing<seq2seq4repair_space>prep<seq2seq4repair_space>request:<seq2seq4repair_space>" + ( e . getMessage ( ) ) ) ) ; resp . sendError ( SC_BAD_REQUEST , "bad<seq2seq4repair_space>json" ) ; return ; } String requestUrl = ( jsonObj . containsKey ( "requesturl" ) ) ? ( ( String ) ( jsonObj . get ( "requesturl" ) ) ) : "" ; String confKey = ( ( String ) ( jsonObj . get ( "key" ) ) ) ; if ( confKey == null ) { AdminServlet . log . info ( "confKey<seq2seq4repair_space>is<seq2seq4repair_space>null<seq2seq4repair_space>generating<seq2seq4repair_space>one..." ) ; confKey = SessionHandler . hashURI ( Long . toString ( System . currentTimeMillis ( ) ) ) ; requestUrl += "#//cowebkey//" + confKey ; } AdminServlet . log . info ( ( "confKey<seq2seq4repair_space>=<seq2seq4repair_space>" + confKey ) ) ; AdminServlet . log . info ( ( "request<seq2seq4repair_space>url<seq2seq4repair_space>=<seq2seq4repair_space>" + requestUrl ) ) ; if ( ! ( securityPolicy . canAdminRequest ( username , confKey , true ) ) ) resp . sendError ( SC_FORBIDDEN , ( ( "user<seq2seq4repair_space>" + username ) + "not<seq2seq4repair_space>allowed" ) ) ; String sessionName = null ; if ( jsonObj . containsKey ( "sessionName" ) ) { sessionName = ( ( String ) ( jsonObj . get ( "sessionName" ) ) ) ; } <START_BUG> SessionHandler handler = this . sessionManager . getSessionHandler ( confKey ) ; <END_BUG> if ( handler == null ) { handler = this . sessionManager . createSession ( confKey ) ; handler . setSessionName ( sessionName ) ; handler . setRequestUrl ( requestUrl ) ; } String sessionId = handler . getSessionId ( ) ; String base = this . getServletContext ( ) . getContextPath ( ) ; HashMap < String , Object > jsonResp = new HashMap < String , Object > ( ) ; try { jsonResp . put ( "sessionurl" , ( base + "//cometd" ) ) ; jsonResp . put ( "sessionid" , sessionId ) ; jsonResp . put ( "username" , username ) ; jsonResp . put ( "key" , confKey ) ; jsonResp . put ( "collab" , new Boolean ( true ) ) ; jsonResp . put ( "info" , new HashMap < String , Object > ( ) ) ; String jsonStr = JSON . toString ( jsonResp ) ; PrintWriter writer = resp . getWriter ( ) ; writer . print ( jsonStr ) ; writer . flush ( ) ; } catch ( Exception e ) { AdminServlet . log . severe ( ( "error<seq2seq4repair_space>creating<seq2seq4repair_space>prep<seq2seq4repair_space>response:<seq2seq4repair_space>" + ( e . getMessage ( ) ) ) ) ; } } private void _handleDisconnect ( HttpServletRequest req , HttpServletResponse resp ) { } private Map < String , Object > getCowebConfigOptions ( ServletConfig config ) throws Exception { } private Map < String , Object > getConfigOptionsFromInitParams ( ServletConfig config ) { } @ SuppressWarnings ( "unchecked" ) private Map < String , Object > getConfigOptionsFromFile ( String filePath , ServletConfig servletConfig ) { } }

Fix:
SessionHandler handler = this . sessionManager . getSessionHandlerByConfkey ( confKey ) ;