karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [1/2] karaf git commit: EntrySet should be iterated when both the key and value are needed
Date Wed, 06 Sep 2017 08:37:40 GMT
Repository: karaf
Updated Branches:
  refs/heads/master aaa3ed70f -> 47451b0ed


EntrySet should be iterated when both the key and value are needed

Signed-off-by: Aurélien Pupier <apupier@redhat.com>

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

Branch: refs/heads/master
Commit: 362d7b5dc036880c4d0cbc5263efd4b0a053ae19
Parents: aaa3ed7
Author: Aurélien Pupier <apupier@redhat.com>
Authored: Tue Sep 5 16:59:54 2017 +0200
Committer: Jean-Baptiste Onofré <jbonofre@apache.org>
Committed: Wed Sep 6 10:18:13 2017 +0200

----------------------------------------------------------------------
 .../apache/karaf/bundle/command/ShowBundleTree.java  | 15 ++++++++-------
 .../org/apache/karaf/config/command/ListCommand.java |  7 +++----
 .../features/internal/region/DigraphHelper.java      |  8 ++++----
 3 files changed, 15 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/362d7b5d/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
b/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
index 792c9dc..98bdc87 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/ShowBundleTree.java
@@ -139,15 +139,16 @@ public class ShowBundleTree extends BundleCommand {
                 }
             }
         }
-
-        for (String pkg : exports.keySet()) {
-            if (exports.get(pkg).size() > 1) {
-                System.out.printf("%n");
-                System.out.printf("WARNING: multiple bundles are exporting package %s%n",
pkg);
-                for (Bundle bundle : exports.get(pkg)) {
+        
+        for(Map.Entry<String, Set<Bundle>> entry : exports.entrySet()) {
+        	Set<Bundle> bundlesExportingPkg = entry.getValue();
+        	if(bundlesExportingPkg.size() > 1) {
+        		System.out.printf("%n");
+                System.out.printf("WARNING: multiple bundles are exporting package %s%n",
entry.getKey());
+                for (Bundle bundle : bundlesExportingPkg) {
                     System.out.printf("- %s%n", bundle);
                 }
-            }
+        	}
         }
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/362d7b5d/config/src/main/java/org/apache/karaf/config/command/ListCommand.java
----------------------------------------------------------------------
diff --git a/config/src/main/java/org/apache/karaf/config/command/ListCommand.java b/config/src/main/java/org/apache/karaf/config/command/ListCommand.java
index b4df5c6..dc041c9 100644
--- a/config/src/main/java/org/apache/karaf/config/command/ListCommand.java
+++ b/config/src/main/java/org/apache/karaf/config/command/ListCommand.java
@@ -41,8 +41,7 @@ public class ListCommand extends ConfigCommandSupport {
             for (Configuration config : configs) {
                 sortedConfigs.put(config.getPid(), config);
             }
-            for (String pid : sortedConfigs.keySet()) {
-                Configuration config = sortedConfigs.get(pid);
+            for (Configuration config : sortedConfigs.values()) {
                 System.out.println("----------------------------------------------------------------");
                 System.out.println("Pid:            " + config.getPid());
                 if (config.getFactoryPid() != null) {
@@ -57,8 +56,8 @@ public class ListCommand extends ConfigCommandSupport {
                         Object key = e.nextElement();
                         sortedProps.put(key.toString(), props.get(key));
                     }
-                    for (String key : sortedProps.keySet()) {
-                        System.out.println("   " + key + " = " + displayValue(sortedProps.get(key)));
+                    for (Map.Entry<String, Object> entry : sortedProps.entrySet())
{
+                        System.out.println("   " + entry.getKey() + " = " + displayValue(entry.getValue()));
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/karaf/blob/362d7b5d/features/core/src/main/java/org/apache/karaf/features/internal/region/DigraphHelper.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/region/DigraphHelper.java
b/features/core/src/main/java/org/apache/karaf/features/internal/region/DigraphHelper.java
index 31056b4..944fe6f 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/region/DigraphHelper.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/region/DigraphHelper.java
@@ -180,10 +180,10 @@ public final class DigraphHelper {
             for (RegionDigraph.FilteredRegion fr : digraph.getEdges(region)) {
                 Map<String, Set<String>> policy = new HashMap<>();
                 Map<String, Collection<String>> current = fr.getFilter().getSharingPolicy();
-                for (String ns : current.keySet()) {
-                    for (String f : current.get(ns)) {
-                        addToMapSet(policy, ns, f);
-                    }
+                for (Map.Entry<String, Collection<String>> entry : current.entrySet())
{
+                	for(String f : entry.getValue()) {
+                		 addToMapSet(policy, entry.getKey(), f);
+                	}
                 }
                 edges.put(fr.getRegion().getName(), policy);
             }


Mime
View raw message