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 2023/05/02 07:47:31 UTC
[sling-org-apache-sling-feature-cpconverter] branch master updated: SLING-11855 : Conversion of old factory config names to new one is not checking for tilde
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-feature-cpconverter.git
The following commit(s) were added to refs/heads/master by this push:
new 5f2c390 SLING-11855 : Conversion of old factory config names to new one is not checking for tilde
5f2c390 is described below
commit 5f2c390fb3846d7f4dd11c4bdedc6bbf7df97613
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Tue May 2 09:47:25 2023 +0200
SLING-11855 : Conversion of old factory config names to new one is not checking for tilde
---
.../feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java | 2 +-
.../cpconverter/handlers/AbstractConfigurationEntryHandlerTest.java | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java b/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java
index 4222219..1bbba74 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandler.java
@@ -103,7 +103,7 @@ abstract class AbstractConfigurationEntryHandler extends AbstractRegexEntryHandl
}
// check for old format for factory configurations (using dash instead of tilde)
idx = pid.indexOf('-');
- if ( idx != -1 ) {
+ if ( idx != -1 && pid.indexOf('~') == -1 ) {
pid = pid.substring(0, idx).concat("~").concat(pid.substring(idx + 1));
}
return pid;
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandlerTest.java
index 7db5a4f..ca8f2b3 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandlerTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/AbstractConfigurationEntryHandlerTest.java
@@ -27,5 +27,6 @@ public class AbstractConfigurationEntryHandlerTest {
assertEquals("org.apache.sling.Component", AbstractConfigurationEntryHandler.extractId("apath/org.apache.sling.Component"));
assertEquals("org.apache.sling.Component~factory", AbstractConfigurationEntryHandler.extractId("org.apache.sling.Component~factory"));
assertEquals("org.apache.sling.Component~factory", AbstractConfigurationEntryHandler.extractId("org.apache.sling.Component-factory"));
+ assertEquals("org.apache.sling.Component~factory-a", AbstractConfigurationEntryHandler.extractId("org.apache.sling.Component~factory-a"));
}
}