sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r1785639 - in /sling/trunk/bundles/extensions/validation: api/src/main/java/org/apache/sling/validation/model/ core/src/main/java/org/apache/sling/validation/impl/ core/src/main/java/org/apache/sling/validation/impl/model/ core/src/test/jav...
Date Mon, 06 Mar 2017 12:13:49 GMT
Author: kwin
Date: Mon Mar  6 12:13:49 2017
New Revision: 1785639

URL: http://svn.apache.org/viewvc?rev=1785639&view=rev
Log:
remove some warning due to unnecessary import and missing JSR 305 annotations

Modified:
    sling/trunk/bundles/extensions/validation/api/src/main/java/org/apache/sling/validation/model/ValidatorAndSeverity.java
    sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ResourceToValidationResultAdapterFactory.java
    sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ValidationModelRetrieverImpl.java
    sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyBuilder.java
    sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyImpl.java
    sling/trunk/bundles/extensions/validation/core/src/test/java/org/apache/sling/validation/impl/ValidationModelRetrieverImplTest.java

Modified: sling/trunk/bundles/extensions/validation/api/src/main/java/org/apache/sling/validation/model/ValidatorAndSeverity.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/api/src/main/java/org/apache/sling/validation/model/ValidatorAndSeverity.java?rev=1785639&r1=1785638&r2=1785639&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/api/src/main/java/org/apache/sling/validation/model/ValidatorAndSeverity.java
(original)
+++ sling/trunk/bundles/extensions/validation/api/src/main/java/org/apache/sling/validation/model/ValidatorAndSeverity.java
Mon Mar  6 12:13:49 2017
@@ -29,7 +29,7 @@ import org.apache.sling.validation.spi.V
  * @param <T> the type param of the encapsulated {@link Validator}
  */
 public final class ValidatorAndSeverity<T> {
-    private final Validator<T> validator;
+    private final @Nonnull Validator<T> validator;
     private final Integer severity;
 
     public ValidatorAndSeverity(@Nonnull Validator<T> validator, Integer severity)
{
@@ -67,16 +67,13 @@ public final class ValidatorAndSeverity<
             return false;
         if (getClass() != obj.getClass())
             return false;
-        ValidatorAndSeverity other = (ValidatorAndSeverity) obj;
+        ValidatorAndSeverity<?> other = (ValidatorAndSeverity<?>) obj;
         if (severity == null) {
             if (other.severity != null)
                 return false;
         } else if (!severity.equals(other.severity))
             return false;
-        if (validator == null) {
-            if (other.validator != null)
-                return false;
-        } else if (!validator.equals(other.validator))
+        if (!validator.equals(other.validator))
             return false;
         return true;
     }

Modified: sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ResourceToValidationResultAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ResourceToValidationResultAdapterFactory.java?rev=1785639&r1=1785638&r2=1785639&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ResourceToValidationResultAdapterFactory.java
(original)
+++ sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ResourceToValidationResultAdapterFactory.java
Mon Mar  6 12:13:49 2017
@@ -18,6 +18,8 @@
  */
 package org.apache.sling.validation.impl;
 
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.adapter.AdapterFactory;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.validation.ValidationFailure;
@@ -31,7 +33,7 @@ public class ResourceToValidationResultA
 
     private static final Logger LOG = LoggerFactory.getLogger(ResourceToValidationResultAdapterFactory.class);
     
-    private static final String KEY_RESOURCE_METADATA = "sling.validationResult";
+    private static final @Nonnull String KEY_RESOURCE_METADATA = "sling.validationResult";
 
     @SuppressWarnings("unchecked")
     public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType>
type) {

Modified: sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ValidationModelRetrieverImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ValidationModelRetrieverImpl.java?rev=1785639&r1=1785638&r2=1785639&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ValidationModelRetrieverImpl.java
(original)
+++ sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/ValidationModelRetrieverImpl.java
Mon Mar  6 12:13:49 2017
@@ -159,7 +159,7 @@ public class ValidationModelRetrieverImp
     }
 
     @Reference(cardinality = ReferenceCardinality.MULTIPLE, policyOption = ReferencePolicyOption.GREEDY)
-    protected void addValidator(Validator<?> validator, Map<String, Object> properties,
ServiceReference<Validator<?>> serviceReference) {
+    protected void addValidator(@Nonnull Validator<?> validator, Map<String, Object>
properties, ServiceReference<Validator<?>> serviceReference) {
         String validatorId = getValidatorIdFromServiceProperties(properties, validator, serviceReference);
         Integer severity = getValidatorSeverityFromServiceProperties(properties, validator,
serviceReference);
         if (validators.containsKey(validatorId)) {

Modified: sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyBuilder.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyBuilder.java?rev=1785639&r1=1785638&r2=1785639&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyBuilder.java
(original)
+++ sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyBuilder.java
Mon Mar  6 12:13:49 2017
@@ -28,7 +28,6 @@ import javax.annotation.Nonnull;
 import org.apache.sling.validation.model.ParameterizedValidator;
 import org.apache.sling.validation.model.ResourceProperty;
 import org.apache.sling.validation.model.ValidatorAndSeverity;
-import org.apache.sling.validation.spi.Validator;
 
 public class ResourcePropertyBuilder {
 

Modified: sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyImpl.java?rev=1785639&r1=1785638&r2=1785639&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyImpl.java
(original)
+++ sling/trunk/bundles/extensions/validation/core/src/main/java/org/apache/sling/validation/impl/model/ResourcePropertyImpl.java
Mon Mar  6 12:13:49 2017
@@ -29,7 +29,7 @@ import org.apache.sling.validation.model
 
 public class ResourcePropertyImpl implements ResourceProperty {
 
-    private final String name;
+    private final @Nonnull String name;
     private final boolean isMultiple;
     private final boolean isRequired;
     private final @Nonnull List<ParameterizedValidator> validators;
@@ -117,10 +117,7 @@ public class ResourcePropertyImpl implem
             return false;
         if (isRequired != other.isRequired)
             return false;
-        if (name == null) {
-            if (other.name != null)
-                return false;
-        } else if (!name.equals(other.name))
+        if (!name.equals(other.name))
             return false;
         if (namePattern == null) {
             if (other.namePattern != null)

Modified: sling/trunk/bundles/extensions/validation/core/src/test/java/org/apache/sling/validation/impl/ValidationModelRetrieverImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/validation/core/src/test/java/org/apache/sling/validation/impl/ValidationModelRetrieverImplTest.java?rev=1785639&r1=1785638&r2=1785639&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/validation/core/src/test/java/org/apache/sling/validation/impl/ValidationModelRetrieverImplTest.java
(original)
+++ sling/trunk/bundles/extensions/validation/core/src/test/java/org/apache/sling/validation/impl/ValidationModelRetrieverImplTest.java
Mon Mar  6 12:13:49 2017
@@ -52,7 +52,6 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.osgi.framework.Bundle;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
 @RunWith(MockitoJUnitRunner.class)



Mime
View raw message