Project: Tomcat
Bug 40844 JDBCRealm.getPassword throws NullPointerException
Reported: 2006-10-30 06:25:52 | Status: resolved fixed

JDBCRealm.getPassword throws NullPointerException I'm using tomcat 5.5.20 with postgresql-8.1-407.jdbc3.jar and postgresql-8.1.4 on Ubuntu Dapper. Authenticating two users simultaneously with HTTP DIGEST causes sometimes the following errors and a 401 Unauthorized reply: 30.10.2006 14:24:54 org.apache.catalina.realm.JDBCRealm getPassword SEVERE: Exception performing authentication org.postgresql.util.PSQLException: ERROR: invalid message format at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1309) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:188) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:258) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:546) at org.apache.catalina.realm.RealmBase.getDigest(RealmBase.java:1156) at org.apache.catalina.realm.RealmBase.authenticate(RealmBase.java:365) at org.apache.catalina.authenticator.DigestAuthenticator.findPrincipal(DigestAuthenticator.java:282) at org.apache.catalina.authenticator.DigestAuthenticator.authenticate(DigestAuthenticator.java:175) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) 30.10.2006 14:24:54 org.apache.catalina.connector.CoyoteAdapter service SEVERE: An exception or error occurred in the container during the request processing java.lang.NullPointerException at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:568) at org.apache.catalina.realm.JDBCRealm.getPrincipal(JDBCRealm.java:594) at org.apache.catalina.realm.RealmBase.authenticate(RealmBase.java:398) at org.apache.catalina.authenticator.DigestAuthenticator.findPrincipal(DigestAuthenticator.java:282) at org.apache.catalina.authenticator.DigestAuthenticator.authenticate(DigestAuthenticator.java:175) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595)

Files changed in fix:
java/org/apache/catalina/realm/JDBCRealm.java