jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r691324 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
Date Tue, 02 Sep 2008 17:23:04 GMT
Author: jukka
Date: Tue Sep  2 10:23:04 2008
New Revision: 691324

URL: http://svn.apache.org/viewvc?rev=691324&view=rev
Log:
JCR-1308: Unnecessary null check in EffectiveNodeType.getApplicableChildNodeDef()

Applied improvement suggested by Ed Burnette.

Also simplified the control flow statements a bit without introducing functional changes.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java?rev=691324&r1=691323&r2=691324&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/EffectiveNodeType.java
Tue Sep  2 10:23:04 2008
@@ -686,25 +686,20 @@
 
         // try named node definitions first
         ItemDef[] defs = getNamedItemDefs(name);
-        if (defs != null) {
-            for (int i = 0; i < defs.length; i++) {
-                ItemDef def = defs[i];
-                if (def.definesNode()) {
-                    NodeDef nd = (NodeDef) def;
-                    // node definition with that name exists
-                    if (entTarget != null && nd.getRequiredPrimaryTypes() != null)
{
-                        // check 'required primary types' constraint
-                        if (!entTarget.includesNodeTypes(nd.getRequiredPrimaryTypes())) {
-                            continue;
-                        }
+        for (int i = 0; i < defs.length; i++) {
+            if (defs[i].definesNode()) {
+                NodeDef nd = (NodeDef) defs[i];
+                Name[] types = nd.getRequiredPrimaryTypes();
+                // node definition with that name exists
+                if (entTarget != null && types != null) {
+                    // check 'required primary types' constraint
+                    if (entTarget.includesNodeTypes(types)) {
                         // found named node definition
                         return nd;
-                    } else {
-                        if (nd.getDefaultPrimaryType() != null) {
-                            // found node definition with default node type
-                            return nd;
-                        }
                     }
+                } else if (nd.getDefaultPrimaryType() != null) {
+                    // found node definition with default node type
+                    return nd;
                 }
             }
         }



Mime
View raw message