sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1788870 - in /sling/trunk/bundles/resourceresolver: ./ src/main/java/org/apache/sling/resourceresolver/impl/ src/main/java/org/apache/sling/resourceresolver/impl/helper/ src/main/java/org/apache/sling/resourceresolver/impl/legacy/ src/main...
Date Mon, 27 Mar 2017 09:54:51 GMT
Author: cziegeler
Date: Mon Mar 27 09:54:51 2017
New Revision: 1788870

URL: http://svn.apache.org/viewvc?rev=1788870&view=rev
Log:
SLING-6717 : Use commons lang3

Modified:
    sling/trunk/bundles/resourceresolver/pom.xml
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderFactoryAdapter.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderWhiteboard.java
    sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/tree/PathTree.java

Modified: sling/trunk/bundles/resourceresolver/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/pom.xml?rev=1788870&r1=1788869&r2=1788870&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/pom.xml (original)
+++ sling/trunk/bundles/resourceresolver/pom.xml Mon Mar 27 09:54:51 2017
@@ -133,9 +133,9 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-           <groupId>commons-lang</groupId>
-           <artifactId>commons-lang</artifactId>
-           <version>2.4</version>
+           <groupId>org.apache.commons</groupId>
+           <artifactId>commons-lang3</artifactId>
+           <version>3.5</version>
            <scope>provided</scope>
         </dependency>
         <dependency>

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java?rev=1788870&r1=1788869&r2=1788870&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/ResourceResolverImpl.java
Mon Mar 27 09:54:51 2017
@@ -18,7 +18,7 @@
  */
 package org.apache.sling.resourceresolver.impl;
 
-import static org.apache.commons.lang.StringUtils.defaultString;
+import static org.apache.commons.lang3.StringUtils.defaultString;
 
 import java.util.Arrays;
 import java.util.Collections;
