problem with RiakClient streamBucket method

santhosh venkat santhoshvenkat1988 at gmail.com
Fri Mar 4 02:16:40 EST 2011


Hi ,
      streamBucket  method of RiakClient throws this exception when i tried
using it .

Exception in thread "main" java.lang.NoSuchMethodError:
org.json.JSONTokener.end()Z
    at
com.basho.riak.client.response.StreamedKeysCollection.cacheNext(StreamedKeysCollection.java:45)
    at
com.basho.riak.client.util.CollectionWrapper$WrappedCollectionIterator.hasNext(CollectionWrapper.java:123)
    at RiakPerfTest.cleanUpRiak(RiakPerfTest.java:109)
    at RiakPerfTest.main(RiakPerfTest.java:94)

I used it  exactly in the same way as said in github wiki .

Later reading the source Code of riak , I found that the problem lies in
StreamedKeysCollection Class of package com.basho.riak.client.response.

            while (!tokens.end()) {
                char c = tokens.nextClean();
                if ((!readingArray && c == '[') || (readingArray && c ==
',')) {
                    if (tokens.nextClean() != ']') {
                        tokens.back();
                        readingArray = true;
                        cache(tokens.nextValue().toString());
                        return true;
                    }
                } else if (readingArray && c == ']') {
                    readingArray = false;
                } else if (c == '\\') {
                    tokens.nextClean(); // skip over escaped chars
                }
            }


 while (!tokens.end()) {   // -> Method end() is not defined in JSONTokener
Class

  There is a method named more() defined in JSONTokener Class , I was able
to successfully retrieve all the keys when i replaced end() method with
more()  .

Please throw some light  if i am using the api's wrongly .


--
Santhosh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110304/34d39fdc/attachment.html>


More information about the riak-users mailing list