You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ol...@apache.org on 2019/12/08 15:22:00 UTC

[sling-org-apache-sling-commons-crypto] branch master updated: SLING-8886 Provide a Web Console plugin to encrypt messages

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

olli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a62cab  SLING-8886 Provide a Web Console plugin to encrypt messages
8a62cab is described below

commit 8a62cab2af65659f3a916243e70a33d7b25dfb42
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Dec 8 16:21:51 2019 +0100

    SLING-8886 Provide a Web Console plugin to encrypt messages
    
    Add null and length check for service references
---
 .../apache/sling/commons/crypto/internal/EncryptWebConsolePlugin.java  | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/crypto/internal/EncryptWebConsolePlugin.java b/src/main/java/org/apache/sling/commons/crypto/internal/EncryptWebConsolePlugin.java
index cff31ae..6fa0c1a 100644
--- a/src/main/java/org/apache/sling/commons/crypto/internal/EncryptWebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/commons/crypto/internal/EncryptWebConsolePlugin.java
@@ -166,6 +166,9 @@ public class EncryptWebConsolePlugin extends HttpServlet {
 
     private @Nullable CryptoService findCryptoService(@NotNull final String id) {
         final ServiceReference<CryptoService>[] references = tracker.getServiceReferences();
+        if (Objects.isNull(references) || references.length == 0) {
+            return null;
+        }
         for (final ServiceReference<CryptoService> reference : references) {
             if (id.equals(reference.getProperty(COMPONENT_ID).toString())) {
                 return bundleContext.getService(reference);