@@ -109,7 +109,7 @@ public class ResourceResolverImpl extend
      */
     private ResourceResolverImpl(final ResourceResolverImpl resolver, final Map<String,
Object> authenticationInfo) throws LoginException {
         this.factory = resolver.factory;
-        Map<String, Object> authInfo = new HashMap<String, Object>();
+        Map<String, Object> authInfo = new HashMap<>();
         if (resolver.control.getAuthenticationInfo() != null) {
             authInfo.putAll(resolver.control.getAuthenticationInfo());
         }
@@ -461,7 +461,7 @@ public class ResourceResolverImpl extend
             // find aliases for segments. we can't walk the parent chain
             // since the request session might not have permissions to
             // read all parents SLING-2093
-            final LinkedList<String> names = new LinkedList<String>();
+            final LinkedList<String> names = new LinkedList<>();
 
             Resource current = res;
             String path = res.getPath();
@@ -1229,7 +1229,7 @@ public class ResourceResolverImpl extend
              if (ResourceTypeUtil.areResourceTypesEqual(resourceType, resource.getResourceType(),
getSearchPath())) {
                  result = true;
              } else {
-                 Set<String> superTypesChecked = new HashSet<String>();
+                 Set<String> superTypesChecked = new HashSet<>();
                  String superType = this.getParentResourceType(resource);
                  while (!result && superType != null) {
                      if (ResourceTypeUtil.areResourceTypesEqual(resourceType, superType,
getSearchPath())) {

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java?rev=1788870&r1=1788869&r2=1788870&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/helper/ResourceResolverControl.java
Mon Mar 27 09:54:51 2017
@@ -37,7 +37,7 @@ import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
 import org.apache.commons.collections.iterators.IteratorChain;
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;
@@ -48,6 +48,7 @@ import org.apache.sling.api.resource.Syn
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.resource.path.PathBuilder;
 import org.apache.sling.resourceresolver.impl.providers.ResourceProviderHandler;
+import org.apache.sling.resourceresolver.impl.providers.ResourceProviderInfo;
 import org.apache.sling.resourceresolver.impl.providers.ResourceProviderStorage;
 import org.apache.sling.resourceresolver.impl.providers.ResourceProviderStorageProvider;
 import org.apache.sling.resourceresolver.impl.providers.stateful.AuthenticatedResourceProvider;
@@ -97,7 +98,7 @@ public class ResourceResolverControl {
     public ResourceResolverControl(final boolean isAdmin,
             final Map<String, Object> authenticationInfo,
             final ResourceProviderStorageProvider resourceProviderTracker) {
-        this.authenticatedProviders = new IdentityHashMap<ResourceProviderHandler, Object>();
+        this.authenticatedProviders = new IdentityHashMap<>();
         this.authenticationInfo = authenticationInfo;
         this.isAdmin = isAdmin;
         this.resourceProviderTracker = resourceProviderTracker;
@@ -268,7 +269,7 @@ public class ResourceResolverControl {
             realChildren = provider.listChildren(parent);
         }
 
-        final Set<String> visitedNames = new HashSet<String>();
+        final Set<String> visitedNames = new HashSet<>();
 
         IteratorChain chain = new IteratorChain();
         if ( realChildren != null ) {
@@ -278,8 +279,8 @@ public class ResourceResolverControl {
         // synthetic and providers are done in one loop
         final Node<ResourceProviderHandler> node = getResourceProviderStorage().getTree().getNode(parent.getPath());
         if (node != null) {
-            final List<Resource> syntheticList = new ArrayList<Resource>();
-            final List<Resource> providerList = new ArrayList<Resource>();
+            final List<Resource> syntheticList = new ArrayList<>();
+            final List<Resource> providerList = new ArrayList<>();
 
             for (final Entry<String, Node<ResourceProviderHandler>> entry : node.getChildren().entrySet())
{
                 final String name = entry.getKey();
@@ -327,7 +328,7 @@ public class ResourceResolverControl {
      * Returns the union of all attribute names.
      */
     public Collection<String> getAttributeNames(final ResourceResolverContext context)
{
-        final Set<String> names = new LinkedHashSet<String>();
+        final Set<String> names = new LinkedHashSet<>();
         for (final AuthenticatedResourceProvider p : context.getProviderManager().getAllBestEffort(getResourceProviderStorage().getAttributableHandlers(),
this)) {
             p.getAttributeNames(names);
         }
@@ -437,7 +438,7 @@ public class ResourceResolverControl {
      * Return the union of query languages supported by the providers.
      */
     public String[] getSupportedLanguages(final ResourceResolverContext context) {
-        final Set<String> supportedLanguages = new LinkedHashSet<String>();
+        final Set<String> supportedLanguages = new LinkedHashSet<>();
         for (AuthenticatedResourceProvider p : context.getProviderManager().getAllBestEffort(getResourceProviderStorage().getLanguageQueryableHandlers(),
this)) {
             supportedLanguages.addAll(Arrays.asList(p.getSupportedLanguages()));
         }
@@ -450,17 +451,17 @@ public class ResourceResolverControl {
     public Iterator<Resource> findResources(final ResourceResolverContext context,
             final String query, final String language) {
         final List<AuthenticatedResourceProvider> queryableRP = getQueryableProviders(context,
language);
-        final List<Iterator<Resource>> iterators = new ArrayList<Iterator<Resource>>(queryableRP.size());
+        final List<Iterator<Resource>> iterators = new ArrayList<>(queryableRP.size());
         for (AuthenticatedResourceProvider p : queryableRP) {
             iterators.add(p.findResources(query, language));
         }
-        return new ChainedIterator<Resource>(iterators.iterator());
+        return new ChainedIterator<>(iterators.iterator());
     }
 
     private List<AuthenticatedResourceProvider> getQueryableProviders(
             final ResourceResolverContext context,
             final String language) {
-        final List<AuthenticatedResourceProvider> queryableProviders = new ArrayList<AuthenticatedResourceProvider>();
+        final List<AuthenticatedResourceProvider> queryableProviders = new ArrayList<>();
         for (final AuthenticatedResourceProvider p : context.getProviderManager().getAllBestEffort(getResourceProviderStorage().getLanguageQueryableHandlers(),
this)) {
             if (ArrayUtils.contains(p.getSupportedLanguages(), language)) {
                 queryableProviders.add(p);
@@ -475,11 +476,11 @@ public class ResourceResolverControl {
     public Iterator<Map<String, Object>> queryResources(final ResourceResolverContext
context,
             final String query, final String language) {
         final List<AuthenticatedResourceProvider> queryableRP = getQueryableProviders(context,
language);
-        final List<Iterator<Map<String, Object>>> iterators = new ArrayList<Iterator<Map<String,
Object>>>(queryableRP.size());
+        final List<Iterator<Map<String, Object>>> iterators = new ArrayList<>(queryableRP.size());
         for (AuthenticatedResourceProvider p : queryableRP) {
             iterators.add(p.queryResources(query, language));
         }
-        return new ChainedIterator<Map<String, Object>>(iterators.iterator());
+        return new ChainedIterator<>(iterators.iterator());
     }
 
     /**
@@ -586,7 +587,7 @@ public class ResourceResolverControl {
         }
 
         final Resource srcResource = this.getResource(context, srcAbsPath, null, null, false);
-        final List<Resource> newResources = new ArrayList<Resource>();
+        final List<Resource> newResources = new ArrayList<>();
         boolean rollback = true;
         try {
             this.copy(context, srcResource, destAbsPath, newResources);
@@ -613,7 +614,7 @@ public class ResourceResolverControl {
             return this.getResource(context, destAbsPath + '/' + ResourceUtil.getName(srcAbsPath),
null, null, false);
         }
         final Resource srcResource = this.getResource(context, srcAbsPath, null, null, false);
-        final List<Resource> newResources = new ArrayList<Resource>();
+        final List<Resource> newResources = new ArrayList<>();
         boolean rollback = true;
         try {
             this.copy(context, srcResource, destAbsPath, newResources);
@@ -697,7 +698,7 @@ public class ResourceResolverControl {
                     // make sure we're getting the resourceTypeResourceResolver on behalf
of
                     // the resourceresolver bundle
                     final Bundle bundle = FrameworkUtil.getBundle(ResourceResolverControl.class);
-                    final Map<String, Object> authenticationInfo = new HashMap<String,
Object>();
+                    final Map<String, Object> authenticationInfo = new HashMap<>();
                     authenticationInfo.put(ResourceProvider.AUTH_SERVICE_BUNDLE, bundle);
                     authenticationInfo.put(ResourceResolverFactory.SUBSERVICE, "hierarchy");
                     this.resourceTypeResourceResolver = factory.getServiceResourceResolver(authenticationInfo);

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderFactoryAdapter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderFactoryAdapter.java?rev=1788870&r1=1788869&r2=1788870&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderFactoryAdapter.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderFactoryAdapter.java
Mon Mar 27 09:54:51 2017
@@ -25,7 +25,7 @@ import java.util.Map;
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.PersistenceException;
 import org.apache.sling.api.resource.Resource;

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderWhiteboard.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderWhiteboard.java?rev=1788870&r1=1788869&r2=1788870&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderWhiteboard.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/legacy/LegacyResourceProviderWhiteboard.java
Mon Mar 27 09:54:51 2017
@@ -42,8 +42,8 @@ import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.api.adapter.Adaptable;
 import org.apache.sling.api.resource.AttributableResourceProvider;
 import org.apache.sling.api.resource.ModifyingResourceProvider;
@@ -66,7 +66,7 @@ public class LegacyResourceProviderWhite
 
     public static final String ORIGINAL_SERVICE_PID = "original.service.pid";
 
-    private Map<Object, List<ServiceRegistration>> registrations = new HashMap<Object,
List<ServiceRegistration>>();
+    private Map<Object, List<ServiceRegistration>> registrations = new HashMap<>();
 
     @Reference(service = ResourceProvider.class, cardinality = ReferenceCardinality.MULTIPLE,
policy = ReferencePolicy.DYNAMIC)
     protected void bindResourceProvider(final ServiceReference<ResourceProvider> ref)
{
@@ -76,10 +76,10 @@ public class LegacyResourceProviderWhite
             final String[] propertyNames = ref.getPropertyKeys();
             final boolean ownsRoot = toBoolean(ref.getProperty(OWNS_ROOTS), false);
 
-            final List<ServiceRegistration> newServices = new ArrayList<ServiceRegistration>();
+            final List<ServiceRegistration> newServices = new ArrayList<>();
             for (final String path : PropertiesUtil.toStringArray(ref.getProperty(ROOTS),
new String[0])) {
                 if ( path != null && !path.isEmpty() ) {
-                    final Dictionary<String, Object> newProps = new Hashtable<String,
Object>();
+                    final Dictionary<String, Object> newProps = new Hashtable<>();
                     newProps.put(PROPERTY_AUTHENTICATE, AuthType.no.toString());
                     newProps.put(PROPERTY_MODIFIABLE, provider instanceof ModifyingResourceProvider);
                     newProps.put(PROPERTY_ADAPTABLE, provider instanceof Adaptable);
@@ -122,10 +122,10 @@ public class LegacyResourceProviderWhite
             final String[] propertyNames = ref.getPropertyKeys();
             final boolean ownsRoot = toBoolean(ref.getProperty(OWNS_ROOTS), false);
 
-            final List<ServiceRegistration> newServices = new ArrayList<ServiceRegistration>();
+            final List<ServiceRegistration> newServices = new ArrayList<>();
             for (final String path : PropertiesUtil.toStringArray(ref.getProperty(ROOTS),
new String[0])) {
                 if ( path != null && !path.isEmpty() ) {
-                    final Dictionary<String, Object> newProps = new Hashtable<String,
Object>();
+                    final Dictionary<String, Object> newProps = new Hashtable<>();
                     if (PropertiesUtil.toBoolean(ref.getProperty(PROPERTY_REQUIRED), false))
{
                         newProps.put(PROPERTY_AUTHENTICATE, AuthType.required.toString());
                     } else {

Modified: sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/tree/PathTree.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/tree/PathTree.java?rev=1788870&r1=1788869&r2=1788870&view=diff
==============================================================================
--- sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/tree/PathTree.java
(original)
+++ sling/trunk/bundles/resourceresolver/src/main/java/org/apache/sling/resourceresolver/impl/providers/tree/PathTree.java
Mon Mar 27 09:54:51 2017
@@ -18,7 +18,7 @@
  */
 package org.apache.sling.resourceresolver.impl.providers.tree;
 
-import static org.apache.commons.lang.StringUtils.split;
+import static org.apache.commons.lang3.StringUtils.split;
 
 import java.util.Iterator;
 import java.util.List;
@@ -28,7 +28,7 @@ public class PathTree<T extends Pathable
     private Node<T> root;
 
     public PathTree(List<T> values) {
-        this.root = new Node<T>();
+        this.root = new Node<>();
         for (T v : values) {
             addNewValue(v);
         }



Mime
View raw message