Skip to content

Commit

Permalink
Avoid returning null too early in OSGi case
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <[email protected]>
  • Loading branch information
lukasj committed Feb 20, 2021
1 parent e537f6b commit 77a7998
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions api/src/main/java/jakarta/xml/soap/FactoryFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2021 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -114,7 +114,10 @@ static <T> T find(Class<T> factoryClass,

// handling Glassfish/OSGi (platform specific default)
if (isOsgi()) {
return (T) lookupUsingOSGiServiceLoader(factoryId);
Object result = lookupUsingOSGiServiceLoader(factoryId);
if (result != null) {
return (T) result;
}
}

// If not found and fallback should not be tried, return a null result.
Expand Down

0 comments on commit 77a7998

Please sign in to comment.