Repository: karaf
Updated Branches:
  refs/heads/master e1c311788 -> b65801b63


Extract pattern creation


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/d99dc071
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/d99dc071
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/d99dc071

Branch: refs/heads/master
Commit: d99dc07112eb221e456c67a7b9f92b1c63f1df2c
Parents: e1c3117
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Wed Aug 9 11:12:01 2017 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Wed Aug 9 11:12:09 2017 +0200

----------------------------------------------------------------------
 .../features/internal/service/FeaturesServiceImpl.java   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/d99dc071/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
 
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
index bd98364..6a000cd 100644
--- 
a/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
+++ 
b/features/core/src/main/java/org/apache/karaf/features/internal/service/FeaturesServiceImpl.java
@@ -891,10 +891,7 @@ public class FeaturesServiceImpl implements 
FeaturesService, Deployer.DeployCall
                     }
                 }
             } else {
-                // Match on name and version
-                String name = feature.substring(0, 
feature.indexOf(VERSION_SEPARATOR));
-                String version = 
feature.substring(feature.indexOf(VERSION_SEPARATOR) + 1);
-                Pattern pattern = getFeaturePattern(name, version);
+                Pattern pattern = getNameAndVersionPattern(feature);
                 for (String f : fl) {
                     Matcher matcher = pattern.matcher(f);
                     if (matcher.matches()) {
@@ -919,6 +916,12 @@ public class FeaturesServiceImpl implements 
FeaturesService, Deployer.DeployCall
         doProvisionInThread(required, stateChanges, state, getFeaturesById(), 
options);
     }
 
+    private Pattern getNameAndVersionPattern(String feature) {
+        String name = feature.substring(0, feature.indexOf(VERSION_SEPARATOR));
+        String version = feature.substring(feature.indexOf(VERSION_SEPARATOR) 
+ 1);
+        return getFeaturePattern(name, version);
+    }
+
     @Override
     public void updateFeaturesState(Map<String, Map<String, FeatureState>> 
stateChanges, EnumSet<Option> options) throws Exception {
         State state = copyState();

Reply via email to