Coder Social home page Coder Social logo

jcouchdb's Introduction

this is the jcouchdb source code. it can be build with ant.

you can import this as project into Eclipse.

contents:
---------

LICENSE.TXT             copy of the BSD license
build.properties        settings for the build process
build.xml               ant build file
ivy.xml			ivy dependency definition
lib                     contains the dependencies
src                     contains the source code
test                    contains unit tests, 1 integration test that will 
                        only pass if run against a real couchdb 
                        (default it runs against localhost)

jcouchdb's People

Contributors

fforw avatar smoyer64 avatar

Watchers

 avatar

jcouchdb's Issues

Support https in default server implementation

The ServerImpl constructs the server URI this way:
this.serverURI = "http://" + host + ":" + port;

which prevents from accessing couchDB on https. Please provide either
constructor with the complete server URI or some boolean parametr e.g.: 
useHttps in Database and/or ServerImpl classes.

Thanks

Original issue reported on code.google.com by [email protected] on 28 Apr 2010 at 9:56

Cannot set property reason on class org.jcouchdb.document.DocumentInfo

I am running CouchDB from trunk (0.10.0a781700) and jcouchdb from trunk 
(r126). When using bulkCreateDocuments I get the following exception when 
there is a problem with the documents I am creating:

org.svenson.JSONParseException: Cannot set property reason on class 
org.jcouchdb.document.DocumentInfo
    at org.svenson.JSONParser.parseObjectInto(JSONParser.java:441)
    at org.svenson.JSONParser.parseArrayInto(JSONParser.java:367)
    at org.svenson.JSONParser.parse(JSONParser.java:279)
    at org.svenson.JSONParser.parse(JSONParser.java:256)
    at org.jcouchdb.db.Response.getContentAsBean(Response.java:140)
    at org.jcouchdb.db.Database.bulkCreateDocuments(Database.java:330)

I guess this is related to the changes in the CouchDB bulk document API 
which are not reflected by jcouchdb.

Original issue reported on code.google.com by [email protected] on 4 Jun 2009 at 12:04

createDocument doesn't provide the id

What steps will reproduce the problem?
1. create a document using createDocument() and do not specify the id.

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

  createDocument() should return the generated id as a string.

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

  couchdb 0.8.0-1, Ubuntu 8.10, jdk 1.5.0-16-3, jcouchdb 0.7.2

Original issue reported on code.google.com by [email protected] on 2 Mar 2009 at 9:21

setJsonConfig(); not working as expected

I want to register a DateConverter to automatically convert java.util.Dates as 
was described in the last comment overthere:

http://code.google.com/p/svenson/wiki/TypeConversion

Here is what I do:

// 1. Create the Database object
Database couchdb = new Database(host, databaseName);
// 2. Get the configuration from my Database 
JSONConfig jsonConfig = couchdb.getJsonConfig();
// 3. get the parser
JSONParser jsonParser = jsonConfig.getJsonParser();
// 4. create a new parser
jsonParser = new JSONParser();
// 5. and register the converter
jsonParser.registerTypeConversion(java.util.Date.class, new DateConverter());
// 6. finally, submit the new configuration to the Database
couchdb.setJsonConfig(new JSONConfig(jsonConfig.getJsonGenerator(), 
jsonParser));


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

When I call couchdb.getDocument(MyDocument.class, someID) 
where "MyDocument" is a bean with setDate(java.util.Date date) and getDate() 
(returning a java.util.Date)
I get a 

org.svenson.JSONParserException: Cannot set property day on class 
java.util.Date.

The post mentioned above ( http://code.google.com/p/svenson/wiki/TypeConversion 
) pointed me to Svenson's registerTypeConversion() method. 
However, the couchdb.setJsonConfig() method does not seem to propagate the 
submitted JSONParser when it retrieves and parses responses from the 
server. 

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

jcouchdb-0.10.0-3.jar
svenson-1.3.6.jar

Original issue reported on code.google.com by [email protected] on 26 Feb 2010 at 2:29

Does not return error message . Only returns error code


