Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -174,10 +174,7 @@ private static ClassLoader getClassLoader() {
private static <T> T findFirstService(final String factoryId, final ClassLoader cl, final Class<T> service) {
final PrivilegedAction<T> action = () -> {
try {
final ServiceLoader<T> loader = ServiceLoader.load(service, cl);
if (loader.iterator().hasNext()) {
return loader.iterator().next();
}
return ServiceLoader.load(service, cl).findFirst().orElse(null);
} catch (Exception e) {
LOGGER.log(Level.FINER, "Failed to load service " + factoryId + ".", e);
}
Expand Down
7 changes: 2 additions & 5 deletions jaxrs-api/src/main/java/jakarta/ws/rs/ext/FactoryFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -174,10 +174,7 @@ private static ClassLoader getClassLoader() {
private static <T> T findFirstService(final String factoryId, final ClassLoader cl, final Class<T> service) {
final PrivilegedAction<T> action = () -> {
try {
final ServiceLoader<T> loader = ServiceLoader.load(service, cl);
if (loader.iterator().hasNext()) {
return loader.iterator().next();
}
return ServiceLoader.load(service, cl).findFirst().orElse(null);
} catch (Exception e) {
LOGGER.log(Level.FINER, "Failed to load service " + factoryId + ".", e);
}
Expand Down
7 changes: 2 additions & 5 deletions jaxrs-api/src/main/java/jakarta/ws/rs/sse/FactoryFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -174,10 +174,7 @@ private static ClassLoader getClassLoader() {
private static <T> T findFirstService(final String factoryId, final ClassLoader cl, final Class<T> service) {
final PrivilegedAction<T> action = () -> {
try {
final ServiceLoader<T> loader = ServiceLoader.load(service, cl);
if (loader.iterator().hasNext()) {
return loader.iterator().next();
}
return ServiceLoader.load(service, cl).findFirst().orElse(null);
} catch (Exception e) {
LOGGER.log(Level.FINER, "Failed to load service " + factoryId + ".", e);
}
Expand Down
Loading