jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1364659 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type: NodeDefinitionImpl.java NodeDefinitionTemplateImpl.java NodeTypeImpl.java NodeTypeManagerImpl.java
Date Mon, 23 Jul 2012 14:44:46 GMT
Author: mduerig
Date: Mon Jul 23 14:44:46 2012
New Revision: 1364659

URL: http://svn.apache.org/viewvc?rev=1364659&view=rev
Log:
OAK-202 Simplify the code when possible
use for each loop

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java?rev=1364659&r1=1364658&r2=1364659&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionImpl.java
Mon Jul 23 14:44:46 2012
@@ -58,12 +58,13 @@ class NodeDefinitionImpl extends ItemDef
     public NodeType[] getRequiredPrimaryTypes() {
         String[] names = getRequiredPrimaryTypeNames();
         List<NodeType> types = new ArrayList<NodeType>(names.length);
-        for (int i = 0; i < names.length; i++) {
+        for (String name : names) {
             try {
-                types.add(manager.getNodeType(names[i]));
-            } catch (RepositoryException e) {
+                types.add(manager.getNodeType(name));
+            }
+            catch (RepositoryException e) {
                 log.warn("Unable to access required primary type "
-                        + names[i] + " of node " + getName(), e);
+                        + name + " of node " + getName(), e);
             }
         }
         return types.toArray(new NodeType[types.size()]);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java?rev=1364659&r1=1364658&r2=1364659&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeDefinitionTemplateImpl.java
Mon Jul 23 14:44:46 2012
@@ -154,12 +154,13 @@ class NodeDefinitionTemplateImpl
         } else {
             List<NodeType> types =
                     new ArrayList<NodeType>(requiredPrimaryTypeNames.length);
-            for (int i = 0; i < requiredPrimaryTypeNames.length; i++) {
+            for (String requiredPrimaryTypeName : requiredPrimaryTypeNames) {
                 try {
-                    types.add(getNodeType(requiredPrimaryTypeNames[i]));
-                } catch (RepositoryException e) {
+                    types.add(getNodeType(requiredPrimaryTypeName));
+                }
+                catch (RepositoryException e) {
                     log.warn("Unable to required primary primary type "
-                            + requiredPrimaryTypeNames[i] + " of " + name, e);
+                            + requiredPrimaryTypeName + " of " + name, e);
                 }
             }
             return types.toArray(new NodeType[types.size()]);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java?rev=1364659&r1=1364658&r2=1364659&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeImpl.java
Mon Jul 23 14:44:46 2012
@@ -156,13 +156,14 @@ class NodeTypeImpl implements NodeType {
     public NodeType[] getDeclaredSupertypes() {
         String[] names = getDeclaredSupertypeNames();
         List<NodeType> types = new ArrayList<NodeType>(names.length);
-        for (int i = 0; i < names.length; i++) {
+        for (String name : names) {
             try {
-                NodeType type = manager.getNodeType(names[i]);
+                NodeType type = manager.getNodeType(name);
                 types.add(type);
-            } catch (RepositoryException e) {
+            }
+            catch (RepositoryException e) {
                 log.warn("Unable to access declared supertype "
-                        + names[i] + " of " + getName(), e);
+                        + name + " of " + getName(), e);
             }
         }
         return types.toArray(new NodeType[types.size()]);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java?rev=1364659&r1=1364658&r2=1364659&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/type/NodeTypeManagerImpl.java
Mon Jul 23 14:44:46 2012
@@ -235,8 +235,8 @@ public class NodeTypeManagerImpl impleme
         Tree types = getOrCreateNodeTypes(root);
         try {
             List<NodeType> list = Lists.newArrayList();
-            for (int i = 0; i < ntds.length; i++) {
-                list.add(internalRegister(types, ntds[i], allowUpdate));
+            for (NodeTypeDefinition ntd : ntds) {
+                list.add(internalRegister(types, ntd, allowUpdate));
             }
             root.commit(DefaultConflictHandler.OURS);
             return new NodeTypeIteratorAdapter(list);



Mime
View raw message