https://bz.apache.org/bugzilla/show_bug.cgi?id=65363
Bug ID: 65363 Summary: NullPointerException in HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizatio nForAuthScope when 401 response from remote and httpclient4.auth.preemptive=false Product: JMeter Version: 5.4.1 Hardware: PC OS: Mac OS X 10.1 Status: NEW Severity: normal Priority: P2 Component: HTTP Assignee: issues@jmeter.apache.org Reporter: ply...@apache.org Target Milestone: JMETER_5.5 Created attachment 37892 --> https://bz.apache.org/bugzilla/attachment.cgi?id=37892&action=edit JMeter test file issue reproduce case 1. Configure jmeter property to turn off pre-emptive auth. ( httpclient4.auth.preemptive=false ) 2. Have a server endpoint return 401 challenge to a request. ( in my example jmeter test, the endpoint is http://httpbin.org/basic-auth/admin/admin123 ) 3. Execute the attached example JMeter test case that sends a single request to the server endpoint. 4. In the View Results Tree, select the sampler result tree node which indicates an error. Problem 1: On the Sampler result tab, notice that the sampler result indicates something not helpful to end user. The following: Response code:Non HTTP response code: java.lang.NullPointerException Response message:Non HTTP response message: null Expected: Response code should be 401 as that is what was actually returned by the server. Problem 2: on the Response data tab, Response headers tab, there are no response headers from the 401 response. Expected: there should be all the response headers that were returned by the server. Problem 3: Select the "Valid Response Codes" assertion node in the View Results Tree. The "Assertion result" tab shows the following message: Assertion error:false Assertion failure:true Assertion failure message:Test failed: code expected something using / ****** received : [[[Non HTTP response code: java.lang.NullPointerException]]] ****** comparison: [[[200 ]]] Expected: Instead the "received" section should show the 401 status code ----------------- Examining jmeter DEBUG logs we see the following stack trace at DEBUG level: 2021-06-07 09:13:35,074 DEBUG o.a.j.p.h.s.HTTPHC4Impl: RuntimeException java.lang.NullPointerException: null at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$ManagedCredentialsProvider.getAuthorizationForAuthScope(HTTPHC4Impl.java:252) ~[ApacheJMeter_http.jar:5.4.1] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl$ManagedCredentialsProvider.getCredentials(HTTPHC4Impl.java:233) ~[ApacheJMeter_http.jar:5.4.1] at org.apache.http.impl.client.AuthenticationStrategyImpl.select(AuthenticationStrategyImpl.java:197) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.client.TargetAuthenticationStrategy.select(TargetAuthenticationStrategy.java:44) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.auth.HttpAuthenticator.handleAuthChallenge(HttpAuthenticator.java:151) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.execchain.MainClientExec.needAuthentication(MainClientExec.java:588) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:293) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.12.jar:4.5.12] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:935) ~[ApacheJMeter_http.jar:5.4.1] at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:646) [ApacheJMeter_http.jar:5.4.1] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66) [ApacheJMeter_http.jar:5.4.1] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296) [ApacheJMeter_http.jar:5.4.1] at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285) [ApacheJMeter_http.jar:5.4.1] at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638) [ApacheJMeter_core.jar:?] at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558) [ApacheJMeter_core.jar:?] at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) [ApacheJMeter_core.jar:?] at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275] Expected: Avoid the NullPointerException on no auth manager present to process the server challenge. Instead propagate the actual response code returned by the server. This bug seems to have been introduced by the fix for bug 64267. -- You are receiving this mail because: You are the assignee for the bug.