question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

0.7.0 upgrade - nullPointerException when performing request with missing or invalid basic auth credentials

See original GitHub issue

The following scenario passes on 0.6.2 but fails on 0.7.0

  Scenario: Basic Auth Credentials must be supplied for POST
    Given path '/apath'
    And request
    """
      {
        "foo": "bar"
      }
    """
    When method PUT
    Then status 401
    And match response.errors[0].code == "unauthorized"
    And match response.errors[0].message == "Not authorized"

I get the response

15:56:05.225 [main] DEBUG com.intuit.karate - 
1 > PUT SOMEENDPOINT
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 128
1 > Content-Type: application/json; charset=UTF-81 > Host: SOMEHOST
1 > User-Agent: Apache-HttpClient/4.5.4 (Java/1.8.0_112)
{"foo":"bar"}
15:56:05.391 [main] ERROR com.intuit.karate - java.lang.NullPointerException, http call failed after 167 milliseconds for URL: SOMEENDPOINT
15:56:05.391 [main] ERROR com.intuit.karate - http request failed: 
java.lang.NullPointerException
com.intuit.karate.exception.KarateException:
java.lang.NullPointerException
  at com.intuit.karate.StepDefs.method(StepDefs.java:364)
  at ✽.When method PUT(.feature:209)

If I revert back to 0.6.2 it works again!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Mar 8, 2018

@YOU54F no we can keep this open until the 0.7.1 release. thanks !

1reaction
ptrthomascommented, Mar 8, 2018

this is a bug in Apache ! https://issues.apache.org/jira/browse/HTTPCLIENT-1888

fixed in dev.

for those who need a workaround but don’t want to use karate-jersey this is a possible workaround in the pom.xml.

<dependency>
    <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.5</version>
    <scope>test</scope>
</dependency>
Read more comments on GitHub >

github_iconTop Results From Across the Web

0.7.0 upgrade - nullPointerException when performing request ...
The following scenario passes on 0.6.2 but fails on 0.7.0 Scenario: Basic Auth Credentials must be supplied for POST Given path '/apath' And ......
Read more >
Why am I getting NullPointerException after second rest call ...
I am using Basic Auth. Might it be that after first call I shouldn't send my user credentials at all or is it...
Read more >
Producer Failed to Send Data and Threw ... - 华为云
An MRS cluster has ZooKeeper and Kafka installed.When the Producer client sends data to Kafka, it fails and throws "NullPointerException".
Read more >
Receive Error 500: java.lang.NullPointerException when ... - IBM
NullPointerException A parameter was invalid or missing, the server could not connect to the target deployment server, or an internal server ...
Read more >
RHSA-2022:5498 - Security Advisory - Red Hat Customer Portal
BZ - 2031154 - After upgrading to Satellite 6.10, Repository sync randomly fails if a ReservedResource exists in core_taskreservedresource table ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found