@@ -90,7 +90,6 @@ private ExecuteResult(InputStream stream,
9090 String responseMessage ,
9191 Throwable cause )
9292 {
93- this .responseCode = responseCode ;
9493 boolean needsCouchException = false ;
9594 switch (responseCode / 100 ) {
9695 case 1 :
@@ -145,7 +144,6 @@ private ExecuteResult(InputStream stream,
145144
146145 InputStream stream ;
147146 CouchException exception ;
148- int responseCode ;
149147 boolean fatal ;
150148 }
151149
@@ -695,20 +693,27 @@ public Response putMultipart(final MultipartAttachmentWriter mpw) {
695693
696694 public boolean isBulkSupported () {
697695 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+ }
711712 }
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 );
712717 }
713718
714719 public static class MissingRevisions {
0 commit comments