What steps will reproduce the problem?
1.I could create a document in couchdb. Now the issue is that with jcouchdb
when i try to insert a wrong doc, I get an exception back 
sekhri@xps:~/Work/RegSrv/Client/java$ java test 
org.jcouchdb.db.Response@4a6cbf: code = 403, stream = null
org.jcouchdb.exception.DataAccessException: error creating document
{"typea":"test","alias":"test","admin":"test","foo":"value for the foo
attribute","bar":"value for the bar attribute","url":"test"}in database
'registrationservice': code 403
    at org.jcouchdb.db.Database.createOrUpdateDocument(Database.java:479)
    at org.jcouchdb.db.Database.createDocument(Database.java:266)
2. I tried to retrive the error messag but it seems it gets lost somewhere.
The good thing is I still get an exception with code 403. The bad thing is
that i can't retrieve the proper message back "The 'type' field is required."
3.I tested it with the python client and it seems to work fine. The good
thing is that if I don't specify a certain field , I get back proper
message now.
sekhri@xps:~/Work/RegSrv/Client$ python testreg.py 

Create a document, using an assigned docId:
{
    "error": "forbidden", 
    "reason": "The 'alias' field is required."
}

What is the expected output? What do you see instead?
 "reason": "The 'alias' field is required."
org.jcouchdb.db.Response@4a6cbf: code = 403, stream = null

What version of the product are you using? On what operating system?
http://jcouchdb.googlecode.com/files/jcouchdb-0.9.0-2.jar

Please provide any additional information below.



Original issue reported on code.google.com by [email protected] on 20 Jul 2009 at 6:31

Request to support Server.setCredentials method

I am using administration credentials on the svn version of couchdb

I would like to request a method stub such as 

public void setCredentials(String u, String p) throws CouchDBException;

in org.jcouchdb.db.Server

My implementation (really super basic cut and paste from apache HttpClient
website)

    public void setCredentials(String u, String p) throws CouchDBException{
        // copied from apache example
        // pass our credentials to HttpClient, they will only be used for
        // authenticating to servers with realm "realm" on the host
        // "www.verisign.com", to authenticate against
        // an arbitrary realm or host change the appropriate argument to null.
            httpClient.getState().setCredentials(

                    new AuthScope(hostConfiguration.getHost(),
hostConfiguration.getPort(), null),
                    new UsernamePasswordCredentials(u, p)
            );
    }

This passes the following really basic tests (it works with credentials to
create and delete databases, and it fails (throws exceptions) without
credentials when trying to create or delete databases.

    @Test(expected= CouchDBException.class) public void mustBeAdmin() { 
        Server server = new org.jcouchdb.db.ServerImpl(COUCHDB_HOST,
COUCHDB_PORT);
        List<String> databases = server.listDatabases();
        log.warn("visible databases = " + databases);
        if (databases.contains(TESTDB_NAME))
        {
            // expect a failure without login
            server.deleteDatabase(TESTDB_NAME);
        }else{
            // expect a failure without login
            server.createDatabase(TESTDB_NAME);
        }
    }

    @Test public void simpleAddDBDeleteDB() {
        Server server = new org.jcouchdb.db.ServerImpl(COUCHDB_HOST,
COUCHDB_PORT);
        server.setCredentials("admin","secretepassword");
        List<String> databases = server.listDatabases();
        if (databases.contains(TESTDB_NAME))
        {
            server.deleteDatabase(TESTDB_NAME);
            databases = server.listDatabases();
            assertFalse(databases.contains(TESTDB_NAME));
        }
        server.createDatabase(TESTDB_NAME);
        databases = server.listDatabases();
        assertTrue(databases.contains(TESTDB_NAME));
        server.deleteDatabase(TESTDB_NAME);
        databases = server.listDatabases();
        assertFalse(databases.contains(TESTDB_NAME));
    }

Original issue reported on code.google.com by [email protected] on 22 Dec 2008 at 7:37

New Feature Patch Query List function with multiple keys

This is an addition to the Database object that will allow you to pass in a
List function, View function and a List of keys to be processed by the
views along with an Options object. This is so you can post process the
results of a View thru a List with a POST of multiple keys.

    /**
     * Queries the specified list function with the specified view and the
specified Keys
     * @param listName Name of list included design doc (e.g.
"designDocId/listName")
     * @param viewName view name without design document
     * @param keys list of keys to apply to the view
     * @param options query options
     * @return response
     */
    public Response queryList(final String listName, final String viewName,
final List<List<String>> keys, final Options options)
    {
        String uri = "/" + name + "/" +
getDesignURIFromNameAndInfix(listName, LIST_DOCUMENT_INFIX) + "/" +
encodeURL(viewName);

        if (options != null)
        {
            uri += options.toQuery();
        }
        final Map<String, List<List<String>>> map = new HashMap<String,
List<List<String>>>(1);
        map.put("keys", keys);
        return server.post(uri, jsonGenerator.forValue(map));  
    }


Original issue reported on code.google.com by [email protected] on 19 Apr 2010 at 11:43

Attachments:

Domain classes defined in Groovy cause stack overflow

Apparently Domain classes defined in Groovy cause stack overflow, possibly due 
to the 
"metaClass" properties added by Groovy.

What steps will reproduce the problem?
1. Create a class in Groovy, for example:

class Example implements Serializable {

    private String key
    private String revision

    @json (value = '_id', ignoreIfNull = true)
    public String getKey() { key }
    public void setKey(String key) { this.key = key }

    @json (value = '_rev', ignoreIfNull = true)
    public String getRevision() { revision }
    public void setRevision(String revision) { this.revision = revision }

    boolean equals(o) {
        if (this.is(o)) return true
        if (!(o instanceof Example)) return false
        return key ? key == o.key : o.key == null
    }

    int hashCode() { key ? key.hashCode() : 0 }
}

2. When mapping to JSON, will see the stacktrace below

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

java.lang.StackOverflowError
    at java.util.HashMap$EntryIterator.<init>(HashMap.java:832)
    at java.util.HashMap$EntryIterator.<init>(HashMap.java:832)
    at java.util.HashMap.newEntryIterator(HashMap.java:846)
    at java.util.HashMap$EntrySet.iterator(HashMap.java:950)
    at java.util.Collections$SynchronizedCollection.iterator(Collections.java:1573)
    at org.svenson.JSON.getJSONifierForClass(JSON.java:472)
    at org.svenson.JSON.dumpObject(JSON.java:333)
    at org.svenson.JSON.dumpObject(JSON.java:428)
    at org.svenson.JSON.dumpObject(JSON.java:428)
    at org.svenson.JSON.dumpObject(JSON.java:428)
    at org.svenson.JSON.dumpObject(JSON.java:428)

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

Svenson 1.3.5
Mac OS X, 10.6



Original issue reported on code.google.com by [email protected] on 17 Nov 2009 at 6:57

Refuse to connect

What steps will reproduce the problem?
1. Refuse to connect error is coming
2.
3.

What is the expected output? What do you see instead?
Database connection and read the document file which I made as text file. 

What version of the product are you using? On what operating system?
I am using on windows and version is jcouchdb-0.9.0-1


Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 12 May 2009 at 4:41

Attachments:

Http Connections are not properly closed which causes the HttpClient to block infinitely

What steps will reproduce the problem?
1. Set maxConnectionsPerRoute and maxTotalConnections of the ServerImpl to 1. 
(Actually the number doesn't matter. Setting it to 1 will just make the problem 
occur earlier.)
2. Make multiple consecutive calls to the same host.
3. In my case the HttpClient ended up infinitely waiting for new connections.

What is the expected output? What do you see instead?
For testing I limited the number of connections to 1 and still expected all my 
tests to run smoothly. Unfortunately only the first request was successful and 
after that I always saw the following 
log output:

18:06:51:829 - DEBUG - ServerImpl - PUT /database_name/, body = null
18:06:51:830 - DEBUG - ThreadSafeClientConnManager$1 - 
ThreadSafeClientConnManager.getConnection: 
HttpRoute[{}->http://192.168.1.168:5984], timeout = 0
18:06:51:831 - DEBUG - ConnPoolByRoute - Total connections kept alive: 0
18:06:51:842 - DEBUG - ConnPoolByRoute - Total issued connections: 1
18:06:51:843 - DEBUG - ConnPoolByRoute - Total allocated connection: 1 out of 1
18:06:51:844 - DEBUG - ConnPoolByRoute - No free connections 
[HttpRoute[{}->http://192.168.1.168:5984]][null]
18:06:51:846 - DEBUG - ConnPoolByRoute - Available capacity: 1 out of 1 
[HttpRoute[{}->http://192.168.1.168:5984]][null]
18:06:56:106 - DEBUG - ConnPoolByRoute - Need to wait for connection 
[HttpRoute[{}->http://192.168.1.168:5984]][null]

After digging deeper into jcouchdb and the httpclient library, I found the 
following example page 
(http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/httpclient/src/
examples/org/apache/http/examples/client/ClientConnectionRelease.java), which 
mentions that 
connections are released once the close method of the Response InputStream has 
been called. I located the point where jcouchdb reads from the InputStream 
(org.jcouchdb.db.Response) and 
realized that it doesn't seem to be closed afterwards. Once I modified the 
Class to close the InputStream (after reading the data, plus - to be save - in 
the destroy method), my problem was 
gone. It seems pretty obvious to me that this was a general issue, but I find 
it hard to believe that nobody else has been complaining about this. So 
probably it was just something really weird 
that only happened to me. In any case, I attached a patch that resolved the 
issue for me. I hope it helps!

I am using jcouchdb version 0.9.1-1 and httpclient 4.0.1 by the way. (I tried 
this on various CouchDB versions from 0.8.x to 0.10.x)

Original issue reported on code.google.com by [email protected] on 9 Sep 2009 at 12:49

Attachments:

java.lang.NoSuchMethodError: java/lang/Character.isISOControl(I)Z

What steps will reproduce the problem?
1. Use jcouchdb within an eclipse plugin:

        Database db = new Database("192.168.178.43", "xyz");
        ViewResult<Map> result = db.queryView("xyz/show", Map.class, null, null);

2. it seems to be connecting fine, and also loading the response:

0    DEBUG [Worker-0]              org.jcouchdb.db.Database     - querying
view /xyz/_design/xyz/_view/show
0    DEBUG [Worker-0]            org.jcouchdb.db.ServerImpl     - GET
/xyz/_design/xyz/_view/show
63   DEBUG [Worker-0]
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager     -
ThreadSafeClientConnManager.getConnection:
HttpRoute[{}->http://192.168.178.43:5984], timeout = 0
63   DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Total connections kept alive: 0
78   DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Total issued connections: 0
78   DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Total allocated connection: 0 out of 25
78   DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
No free connections [HttpRoute[{}->http://192.168.178.43:5984]][null]
78   DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Available capacity: 10 out of 10
[HttpRoute[{}->http://192.168.178.43:5984]][null]
78   DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Creating new connection [HttpRoute[{}->http://192.168.178.43:5984]]
344  DEBUG [Worker-0] org.apache.http.impl.client.ClientParamsStack     -
'http.protocol.version': HTTP/1.1
344  DEBUG [Worker-0] org.apache.http.client.protocol.RequestAddCookies   
 - CookieSpec selected: best-match
360  DEBUG [Worker-0] org.apache.http.impl.client.DefaultRequestDirector  
  - Attempt 1 to execute request
360  DEBUG [Worker-0] org.apache.http.impl.conn.DefaultClientConnection   
 - Sending request: GET /xyz/_design/xyz/_view/show HTTP/1.1
360  DEBUG [Worker-0]                  org.apache.http.wire     - >> "GET
/xyz/_design/xyz/_view/show HTTP/1.1[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - >> "Host:
192.168.178.43:5984[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - >>
"Connection: Keep-Alive[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - >> "[EOL]"
360  DEBUG [Worker-0]               org.apache.http.headers     - >> GET
/xyz/_design/xyz/_view/show HTTP/1.1
360  DEBUG [Worker-0]               org.apache.http.headers     - >> Host:
192.168.178.43:5984
360  DEBUG [Worker-0]               org.apache.http.headers     - >>
Connection: Keep-Alive
360  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"HTTP/1.1 200 OK[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"Transfer-Encoding: chunked[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"Server: CouchDB/0.10.0 (Erlang OTP/R13B)[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - << "Etag:
"4MTRT5M0CU31IEKDBHY9RHOGJ"[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - << "Date:
Sat, 14 Nov 2009 15:55:48 GMT[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"Content-Type: text/plain;charset=utf-8[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"Cache-Control: must-revalidate[EOL]"
360  DEBUG [Worker-0]                  org.apache.http.wire     - << "[EOL]"
375  DEBUG [Worker-0] org.apache.http.impl.conn.DefaultClientConnection   
 - Receiving response: HTTP/1.1 200 OK
375  DEBUG [Worker-0]               org.apache.http.headers     - <<
HTTP/1.1 200 OK
375  DEBUG [Worker-0]               org.apache.http.headers     - <<
Transfer-Encoding: chunked
375  DEBUG [Worker-0]               org.apache.http.headers     - <<
Server: CouchDB/0.10.0 (Erlang OTP/R13B)
375  DEBUG [Worker-0]               org.apache.http.headers     - << Etag:
"4MTRT5M0CU31IEKDBHY9RHOGJ"
375  DEBUG [Worker-0]               org.apache.http.headers     - << Date:
Sat, 14 Nov 2009 15:55:48 GMT
375  DEBUG [Worker-0]               org.apache.http.headers     - <<
Content-Type: text/plain;charset=utf-8
375  DEBUG [Worker-0]               org.apache.http.headers     - <<
Cache-Control: must-revalidate
375  DEBUG [Worker-0] org.apache.http.impl.client.DefaultRequestDirector  
  - Connection can be kept alive indefinitely
375  DEBUG [Worker-0] org.apache.http.impl.client.ClientParamsStack     -
'http.protocol.handle-redirects': false
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "ef[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"{"total_rows":5,"offset":0,"rows":[[\r][\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"{"id":"3d4799bcb23fd590911a90efa14b3492","key":["3d4799bcb23fd590911a90efa14b34
92",0],"value":{"_id":"3d4799bcb23fd590911a90efa14b3492","_rev":"2-6f9bbc0ddf015
7ccc9955139b1ac3f4f","type":"spreadsheet"}}"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "131[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
",[\r][\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"{"id":"694ffc0aa78ba50dc5dc68bcf9604462","key":["3d4799bcb23fd590911a90efa14b34
92",1,"Test",1,1],"value":{"_id":"694ffc0aa78ba50dc5dc68bcf9604462","_rev":"4-af
1cf6c6ab17d08db0438fc672120b0b","type":"cell","belongs":"3d4799bcb23fd590911a90e
fa14b3492","row":1,"column":1,"worksheet":"Test","value":1000}}"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "13a[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
",[\r][\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"{"id":"1a58ca9a4e2e650bb21e9623b9ff7c2e","key":["3d4799bcb23fd590911a90efa14b34
92",1,"Test",1,2],"value":{"_id":"1a58ca9a4e2e650bb21e9623b9ff7c2e","_rev":"2-f9
daf079b031b1449fba5df6fcf05a3e","type":"cell","belongs":"3d4799bcb23fd590911a90e
fa14b3492","row":1,"column":2,"value":"Hello
World","worksheet":"Test"}}"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "cd[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
",[\r][\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"{"id":"5a46f753080fd7e404371d7abff608ca","key":["5a46f753080fd7e404371d7abff608
ca",0],"value":{"_id":"5a46f753080fd7e404371d7abff608ca","_rev":"1-f31b5cf86494c
d74f7b2101b82dbe8d9","type":"spreadsheet"}}"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "cd[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
",[\r][\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - <<
"{"id":"adc198794b8e8c908bb62145aa1251d4","key":["adc198794b8e8c908bb62145aa1251
d4",0],"value":{"_id":"adc198794b8e8c908bb62145aa1251d4","_rev":"1-f31b5cf86494c
d74f7b2101b82dbe8d9","type":"spreadsheet"}}"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "4[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r][\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "]}"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "1[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\r]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[\n]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "0[EOL]"
391  DEBUG [Worker-0]                  org.apache.http.wire     - << "[EOL]"
391  DEBUG [Worker-0]
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager     - Released
connection is reusable.
391  DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Releasing connection [HttpRoute[{}->http://192.168.178.43:5984]][null]
391  DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Pooling connection [HttpRoute[{}->http://192.168.178.43:5984]][null]; keep
alive for -1 MILLISECONDS
391  DEBUG [Worker-0] org.apache.http.impl.conn.IdleConnectionHandler     -
Adding connection at: 1258214169031
391  DEBUG [Worker-0] org.apache.http.impl.conn.tsccm.ConnPoolByRoute     -
Notifying no-one, there are no waiting threads

3. but then it crashes with some weird error about a missing error.

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

Caused by: java.lang.NoSuchMethodError: java/lang/Character.isISOControl(I)Z
    at org.svenson.tokenize.JSONTokenizer.parseString(JSONTokenizer.java:402)
    at org.svenson.tokenize.JSONTokenizer.next(JSONTokenizer.java:186)
    at org.svenson.tokenize.JSONTokenizer.expectNext(JSONTokenizer.java:518)
    at org.svenson.JSONParser.parseObjectInto(JSONParser.java:514)
    at org.svenson.JSONParser.parse(JSONParser.java:383)
    at org.svenson.JSONParser.parse(JSONParser.java:365)
    at org.jcouchdb.db.Response.getContentAsBean(Response.java:158)
    at org.jcouchdb.db.Database.queryViewInternal(Database.java:827)
    at org.jcouchdb.db.Database.queryView(Database.java:628)
    at
com.ibm.productivity.tools.samples.spreadsheet.Activator.start(Activator.java:59
)
    at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextIm
pl.java:1009)
    at java.security.AccessController.doPrivileged(AccessController.java:255)
    at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(Bundle
ContextImpl.java:1003)
    ... 28 more

What version of the product are you using? On what operating system?
0.10.0-3 on Windows with svenson 1.3.5 and Java 5

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 14 Nov 2009 at 3:58

Bundling of SLF4J libraries causes collisions

Using jcouchdb in projects which themselves uses SLF4J libraries (including 
logback) will most likely 
casuse "Class path contains multiple SLF4J bindings" 

See http://www.slf4j.org/codes.html#multiple_bindings

Original issue reported on code.google.com by [email protected] on 3 May 2010 at 10:02

Improvement: Customizable DocumentHelper

My Possibilities on changing the code of the domain-objects which i want to
store in the couchdb are very limited. I would like to be able to change
the documenthelper because this one needs to change the Source of the
Domain objects, e.g. (inside getRevision(Object document)):

if (document instanceof Document) // Need to implement an interface
{
      return ((Document) document).getRevision();
}
String name = getPropertyNameFromAnnotation(document, "_rev");
return (String) PropertyUtils.getProperty(document, name);

In both cases a change of the Sourcecode is needed.

So a suggestion to workaround that limitation would be to create a
interface for the documenthelper (change the methods to non-static) and a
possibility to inject a DocumentHelper to the Database-Class. You can do
this as a lazy-getter which is instantiating the Default-one and you have
no changes in the interface of jcouchdb (no need to set a Documenthelper if
you are happy with the Default-implementation).


Original issue reported on code.google.com by [email protected] on 28 Mar 2010 at 9:39

Patch for bulkDelete

Hi,

somehow I cannot change the issues type to "enhancement" :)

Please find attached a patch that will enable the bulkDelete feature.

Daniel

Original issue reported on code.google.com by [email protected] on 1 Sep 2009 at 6:32

Attachments:

Atomic Bulk

sorry for the noise but I have another patch: atomic bulk storing (the
'all_or_nothing' parameter)

Daniel

Original issue reported on code.google.com by [email protected] on 1 Sep 2009 at 7:19

Attachments:

bulkDeleteDocuments doesn't use DocumentHelper to get Id and Revision

What steps will reproduce the problem?
1. Create domain object that contains aliased id and revision fields.
2. Create several documents in the database
3. Try to delete them using bulkDeleteDocuments

What is the expected output? What do you see instead?
I expected to have the documents deleted, instead I get an exception stating 
that I don't have a 
Document object.

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

Please provide any additional information below.
Technically, the definition of the documents parameter is List<? extends 
Document>, but this 
isn't enforced by the compiler and all of the other methods accept Object and 
use the 
DocumentHelper to get the Id and Revision fields.


Original issue reported on code.google.com by [email protected] on 23 Oct 2009 at 4:34

org.svenson.JSONParseException: Cannot set property ok on class java.util.ArrayList

What steps will reproduce the problem?
1. Cannot bulk load docs
2.
3.

What is the expected output? What do you see instead?
NOTE: The data ends up in the database but the return is causing issues!

Exception in thread "main" org.svenson.JSONParseException: Cannot set
property ok on class java.util.ArrayList
    at org.svenson.JSONParser.parseObjectInto(JSONParser.java:571)
    at org.svenson.JSONParser.parse(JSONParser.java:385)
    at org.svenson.JSONParser.parse(JSONParser.java:367)
    at org.jcouchdb.db.Response.getContentAsBean(Response.java:158)
    at org.jcouchdb.db.Database.bulkCreateDocuments(Database.java:387)
    at org.jcouchdb.db.Database.bulkCreateDocuments(Database.java:321)
    at com.marc.XStreamDomParser.main(XStreamDomParser.java:136)



What version of the product are you using? On what operating system?
jcouchdb-0.10.0-3.jar
svenson-1.3.6-dev.jar
OS Linux 2.6.27.23-0.1-default x86_64
openSUSE 11.1 (x86_64)



Please provide any additional information below.
This does not work->
final int num_docs = 1000;
                List<BaseDocument> documents = new ArrayList<BaseDocument>(num_docs);
                for (int i=0; i < num_docs; i++)
                {
                    BaseDocument doc = new BaseDocument();
                    doc.setProperty("data", "The quick brown fox jumps over the
lazy dog.");
                    doc.setId(null);
                    doc.setRevision(null);
                    documents.add(doc);
                }

                db.bulkCreateDocuments(documents);


Original issue reported on code.google.com by [email protected] on 18 Feb 2010 at 3:46

SizedInputStreamMock missing

Just wanted to update but then the "SizedInputStreamMock" is missing so it
won't build...

Where is that from? Cannot find anything at Google so I am assuming it is
self-written...

Original issue reported on code.google.com by [email protected] on 1 Sep 2009 at 9:46

Attachments should provide methods that receive or provide streams

What steps will reproduce the problem?
1. attempt to load an attachment (via Database.createAttachment()) that's
larger than the JVM's heap

What is the expected output?
* Using streams, this would "just work"

What do you see instead?
* java.lang.OutOfMemoryError: Java heap space

In the past I've found that transparent support for both reading
(InputStreams) and writing (OutputStreams) arbitrarily large chunks of
binary data is difficult to achieve, so it may make more sense to refactor
Attachment so that the read and write cases are handled by different classes.

Original issue reported on code.google.com by [email protected] on 5 Mar 2009 at 5:41

Documents aren't being sent with UTF-8 encoding.

What steps will reproduce the problem?
1. Create a document with a string field that contains unicode characters. 
2. Save the document
3. Look at the document using futon, or re-read it

What is the expected output? What do you see instead?
Expect that documents will be saved properly; instead, documents lose the 
extended characters.  
Also, because of a bug in CouchDB, it may cause the server to be unresponsive 
after accessing a 
map/reduce view.

What version of the product are you using? On what operating system?
0.10.0.2, OSX 10.6

Please provide any additional information below.
Creating the StringEntity using the new StringEntity( body, CHARSET ) fixes the 
encoding.

Original issue reported on code.google.com by [email protected] on 28 Oct 2009 at 8:03

Support for continuous feeds

Please add support for listening to change notifications
: http://books.couchdb.org/relax/reference/change-notifications

Original issue reported on code.google.com by [email protected] on 21 Nov 2009 at 12:24

Problems with update of a document with attachments

What steps will reproduce the problem?
1. Create a BaseDocument with Attachment and store it with
createOrUpdateDocument()
2. Load a document with getDocument()
3. Change some property and try to store it again with createOrUpdateDocument()

The couchdb will return code 412.

I found, that jcouchdb sends a PUT with property "data" of _attachments set
to null. I just add a @JSONProperty(ignoreIfNull=true) to the getter
Attachment.getData() and update works OK.

What version of the product are you using? On what operating system?
couchdb 0.11
jcouchdb actual trunk


Original issue reported on code.google.com by vasek%[email protected] on 7 Jun 2010 at 8:23

Loading a view using CouchDBUpdater with no reduce function causes view invocation to fail

What steps will reproduce the problem?

1. Create a folder called 'myapp'

2. Create a file all.map.js that contains the contents
function (doc) {
  emit(null, doc);
}
3. Load the folder using CouchDBUpdater
    public static void main(String[] args) throws Exception {
        String dbname = "myappdb";

        CouchDBUpdater updater = new CouchDBUpdater();
        updater.setDesignDocumentDir(new File("/path/to/designdoc/folder"));

        Server server = new ServerImpl(host, port);
        Database database = Database(server, dbname);   

        updater.setDatabase(database);
        updater.setCreateDatabase(false);
        updater.updateDesignDocuments();        
    }

4. Add a document to the database

5. Invoke the view

$ curl http://localhost:5984/myapp/_design/myapp/_view/all
{"rows":[
curl: (18) transfer closed with outstanding read data remaining 

If you look at the database in Futon, you see that both map and reduce for
the view are defined, but reduce is set to 'null'.

If you remove the reduce field, and rerun the query, it works.

$ curl http://localhost:5984/myapp/_design/myapp/_view/all
{"total_rows":1,"offset":0,"rows":[
{"id":"c70351bd38aca6c4c093685431ad1470","key":null,"value":{"_id":"c70351bd38a
a6c4c093685431ad1470","_rev":"1-d2f49d209e96cda0491ea6a8465cd6a4","author":"Davi
d
Van Couvering"}}
]}

I'm using jcouchdb 0.10.0.3, on WinXP.

Note that if you invoke this view using jcouchdb, the parser barfs:

org.svenson.JSONParseException: Unexpected character '�'
    at org.svenson.tokenize.JSONTokenizer.next(JSONTokenizer.java:233)
    at org.svenson.JSONParser.parseArrayInto(JSONParser.java:445)
    at org.svenson.JSONParser.parseObjectInto(JSONParser.java:620)
    at org.svenson.JSONParser.parse(JSONParser.java:383)
    at org.svenson.JSONParser.parse(JSONParser.java:365)
    at org.jcouchdb.db.Response.getContentAsBean(Response.java:158)
    at org.jcouchdb.db.Database.queryViewInternal(Database.java:827)
    at org.jcouchdb.db.Database.query(Database.java:742)

Under the debugger, I can see that the "character" has the int value 65535

Original issue reported on code.google.com by [email protected] on 19 Jan 2010 at 4:54

Attachment revpos as string causing error in 0.11

What steps will reproduce the problem?
1. using couchdb 0.11
2. save a document and add an attachment
3. read the document
4. save the document

What is the expected output? What do you see instead?
Expect that the document is saved.  Receive an error from couchdb instead.

What version of the product are you using? On what operating system?
Tested on 0.10 and 0.11 on OS X and Ubuntu.

Please provide any additional information below.

The problem appears to be that revpos is a string.  It works if it is converted 
to a long.  I can't 
find any couchdb documentation that explicitly says what it is supposed to be.

It works fine in 0.10.

I have attached a modified LocalDatabaseTestCase that reproduces the problem.

Original issue reported on code.google.com by [email protected] on 11 May 2010 at 4:41

Attachments:

Publish to Maven repository

It would be very nice if jcouchdb was available from a Maven repository for
easy integration in Maven projects.

Original issue reported on code.google.com by [email protected] on 12 Aug 2009 at 1:01

Deleting database with slash produces 404

Preparation:
Run all CouchDB 1.0 tests or create database with slash, e.g. 
'test_suite_db/with_slashes'

What steps will reproduce the problem?
List<String> databases = server.listDatabases();
for (String database : databases)
if (...)
server.deleteDatabase(database);
// 404

---
Another test:
Database d = new Database(server, "test_suite_db/with_slashes");
d.getStatus();
// 404

---
This can be fixed using URLEncoder.encode when creating the URL from database 
name.

Original issue reported on code.google.com by [email protected] on 1 Aug 2010 at 8:33

org.jcouchdb.db.Database.compact throw DataAccessException, should use POST instead of GET

What steps will reproduce the problem?
1. Execute org.jcouchdb.db.Database.compact() method.
2. the API will throw DataAccessException because CouchDB will return this 
{"error":"method_not_allowed","reason":"Only POST allowed"}

What is the expected output? What do you see instead?
According the CouchDB wiki: http://wiki.apache.org/couchdb/Compaction, the 
compact method should be called via POST instead of GET. I have modified 
the source code to use post method with empty data, then everything works 
fine so far. I have attached the modified source for your reference. 

What version of the product are you using? On what operating system?
I am using CouchDB 0.10.0 on Linux (ubuntu 9.10) and running jcouchdb-
0.10.0-3

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 29 Jan 2010 at 3:34

Attachments:

Bug when using startkey_docid

Hi,

as I have learnt today the parameter value for "startkey_docid" should not
contain quotation marks! Otherwise paging won't work. A dirty solution
would be to remove the marks manually in the Options class:

...
String json = optionsJSON.forValue(e.getValue());
if( e.getKey().equals("startkey_docid") ){
  json = json.substring(1, json.length() -1 );
}
...

Daniel

Original issue reported on code.google.com by [email protected] on 26 Aug 2009 at 3:52

ServerImpl.post should use UTF-8 encoding

I believe ServerImpl.post should be using UTF-8 encoding rather than
ISO-8859-1.  Elsewhere (eg. in ServerImpl.put) UTF-8 encoding is used, so
I'm assuming it's just a typo.

Original issue reported on code.google.com by [email protected] on 6 Mar 2009 at 4:17

Need to manually release httpclient connections with the MultiThreadedHttpConnectionManager in ServerImpl.java

See here:  http://hc.apache.org/httpclient-3.x/threading.html

MultiThreadedHttpConnectionManager connectionManager = new 
MultiThreadedHttpConnectionManager();
HttpClient client = new HttpClient(connectionManager);
        ...
// and then from inside some thread executing a method
GetMethod get = new GetMethod("http://httpcomponents.apache.org/");
try {
    client.executeMethod(get);
    // print response to stdout
    System.out.println(get.getResponseBodyAsStream());
} finally {
    // be sure the connection is released back to the connection 
    // manager
    get.releaseConnection();
}

Original issue reported on code.google.com by [email protected] on 23 Jan 2009 at 4:25

Can't deserialize largish values of Long/long types, they end up being zero

What steps will reproduce the problem?
1. Properties of type java.lang.Long do not reconstitute with the values
are large.

I have attached a test program that illustrates that Integer and Doubles
with .MAX_VALUE will serialize and deserialize correctly. Long will not.
This happens with largish numbers like System.currentMilliseconds() and
Date.getTime() produce. It saves them correctly, but will not load them
back correctly.

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

the expected behavior is to correctly deserialize Long values.


What version of the product are you using? On what operating system?
jcouchdb = 0.10.0-3
svenson = 1.3.6

Please provide any additional information below.

import org.jcouchdb.db.Database;
import org.jcouchdb.db.Server;
import org.jcouchdb.db.ServerImpl;
import org.jcouchdb.document.BaseDocument;
import org.svenson.JSONProperty;

public class TransferCentral
{
    public static void main(final String[] args)
    {
        final Server s = new ServerImpl("localhost");
        s.createDatabase("testdb");
        final Database db = new Database("localhost", "testdb");

        final TestPojo tp = new TestPojo();
        tp.setId("testpojo");
        db.createDocument(tp);
        final TestPojo tp2 = db.getDocument(TestPojo.class, "testpojo");
        System.out.println(tp2);
        db.delete(tp2);
        s.deleteDatabase("testdb");
        System.exit(0);
    }

    public static class TestPojo extends BaseDocument
    {
        private Integer i = Integer.MAX_VALUE;
        private Long l = Long.MAX_VALUE;
        private Double d = Double.MAX_VALUE;

        @JSONProperty(value = "myint")
        public Integer getI()
        {
            return i;
        }

        public void setI(final Integer i)
        {
            this.i = i;
        }

        @JSONProperty(value = "mylong")
        public Long getL()
        {
            return l;
        }

        public void setL(final Long l)
        {
            this.l = l;
        }

        @JSONProperty(value = "mydouble")
        public Double getD()
        {
            return d;
        }

        public void setD(final Double d)
        {
            this.d = d;
        }

        @Override
        public String toString()
        {
            final StringBuilder sb = new StringBuilder();
            sb.append("TestPojo");
            sb.append("{i=").append(i);
            sb.append(", l=").append(l);
            sb.append(", d=").append(d);
            sb.append('}');
            return sb.toString();
        }
    }
}



Original issue reported on code.google.com by [email protected] on 14 Apr 2010 at 11:23

group_level option missing

Hi,

the Options class is missing a groupLevel option!

Simple fix is here:

http://github.com/truemped/jcouchdb/commit/2d0b41b0030024125bd1e9872ee2558971f6d
0c1

In the Options.java add the folowing: 

    public Options groupLevel(int level)
    {
        return putUnencoded("group_level",level);
    }


Best
Daniel

Original issue reported on code.google.com by [email protected] on 17 Mar 2010 at 4:50

Can't bulk-delete documents that have a space in the id.

What steps will reproduce the problem?
1. Create a few documents with spaces in the id.
2. Add them to a list of documents to delete.
3. call bulkDelete()

What is the expected output? What do you see instead?
Expect to have the documents deleted.  Instead, get an exception from couchdb 
because the 
space isn't escaped properly.

What version of the product are you using? On what operating system?
jcouchdb-0.10.0-1

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 20 Oct 2009 at 9:20

Bulk updates

Is there plans to support a bulk update (PUT) operation?  Or, equivalently, 
bulk create where the _id 
is taken from the documents?

Original issue reported on code.google.com by [email protected] on 26 Nov 2008 at 8:27

runtime compatibility problem with svenson-1.30

I've updated my project to jcouchdb-0.9.0-2 and svenson-1.3.0, now my
(previously working code) throws a funny exception:

java.lang.NoSuchMethodError:
org.svenson.JSONParser.parse(Ljava/lang/Class;Lorg/svenson/tokenize/JSONCharacte
rSource;)Ljava/lang/Object;
    at org.jcouchdb.db.Response.getContentAsBean(Response.java:140)
    at org.jcouchdb.db.Database.getDocument(Database.java:235)
    at org.jcouchdb.db.Database.getDocument(Database.java:195)
    at
net.ltr.semgraph.processor.controllers.QueueTicketController.handleRequest(Queue
TicketController.java:40)

reverting to jcouchdb-0.9.0-1 + svenson-1.2.8 solves the problem

Original issue reported on code.google.com by [email protected] on 29 Apr 2009 at 10:59

Design documents store the document id as both "id" and "_id".

What steps will reproduce the problem?
1. Use the CouchDBUpdater to store / update design documents
2. Once the design documents are stored in the db, view it in the browser
3. Notice that both "_id" and "id" are set to the document identifier

What is the expected output? What do you see instead?
Expect that the "id" field is just an alias for "_id" as in other BaseDocuments.

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

Please provide any additional information below.
I suspect that this is because DesignDocument extends BaseDocument, but without 
the 
JSONProperty annotation, but I haven't confirmed that is the case.

Original issue reported on code.google.com by [email protected] on 28 Oct 2009 at 12:01

Attachment's getData returns null

Here is the program I am running
Database ipsDatabase = new Database("localhost", 5984, "test");
ViewResult<Map> allDocs = ipsDatabase.listDocuments(new Options(), new
JSONParser());
List<ValueRow<Map>> pAllDocs = allDocs.getRows();
Attachment data;


for (ValueRow<Map> doc: pAllDocs) {
   System.out.println("----------------");
   System.out.println("ID = " + doc.getId());
   BaseDocument d = ipsDatabase.getDocument(BaseDocument.class, doc.getId());
   data = d.getAttachments().get("ips");
   System.out.println("Length = " + data.getLength());
   System.out.println("Content-Type = " + data.getContentType());
   System.out.println("Data = " + data.getData());
}

and here is the output

----------------
ID = 5802341721811236
Length = 709
Content-Type = application/octet-stream
Data = null
----------------
ID = 5828961721221236
Length = 47
Content-Type = application/octet-stream
Data = null
----------------

I can confirm that the length and type is correct, but there is data in the
attachment.

Thanks

Original issue reported on code.google.com by [email protected] on 5 Mar 2009 at 5:00

JarBasedCouchDBUpdater fails on Windows with 'invalid path'

What steps will reproduce the problem?
1. Use a JarBasedCouchDBUpdater with a pathInsideJar containing forward slashes
2. Call updateDesignDocuments() on the updater

What is the expected output? What do you see instead?
The updater should find the map and reduce JavaScript files and use the
remaining path to create the design document (createViewFor). This call
fails because the pathes retrieved from the JarFile contain forward slashes
but createViewFor requires OS-dependent path separators. The call therefore
fails at:

Assert.isTrue(parts.size() > 1, "invalid dir structure");

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

Please provide any additional information below.
This problem only occurs on Windows platforms.

Original issue reported on code.google.com by [email protected] on 17 Dec 2009 at 2:28

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.