This is an automated email from the ASF dual-hosted git repository.

joerghoh pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-resource.git


The following commit(s) were added to refs/heads/master by this push:
     new df83378  SLING-12940 read userData only for local events (#48)
df83378 is described below

commit df8337826bb7b7c3737ba159a5fba07898533414
Author: Jörg Hoh <[email protected]>
AuthorDate: Wed Sep 17 10:41:09 2025 +0200

    SLING-12940 read userData only for local events (#48)
    
    * SLING-12940 read userData only for local events
    * do not concat the event with the debug log message
---
 .../jcr/resource/internal/JcrResourceListener.java     | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java 
b/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
index 66c4357..18988fb 100644
--- 
a/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
+++ 
b/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
@@ -163,17 +163,17 @@ public class JcrResourceListener implements 
EventListener, Closeable {
                                                        final String path,
                                                        final ChangeType 
changeType) {
         final boolean isExternal = isExternal(event);
-        final String userId;
+        String userId = null;
+        String userData = null;
         if (!isExternal) {
+            // In Jackrabbit Oak userId and userData are not available if the 
event 
+            // is external
             userId = event.getUserID();
-        } else {
-            userId = null;
-        }
-        String userData = null;
-        try {
-            userData = event.getUserData();
-        } catch (RepositoryException e) {
-            logger.debug("Could not access user data from event " + event, e);
+            try {
+                userData = event.getUserData();
+            } catch (RepositoryException e) {
+                logger.debug("Could not access user data from event {} ", 
event, e);
+            }
         }
         return new JcrResourceChange(changeType, path, isExternal, userId, 
userData);
     }

Reply via email to