File tree 4 files changed +41
-8
lines changed
core/src/main/java/com/arangodb
jackson-serde-json/src/main/java/com/arangodb/serde/jackson
4 files changed +41
-8
lines changed Original file line number Diff line number Diff line change 36
36
37
37
import javax .annotation .concurrent .ThreadSafe ;
38
38
import javax .net .ssl .SSLContext ;
39
- import java .util .ArrayList ;
40
- import java .util .Collection ;
41
- import java .util .ServiceLoader ;
39
+ import java .util .*;
42
40
import java .util .concurrent .Executor ;
43
41
44
42
/**
@@ -618,7 +616,6 @@ public Builder serde(final ArangoSerde serde) {
618
616
*
619
617
* @param executor async downstream executor
620
618
* @return {@link ArangoDB.Builder}
621
- *
622
619
* @deprecated for removal. To consume the responses in a custom executor use async CompletableFuture methods.
623
620
*/
624
621
@ Deprecated
@@ -630,7 +627,15 @@ public Builder asyncExecutor(final Executor executor) {
630
627
@ UnstableApi
631
628
protected ProtocolProvider protocolProvider (Protocol protocol ) {
632
629
ServiceLoader <ProtocolProvider > loader = ServiceLoader .load (ProtocolProvider .class );
633
- for (ProtocolProvider p : loader ) {
630
+ Iterator <ProtocolProvider > iterator = loader .iterator ();
631
+ while (iterator .hasNext ()) {
632
+ ProtocolProvider p ;
633
+ try {
634
+ p = iterator .next ();
635
+ } catch (ServiceConfigurationError e ) {
636
+ LOG .warn ("ServiceLoader failed to load ProtocolProvider" , e );
637
+ continue ;
638
+ }
634
639
if (p .supportsProtocol (protocol )) {
635
640
return p ;
636
641
}
Original file line number Diff line number Diff line change @@ -51,7 +51,15 @@ public class ArangoConfig {
51
51
private static ArangoSerdeProvider serdeProvider (ContentType contentType ) {
52
52
ServiceLoader <ArangoSerdeProvider > loader = ServiceLoader .load (ArangoSerdeProvider .class );
53
53
ArangoSerdeProvider serdeProvider = null ;
54
- for (ArangoSerdeProvider p : loader ) {
54
+ Iterator <ArangoSerdeProvider > iterator = loader .iterator ();
55
+ while (iterator .hasNext ()) {
56
+ ArangoSerdeProvider p ;
57
+ try {
58
+ p = iterator .next ();
59
+ } catch (ServiceConfigurationError e ) {
60
+ LOG .warn ("ServiceLoader failed to load ArangoSerdeProvider" , e );
61
+ continue ;
62
+ }
55
63
if (contentType .equals (p .getContentType ())) {
56
64
if (serdeProvider != null ) {
57
65
throw new ArangoDBException ("Found multiple serde providers! Please set explicitly the one to use." );
Original file line number Diff line number Diff line change 7
7
import org .slf4j .Logger ;
8
8
import org .slf4j .LoggerFactory ;
9
9
10
+ import java .util .Iterator ;
11
+ import java .util .ServiceConfigurationError ;
10
12
import java .util .ServiceLoader ;
11
13
12
14
class InternalMapperProvider {
@@ -23,7 +25,15 @@ static ObjectMapper of(final ContentType contentType) {
23
25
}
24
26
25
27
ServiceLoader <JsonFactory > sl = ServiceLoader .load (JsonFactory .class );
26
- for (JsonFactory jf : sl ) {
28
+ Iterator <JsonFactory > iterator = sl .iterator ();
29
+ while (iterator .hasNext ()) {
30
+ JsonFactory jf ;
31
+ try {
32
+ jf = iterator .next ();
33
+ } catch (ServiceConfigurationError e ) {
34
+ LOG .warn ("ServiceLoader failed to load JsonFactory" , e );
35
+ continue ;
36
+ }
27
37
if (formatName .equals (jf .getFormatName ())) {
28
38
if (contentType == ContentType .JSON ) {
29
39
JacksonUtils .tryConfigureJsonFactory (jf );
Original file line number Diff line number Diff line change 8
8
import org .slf4j .Logger ;
9
9
import org .slf4j .LoggerFactory ;
10
10
11
+ import java .util .Iterator ;
12
+ import java .util .ServiceConfigurationError ;
11
13
import java .util .ServiceLoader ;
12
14
13
15
/**
@@ -27,7 +29,15 @@ public static ObjectMapper of(final ContentType contentType) {
27
29
}
28
30
29
31
ServiceLoader <JsonFactory > sl = ServiceLoader .load (JsonFactory .class );
30
- for (JsonFactory jf : sl ) {
32
+ Iterator <JsonFactory > iterator = sl .iterator ();
33
+ while (iterator .hasNext ()) {
34
+ JsonFactory jf ;
35
+ try {
36
+ jf = iterator .next ();
37
+ } catch (ServiceConfigurationError e ) {
38
+ LOG .warn ("ServiceLoader failed to load JsonFactory" , e );
39
+ continue ;
40
+ }
31
41
if (formatName .equals (jf .getFormatName ())) {
32
42
if (contentType == ContentType .JSON ) {
33
43
JacksonUtils .tryConfigureJsonFactory (jf );
You can’t perform that action at this time.
0 commit comments