java.lang.IndexOutOfBoundsException on clusterManager.hasBucket

When I try to check if the bucket already exist by JavaSDK that returns a java.lang.IndexOutOfBoundsException.

CouchbaseCluster couchbaseCluster = CouchbaseCluster.create(“localhost”);
String bucketName = “database”;
ClusterManager clusterManager = couchbaseCluster.clusterManager(user, password);
boolean exist = clusterManager.hasBucket(bucketName);


The log:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.couchbase.client.java.cluster.DefaultAsyncClusterManager.ensureServiceEnabled(DefaultAsyncClusterManager.java:366)
at com.couchbase.client.java.cluster.DefaultAsyncClusterManager.getBuckets(DefaultAsyncClusterManager.java:132)
at com.couchbase.client.java.cluster.DefaultAsyncClusterManager.getBucket(DefaultAsyncClusterManager.java:194)
at com.couchbase.client.java.cluster.DefaultAsyncClusterManager.hasBucket(DefaultAsyncClusterManager.java:204)
at com.couchbase.client.java.cluster.DefaultClusterManager.hasBucket(DefaultClusterManager.java:89)
at com.couchbase.client.java.cluster.DefaultClusterManager.hasBucket(DefaultClusterManager.java:84)

A similar error happened when I try to create a bucket with the same API:

CouchbaseCluster couchbaseCluster = CouchbaseCluster.create(“localhost”);
String bucketName = “database”;
ClusterManager clusterManager = couchbaseCluster.clusterManager(user, password);
BucketSettings settings = DefaultBucketSettings.builder().name(bucketName);
clusterManager.insertBucket(settings);

This looks like a bug - which SDK version are you using?

Thanks:
The Version: 2.4.1

Hello @daschl is there any news about this issue?

Not yet, sorry, I didn’t get to it by now. I’ve created a ticket https://issues.couchbase.com/browse/JCBC-1045 and assigned to 2.4.2 release but I don’t know if it will work out timewise or we need to push it to the next bugfix release.

In the meantime, it would be great if you could share the TRACE log file of bootstrapping and then running the command as shown here. That would allow me to investigate this issue more quickly - thank you!