[ 
https://issues.apache.org/jira/browse/SLING-7496?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16369277#comment-16369277
 ] 

ASF GitHub Bot commented on SLING-7496:
---------------------------------------

cziegeler closed pull request #2: SLING-7496 Factory config deleted with 
ConfigAdmin immediately after creation
URL: 
https://github.com/apache/sling-org-apache-sling-installer-factory-configuration/pull/2
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/src/main/java/org/apache/sling/installer/factories/configuration/impl/AbstractConfigTask.java
 
b/src/main/java/org/apache/sling/installer/factories/configuration/impl/AbstractConfigTask.java
index c5f4d1d..a1d628a 100644
--- 
a/src/main/java/org/apache/sling/installer/factories/configuration/impl/AbstractConfigTask.java
+++ 
b/src/main/java/org/apache/sling/installer/factories/configuration/impl/AbstractConfigTask.java
@@ -80,7 +80,12 @@ protected String getCompositeAliasPid() {
         if ( this.aliasPid == null || this.factoryPid == null ) {
             return null;
         }
-        final String alias = factoryPid + "." + this.aliasPid;
+        final String alias;
+        if (this.aliasPid.startsWith(this.factoryPid)) {
+            alias = this.aliasPid;
+        } else {
+            alias = this.factoryPid + "." + this.aliasPid;
+        }
         final int pos = this.getResource().getEntityId().indexOf(':');
         if ( this.getResource().getEntityId().substring(pos + 1).equals(alias) 
) {
             return null;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Factory config deleted with ConfigAdmin immediately after creation
> ------------------------------------------------------------------
>
>                 Key: SLING-7496
>                 URL: https://issues.apache.org/jira/browse/SLING-7496
>             Project: Sling
>          Issue Type: Bug
>          Components: Installer
>    Affects Versions: Installer Configuration Factory 1.1.2
>            Reporter: David Bosschaert
>            Assignee: Carsten Ziegeler
>            Priority: Major
>             Fix For: Installer Configuration Factory 1.2.0
>
>
> In some cases when a factory configuration is created using the OSGi 
> ConfigAdmin API, the configuration gets a call to {{delete()}} immediately 
> when {{update()}} on the configuration is called.
>  
> The issue comes down to the fact that the factory prefix is prepended twice 
> to the configuration at some point in the installer, which is then assigned 
> to the resource {{entityId}}. This mismatch causes the initial configuration 
> to receive a delete callback as the system thinks it's no longer there.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to