jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcel Reutegger (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-1967) Impossible comparison in NodeTypeImpl
Date Thu, 05 Feb 2009 15:17:59 GMT

    [ https://issues.apache.org/jira/browse/JCR-1967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12670786#action_12670786
] 

Marcel Reutegger commented on JCR-1967:
---------------------------------------

I think it should rather be:

Index: src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java
===================================================================
--- src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java	(revision 741110)
+++ src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeImpl.java	(working copy)
@@ -132,7 +132,7 @@
      * from the specified node type, otherwise false.
      */
     public boolean isNodeType(Name nodeTypeName) {
-        return getName().equals(nodeTypeName) ||  ent.includesNodeType(nodeTypeName);
+        return nodeTypeName.equals(ntd.getName()) ||  ent.includesNodeType(nodeTypeName);
     }
 
     /**

note, that I reversed the equals because ntd.getName() may return null.

> Impossible comparison in NodeTypeImpl
> -------------------------------------
>
>                 Key: JCR-1967
>                 URL: https://issues.apache.org/jira/browse/JCR-1967
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-jcr2spi
>    Affects Versions: 1.6.0
>            Reporter: Dave Brosius
>            Priority: Minor
>             Fix For: 1.6.0
>
>
> org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeImpl does
>     public boolean isNodeType(Name nodeTypeName) {
>         return getName().equals(nodeTypeName) ||  ent.includesNodeType(nodeTypeName);
>     }
> as getName() is a string and nodeTypeName is a Name this will always be false. Perhaps
you meant
>     public boolean isNodeType(Name nodeTypeName) {
>         return getName().equals(nodeTypeName.getLocalName()) ||  ent.includesNodeType(nodeTypeName);
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message