jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r1084832 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authenticati...
Date Thu, 24 Mar 2011 02:49:06 GMT
Author: dbrosius
Date: Thu Mar 24 02:49:05 2011
New Revision: 1084832

URL: http://svn.apache.org/viewvc?rev=1084832&view=rev
Log:
JCR-2929
Various places do map lookups in loops instead of using entrySet iterator

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/privilege/PrivilegeXmlHandler.java
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java?rev=1084832&r1=1084831&r2=1084832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RemoveMixinOperation.java
Thu Mar 24 02:49:05 2011
@@ -191,9 +191,10 @@ class RemoveMixinOperation implements Se
         // 2. remove item if 1. fails
         boolean success = false;
         try {
-            for (PropertyId id : affectedProps.keySet()) {
+        	for (Map.Entry<PropertyId, PropertyDefinition> entry : affectedProps.entrySet())
{
+        		PropertyId id = entry.getKey();
                 PropertyImpl prop = (PropertyImpl) itemMgr.getItem(id);
-                PropertyDefinition oldDef = affectedProps.get(id);
+                PropertyDefinition oldDef = entry.getValue();
 
                 if (oldDef.isProtected()) {
                     // remove 'orphaned' protected properties immediately

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java?rev=1084832&r1=1084831&r2=1084832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/query/lucene/MoreLikeThis.java
Thu Mar 24 02:49:05 2011
@@ -605,11 +605,12 @@ public final class MoreLikeThis {
         int numDocs = ir.numDocs();
         FreqQ res = new FreqQ(words.size()); // will order words by score
 
-        Iterator<String> it = words.keySet().iterator();
+        Iterator<Map.Entry<String, Int>> it = words.entrySet().iterator();
         while (it.hasNext()) { // for every word
-            String word = it.next();
+        	Map.Entry<String, Int> entry = it.next();
+            String word = entry.getKey();
 
-            int tf = ((Int) words.get(word)).x; // term freq in the source doc
+            int tf = entry.getValue().x; // term freq in the source doc
             if (minTermFreq > 0 && tf < minTermFreq) {
                 continue; // filter out words that don't occur enough times in the source
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java?rev=1084832&r1=1084831&r2=1084832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authentication/token/TokenBasedAuthentication.java
Thu Mar 24 02:49:05 2011
@@ -210,8 +210,9 @@ public class TokenBasedAuthentication im
                     tokenNode = getTokenNode();
                     s = tokenNode.getSession();
                 }
-                for (String attrName : newAttributes.keySet()) {
-                    tokenNode.setProperty(attrName, newAttributes.get(attrName));
+                for (Map.Entry<String, String> entry : newAttributes.entrySet()) {
+                	String attrName = entry.getKey();
+                    tokenNode.setProperty(attrName, entry.getValue());
                     log.info("Updating token node with informative attribute '" + attrName
+ "'");
                 }
             }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java?rev=1084832&r1=1084831&r2=1084832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/AccessControlEntryImpl.java
Thu Mar 24 02:49:05 2011
@@ -127,10 +127,9 @@ public abstract class AccessControlEntry
         } else {
             this.restrictions = new HashMap<Name, Value>(restrictions.size());
             // validate the passed restrictions and fill the map
-            for (String key : restrictions.keySet()) {
-                Value value = restrictions.get(key);
-                value = ValueHelper.copy(value, getValueFactory());
-                this.restrictions.put(getResolver().getQName(key), value);
+            for (Map.Entry<String, Value> entry : restrictions.entrySet()) {
+                Value value = ValueHelper.copy(entry.getValue(), getValueFactory());
+                this.restrictions.put(getResolver().getQName(entry.getKey()), value);
             }
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/privilege/PrivilegeXmlHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/privilege/PrivilegeXmlHandler.java?rev=1084832&r1=1084831&r2=1084832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/privilege/PrivilegeXmlHandler.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/privilege/PrivilegeXmlHandler.java
Thu Mar 24 02:49:05 2011
@@ -138,8 +138,8 @@ class PrivilegeXmlHandler implements Pri
             Document doc = builder.newDocument();
             Element privileges = (Element) doc.appendChild(doc.createElement(XML_PRIVILEGES));
 
-            for (String prefix : namespaces.keySet()) {
-                privileges.setAttribute(ATTR_XMLNS + prefix, namespaces.get(prefix));
+            for (Map.Entry<String, String> entry : namespaces.entrySet()) {
+                privileges.setAttribute(ATTR_XMLNS + entry.getKey(), entry.getValue());
             }
 
             for (PrivilegeDefinition def : definitions) {

Modified: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java?rev=1084832&r1=1084831&r2=1084832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/WorkspaceResourceImpl.java
Thu Mar 24 02:49:05 2011
@@ -267,9 +267,8 @@ public class WorkspaceResourceImpl exten
 
                 // try to register any prefix/uri pair that has a changed uri or
                 // it has not been present before.
-                for (String prefix : changes.keySet()) {
-                    String uri = changes.get(prefix);
-                    nsReg.registerNamespace(prefix, uri);
+                for (Map.Entry<String, String> entry : changes.entrySet()) {
+                    nsReg.registerNamespace(entry.getKey(), entry.getValue());
                 }
             } catch (RepositoryException e) {
                 throw new JcrDavException(e);



Mime
View raw message