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);