Index: oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRef.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRef.java	(revision 1708292)
+++ oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/ExternalIdentityRef.java	(revision )
@@ -43,7 +43,7 @@
 
         StringBuilder b = new StringBuilder();
         escape(b, id);
-        if (providerName != null && providerName.length() > 0) {
+        if (providerName != null && !providerName.isEmpty()) {
             b.append(';');
             escape(b, providerName);
         }
@@ -119,16 +119,20 @@
     }
 
     /**
-     * Tests if the given object is an external identity reference and if it's getString() is equal to this.
+     * Tests if the given object is an external identity reference and if it's
+     * getString() is equal to this. Note, that there is no need to
+     * include {@code id} and {@code provider} fields in the comparison as
+     * the string representation already incorporates both.
      */
     @Override
     public boolean equals(Object o) {
-        try {
-            // assuming that we never compare other types of classes
-            return this == o || string.equals(((ExternalIdentityRef) o).string);
-        } catch (Exception e) {
-            return false;
+        if (this == o) {
+            return true;
         }
+        if (o instanceof ExternalIdentityRef) {
+            return string.equals(((ExternalIdentityRef) o).string);
+        }
+        return false;
     }
 
     /**
\ No newline at end of file
