Author: cziegeler
Date: Fri Jul 8 11:50:39 2016
New Revision: 1751888
URL: http://svn.apache.org/viewvc?rev=1751888&view=rev
Log:
SLING-5829 : Fix handling of SERVICE_PID
Modified:
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/ResourceProviderTracker.java
Modified:
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java?rev=1751888&r1=1751887&r2=1751888&view=diff
==============================================================================
---
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
(original)
+++
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/FactoryPreconditions.java
Fri Jul 8 11:50:39 2016
@@ -95,7 +95,7 @@ public class FactoryPreconditions {
canRegister = false;
for (final ResourceProviderHandler h :
localTracker.getResourceProviderStorage().getAllHandlers()) {
final ServiceReference ref =
h.getInfo().getServiceReference();
- final String servicePid =
(String)ref.getProperty(Constants.SERVICE_PID);
+ final Object servicePid =
ref.getProperty(Constants.SERVICE_PID);
if ( unavailableServicePid != null &&
unavailableServicePid.equals(servicePid) ) {
// ignore this service
continue;
Modified:
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/ResourceProviderTracker.java
URL:
http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/ResourceProviderTracker.java?rev=1751888&r1=1751887&r2=1751888&view=diff
==============================================================================
---
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/ResourceProviderTracker.java
(original)
+++
sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/ResourceProviderTracker.java
Fri Jul 8 11:50:39 2016
@@ -107,7 +107,11 @@ public class ResourceProviderTracker imp
final ServiceReference ref = (ServiceReference)service;
final ResourceProviderInfo info = infos.remove(ref);
if ( info != null ) {
- unregister(info,
(String)ref.getProperty(Constants.SERVICE_PID));
+ Object pid = ref.getProperty(Constants.SERVICE_PID);
+ if ( pid != null && !(pid instanceof String) ) {
+ pid = null;
+ }
+ unregister(info, (String)pid);
}
}
@@ -199,7 +203,11 @@ public class ResourceProviderTracker imp
if ( deactivateHandler != null ) {
final ResourceProviderInfo handlerInfo =
deactivateHandler.getInfo();
if ( cl != null ) {
-
cl.providerRemoved((String)handlerInfo.getServiceReference().getProperty(Constants.SERVICE_PID),
+ Object pid =
handlerInfo.getServiceReference().getProperty(Constants.SERVICE_PID);
+ if ( pid != null && !(pid instanceof String) ) {
+ pid = null;
+ }
+ cl.providerRemoved((String)pid,
handlerInfo.getAuthType() != AuthType.no,
deactivateHandler.isUsed());
}
@@ -479,15 +487,15 @@ public class ResourceProviderTracker imp
private static final class ProviderEvent {
public final boolean isAdd;
- public final String pid;
+ public final Object pid;
public final String path;
public ProviderEvent(final boolean isAdd, final ResourceProviderInfo
info) {
this.isAdd = isAdd;
this.path = info.getPath();
- String pid = (String)
info.getServiceReference().getProperty(Constants.SERVICE_PID);
+ Object pid =
info.getServiceReference().getProperty(Constants.SERVICE_PID);
if (pid == null) {
- pid = (String)
info.getServiceReference().getProperty(LegacyResourceProviderWhiteboard.ORIGINAL_SERVICE_PID);
+ pid =
info.getServiceReference().getProperty(LegacyResourceProviderWhiteboard.ORIGINAL_SERVICE_PID);
}
this.pid = pid;
}