You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2015/03/09 13:34:28 UTC
svn commit: r1665210 -
/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java
Author: cziegeler
Date: Mon Mar 9 12:34:28 2015
New Revision: 1665210
URL: http://svn.apache.org/r1665210
Log:
SLING-4485 : JcrSystemUserValidator uses a non synchronized set
Modified:
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java
Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java?rev=1665210&r1=1665209&r2=1665210&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java (original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrSystemUserValidator.java Mon Mar 9 12:34:28 2015
@@ -17,10 +17,12 @@
package org.apache.sling.jcr.resource.internal;
import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
+
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
@@ -41,10 +43,10 @@ import org.slf4j.LoggerFactory;
*
* @see org.apache.jackrabbit.api.security.user.User#isSystemUser()
*/
-@Component(label = "Service User Validation Service", description = "Service user validation for JCR system users.")
+@Component
@Service(ServiceUserValidator.class)
public class JcrSystemUserValidator implements ServiceUserValidator {
-
+
/**
* logger instance
*/
@@ -52,12 +54,12 @@ public class JcrSystemUserValidator impl
@Reference
private volatile SlingRepository repository;
-
- private Method isSystemUserMethod;
- private Set<String> validIds = new HashSet<String>();
-
- public JcrSystemUserValidator(){
+ private Method isSystemUserMethod;
+
+ private Set<String> validIds = new CopyOnWriteArraySet<String>();
+
+ public JcrSystemUserValidator() {
try {
isSystemUserMethod = User.class.getMethod("isSystemUser");
} catch (Exception e) {
@@ -105,8 +107,8 @@ public class JcrSystemUserValidator impl
return false;
}
}
-
-
+
+
private boolean isSystemUser(User user){
if (isSystemUserMethod != null) {
try {