@@ -90,7 +90,6 @@ private ExecuteResult(InputStream stream,
90
90
String responseMessage ,
91
91
Throwable cause )
92
92
{
93
- this .responseCode = responseCode ;
94
93
boolean needsCouchException = false ;
95
94
switch (responseCode / 100 ) {
96
95
case 1 :
@@ -145,7 +144,6 @@ private ExecuteResult(InputStream stream,
145
144
146
145
InputStream stream ;
147
146
CouchException exception ;
148
- int responseCode ;
149
147
boolean fatal ;
150
148
}
151
149
@@ -695,20 +693,27 @@ public Response putMultipart(final MultipartAttachmentWriter mpw) {
695
693
696
694
public boolean isBulkSupported () {
697
695
URI bulkGet = this .uriHelper .documentUri ("_bulk_get" );
698
- HttpConnection connection = Http .GET (bulkGet );
699
- connection .responseInterceptors .addAll (responseInterceptors );
700
- connection .requestInterceptors .addAll (requestInterceptors );
701
- ExecuteResult result = this .execute (connection );
702
- switch (result .responseCode ) {
703
- case 404 :
704
- // not found: _bulk_get not supported
705
- return false ;
706
- case 405 :
707
- // method not allowed: this endpoint exists, we called with the wrong method
708
- return true ;
709
- default :
710
- throw (result .exception );
696
+ HttpConnection get = Http .GET (bulkGet );
697
+ Throwable cause = null ;
698
+ try {
699
+ executeWithRetry (get , new NoOpInputStreamProcessor ());
700
+ } catch (CouchException ce ) {
701
+ switch (ce .getStatusCode ()) {
702
+ case 404 :
703
+ // not found: _bulk_get not supported
704
+ return false ;
705
+ case 405 :
706
+ // method not allowed: this endpoint exists, we called with the wrong method
707
+ return true ;
708
+ default :
709
+ // will re-throw with this as cause since we didn't understand the result
710
+ cause = ce ;
711
+ }
711
712
}
713
+ // if we got here, we either ran out of retries or couldn't figure out the response code
714
+ // so all we can do is throw an exception
715
+ throw new RuntimeException ("Could not determine if the _bulk_get endpoint is supported" ,
716
+ cause );
712
717
}
713
718
714
719
public static class MissingRevisions {
0 commit comments