karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject git commit: [KARAF-2749] Use Matcher.matches() instead of find() in the BundleSelector
Date Thu, 10 Jul 2014 19:28:26 GMT
Repository: karaf
Updated Branches:
  refs/heads/karaf-2.3.x 12a40ccc9 -> 3160b7c0e


[KARAF-2749] Use Matcher.matches() instead of find() in the BundleSelector


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

Branch: refs/heads/karaf-2.3.x
Commit: 3160b7c0eafe9d7b5f6de4114e08cc98f450c38f
Parents: 12a40cc
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
Authored: Thu Jul 10 21:27:11 2014 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Thu Jul 10 21:28:13 2014 +0200

----------------------------------------------------------------------
 .../mbeans/bundles/internal/BundlesSelector.java          | 10 +++++-----
 .../java/org/apache/karaf/shell/osgi/BundleSelector.java  | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/3160b7c0/management/mbeans/bundles/src/main/java/org/apache/karaf/management/mbeans/bundles/internal/BundlesSelector.java
----------------------------------------------------------------------
diff --git a/management/mbeans/bundles/src/main/java/org/apache/karaf/management/mbeans/bundles/internal/BundlesSelector.java
b/management/mbeans/bundles/src/main/java/org/apache/karaf/management/mbeans/bundles/internal/BundlesSelector.java
index 91b222e..b8d5903 100644
--- a/management/mbeans/bundles/src/main/java/org/apache/karaf/management/mbeans/bundles/internal/BundlesSelector.java
+++ b/management/mbeans/bundles/src/main/java/org/apache/karaf/management/mbeans/bundles/internal/BundlesSelector.java
@@ -50,7 +50,7 @@ public class BundlesSelector {
             // bundle ID is a number
             Pattern pattern = Pattern.compile("^\\d+$");
             Matcher matcher = pattern.matcher(bundleId);
-            if (matcher.find()) {
+            if (matcher.matches()) {
                 Bundle bundle = this.getBundleById(bundleId);
                 bundles.add(bundle);
                 return bundles;
@@ -59,7 +59,7 @@ public class BundlesSelector {
             // bundle is an ID range
             pattern = Pattern.compile("^(\\d+)-(\\d+)$");
             matcher = pattern.matcher(bundleId);
-            if (matcher.find()) {
+            if (matcher.matches()) {
                 int index = bundleId.indexOf('-');
                 long startId = Long.parseLong(bundleId.substring(0, index));
                 long stopId = Long.parseLong(bundleId.substring(index + 1));
@@ -147,17 +147,17 @@ public class BundlesSelector {
             if (version != null) {
                 String bundleVersion = (String) bundles[i].getHeaders().get(Constants.BUNDLE_VERSION);
                 if (bundleVersion != null) {
-                    boolean nameMatch = (nameMatcher != null && nameMatcher.find())
|| symbolicNameMatcher.find();
+                    boolean nameMatch = (nameMatcher != null && nameMatcher.matches())
|| symbolicNameMatcher.matches();
                     if (nameMatch) {
                         Pattern versionPattern = Pattern.compile(version);
                         Matcher versionMatcher = versionPattern.matcher(bundleVersion);
-                        if (versionMatcher.find()) {
+                        if (versionMatcher.matches()) {
                             result.add(bundles[i]);
                         }
                     }
                 }
             } else {
-                boolean nameMatch = (nameMatcher != null && nameMatcher.find()) ||
symbolicNameMatcher.find();
+                boolean nameMatch = (nameMatcher != null && nameMatcher.matches())
|| symbolicNameMatcher.matches();
                 if (nameMatch) {
                     result.add(bundles[i]);
                 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/3160b7c0/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/BundleSelector.java
----------------------------------------------------------------------
diff --git a/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/BundleSelector.java b/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/BundleSelector.java
index 1ede084..04acf44 100644
--- a/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/BundleSelector.java
+++ b/shell/osgi/src/main/java/org/apache/karaf/shell/osgi/BundleSelector.java
@@ -46,7 +46,7 @@ public class BundleSelector {
                 // id is a number
                 Pattern pattern = Pattern.compile("^\\d+$");
                 Matcher matcher = pattern.matcher(id);
-                if (matcher.find()) {
+                if (matcher.matches()) {
                     Bundle bundle = this.getBundleById(id);
                     addBundle(bundle, id, force, bundles);
                     continue;
@@ -55,7 +55,7 @@ public class BundleSelector {
                 // id as a number range
                 pattern = Pattern.compile("^(\\d+)-(\\d+)$");
                 matcher = pattern.matcher(id);
-                if (matcher.find()) {
+                if (matcher.matches()) {
                     int index = id.indexOf('-');
                     long startId = Long.parseLong(id.substring(0, index));
                     long endId = Long.parseLong(id.substring(index + 1));
@@ -177,17 +177,17 @@ public class BundleSelector {
             if (version != null) {
                 String bundleVersion = (String) bundles[i].getHeaders().get(Constants.BUNDLE_VERSION);
                 if (bundleVersion != null) {
-                    boolean nameMatch = (nameMatcher != null && nameMatcher.find())
|| symbolicNameMatcher.find();
+                    boolean nameMatch = (nameMatcher != null && nameMatcher.matches())
|| symbolicNameMatcher.matches();
                     if (nameMatch) {
                         Pattern versionPattern = Pattern.compile(version);
                         Matcher versionMatcher = versionPattern.matcher(bundleVersion); 
                  
-                        if (versionMatcher.find()) {
+                        if (versionMatcher.matches()) {
                             result.add(bundles[i]);
                         }
                     }
                 }
             } else {
-                boolean nameMatch = (nameMatcher != null && nameMatcher.find()) ||
symbolicNameMatcher.find();
+                boolean nameMatch = (nameMatcher != null && nameMatcher.matches())
|| symbolicNameMatcher.matches();
                 if (nameMatch) {
                     result.add(bundles[i]);
                 }


Mime
View raw message