From 3e3d5e418f2c5194bafbda148255635fa796172f Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Fri, 1 Mar 2024 20:16:27 +0100 Subject: [PATCH] Remove JSR305 nullness annotations (#3268) Migrate to Jetbrains annotations This closes #3267 --- CHANGELOG.md | 8 +- bundle-cloud/pom.xml | 6 -- bundle/pom.xml | 5 -- .../impl/CreateCloudConfigServlet.java | 4 +- .../CustomComponentActivatorListServlet.java | 18 ++-- .../acs/commons/genericlists/GenericList.java | 23 ++--- .../impl/GenericListAdapterFactory.java | 9 +- .../ui/components/ELVariableProvider.java | 5 +- .../include/IncludeDecoratorFilterImpl.java | 29 +++---- .../include/NamespaceResourceWrapper.java | 18 ++-- .../commons/marketo/client/MarketoClient.java | 11 ++- .../client/impl/MarketoClientImpl.java | 13 ++- .../marketo/impl/MarketoFieldDataSource.java | 4 +- .../marketo/impl/MarketoFormDataSource.java | 4 +- .../impl/TestMarketoConnectionServlet.java | 6 +- .../mcp/impl/DialogResourceProviderImpl.java | 24 +++--- .../mcp/impl/processes/DataImporter.java | 1 - .../mcp/impl/processes/TagReporter.java | 4 +- .../oak/impl/EnsureOakIndexJobHandler.java | 60 ++++++------- .../impl/servlets/ExplainScoreServlet.java | 18 ++-- .../internal/ReportCSVExportServlet.java | 18 ++-- .../internal/ReportsRenderCondition.java | 4 +- .../datasources/DynamicSelectDataSource.java | 29 ++++--- ...VersionedClientlibsTransformerFactory.java | 86 ++++++++++--------- .../adobe/acs/commons/util/TemplateUtil.java | 8 +- .../impl/PageCompareDataLinesImpl.java | 2 +- .../AbstractDynamicClientLibraryServlet.java | 30 +++---- .../impl/SharedComponentPropertiesImpl.java | 14 +-- .../impl/AuditLogSearchServletTest.java | 2 +- .../impl/StaticResponseMarketoClient.java | 6 +- .../processes/AssetFolderCreatorTest.java | 15 ---- .../asset/FileAssetIngestorTest.java | 2 +- .../processes/asset/S3AssetIngestorTest.java | 3 +- .../processes/asset/UrlAssetImportTest.java | 2 +- .../processes/cfi/MockContentElement.java | 9 +- .../processes/cfi/MockContentFragment.java | 7 +- .../ReplicationStatusManagerImplTest.java | 2 +- .../wcm/comparisons/impl/lines/LinesTest.java | 23 ++--- .../wcm/impl/PagesReferenceProviderTest.java | 3 +- pom.xml | 5 -- 40 files changed, 256 insertions(+), 284 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e2c30f0b0..01713b6c4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com) ## Unreleased ([details][unreleased changes details]) -### Fix +### Changed + +- #3267 - Remove JSR305 dependency + +### Fixed -- Re-enable accidentally disabled unit tests +- #3270 - Re-enable accidentally disabled JUnit3/4 tests ## 6.4.0 - 2024-02-22 diff --git a/bundle-cloud/pom.xml b/bundle-cloud/pom.xml index a3dd925178..b3fb2f3d36 100644 --- a/bundle-cloud/pom.xml +++ b/bundle-cloud/pom.xml @@ -67,12 +67,6 @@ Fragment-Host: com.adobe.acs.acs-aem-commons-bundle - - - com.google.code.findbugs - jsr305 - provided - com.adobe.acs acs-aem-commons-bundle diff --git a/bundle/pom.xml b/bundle/pom.xml index 574c2de8a7..f6c7aae662 100644 --- a/bundle/pom.xml +++ b/bundle/pom.xml @@ -285,11 +285,6 @@ org.apache.sling.servlets.annotations provided - - com.google.code.findbugs - jsr305 - provided - org.jetbrains annotations diff --git a/bundle/src/main/java/com/adobe/acs/commons/cloudconfig/impl/CreateCloudConfigServlet.java b/bundle/src/main/java/com/adobe/acs/commons/cloudconfig/impl/CreateCloudConfigServlet.java index a3ca2ba583..8a26bb8b7c 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/cloudconfig/impl/CreateCloudConfigServlet.java +++ b/bundle/src/main/java/com/adobe/acs/commons/cloudconfig/impl/CreateCloudConfigServlet.java @@ -20,7 +20,6 @@ import java.io.IOException; import java.util.Collections; -import javax.annotation.Nonnull; import javax.servlet.Servlet; import org.apache.commons.lang3.StringUtils; @@ -33,6 +32,7 @@ import org.apache.sling.api.servlets.SlingAllMethodsServlet; import org.apache.sling.jcr.resource.api.JcrResourceConstants; import org.apache.sling.servlets.post.HtmlResponse; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,7 +50,7 @@ public class CreateCloudConfigServlet extends SlingAllMethodsServlet { private static final Logger log = LoggerFactory.getLogger(CreateCloudConfigServlet.class); @Override - protected void doPost(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) + protected void doPost(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws IOException { ResourceResolver resolver = request.getResourceResolver(); PageManager pageManager = resolver.adaptTo(PageManager.class); diff --git a/bundle/src/main/java/com/adobe/acs/commons/dam/impl/CustomComponentActivatorListServlet.java b/bundle/src/main/java/com/adobe/acs/commons/dam/impl/CustomComponentActivatorListServlet.java index 62069a4862..c6ef0d4391 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/dam/impl/CustomComponentActivatorListServlet.java +++ b/bundle/src/main/java/com/adobe/acs/commons/dam/impl/CustomComponentActivatorListServlet.java @@ -17,9 +17,11 @@ */ package com.adobe.acs.commons.dam.impl; -import com.adobe.acs.commons.util.ParameterUtil; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; +import java.io.IOException; +import java.util.Map; + +import javax.servlet.ServletException; + import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.ConfigurationPolicy; @@ -29,11 +31,11 @@ import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; import org.apache.sling.commons.osgi.PropertiesUtil; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.Map; +import com.adobe.acs.commons.util.ParameterUtil; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; @SlingServlet(paths = "/bin/acs-commons/dam/custom-components.json", generateComponent = false) @Component(metatype = true, policy = ConfigurationPolicy.REQUIRE, label = "ACS AEM Commons - Custom DAM Component List Servlet", @@ -72,7 +74,7 @@ protected void activate(Map config) { } @Override - protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { + protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().print(json.toString()); diff --git a/bundle/src/main/java/com/adobe/acs/commons/genericlists/GenericList.java b/bundle/src/main/java/com/adobe/acs/commons/genericlists/GenericList.java index d1576e708e..43c35f6931 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/genericlists/GenericList.java +++ b/bundle/src/main/java/com/adobe/acs/commons/genericlists/GenericList.java @@ -17,19 +17,22 @@ */ package com.adobe.acs.commons.genericlists; -import com.adobe.acs.commons.mcp.form.FormField; -import com.adobe.acs.commons.mcp.form.MultifieldComponent; import java.util.List; import java.util.Locale; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; + import javax.inject.Inject; import javax.inject.Named; + import org.apache.sling.api.resource.Resource; import org.apache.sling.models.annotations.DefaultInjectionStrategy; import org.apache.sling.models.annotations.Model; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.osgi.annotation.versioning.ProviderType; +import com.adobe.acs.commons.mcp.form.FormField; +import com.adobe.acs.commons.mcp.form.MultifieldComponent; + /** * A generic list of title/value pairs. */ @@ -42,7 +45,7 @@ public interface GenericList { * * @return the item list */ - @Nonnull + @NotNull @Inject @Named("list") @FormField(name = "List", component = MultifieldComponent.class) @@ -54,7 +57,7 @@ public interface GenericList { * @param value the list item's value * @return the title or null */ - @CheckForNull + @Nullable String lookupTitle(String value); /** @@ -64,7 +67,7 @@ public interface GenericList { * @param locale the locale for localization * @return the title or null */ - @CheckForNull + @Nullable String lookupTitle(String value, Locale locale); /** @@ -79,7 +82,7 @@ interface Item { * * @return the title */ - @Nonnull + @NotNull @Inject @Named("jcr:title") @FormField(name = "Title", localize = true) @@ -92,7 +95,7 @@ interface Item { * * @return the title */ - @Nonnull + @NotNull String getTitle(Locale locale); /** @@ -100,7 +103,7 @@ interface Item { * * @return the value */ - @Nonnull + @NotNull @Inject @Named("value") @FormField(name = "Value") diff --git a/bundle/src/main/java/com/adobe/acs/commons/genericlists/impl/GenericListAdapterFactory.java b/bundle/src/main/java/com/adobe/acs/commons/genericlists/impl/GenericListAdapterFactory.java index 61d23a449d..fc91202ac5 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/genericlists/impl/GenericListAdapterFactory.java +++ b/bundle/src/main/java/com/adobe/acs/commons/genericlists/impl/GenericListAdapterFactory.java @@ -17,14 +17,13 @@ */ package com.adobe.acs.commons.genericlists.impl; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; - import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import org.apache.sling.api.adapter.AdapterFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import com.adobe.acs.commons.genericlists.GenericList; import com.day.cq.wcm.api.Page; @@ -37,14 +36,14 @@ public class GenericListAdapterFactory implements AdapterFactory { @SuppressWarnings("unchecked") @Override - public final AdapterType getAdapter(@CheckForNull Object obj, @Nonnull Class clazz) { + public final AdapterType getAdapter(@Nullable Object obj, @NotNull Class clazz) { if (clazz == GenericList.class) { return (AdapterType) adaptToGenericList(obj); } return null; } - private GenericList adaptToGenericList(@CheckForNull Object obj) { + private GenericList adaptToGenericList(@Nullable Object obj) { if (obj == null) { return null; } diff --git a/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/ELVariableProvider.java b/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/ELVariableProvider.java index c32fe04d33..2052e2b444 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/ELVariableProvider.java +++ b/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/ELVariableProvider.java @@ -19,9 +19,8 @@ import java.util.Map; -import javax.annotation.Nonnull; - import org.apache.sling.api.SlingHttpServletRequest; +import org.jetbrains.annotations.NotNull; import org.osgi.annotation.versioning.ConsumerType; import com.adobe.granite.ui.components.ExpressionCustomizer; @@ -44,5 +43,5 @@ public interface ELVariableProvider { * The name must not contain {@code .} * Must never be {@code null}, but can be the empty map if no variable is provided. */ - @Nonnull Map getVariables(SlingHttpServletRequest request); + @NotNull Map getVariables(SlingHttpServletRequest request); } diff --git a/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/IncludeDecoratorFilterImpl.java b/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/IncludeDecoratorFilterImpl.java index 1b58f28092..f221624222 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/IncludeDecoratorFilterImpl.java +++ b/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/IncludeDecoratorFilterImpl.java @@ -17,11 +17,24 @@ */ package com.adobe.acs.commons.granite.ui.components.impl.include; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.function.Predicate; + +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + import org.apache.commons.collections.MapUtils; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ValueMap; import org.apache.sling.engine.EngineConstants; +import org.jetbrains.annotations.Nullable; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.ConfigurationPolicy; @@ -29,20 +42,6 @@ import org.osgi.service.metatype.annotations.Designate; import org.osgi.service.metatype.annotations.ObjectClassDefinition; -import javax.annotation.CheckForNull; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; - - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.function.Predicate; - @Component( service = Filter.class, configurationPolicy = ConfigurationPolicy.OPTIONAL, @@ -132,7 +131,7 @@ public void doFilter(ServletRequest servletRequest, ServletResponse servletRespo } private void performFilter(SlingHttpServletRequest request, ServletResponse servletResponse, FilterChain chain, ValueMap parameters) throws IOException, ServletException { - @CheckForNull Resource parameterResource = request.getResource().getChild(NN_PARAMETERS); + @Nullable Resource parameterResource = request.getResource().getChild(NN_PARAMETERS); if(parameterResource != null){ parameters = parameterResource.getValueMap(); } diff --git a/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/NamespaceResourceWrapper.java b/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/NamespaceResourceWrapper.java index 9dfb1d418f..bbe3728716 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/NamespaceResourceWrapper.java +++ b/bundle/src/main/java/com/adobe/acs/commons/granite/ui/components/impl/include/NamespaceResourceWrapper.java @@ -17,19 +17,19 @@ */ package com.adobe.acs.commons.granite.ui.components.impl.include; -import com.adobe.granite.ui.components.ExpressionResolver; -import com.adobe.granite.ui.components.FilteringResourceWrapper; +import java.util.Arrays; +import java.util.Iterator; +import java.util.Optional; + import org.apache.commons.collections.iterators.FilterIterator; import org.apache.commons.collections.iterators.TransformIterator; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.resource.Resource; -import org.apache.sling.api.resource.ResourceUtil; import org.apache.sling.api.resource.ValueMap; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import java.util.Arrays; -import java.util.Iterator; -import java.util.Optional; +import com.adobe.granite.ui.components.ExpressionResolver; +import com.adobe.granite.ui.components.FilteringResourceWrapper; public class NamespaceResourceWrapper extends FilteringResourceWrapper { @@ -41,8 +41,8 @@ public class NamespaceResourceWrapper extends FilteringResourceWrapper { private final ValueMap valueMap; - public NamespaceResourceWrapper(@Nonnull Resource resource, @Nonnull ExpressionResolver expressionResolver, - @Nonnull SlingHttpServletRequest request, + public NamespaceResourceWrapper(@NotNull Resource resource, @NotNull ExpressionResolver expressionResolver, + @NotNull SlingHttpServletRequest request, String[] namespacedProperties) { super(resource, expressionResolver, request); this.expressionResolver = expressionResolver; diff --git a/bundle/src/main/java/com/adobe/acs/commons/marketo/client/MarketoClient.java b/bundle/src/main/java/com/adobe/acs/commons/marketo/client/MarketoClient.java index 5ec8e78292..f2fdd83e3b 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/marketo/client/MarketoClient.java +++ b/bundle/src/main/java/com/adobe/acs/commons/marketo/client/MarketoClient.java @@ -20,9 +20,8 @@ import java.io.IOException; import java.util.List; -import javax.annotation.Nonnull; - import org.apache.http.impl.client.CloseableHttpClient; +import org.jetbrains.annotations.NotNull; import com.adobe.acs.commons.marketo.MarketoClientConfiguration; @@ -38,14 +37,14 @@ public interface MarketoClient { * @return a valid Marketo API Token * @throws IOException an error occurs retrieving the token */ - public @Nonnull String getApiToken(@Nonnull MarketoClientConfiguration config) throws MarketoApiException; + public @NotNull String getApiToken(@NotNull MarketoClientConfiguration config) throws MarketoApiException; /** * Retrieve a HttpClient for interacting with the Marketo API * * @return the httpclient */ - public @Nonnull CloseableHttpClient getHttpClient(); + public @NotNull CloseableHttpClient getHttpClient(); /** * Retrieve all of the available forms from the current organization in Marketo. @@ -54,7 +53,7 @@ public interface MarketoClient { * @return the full list of available forms * @throws IOException an exception occurs interacting with the API */ - public @Nonnull List getForms(@Nonnull MarketoClientConfiguration config) throws MarketoApiException; + public @NotNull List getForms(@NotNull MarketoClientConfiguration config) throws MarketoApiException; /** * Retrieve all of the available forms from the current organization in Marketo. @@ -63,6 +62,6 @@ public interface MarketoClient { * @return the full list of available forms * @throws IOException an exception occurs interacting with the API */ - public @Nonnull List getFields(@Nonnull MarketoClientConfiguration config) throws MarketoApiException; + public @NotNull List getFields(@NotNull MarketoClientConfiguration config) throws MarketoApiException; } diff --git a/bundle/src/main/java/com/adobe/acs/commons/marketo/client/impl/MarketoClientImpl.java b/bundle/src/main/java/com/adobe/acs/commons/marketo/client/impl/MarketoClientImpl.java index c594c28f56..88675c7cae 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/marketo/client/impl/MarketoClientImpl.java +++ b/bundle/src/main/java/com/adobe/acs/commons/marketo/client/impl/MarketoClientImpl.java @@ -26,9 +26,6 @@ import java.util.function.BiFunction; import java.util.stream.Collectors; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpHost; import org.apache.http.HttpResponse; @@ -46,6 +43,8 @@ import org.apache.http.impl.conn.DefaultProxyRoutePlanner; import org.apache.http.util.EntityUtils; import org.apache.poi.util.IOUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.osgi.framework.InvalidSyntaxException; import org.osgi.service.cm.Configuration; import org.osgi.service.cm.ConfigurationAdmin; @@ -154,7 +153,7 @@ public CloseableHttpClient getHttpClient() { return clientBuilder.build(); } - protected @Nonnull T getApiResponse(@Nonnull String url, String bearerToken, + protected @NotNull T getApiResponse(@NotNull String url, String bearerToken, BiFunction> callback) throws MarketoApiException { CloseableHttpClient client = null; @@ -187,7 +186,7 @@ public CloseableHttpClient getHttpClient() { } } - public @Nonnull String getApiToken(@Nonnull MarketoClientConfiguration config) throws MarketoApiException { + public @NotNull String getApiToken(@NotNull MarketoClientConfiguration config) throws MarketoApiException { log.trace("getApiToken"); String url = String.format( "https://%s/identity/oauth/token?grant_type=client_credentials&client_id=%s&client_secret=%s", @@ -223,7 +222,7 @@ public List getFields(MarketoClientConfiguration config) throws Ma return fields; } - private @Nullable > T[] getApiPage(@Nonnull String urlBase, @Nonnull String token, + private @Nullable > T[] getApiPage(@NotNull String urlBase, @NotNull String token, int page, Class responseType) throws MarketoApiException { log.trace("getApiPage({})", page); int offset = PAGE_SIZE * page; @@ -253,7 +252,7 @@ public List getFields(MarketoClientConfiguration config) throws Ma } @Override - public List getForms(@Nonnull MarketoClientConfiguration config) throws MarketoApiException { + public List getForms(@NotNull MarketoClientConfiguration config) throws MarketoApiException { String apiToken = getApiToken(config); List forms = new ArrayList<>(); String base = String.format("https://%s/rest/asset/v1/forms.json?status=approved&", config.getEndpointHost()); diff --git a/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFieldDataSource.java b/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFieldDataSource.java index 5b2fae6c58..25d5526c05 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFieldDataSource.java +++ b/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFieldDataSource.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.jcr.RepositoryException; import javax.servlet.Servlet; @@ -35,6 +34,7 @@ import org.apache.sling.api.servlets.ServletResolverConstants; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; import org.apache.sling.api.wrappers.ValueMapDecorator; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; @@ -80,7 +80,7 @@ public void bindMarketoClient(MarketoClient client) { } @Override - public void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) { + public void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) { log.trace("doGet"); List options = null; diff --git a/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFormDataSource.java b/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFormDataSource.java index 199be6e309..25b53bfa70 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFormDataSource.java +++ b/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/MarketoFormDataSource.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import javax.annotation.Nonnull; import javax.jcr.RepositoryException; import javax.servlet.Servlet; @@ -35,6 +34,7 @@ import org.apache.sling.api.servlets.ServletResolverConstants; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; import org.apache.sling.api.wrappers.ValueMapDecorator; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; @@ -79,7 +79,7 @@ public void bindMarketoClient(MarketoClient client) { } @Override - public void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) { + public void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) { log.trace("doGet"); List options = null; diff --git a/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/TestMarketoConnectionServlet.java b/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/TestMarketoConnectionServlet.java index ed1ceb7f17..3820269414 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/TestMarketoConnectionServlet.java +++ b/bundle/src/main/java/com/adobe/acs/commons/marketo/impl/TestMarketoConnectionServlet.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Map; -import javax.annotation.Nonnull; import javax.servlet.Servlet; import javax.servlet.ServletException; @@ -39,6 +38,7 @@ import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; @@ -60,8 +60,8 @@ public class TestMarketoConnectionServlet extends SlingSafeMethodsServlet { @Reference private MarketoClient client; - protected void doGet(@Nonnull SlingHttpServletRequest request, - @Nonnull SlingHttpServletResponse response) throws ServletException, + protected void doGet(@NotNull SlingHttpServletRequest request, + @NotNull SlingHttpServletResponse response) throws ServletException, IOException { List logs = new ArrayList<>(); diff --git a/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/DialogResourceProviderImpl.java b/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/DialogResourceProviderImpl.java index bf7383f208..c840d994b0 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/DialogResourceProviderImpl.java +++ b/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/DialogResourceProviderImpl.java @@ -17,18 +17,12 @@ */ package com.adobe.acs.commons.mcp.impl; -import com.adobe.acs.commons.mcp.form.AbstractResourceImpl; -import com.adobe.acs.commons.mcp.form.DialogProvider; -import com.adobe.acs.commons.mcp.form.GeneratedDialog; -import com.adobe.acs.commons.mcp.form.GeneratedDialogWrapper; -import com.adobe.acs.commons.mcp.util.SyntheticResourceBuilder; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Collections; import java.util.Iterator; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; + import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.reflect.FieldUtils; import org.apache.commons.lang.reflect.MethodUtils; @@ -37,9 +31,17 @@ import org.apache.sling.spi.resource.provider.ResolveContext; import org.apache.sling.spi.resource.provider.ResourceContext; import org.apache.sling.spi.resource.provider.ResourceProvider; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.adobe.acs.commons.mcp.form.AbstractResourceImpl; +import com.adobe.acs.commons.mcp.form.DialogProvider; +import com.adobe.acs.commons.mcp.form.GeneratedDialog; +import com.adobe.acs.commons.mcp.form.GeneratedDialogWrapper; +import com.adobe.acs.commons.mcp.util.SyntheticResourceBuilder; + /** * Create a resource provider for a dialog, the resource type is identified in * three ways: First it checks if the Model annotation is present and declares a @@ -107,9 +109,9 @@ private void setResourceTypeFromClass() throws IllegalAccessException, Instantia } } - @CheckForNull + @Nullable @Override - public Resource getResource(@Nonnull ResolveContext resolveContext, @Nonnull String path, @Nonnull ResourceContext resourceContext, @CheckForNull Resource parent) { + public Resource getResource(@NotNull ResolveContext resolveContext, @NotNull String path, @NotNull ResourceContext resourceContext, @Nullable Resource parent) { LOGGER.debug("Get resource at path: {}", path); AbstractResourceImpl clone = null; if (root.equals(path)) { @@ -134,9 +136,9 @@ public Resource getResource(@Nonnull ResolveContext resolveContext, @Nonnull Str return clone; } - @CheckForNull + @Nullable @Override - public Iterator listChildren(@Nonnull ResolveContext resolveContext, @Nonnull Resource parent) { + public Iterator listChildren(@NotNull ResolveContext resolveContext, @NotNull Resource parent) { LOGGER.debug("List children of {}", parent.getPath()); if (parent instanceof AbstractResourceImpl) { AbstractResourceImpl res = (AbstractResourceImpl) parent; diff --git a/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/DataImporter.java b/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/DataImporter.java index 6651be159b..217f39efbc 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/DataImporter.java +++ b/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/DataImporter.java @@ -36,7 +36,6 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.concurrent.Immutable; import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.Session; diff --git a/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/TagReporter.java b/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/TagReporter.java index 6c99360e13..be0f2e796a 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/TagReporter.java +++ b/bundle/src/main/java/com/adobe/acs/commons/mcp/impl/processes/TagReporter.java @@ -29,7 +29,6 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import javax.annotation.Nonnull; import javax.jcr.RepositoryException; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -38,6 +37,7 @@ import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; +import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -129,7 +129,7 @@ public void buildProcess(ProcessInstance instance, ResourceResolver rr) throws L instance.defineCriticalAction("Finding references", rr, this::recordTags); } - private @Nonnull List computeReferenceCellValues(Collection references) { + private @NotNull List computeReferenceCellValues(Collection references) { List cells = new ArrayList<>(); List cell = new ArrayList<>(); int len = 0; diff --git a/bundle/src/main/java/com/adobe/acs/commons/oak/impl/EnsureOakIndexJobHandler.java b/bundle/src/main/java/com/adobe/acs/commons/oak/impl/EnsureOakIndexJobHandler.java index e30b7d22f6..5e9084d485 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/oak/impl/EnsureOakIndexJobHandler.java +++ b/bundle/src/main/java/com/adobe/acs/commons/oak/impl/EnsureOakIndexJobHandler.java @@ -18,11 +18,21 @@ package com.adobe.acs.commons.oak.impl; -import com.adobe.acs.commons.analysis.jcrchecksum.ChecksumGenerator; -import com.adobe.acs.commons.analysis.jcrchecksum.impl.options.CustomChecksumGeneratorOptions; -import com.adobe.acs.commons.oak.impl.EnsureOakIndex.OakIndexDefinitionException; -import com.day.cq.commons.jcr.JcrConstants; -import com.day.cq.commons.jcr.JcrUtil; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.jcr.Node; +import javax.jcr.Property; +import javax.jcr.PropertyType; +import javax.jcr.RepositoryException; +import javax.jcr.Session; + import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.apache.sling.api.resource.LoginException; @@ -32,24 +42,16 @@ import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.api.resource.ValueMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.jcr.Node; -import javax.jcr.Property; -import javax.jcr.PropertyType; -import javax.jcr.RepositoryException; -import javax.jcr.Session; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import com.adobe.acs.commons.analysis.jcrchecksum.ChecksumGenerator; +import com.adobe.acs.commons.analysis.jcrchecksum.impl.options.CustomChecksumGeneratorOptions; +import com.adobe.acs.commons.oak.impl.EnsureOakIndex.OakIndexDefinitionException; +import com.day.cq.commons.jcr.JcrConstants; +import com.day.cq.commons.jcr.JcrUtil; public class EnsureOakIndexJobHandler implements Runnable { //@formatter:off @@ -248,7 +250,7 @@ private void ensure(final ResourceResolver resourceResolver, final String ensure * @throws IOException */ void handleHeavyWeightIndexOperations(final Resource oakIndexes, - final @Nonnull Resource ensureDefinition, final @Nullable Resource oakIndex) + final @NotNull Resource ensureDefinition, final @Nullable Resource oakIndex) throws RepositoryException, IOException { final ValueMap ensureDefinitionProperties = ensureDefinition.getValueMap(); @@ -291,7 +293,7 @@ void handleHeavyWeightIndexOperations(final Resource oakIndexes, * @throws PersistenceException */ boolean handleLightWeightIndexOperations( - final @Nonnull Resource ensureDefinition, final @Nullable Resource oakIndex) + final @NotNull Resource ensureDefinition, final @Nullable Resource oakIndex) throws RepositoryException, PersistenceException { final ValueMap ensureDefinitionProperties = ensureDefinition.getValueMap(); @@ -333,7 +335,7 @@ boolean handleLightWeightIndexOperations( * @param oakIndex the index representing the oak index * @throws PersistenceException */ - public void forceRefresh(final @Nonnull Resource oakIndex) throws PersistenceException { + public void forceRefresh(final @NotNull Resource oakIndex) throws PersistenceException { final ModifiableValueMap mvm = oakIndex.adaptTo(ModifiableValueMap.class); if (mvm == null ) { @@ -354,7 +356,7 @@ public void forceRefresh(final @Nonnull Resource oakIndex) throws PersistenceExc * @throws PersistenceException * @throws RepositoryException */ - public Resource create(final @Nonnull Resource ensuredDefinition, final @Nonnull Resource oakIndexes) throws + public Resource create(final @NotNull Resource ensuredDefinition, final @NotNull Resource oakIndexes) throws RepositoryException { final Node oakIndex = JcrUtil.copy( @@ -383,7 +385,7 @@ public Resource create(final @Nonnull Resource ensuredDefinition, final @Nonnull * @throws IOException */ @SuppressWarnings("squid:S3776") - public Resource update(final @Nonnull Resource ensureDefinition, final @Nonnull Resource oakIndexes, boolean forceReindex) + public Resource update(final @NotNull Resource ensureDefinition, final @NotNull Resource oakIndexes, boolean forceReindex) throws RepositoryException, IOException { final ValueMap ensureDefinitionProperties = ensureDefinition.getValueMap(); @@ -475,7 +477,7 @@ public Resource update(final @Nonnull Resource ensureDefinition, final @Nonnull * @param oakIndex the index * @throws PersistenceException */ - public void disableIndex(@Nonnull Resource oakIndex) throws PersistenceException { + public void disableIndex(@NotNull Resource oakIndex) throws PersistenceException { final ModifiableValueMap oakIndexProperties = oakIndex.adaptTo(ModifiableValueMap.class); oakIndexProperties.put(PN_TYPE, DISABLED); @@ -491,7 +493,7 @@ public void disableIndex(@Nonnull Resource oakIndex) throws PersistenceException * @throws IOException * @throws RepositoryException */ - boolean needsUpdate(@Nonnull Resource ensureDefinition, @Nonnull Resource oakIndex) throws IOException, RepositoryException { + boolean needsUpdate(@NotNull Resource ensureDefinition, @NotNull Resource oakIndex) throws IOException, RepositoryException { final Session session = ensureDefinition.getResourceResolver().adaptTo(Session.class); final ChecksumGenerator checksumGenerator = this.ensureOakIndex.getChecksumGenerator(); @@ -526,7 +528,7 @@ boolean needsUpdate(@Nonnull Resource ensureDefinition, @Nonnull Resource oakInd * @throws RepositoryException * @throws PersistenceException */ - public void delete(final @Nonnull Resource oakIndex) throws RepositoryException { + public void delete(final @NotNull Resource oakIndex) throws RepositoryException { if (oakIndex.adaptTo(Node.class) != null) { // Remove the node and its descendants @@ -543,7 +545,7 @@ public void delete(final @Nonnull Resource oakIndex) throws RepositoryException * @throws RepositoryException * @throws OakIndexDefinitionException */ - public void validateEnsureDefinition(@Nonnull Resource ensureDefinition) + public void validateEnsureDefinition(@NotNull Resource ensureDefinition) throws RepositoryException, OakIndexDefinitionException { Node node = ensureDefinition.adaptTo(Node.class); diff --git a/bundle/src/main/java/com/adobe/acs/commons/oak/sql2scorer/impl/servlets/ExplainScoreServlet.java b/bundle/src/main/java/com/adobe/acs/commons/oak/sql2scorer/impl/servlets/ExplainScoreServlet.java index f9a9a3675a..96b032c8e8 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/oak/sql2scorer/impl/servlets/ExplainScoreServlet.java +++ b/bundle/src/main/java/com/adobe/acs/commons/oak/sql2scorer/impl/servlets/ExplainScoreServlet.java @@ -21,7 +21,7 @@ import java.io.IOException; import java.util.Optional; -import javax.annotation.Nonnull; + import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.Session; @@ -35,17 +35,19 @@ import javax.servlet.Servlet; import javax.servlet.ServletException; +import org.apache.jackrabbit.util.ISO8601; +import org.apache.sling.api.SlingHttpServletRequest; +import org.apache.sling.api.SlingHttpServletResponse; +import org.apache.sling.api.servlets.SlingAllMethodsServlet; +import org.jetbrains.annotations.NotNull; +import org.osgi.service.component.annotations.Component; + import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import org.apache.jackrabbit.util.ISO8601; -import org.apache.sling.api.SlingHttpServletRequest; -import org.apache.sling.api.SlingHttpServletResponse; -import org.apache.sling.api.servlets.SlingAllMethodsServlet; -import org.osgi.service.component.annotations.Component; /** * This servlet submits a JCR-SQL2 query with an additional oak:scoreExplanation column that contains the explanation of @@ -130,8 +132,8 @@ public class ExplainScoreServlet extends SlingAllMethodsServlet { static final String KEY_ERROR = "error"; @Override - protected void doPost(@Nonnull final SlingHttpServletRequest request, - @Nonnull final SlingHttpServletResponse response) throws ServletException, IOException { + protected void doPost(@NotNull final SlingHttpServletRequest request, + @NotNull final SlingHttpServletResponse response) throws ServletException, IOException { response.setContentType("application/json;charset=utf-8"); diff --git a/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportCSVExportServlet.java b/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportCSVExportServlet.java index 38b9e50c2c..9df6ca8705 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportCSVExportServlet.java +++ b/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportCSVExportServlet.java @@ -26,17 +26,9 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; import javax.servlet.Servlet; import javax.servlet.ServletException; -import com.adobe.acs.commons.reports.api.ReportCellCSVExporter; -import com.adobe.acs.commons.reports.api.ReportException; -import com.adobe.acs.commons.reports.api.ReportExecutor; -import com.adobe.acs.commons.reports.api.ResultsPage; -import com.day.cq.commons.jcr.JcrConstants; -import com.day.text.csv.Csv; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; @@ -44,11 +36,19 @@ import org.apache.sling.api.resource.Resource; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; import org.apache.sling.commons.classloader.DynamicClassLoaderManager; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.adobe.acs.commons.reports.api.ReportCellCSVExporter; +import com.adobe.acs.commons.reports.api.ReportException; +import com.adobe.acs.commons.reports.api.ReportExecutor; +import com.adobe.acs.commons.reports.api.ResultsPage; +import com.day.cq.commons.jcr.JcrConstants; +import com.day.text.csv.Csv; + /** * Servlet for exporting the results of the report to CSV. */ @@ -67,7 +67,7 @@ public class ReportCSVExportServlet extends SlingSafeMethodsServlet { private DelimiterConfiguration delimiterConfiguration; @Override - protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) + protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws ServletException, IOException { log.trace("doGet"); diff --git a/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportsRenderCondition.java b/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportsRenderCondition.java index db8df8d843..8c7c406621 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportsRenderCondition.java +++ b/bundle/src/main/java/com/adobe/acs/commons/reports/internal/ReportsRenderCondition.java @@ -19,13 +19,13 @@ import java.io.IOException; -import javax.annotation.Nonnull; import javax.servlet.Servlet; import javax.servlet.ServletException; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import com.adobe.granite.ui.components.rendercondition.RenderCondition; @@ -38,7 +38,7 @@ public class ReportsRenderCondition extends SlingSafeMethodsServlet { private static final long serialVersionUID = 8821022395219226632L; @Override - protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) + protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws ServletException, IOException { request.setAttribute(RenderCondition.class.getName(), INSTANCE); } diff --git a/bundle/src/main/java/com/adobe/acs/commons/reports/internal/datasources/DynamicSelectDataSource.java b/bundle/src/main/java/com/adobe/acs/commons/reports/internal/datasources/DynamicSelectDataSource.java index 53bbc299ff..15c7a8680b 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/reports/internal/datasources/DynamicSelectDataSource.java +++ b/bundle/src/main/java/com/adobe/acs/commons/reports/internal/datasources/DynamicSelectDataSource.java @@ -17,9 +17,16 @@ */ package com.adobe.acs.commons.reports.internal.datasources; -import com.adobe.acs.commons.util.QueryHelper; -import com.adobe.acs.commons.wcm.datasources.DataSourceBuilder; -import com.adobe.acs.commons.wcm.datasources.DataSourceOption; +import static javax.jcr.query.Query.JCR_SQL2; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.Servlet; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletResponse; + import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; @@ -29,21 +36,15 @@ import org.apache.sling.api.resource.ValueMap; import org.apache.sling.api.servlets.HttpConstants; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; +import org.jetbrains.annotations.NotNull; import org.osgi.service.component.annotations.Component; import org.osgi.service.component.annotations.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.Nonnull; -import javax.servlet.Servlet; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletResponse; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import static javax.jcr.query.Query.JCR_SQL2; +import com.adobe.acs.commons.util.QueryHelper; +import com.adobe.acs.commons.wcm.datasources.DataSourceBuilder; +import com.adobe.acs.commons.wcm.datasources.DataSourceOption; @Component(service = Servlet.class, property = { "sling.servlet.resourceTypes=acs-commons/components/utilities/report-builder/data-sources/dynamic-select", @@ -65,7 +66,7 @@ public class DynamicSelectDataSource extends SlingSafeMethodsServlet { private transient QueryHelper queryHelper; @Override - protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) + protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws ServletException, IOException { final ResourceResolver resolver = request.getResourceResolver(); diff --git a/bundle/src/main/java/com/adobe/acs/commons/rewriter/impl/VersionedClientlibsTransformerFactory.java b/bundle/src/main/java/com/adobe/acs/commons/rewriter/impl/VersionedClientlibsTransformerFactory.java index 4fa400678a..09ea9e1ad5 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/rewriter/impl/VersionedClientlibsTransformerFactory.java +++ b/bundle/src/main/java/com/adobe/acs/commons/rewriter/impl/VersionedClientlibsTransformerFactory.java @@ -17,18 +17,32 @@ */ package com.adobe.acs.commons.rewriter.impl; -import com.adobe.acs.commons.rewriter.ContentHandlerBasedTransformer; -import com.adobe.acs.commons.util.RequireAem; -import com.adobe.acs.commons.util.impl.AbstractGuavaCacheMBean; -import com.adobe.acs.commons.util.impl.CacheMBean; -import com.adobe.acs.commons.util.impl.exception.CacheMBeanException; -import com.adobe.granite.ui.clientlibs.ClientLibrary; -import com.adobe.granite.ui.clientlibs.HtmlLibrary; -import com.adobe.granite.ui.clientlibs.HtmlLibraryManager; -import com.adobe.granite.ui.clientlibs.LibraryType; -import com.day.cq.wcm.contentsync.PathRewriterOptions; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.management.DynamicMBean; +import javax.management.NotCompliantMBeanException; +import javax.management.openmbean.CompositeType; +import javax.management.openmbean.OpenDataException; +import javax.management.openmbean.OpenType; +import javax.management.openmbean.SimpleType; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletResponse; + import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang.StringUtils; import org.apache.felix.scr.annotations.Activate; @@ -49,6 +63,8 @@ import org.apache.sling.rewriter.ProcessingContext; import org.apache.sling.rewriter.Transformer; import org.apache.sling.rewriter.TransformerFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.osgi.service.component.ComponentContext; @@ -61,32 +77,18 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import javax.management.DynamicMBean; -import javax.management.NotCompliantMBeanException; -import javax.management.openmbean.CompositeType; -import javax.management.openmbean.OpenDataException; -import javax.management.openmbean.OpenType; -import javax.management.openmbean.SimpleType; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.Collections; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import com.adobe.acs.commons.rewriter.ContentHandlerBasedTransformer; +import com.adobe.acs.commons.util.RequireAem; +import com.adobe.acs.commons.util.impl.AbstractGuavaCacheMBean; +import com.adobe.acs.commons.util.impl.CacheMBean; +import com.adobe.acs.commons.util.impl.exception.CacheMBeanException; +import com.adobe.granite.ui.clientlibs.ClientLibrary; +import com.adobe.granite.ui.clientlibs.HtmlLibrary; +import com.adobe.granite.ui.clientlibs.HtmlLibraryManager; +import com.adobe.granite.ui.clientlibs.LibraryType; +import com.day.cq.wcm.contentsync.PathRewriterOptions; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; /** * ACS AEM Commons - Versioned Clientlibs (CSS/JS) Rewriter @@ -323,7 +325,7 @@ private ClientLibrary getClientLibrary(String path) { return clientLibrariesCache.get(path); } - @Nonnull private String getMd5(@Nonnull final HtmlLibrary htmlLibrary) throws IOException, ExecutionException { + @NotNull private String getMd5(@NotNull final HtmlLibrary htmlLibrary) throws IOException, ExecutionException { return md5Cache.get(new VersionedClientLibraryMd5CacheKey(htmlLibrary), new Callable() { @Override @@ -335,7 +337,7 @@ public String call() throws Exception { @SuppressWarnings("squid:S2070") // MD5 not used cryptographically - @Nonnull private String calculateMd5(@Nonnull final HtmlLibrary htmlLibrary, boolean isMinified) throws IOException { + @NotNull private String calculateMd5(@NotNull final HtmlLibrary htmlLibrary, boolean isMinified) throws IOException { // make sure that the minified version is being request in case minification is globally enabled // as this will reset the dirty flag on the clientlib try (InputStream input = htmlLibrary.getInputStream(isMinified)) { @@ -409,8 +411,8 @@ protected CompositeType getCacheEntryType() throws OpenDataException { new OpenType[] { SimpleType.STRING, SimpleType.STRING }); } - @Nonnull - UriInfo getUriInfo(@Nullable final String uri, @Nonnull SlingHttpServletRequest request) { + @NotNull + UriInfo getUriInfo(@Nullable final String uri, @NotNull SlingHttpServletRequest request) { if (uri != null) { Matcher matcher; if (enforceMd5) { diff --git a/bundle/src/main/java/com/adobe/acs/commons/util/TemplateUtil.java b/bundle/src/main/java/com/adobe/acs/commons/util/TemplateUtil.java index e6ea89b0b2..a5fb080cf5 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/util/TemplateUtil.java +++ b/bundle/src/main/java/com/adobe/acs/commons/util/TemplateUtil.java @@ -17,10 +17,8 @@ */ package com.adobe.acs.commons.util; -import javax.annotation.CheckForNull; - import org.apache.sling.api.resource.ValueMap; - +import org.jetbrains.annotations.Nullable; import org.osgi.annotation.versioning.ProviderType; import com.day.cq.wcm.api.NameConstants; @@ -43,7 +41,7 @@ private TemplateUtil() { * @param templatePath the path of the template to check * @return true if the page is of the defined template */ - public static boolean hasTemplate(@CheckForNull final Page page, @CheckForNull final String templatePath) { + public static boolean hasTemplate(@Nullable final Page page, @Nullable final String templatePath) { if (page == null) { return false; } @@ -51,7 +49,7 @@ public static boolean hasTemplate(@CheckForNull final Page page, @CheckForNull f } @SuppressWarnings("squid:S1144") - private static boolean hasTemplate(@CheckForNull final ValueMap valueMap, @CheckForNull final String templatePath) { + private static boolean hasTemplate(@Nullable final ValueMap valueMap, @Nullable final String templatePath) { if (valueMap != null && templatePath != null) { String path = valueMap.get(NameConstants.NN_TEMPLATE, String.class); if (templatePath.equals(path)) { diff --git a/bundle/src/main/java/com/adobe/acs/commons/wcm/comparisons/impl/PageCompareDataLinesImpl.java b/bundle/src/main/java/com/adobe/acs/commons/wcm/comparisons/impl/PageCompareDataLinesImpl.java index 21728f650e..d9fbf89cd9 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/wcm/comparisons/impl/PageCompareDataLinesImpl.java +++ b/bundle/src/main/java/com/adobe/acs/commons/wcm/comparisons/impl/PageCompareDataLinesImpl.java @@ -24,8 +24,8 @@ import com.google.common.base.Function; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Service; +import org.jetbrains.annotations.Nullable; -import javax.annotation.Nullable; import java.io.Serializable; import java.util.List; diff --git a/bundle/src/main/java/com/adobe/acs/commons/wcm/impl/AbstractDynamicClientLibraryServlet.java b/bundle/src/main/java/com/adobe/acs/commons/wcm/impl/AbstractDynamicClientLibraryServlet.java index 530e4b942f..7e1f29c372 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/wcm/impl/AbstractDynamicClientLibraryServlet.java +++ b/bundle/src/main/java/com/adobe/acs/commons/wcm/impl/AbstractDynamicClientLibraryServlet.java @@ -17,27 +17,23 @@ */ package com.adobe.acs.commons.wcm.impl; -import com.adobe.granite.ui.clientlibs.ClientLibrary; -import com.adobe.granite.ui.clientlibs.HtmlLibraryManager; -import com.adobe.granite.ui.clientlibs.LibraryType; -import com.google.gson.stream.JsonWriter; -import org.apache.felix.scr.annotations.Activate; -import org.apache.felix.scr.annotations.Property; -import org.apache.felix.scr.annotations.Reference; -import org.apache.felix.scr.annotations.sling.SlingServlet; +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Optional; + +import javax.servlet.ServletException; + import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.servlets.SlingSafeMethodsServlet; -import org.apache.sling.commons.osgi.PropertiesUtil; +import org.jetbrains.annotations.NotNull; -import javax.annotation.Nonnull; -import javax.servlet.ServletException; -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.Optional; +import com.adobe.granite.ui.clientlibs.ClientLibrary; +import com.adobe.granite.ui.clientlibs.HtmlLibraryManager; +import com.adobe.granite.ui.clientlibs.LibraryType; +import com.google.gson.stream.JsonWriter; abstract class AbstractDynamicClientLibraryServlet extends SlingSafeMethodsServlet { @@ -48,7 +44,7 @@ abstract class AbstractDynamicClientLibraryServlet extends SlingSafeMethodsServl private boolean excludeAll; @Override - protected void doGet(@Nonnull SlingHttpServletRequest request, @Nonnull SlingHttpServletResponse response) throws ServletException, IOException { + protected void doGet(@NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws ServletException, IOException { ResourceResolver resourceResolver = request.getResourceResolver(); response.setContentType("application/json"); JsonWriter writer = new JsonWriter(response.getWriter()); diff --git a/bundle/src/main/java/com/adobe/acs/commons/wcm/properties/shared/impl/SharedComponentPropertiesImpl.java b/bundle/src/main/java/com/adobe/acs/commons/wcm/properties/shared/impl/SharedComponentPropertiesImpl.java index 03665084fe..b5b3f07089 100644 --- a/bundle/src/main/java/com/adobe/acs/commons/wcm/properties/shared/impl/SharedComponentPropertiesImpl.java +++ b/bundle/src/main/java/com/adobe/acs/commons/wcm/properties/shared/impl/SharedComponentPropertiesImpl.java @@ -34,11 +34,11 @@ import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ValueMap; import org.apache.sling.api.wrappers.ValueMapDecorator; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; import java.util.HashMap; import java.util.Map; import java.util.Optional; @@ -168,18 +168,18 @@ public ValueMap mergeProperties(final ValueMap globalProperties, } @SuppressWarnings("unchecked") - @CheckForNull + @Nullable @Override - public AdapterType getAdapter(@Nonnull final Object adaptable, - @Nonnull final Class adapterType) { + public AdapterType getAdapter(@NotNull final Object adaptable, + @NotNull final Class adapterType) { if (adaptable instanceof Resource && adapterType == SharedValueMapResourceAdapter.class) { return (AdapterType) getSharedValueMapResourceAdapter((Resource) adaptable); } return null; } - @Nonnull - SharedValueMapResourceAdapter getSharedValueMapResourceAdapter(@Nonnull final Resource adaptable) { + @NotNull + SharedValueMapResourceAdapter getSharedValueMapResourceAdapter(@NotNull final Resource adaptable) { final ValueMap globalProperties = getGlobalProperties(adaptable); final ValueMap sharedProperties = getSharedProperties(adaptable); final ValueMap mergedProperties = mergeProperties(globalProperties, sharedProperties, adaptable); diff --git a/bundle/src/test/java/com/adobe/acs/commons/audit_log_search/impl/AuditLogSearchServletTest.java b/bundle/src/test/java/com/adobe/acs/commons/audit_log_search/impl/AuditLogSearchServletTest.java index e1244b27f1..843288ca35 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/audit_log_search/impl/AuditLogSearchServletTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/audit_log_search/impl/AuditLogSearchServletTest.java @@ -26,7 +26,6 @@ import java.util.Map; import java.util.function.Function; -import javax.annotation.Nullable; import javax.jcr.Session; import org.apache.jackrabbit.api.JackrabbitSession; @@ -37,6 +36,7 @@ import org.apache.sling.testing.mock.sling.junit.SlingContext; import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletRequest; import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletResponse; +import org.jetbrains.annotations.Nullable; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/bundle/src/test/java/com/adobe/acs/commons/marketo/client/impl/StaticResponseMarketoClient.java b/bundle/src/test/java/com/adobe/acs/commons/marketo/client/impl/StaticResponseMarketoClient.java index 2243bbfcc9..6076be2e96 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/marketo/client/impl/StaticResponseMarketoClient.java +++ b/bundle/src/test/java/com/adobe/acs/commons/marketo/client/impl/StaticResponseMarketoClient.java @@ -25,14 +25,12 @@ import java.util.Iterator; import java.util.function.BiFunction; -import javax.annotation.Nonnull; - import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.methods.HttpGet; import org.apache.http.entity.InputStreamEntity; import org.apache.http.message.BasicRequestLine; - +import org.jetbrains.annotations.NotNull; import org.apache.http.ProtocolVersion; import com.adobe.acs.commons.marketo.client.MarketoApiException; @@ -54,7 +52,7 @@ public StaticResponseMarketoClient(String[] resourcePaths) { } @Override - protected @Nonnull T getApiResponse(@Nonnull String url, String bearerToken, + protected @NotNull T getApiResponse(@NotNull String url, String bearerToken, BiFunction> callback) throws MarketoApiException { InputStream is = StaticResponseMarketoClient.class.getResourceAsStream(resourcePath); diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/AssetFolderCreatorTest.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/AssetFolderCreatorTest.java index 126779c71f..8db076f8d3 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/AssetFolderCreatorTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/AssetFolderCreatorTest.java @@ -19,23 +19,12 @@ import com.adobe.acs.commons.fam.ActionManager; import com.adobe.acs.commons.functions.CheckedConsumer; -import com.adobe.acs.commons.util.datadefinitions.ResourceDefinition; import com.adobe.acs.commons.util.datadefinitions.ResourceDefinitionBuilder; import com.adobe.acs.commons.util.datadefinitions.impl.JcrValidNameDefinitionBuilderImpl; import com.adobe.acs.commons.util.datadefinitions.impl.LowercaseWithDashesDefinitionBuilderImpl; import com.adobe.acs.commons.util.datadefinitions.impl.TitleAndNodeNameDefinitionBuilderImpl; -import com.amazonaws.auth.AnonymousAWSCredentials; -import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3Client; -import com.amazonaws.services.s3.S3ClientOptions; -import com.day.cq.dam.api.AssetManager; -import com.google.common.base.Function; -import me.alexpanov.net.FreePortFinder; import org.apache.jackrabbit.JcrConstants; -import org.apache.sling.api.resource.ModifiableValueMap; import org.apache.sling.api.resource.ResourceResolver; -import org.apache.sling.commons.mime.MimeTypeService; -import org.apache.sling.testing.mock.sling.ResourceResolverType; import org.apache.sling.testing.mock.sling.junit.SlingContext; import org.junit.Before; import org.junit.Rule; @@ -48,10 +37,6 @@ import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; -import javax.annotation.Nullable; -import javax.annotation.Resource; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; import java.util.Map; diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/FileAssetIngestorTest.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/FileAssetIngestorTest.java index 15df922908..9a3c4bf557 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/FileAssetIngestorTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/FileAssetIngestorTest.java @@ -46,7 +46,6 @@ import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nullable; import javax.jcr.RepositoryException; import org.apache.commons.io.FileUtils; @@ -57,6 +56,7 @@ import org.apache.sling.commons.mime.MimeTypeService; import org.apache.sling.testing.mock.sling.ResourceResolverType; import org.apache.sling.testing.mock.sling.junit.SlingContext; +import org.jetbrains.annotations.Nullable; import org.junit.After; import org.junit.Assert; import org.junit.Before; diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/S3AssetIngestorTest.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/S3AssetIngestorTest.java index 0eda57ab5d..6bcfff8567 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/S3AssetIngestorTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/S3AssetIngestorTest.java @@ -33,14 +33,13 @@ import java.util.Arrays; import java.util.function.Function; -import javax.annotation.Nullable; - import org.apache.jackrabbit.JcrConstants; import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.commons.mime.MimeTypeService; import org.apache.sling.testing.mock.sling.ResourceResolverType; import org.apache.sling.testing.mock.sling.junit.SlingContext; +import org.jetbrains.annotations.Nullable; import org.junit.After; import org.junit.Before; import org.junit.Rule; diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/UrlAssetImportTest.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/UrlAssetImportTest.java index 2fb6b81813..d06329e88a 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/UrlAssetImportTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/asset/UrlAssetImportTest.java @@ -32,7 +32,6 @@ import java.util.Map; import java.util.function.Function; -import javax.annotation.Nullable; import javax.jcr.RepositoryException; import org.apache.jackrabbit.JcrConstants; @@ -43,6 +42,7 @@ import org.apache.sling.commons.mime.MimeTypeService; import org.apache.sling.testing.mock.sling.ResourceResolverType; import org.apache.sling.testing.mock.sling.junit.SlingContext; +import org.jetbrains.annotations.Nullable; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentElement.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentElement.java index a35e0be072..229b0a317d 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentElement.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentElement.java @@ -26,8 +26,9 @@ import com.adobe.cq.dam.cfm.VersionedContent; import java.util.Iterator; import java.util.Map; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Incomplete mock that provides just enough for basic testing @@ -104,9 +105,9 @@ public VersionedContent getVersionedContent(VersionDef versionDef) throws Conten return null; } - @CheckForNull + @Nullable @Override - public AdapterType adaptTo(@Nonnull Class aClass) { + public AdapterType adaptTo(@NotNull Class aClass) { return null; } diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java index 82cc8676e9..182226bca9 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java @@ -32,10 +32,9 @@ import java.util.Iterator; import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; import org.apache.sling.api.resource.Resource; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; @@ -162,9 +161,9 @@ public VersionedContent getVersionedContent(VersionDef versionDef) throws Conten return null; } - @CheckForNull + @Nullable @Override - public AdapterType adaptTo(@Nonnull Class aClass) { + public AdapterType adaptTo(@NotNull Class aClass) { return null; } diff --git a/bundle/src/test/java/com/adobe/acs/commons/replication/status/impl/ReplicationStatusManagerImplTest.java b/bundle/src/test/java/com/adobe/acs/commons/replication/status/impl/ReplicationStatusManagerImplTest.java index 2f40e4dad6..73cd69b9d0 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/replication/status/impl/ReplicationStatusManagerImplTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/replication/status/impl/ReplicationStatusManagerImplTest.java @@ -29,7 +29,6 @@ import java.util.Calendar; import java.util.function.Function; -import javax.annotation.Nullable; import javax.jcr.Node; import javax.jcr.Session; @@ -38,6 +37,7 @@ import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.testing.mock.sling.ResourceResolverType; import org.apache.sling.testing.mock.sling.junit.SlingContext; +import org.jetbrains.annotations.Nullable; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/bundle/src/test/java/com/adobe/acs/commons/wcm/comparisons/impl/lines/LinesTest.java b/bundle/src/test/java/com/adobe/acs/commons/wcm/comparisons/impl/lines/LinesTest.java index b7acd76cec..92a97304bf 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/wcm/comparisons/impl/lines/LinesTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/wcm/comparisons/impl/lines/LinesTest.java @@ -17,23 +17,24 @@ */ package com.adobe.acs.commons.wcm.comparisons.impl.lines; -import com.adobe.acs.commons.wcm.comparisons.lines.Line; -import com.google.common.base.Function; -import com.google.common.base.Optional; -import com.google.common.collect.Lists; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import java.io.Serializable; +import java.util.Iterator; +import java.util.List; + import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; +import org.jetbrains.annotations.Nullable; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; -import javax.annotation.Nullable; -import java.io.Serializable; -import java.util.Iterator; -import java.util.List; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import com.adobe.acs.commons.wcm.comparisons.lines.Line; +import com.google.common.base.Function; +import com.google.common.base.Optional; +import com.google.common.collect.Lists; @RunWith(MockitoJUnitRunner.class) public class LinesTest { diff --git a/bundle/src/test/java/com/adobe/acs/commons/wcm/impl/PagesReferenceProviderTest.java b/bundle/src/test/java/com/adobe/acs/commons/wcm/impl/PagesReferenceProviderTest.java index 31ab110b9c..2a736220ab 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/wcm/impl/PagesReferenceProviderTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/wcm/impl/PagesReferenceProviderTest.java @@ -29,10 +29,9 @@ import java.util.function.Function; import java.util.stream.Collectors; -import javax.annotation.Nullable; - import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.testing.mock.sling.junit.SlingContext; +import org.jetbrains.annotations.Nullable; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/pom.xml b/pom.xml index 808a5c3504..87e068fbc7 100644 --- a/pom.xml +++ b/pom.xml @@ -590,11 +590,6 @@ Service-Component: OSGI-INF/*.xml annotations 23.0.0 - - com.google.code.findbugs - jsr305 - 3.0.0 - biz.aQute.bnd