jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1759440 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/security/authorization/GlobPattern.java test/java/org/apache/jackrabbit/core/security/authorization/GlobPatternTest.java
Date Tue, 06 Sep 2016 14:57:58 GMT
Author: mreutegg
Date: Tue Sep  6 14:57:58 2016
New Revision: 1759440

URL: http://svn.apache.org/viewvc?rev=1759440&view=rev
Log:
JCR-3882: GlobalPattern's equals() implementation throws NullPointerException

Apply Woonsan Ko's pull request. Thanks Pedro Teixeira for reporting the issue.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/GlobPattern.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/GlobPatternTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/GlobPattern.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/GlobPattern.java?rev=1759440&r1=1759439&r2=1759440&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/GlobPattern.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/authorization/GlobPattern.java
Tue Sep  6 14:57:58 2016
@@ -158,7 +158,7 @@ public final class GlobPattern {
         if (obj instanceof GlobPattern) {
             GlobPattern other = (GlobPattern) obj;
             return nodePath.equals(other.nodePath) &&
-                    (restriction == null) ? other.restriction == null : restriction.equals(other.restriction);
+                    ((restriction == null) ? other.restriction == null : restriction.equals(other.restriction));
         }
         return false;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/GlobPatternTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/GlobPatternTest.java?rev=1759440&r1=1759439&r2=1759440&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/GlobPatternTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/GlobPatternTest.java
Tue Sep  6 14:57:58 2016
@@ -351,4 +351,22 @@ public class GlobPatternTest extends JUn
     public void testMatchesItem() {
        // TODO
     }
+
+     public void testEquals() {
+         GlobPattern gp1 = GlobPattern.create("/a/b/c");
+         GlobPattern gp2 = GlobPattern.create("/a/b/c");
+         assertEquals(gp1, gp2);
+
+         gp1 = GlobPattern.create("/a/b/c");
+         gp2 = GlobPattern.create("/a/b/c/d");
+         assertFalse(gp1.equals(gp2));
+
+         gp1 = GlobPattern.create("/a/b/c", null);
+         gp2 = GlobPattern.create("/a/b/c", "");
+         assertFalse(gp1.equals(gp2));
+
+         gp1 = GlobPattern.create("/a/b/c", "");
+         gp2 = GlobPattern.create("/a/b/c", "");
+         assertEquals(gp1, gp2);
+     }
 }



Mime
View raw message