You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/11/25 19:46:12 UTC
[sling-org-apache-sling-resourceresolver] branch master updated:
SLING-7266 : NPE in resource resolver activator
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git
The following commit(s) were added to refs/heads/master by this push:
new e10e25b SLING-7266 : NPE in resource resolver activator
e10e25b is described below
commit e10e25b882c774c6ba8491db76a2e019d239c102
Author: Carsten Ziegeler <cz...@adobe.com>
AuthorDate: Sat Nov 25 20:45:56 2017 +0100
SLING-7266 : NPE in resource resolver activator
---
.../sling/resourceresolver/impl/FactoryPreconditions.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java b/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
index 9f487ac..3262805 100644
--- a/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
+++ b/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
@@ -24,6 +24,7 @@ import java.util.Set;
import org.apache.sling.resourceresolver.impl.legacy.LegacyResourceProviderWhiteboard;
import org.apache.sling.resourceresolver.impl.providers.ResourceProviderHandler;
+import org.apache.sling.resourceresolver.impl.providers.ResourceProviderInfo;
import org.apache.sling.resourceresolver.impl.providers.ResourceProviderTracker;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -56,7 +57,7 @@ public class FactoryPreconditions {
synchronized ( this ) {
this.tracker = tracker;
- final List<RequiredProvider> rps = new ArrayList<RequiredProvider>();
+ final List<RequiredProvider> rps = new ArrayList<>();
if ( legycyConfiguration != null ) {
final Logger logger = LoggerFactory.getLogger(getClass());
for(final String value : legycyConfiguration) {
@@ -103,17 +104,23 @@ public class FactoryPreconditions {
for (final RequiredProvider rp : localRequiredProviders) {
canRegister = false;
for (final ResourceProviderHandler h : localTracker.getResourceProviderStorage().getAllHandlers()) {
- final ServiceReference ref = h.getInfo().getServiceReference();
+ final ResourceProviderInfo info = h.getInfo();
+ if ( info == null ) {
+ // provider has been deactivated in the meantime
+ // ignore and continue
+ continue;
+ }
+ final ServiceReference ref = info.getServiceReference();
final Object servicePid = ref.getProperty(Constants.SERVICE_PID);
if ( unavailableServicePid != null && unavailableServicePid.equals(servicePid) ) {
// ignore this service
continue;
}
- if ( unavailableName != null && unavailableName.equals(h.getInfo().getName()) ) {
+ if ( unavailableName != null && unavailableName.equals(info.getName()) ) {
// ignore this service
continue;
}
- if ( rp.name != null && rp.name.equals(h.getInfo().getName()) ) {
+ if ( rp.name != null && rp.name.equals(info.getName()) ) {
canRegister = true;
break;
} else if (rp.filter != null && rp.filter.match(ref)) {
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].