Closed Kenzku closed 5 years ago
If you call client.serverVersion()
against CouchDB or Cloudant with an incorrect password then you will get a successful response without a CouchDbException
because the server information (root endpoint) is not protected.
What type of server are you running against?
I can't see how you can get a NullPointerException
from your example because you'll never end up in the catch block. In your real code are you assigning the exception to a field and then calling toString()
on it and therefore in the server version case ending up with a NPE?
did you try to give a wrong password?
In your real code are you assigning the exception to a field and then calling
toString()
on it and therefore in the server version case ending up with a NPE?
That NPE is from your code
If you call
client.serverVersion()
against CouchDB or Cloudant with an incorrect password then you will get a successful response without aCouchDbException
because the server information (root endpoint) is not protected.
I can call client.createDB("TEST")
and get the same result
It seems that perhaps the error/reason is missing from the response body, which I think would be a server side problem.
I took another look at this and neither the server returning an empty body nor null
error/reason responses causes a NPE in the CouchDbException
code. Are you able to provide the full stack trace of the NPE?
Please read these guidelines before opening an issue.
Bug Description
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
2. What you expected to happen
Shall catch unauthorised error
3. What actually happened
Method threw 'java.lang.NullPointerException' exception. Cannot evaluate com.cloudant.client.org.lightcouch.CouchDbException.toString()
Environment details
looks like somewhere the in highlight below, gets null, and passed down to the
super(message)