Export to GitHub

couchdb4j - issue #6

CouchResponse expects that error is a JSONObject when CouchDB sends a string


Posted on Mar 16, 2008 by Grumpy Ox

What steps will reproduce the problem? 1. Create a Session 2. getDatabase() a non-existant database

What is the expected output? What do you see instead?

getDatabase() should return null as documented.

Instead it throws net.sf.json.JSONException: JSONObject["error"] is not a JSONObject. at net.sf.json.JSONObject.getJSONObject(JSONObject.java:2139) at com.fourspaces.couchdb.CouchResponse.<init>(CouchResponse.java:90)

This is probably because CouchDB returns {"error":"not_found","reason":"missing"} where response["error"] is no JSONObject

What version of the product are you using? On what operating system?

SVN trunk, Arch64 Linux, CouchDB 0.7.2

Comment #1

Posted on Mar 16, 2008 by Grumpy Ox

The attached patch seems to fix the error (at least the only failing unit tests are related to NullPointerExceptions and ad-hoc views)

Attachments

Comment #2

Posted on Apr 11, 2008 by Helpful Elephant

Applied

Status: Fixed

Labels:
Type-Defect Priority-Medium