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 2021/07/26 07:20:55 UTC

[sling-org-apache-sling-commons-messaging-mail] branch master updated (5b87c21 -> 2f848bd)

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

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


    from 5b87c21  SLING-10516 Update Sling Commons Crypto to 1.1.0
     new 89cb88f  SLING-10639 Enable code checks with Checkstyle
     new 6e9625e  SLING-10640 Enable code checks with PMD
     new 7098f40  SLING-10641 Enable code checks with SpotBugs
     new d9a98f7  [checkstyle] (modifier) InterfaceMemberImpliedModifier
     new 0291017  [checkstyle] (design) DesignForExtension
     new ba54c3a  [checkstyle] (misc) FinalParameters
     new 4b5491a  [checkstyle] (javadoc) MissingJavadocMethod
     new ab8bcdd  [checkstyle] (javadoc) JavadocPackage
     new dac1d87  [checkstyle] (coding) MissingCtor
     new 2561508  [checkstyle] (modifier) RedundantModifier
     new c3c1414  [checkstyle] (coding) DeclarationOrder
     new b0958ff  SLING-10639 Enable code checks with Checkstyle
     new 085abcb  [checkstyle] (coding) IllegalCatch
     new 6a5b899  [checkstyle] (design) VisibilityModifier
     new dc1efbd  [checkstyle] (metrics) ClassFanOutComplexity
     new 30bb86e  [checkstyle] (metrics) ClassDataAbstractionCoupling
     new d343506  [checkstyle] (coding) MultipleStringLiterals
     new 0f6a7c7  [checkstyle] (coding) OverloadMethodsDeclarationOrder
     new 3713f9c  [checkstyle] (javadoc) MissingJavadocType
     new 4e6acb6  [checkstyle] (javadoc) MissingJavadocMethod
     new bc20713  [pmd] UnusedPrivateMethod
     new f29c91a  [pmd] EmptyCatchBlock
     new 2f848bd  [spotbugs] exclude EI_EXPOSE_REP2

The 23 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../template.html => checkstyle-suppressions.xml   |  28 +-
 pmd-exclude.properties                             |  21 +
 pom.xml                                            |  70 +++
 .../template.html => spotbugs-exclude.xml          |  25 +-
 .../sling/commons/messaging/mail/MailService.java  |  20 +-
 .../commons/messaging/mail/MessageBuilder.java     | 493 ++++++++++++++++++---
 .../commons/messaging/mail/MessageIdProvider.java  |  15 +-
 .../messaging/mail/internal/SimpleMailService.java |  23 +-
 .../mail/internal/SimpleMessageBuilder.java        |  80 ++--
 .../mail/internal/SimpleMessageIdProvider.java     |  10 +-
 .../messaging/mail/internal/package-info.java      |   7 +-
 .../sling/commons/messaging/mail/package-info.java |   4 +
 12 files changed, 635 insertions(+), 161 deletions(-)
 copy src/test/resources/template.html => checkstyle-suppressions.xml (50%)
 create mode 100644 pmd-exclude.properties
 copy src/test/resources/template.html => spotbugs-exclude.xml (71%)
 copy Jenkinsfile => src/main/java/org/apache/sling/commons/messaging/mail/internal/package-info.java (80%)

[sling-org-apache-sling-commons-messaging-mail] 14/23: [checkstyle] (design) VisibilityModifier

Posted by ol...@apache.org.
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-messaging-mail.git

commit 6a5b89964ed012c938612734888d5e682b1603bb
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 20 21:28:36 2021 +0200

    [checkstyle] (design) VisibilityModifier
---
 .../sling/commons/messaging/mail/internal/SimpleMessageBuilder.java     | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index b8c7827..be2efce 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -522,6 +522,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         }
     }
 
+    @SuppressWarnings("checkstyle:VisibilityModifier")
     private static class Attachment {
 
         final byte[] content;
@@ -541,6 +542,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
 
     }
 
+    @SuppressWarnings("checkstyle:VisibilityModifier")
     private static class Inline {
 
         final byte[] content;

[sling-org-apache-sling-commons-messaging-mail] 03/23: SLING-10641 Enable code checks with SpotBugs

Posted by ol...@apache.org.
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-messaging-mail.git

commit 7098f404b91576f442671c14bb04c085e1c6b4e4
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:13:50 2021 +0200

    SLING-10641 Enable code checks with SpotBugs
---
 pom.xml | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/pom.xml b/pom.xml
index 43c36e0..762a779 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,6 +124,28 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>com.github.spotbugs</groupId>
+        <artifactId>spotbugs-maven-plugin</artifactId>
+        <version>4.3.0</version>
+        <configuration>
+          <plugins>
+            <plugin>
+              <groupId>com.h3xstream.findsecbugs</groupId>
+              <artifactId>findsecbugs-plugin</artifactId>
+              <version>1.11.0</version>
+            </plugin>
+          </plugins>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 

[sling-org-apache-sling-commons-messaging-mail] 07/23: [checkstyle] (javadoc) MissingJavadocMethod

Posted by ol...@apache.org.
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-messaging-mail.git

commit 4b5491ac3ad18283e99e89a48d9e416d612e2d18
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:45:24 2021 +0200

    [checkstyle] (javadoc) MissingJavadocMethod
---
 .../sling/commons/messaging/mail/internal/SimpleMessageBuilder.java     | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index 7427056..6c7b7d2 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -227,6 +227,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         return bcc(bcc);
     }
 
+    @Override
     public @NotNull MessageBuilder bcc(@NotNull final String address, final String name) throws AddressException {
         final InternetAddress bcc = new InternetAddress(address);
         try {
@@ -406,6 +407,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         return !inlines().isEmpty();
     }
 
+    @Override
     public @NotNull MimeMessage build() throws MessagingException {
         final MimeMessage message = new MimeMessage(session);
 

[sling-org-apache-sling-commons-messaging-mail] 11/23: [checkstyle] (coding) DeclarationOrder

Posted by ol...@apache.org.
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-messaging-mail.git

commit c3c14142e66945ad551312d9ae6d946e0d6728a2
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 21:32:21 2021 +0200

    [checkstyle] (coding) DeclarationOrder
---
 .../messaging/mail/internal/SimpleMailService.java | 16 +++++++--------
 .../mail/internal/SimpleMessageBuilder.java        | 24 +++++++++++-----------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
index bc7d5e0..77e6d06 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
@@ -69,6 +69,14 @@ import org.slf4j.LoggerFactory;
 )
 public final class SimpleMailService implements MailService {
 
+    private static final String SMTPS_PROTOCOL = "smtps";
+
+    // https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
+
+    private static final String MAIL_SMTPS_FROM = "mail.smtps.from";
+
+    private static final String MESSAGE_ID_HEADER = "Message-ID";
+
     @Reference(
         cardinality = ReferenceCardinality.OPTIONAL,
         policy = ReferencePolicy.DYNAMIC,
@@ -110,14 +118,6 @@ public final class SimpleMailService implements MailService {
 
     private Session session;
 
-    private static final String SMTPS_PROTOCOL = "smtps";
-
-    // https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
-
-    private static final String MAIL_SMTPS_FROM = "mail.smtps.from";
-
-    private static final String MESSAGE_ID_HEADER = "Message-ID";
-
     private final Logger logger = LoggerFactory.getLogger(SimpleMailService.class);
 
     public SimpleMailService() { //
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index 62679cc..1270f37 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -49,6 +49,18 @@ import org.jetbrains.annotations.Nullable;
 
 public final class SimpleMessageBuilder implements MessageBuilder {
 
+    private static final String CONTENT_TYPE_TEXT_HTML = "text/html; charset=utf-8";
+
+    private static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain; charset=utf-8";
+
+    private static final String CHARSET_UTF8 = "utf-8";
+
+    private static final String MULTIPART_SUBTYPE_MIXED = "mixed";
+
+    private static final String MULTIPART_SUBTYPE_ALTERNATIVE = "alternative";
+
+    private static final String MULTIPART_SUBTYPE_RELATED = "related";
+
     private final Session session;
 
     private final List<Header> headers = new LinkedList<>();
@@ -73,18 +85,6 @@ public final class SimpleMessageBuilder implements MessageBuilder {
 
     private final List<Inline> inlines = new LinkedList<>();
 
-    private static final String CONTENT_TYPE_TEXT_HTML = "text/html; charset=utf-8";
-
-    private static final String CONTENT_TYPE_TEXT_PLAIN = "text/plain; charset=utf-8";
-
-    private static final String CHARSET_UTF8 = "utf-8";
-
-    private static final String MULTIPART_SUBTYPE_MIXED = "mixed";
-
-    private static final String MULTIPART_SUBTYPE_ALTERNATIVE = "alternative";
-
-    private static final String MULTIPART_SUBTYPE_RELATED = "related";
-
     SimpleMessageBuilder(@NotNull final Session session) {
         this.session = session;
     }

[sling-org-apache-sling-commons-messaging-mail] 02/23: SLING-10640 Enable code checks with PMD

Posted by ol...@apache.org.
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-messaging-mail.git

commit 6e9625ebb30a99ad7e38940a3828f188708b94b0
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:13:03 2021 +0200

    SLING-10640 Enable code checks with PMD
---
 pom.xml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/pom.xml b/pom.xml
index 451607e..43c36e0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,22 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+        <version>3.14.0</version>
+        <configuration>
+          <targetJdk>${sling.java.version}</targetJdk>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 

[sling-org-apache-sling-commons-messaging-mail] 04/23: [checkstyle] (modifier) InterfaceMemberImpliedModifier

Posted by ol...@apache.org.
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-messaging-mail.git

commit d9a98f7f9bac2f43d9129530c317817610bf4742
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:26:09 2021 +0200

    [checkstyle] (modifier) InterfaceMemberImpliedModifier
---
 pmd-exclude.properties                             | 21 ++++++
 pom.xml                                            |  1 +
 .../sling/commons/messaging/mail/MailService.java  |  4 +-
 .../commons/messaging/mail/MessageBuilder.java     | 74 +++++++++++-----------
 .../commons/messaging/mail/MessageIdProvider.java  |  2 +-
 5 files changed, 62 insertions(+), 40 deletions(-)

diff --git a/pmd-exclude.properties b/pmd-exclude.properties
new file mode 100644
index 0000000..a748f15
--- /dev/null
+++ b/pmd-exclude.properties
@@ -0,0 +1,21 @@
+################################################################################
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You under the Apache License, Version 2.0
+#    (the "License"); you may not use this file except in compliance with
+#    the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+################################################################################
+org.apache.sling.commons.messaging.mail.MailService=UnnecessaryModifier
+org.apache.sling.commons.messaging.mail.MessageBuilder=UnnecessaryModifier
+org.apache.sling.commons.messaging.mail.MessageIdProvider=UnnecessaryModifier
diff --git a/pom.xml b/pom.xml
index 762a779..e0547c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -114,6 +114,7 @@
         <version>3.14.0</version>
         <configuration>
           <targetJdk>${sling.java.version}</targetJdk>
+          <excludeFromFailureFile>pmd-exclude.properties</excludeFromFailureFile>
         </configuration>
         <executions>
           <execution>
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
index 854731e..0b1af4a 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
@@ -29,8 +29,8 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public interface MailService extends MessageService<MimeMessage, Void> {
 
-    @NotNull MessageBuilder getMessageBuilder();
+    public abstract @NotNull MessageBuilder getMessageBuilder();
 
-    @NotNull CompletableFuture<Void> sendMessage(@NotNull final MimeMessage message);
+    public abstract @NotNull CompletableFuture<Void> sendMessage(@NotNull MimeMessage message);
 
 }
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
index bfb504d..52e926e 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
@@ -33,78 +33,78 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public interface MessageBuilder {
 
-    @NotNull MessageBuilder header(@NotNull final String name, @Nullable final String value);
+    public abstract @NotNull MessageBuilder header(@NotNull final String name, @Nullable final String value);
 
-    @NotNull MessageBuilder headers(@NotNull final Collection<Header> headers);
+    public abstract @NotNull MessageBuilder headers(@NotNull final Collection<Header> headers);
 
-    @NotNull MessageBuilder from(@NotNull final InternetAddress from);
+    public abstract @NotNull MessageBuilder from(@NotNull final InternetAddress from);
 
-    @NotNull MessageBuilder from(@NotNull final String address) throws AddressException;
+    public abstract @NotNull MessageBuilder from(@NotNull final String address) throws AddressException;
 
-    @NotNull MessageBuilder from(@NotNull final String address, @NotNull final String name) throws AddressException;
+    public abstract @NotNull MessageBuilder from(@NotNull final String address, @NotNull final String name) throws AddressException;
 
-    @NotNull MessageBuilder to(@NotNull final InternetAddress to);
+    public abstract @NotNull MessageBuilder to(@NotNull final InternetAddress to);
 
-    @NotNull MessageBuilder to(@NotNull final String address) throws AddressException;
+    public abstract @NotNull MessageBuilder to(@NotNull final String address) throws AddressException;
 
-    @NotNull MessageBuilder to(@NotNull final String address, @NotNull final String name) throws AddressException;
+    public abstract @NotNull MessageBuilder to(@NotNull final String address, @NotNull final String name) throws AddressException;
 
-    @NotNull MessageBuilder to(@NotNull final InternetAddress[] addresses);
+    public abstract @NotNull MessageBuilder to(@NotNull final InternetAddress[] addresses);
 
-    @NotNull MessageBuilder to(@NotNull final String[] addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder to(@NotNull final String[] addresses) throws AddressException;
 
-    @NotNull MessageBuilder to(@NotNull final Collection<String> addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder to(@NotNull final Collection<String> addresses) throws AddressException;
 
-    @NotNull MessageBuilder cc(@NotNull final InternetAddress cc);
+    public abstract @NotNull MessageBuilder cc(@NotNull final InternetAddress cc);
 
-    @NotNull MessageBuilder cc(@NotNull final String address) throws AddressException;
+    public abstract @NotNull MessageBuilder cc(@NotNull final String address) throws AddressException;
 
-    @NotNull MessageBuilder cc(@NotNull final String address, @NotNull final String name) throws AddressException;
+    public abstract @NotNull MessageBuilder cc(@NotNull final String address, @NotNull final String name) throws AddressException;
 
-    @NotNull MessageBuilder cc(@NotNull final InternetAddress[] addresses);
+    public abstract @NotNull MessageBuilder cc(@NotNull final InternetAddress[] addresses);
 
-    @NotNull MessageBuilder cc(@NotNull final String[] addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder cc(@NotNull final String[] addresses) throws AddressException;
 
-    @NotNull MessageBuilder cc(@NotNull final Collection<String> addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder cc(@NotNull final Collection<String> addresses) throws AddressException;
 
-    @NotNull MessageBuilder bcc(@NotNull final InternetAddress bcc);
+    public abstract @NotNull MessageBuilder bcc(@NotNull final InternetAddress bcc);
 
-    @NotNull MessageBuilder bcc(@NotNull final String address) throws AddressException;
+    public abstract @NotNull MessageBuilder bcc(@NotNull final String address) throws AddressException;
 
-    @NotNull MessageBuilder bcc(@NotNull final String address, final String name) throws AddressException;
+    public abstract @NotNull MessageBuilder bcc(@NotNull final String address, final String name) throws AddressException;
 
-    @NotNull MessageBuilder bcc(@NotNull final InternetAddress[] addresses);
+    public abstract @NotNull MessageBuilder bcc(@NotNull final InternetAddress[] addresses);
 
-    @NotNull MessageBuilder bcc(@NotNull final String[] addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder bcc(@NotNull final String[] addresses) throws AddressException;
 
-    @NotNull MessageBuilder bcc(@NotNull final Collection<String> addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder bcc(@NotNull final Collection<String> addresses) throws AddressException;
 
-    @NotNull MessageBuilder replyTo(@NotNull final InternetAddress replyTo);
+    public abstract @NotNull MessageBuilder replyTo(@NotNull final InternetAddress replyTo);
 
-    @NotNull MessageBuilder replyTo(@NotNull final String address) throws AddressException;
+    public abstract @NotNull MessageBuilder replyTo(@NotNull final String address) throws AddressException;
 
-    @NotNull MessageBuilder replyTo(@NotNull final String address, final String name) throws AddressException;
+    public abstract @NotNull MessageBuilder replyTo(@NotNull final String address, final String name) throws AddressException;
 
-    @NotNull MessageBuilder replyTo(@NotNull final InternetAddress[] addresses);
+    public abstract @NotNull MessageBuilder replyTo(@NotNull final InternetAddress[] addresses);
 
-    @NotNull MessageBuilder replyTo(@NotNull final String[] addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder replyTo(@NotNull final String[] addresses) throws AddressException;
 
-    @NotNull MessageBuilder replyTo(@NotNull final Collection<String> addresses) throws AddressException;
+    public abstract @NotNull MessageBuilder replyTo(@NotNull final Collection<String> addresses) throws AddressException;
 
-    @NotNull MessageBuilder subject(@NotNull final String subject);
+    public abstract @NotNull MessageBuilder subject(@NotNull final String subject);
 
-    @NotNull MessageBuilder text(@NotNull final String text);
+    public abstract @NotNull MessageBuilder text(@NotNull final String text);
 
-    @NotNull MessageBuilder html(@NotNull final String html);
+    public abstract @NotNull MessageBuilder html(@NotNull final String html);
 
-    @NotNull MessageBuilder attachment(final byte @NotNull [] content, @NotNull final String type, @NotNull final String filename);
+    public abstract @NotNull MessageBuilder attachment(final byte @NotNull [] content, @NotNull final String type, @NotNull final String filename);
 
-    @NotNull MessageBuilder attachment(final byte @NotNull [] content, @NotNull final String type, @NotNull final String filename, @Nullable final Collection<Header> headers);
+    public abstract @NotNull MessageBuilder attachment(final byte @NotNull [] content, @NotNull final String type, @NotNull final String filename, @Nullable final Collection<Header> headers);
 
-    @NotNull MessageBuilder inline(final byte @NotNull [] content, @NotNull final String type, @NotNull final String cid);
+    public abstract @NotNull MessageBuilder inline(final byte @NotNull [] content, @NotNull final String type, @NotNull final String cid);
 
-    @NotNull MessageBuilder inline(final byte @NotNull [] content, @NotNull final String type, @NotNull final String cid, @Nullable final Collection<Header> headers);
+    public abstract @NotNull MessageBuilder inline(final byte @NotNull [] content, @NotNull final String type, @NotNull final String cid, @Nullable final Collection<Header> headers);
 
-    @NotNull MimeMessage build() throws MessagingException;
+    public abstract @NotNull MimeMessage build() throws MessagingException;
 
 }
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
index a8288c9..00259c2 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
@@ -27,6 +27,6 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public interface MessageIdProvider {
 
-    @NotNull String getMessageId(@NotNull final MimeMessage message) throws MessagingException;
+    public abstract @NotNull String getMessageId(@NotNull final MimeMessage message) throws MessagingException;
 
 }

[sling-org-apache-sling-commons-messaging-mail] 23/23: [spotbugs] exclude EI_EXPOSE_REP2

Posted by ol...@apache.org.
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-messaging-mail.git

commit 2f848bd95ba80eb096662bd78fea80c53bf2c80c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Jul 26 09:14:49 2021 +0200

    [spotbugs] exclude EI_EXPOSE_REP2
---
 pom.xml              |  1 +
 spotbugs-exclude.xml | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/pom.xml b/pom.xml
index f7f77bb..28c7150 100644
--- a/pom.xml
+++ b/pom.xml
@@ -132,6 +132,7 @@
         <artifactId>spotbugs-maven-plugin</artifactId>
         <version>4.3.0</version>
         <configuration>
+          <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
           <plugins>
             <plugin>
               <groupId>com.h3xstream.findsecbugs</groupId>
diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml
new file mode 100644
index 0000000..191fbac
--- /dev/null
+++ b/spotbugs-exclude.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<FindBugsFilter>
+  <Match>
+    <Bug pattern="EI_EXPOSE_REP2"/>
+    <Class name="org.apache.sling.commons.messaging.mail.internal.SimpleMessageBuilder"/>
+    <Method name="from"/>
+  </Match>
+</FindBugsFilter>

[sling-org-apache-sling-commons-messaging-mail] 16/23: [checkstyle] (metrics) ClassDataAbstractionCoupling

Posted by ol...@apache.org.
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-messaging-mail.git

commit 30bb86e5c20c50389f3eac1b451ac440e7061bde
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 20 22:08:56 2021 +0200

    [checkstyle] (metrics) ClassDataAbstractionCoupling
    
    purpose of the implementation is to free users from the complexity of Jakarta Mail
---
 checkstyle-suppressions.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index c59571d..aeef2b9 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -21,4 +21,5 @@
 <suppressions>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMailService\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMessageBuilder\.java"/>
+  <suppress checks="ClassDataAbstractionCoupling" files=".*\/SimpleMessageBuilder\.java"/>
 </suppressions>

[sling-org-apache-sling-commons-messaging-mail] 08/23: [checkstyle] (javadoc) JavadocPackage

Posted by ol...@apache.org.
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-messaging-mail.git

commit ab8bcddc93c432853948393a60e08b21e85bb8f8
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 20:59:35 2021 +0200

    [checkstyle] (javadoc) JavadocPackage
---
 .../sling/commons/messaging/mail/{ => internal}/package-info.java  | 7 ++++---
 .../java/org/apache/sling/commons/messaging/mail/package-info.java | 4 ++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/package-info.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/package-info.java
similarity index 80%
copy from src/main/java/org/apache/sling/commons/messaging/mail/package-info.java
copy to src/main/java/org/apache/sling/commons/messaging/mail/internal/package-info.java
index bae6ec4..4e400da 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/package-info.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/package-info.java
@@ -16,7 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-@Version("2.0.0")
-package org.apache.sling.commons.messaging.mail;
 
-import org.osgi.annotation.versioning.Version;
+/**
+ * Provides a simple implementation of the Apache Sling Commons Messaging Mail API using SMTPS (Simple Mail Transfer Protocol Secure).
+ */
+package org.apache.sling.commons.messaging.mail.internal;
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/package-info.java b/src/main/java/org/apache/sling/commons/messaging/mail/package-info.java
index bae6ec4..ec46384 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/package-info.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/package-info.java
@@ -16,6 +16,10 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
+/**
+ * Provides the Apache Sling Commons Messaging Mail API.
+ */
 @Version("2.0.0")
 package org.apache.sling.commons.messaging.mail;
 

[sling-org-apache-sling-commons-messaging-mail] 17/23: [checkstyle] (coding) MultipleStringLiterals

Posted by ol...@apache.org.
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-messaging-mail.git

commit d34350648ec97723c4ee5edaf1d37945f449518c
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 20 22:14:58 2021 +0200

    [checkstyle] (coding) MultipleStringLiterals
---
 checkstyle-suppressions.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index aeef2b9..2e05dca 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -22,4 +22,5 @@
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMailService\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMessageBuilder\.java"/>
   <suppress checks="ClassDataAbstractionCoupling" files=".*\/SimpleMessageBuilder\.java"/>
+  <suppress checks="MultipleStringLiterals" files=".*\/SimpleMailServiceConfiguration\.java"/>
 </suppressions>

[sling-org-apache-sling-commons-messaging-mail] 05/23: [checkstyle] (design) DesignForExtension

Posted by ol...@apache.org.
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-messaging-mail.git

commit 0291017700374e2248b89f1abfdadfdac56954a7
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:35:52 2021 +0200

    [checkstyle] (design) DesignForExtension
---
 .../apache/sling/commons/messaging/mail/internal/SimpleMailService.java | 2 +-
 .../sling/commons/messaging/mail/internal/SimpleMessageBuilder.java     | 2 +-
 .../sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
index 8717721..c9124a6 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
@@ -67,7 +67,7 @@ import org.slf4j.LoggerFactory;
     ocd = SimpleMailServiceConfiguration.class,
     factory = true
 )
-public class SimpleMailService implements MailService {
+public final class SimpleMailService implements MailService {
 
     @Reference(
         cardinality = ReferenceCardinality.OPTIONAL,
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index 3f1b118..aed5015 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -47,7 +47,7 @@ import org.apache.sling.commons.messaging.mail.MessageBuilder;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
-public class SimpleMessageBuilder implements MessageBuilder {
+public final class SimpleMessageBuilder implements MessageBuilder {
 
     private final Session session;
 
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
index eaf2bb2..c365926 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
@@ -44,7 +44,7 @@ import org.slf4j.LoggerFactory;
     ocd = SimpleMessageIdProviderConfiguration.class,
     factory = true
 )
-public class SimpleMessageIdProvider implements MessageIdProvider {
+public final class SimpleMessageIdProvider implements MessageIdProvider {
 
     private SimpleMessageIdProviderConfiguration configuration;
 

[sling-org-apache-sling-commons-messaging-mail] 15/23: [checkstyle] (metrics) ClassFanOutComplexity

Posted by ol...@apache.org.
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-messaging-mail.git

commit dc1efbdae5056c2b625ded87697127c0e801ff14
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 20 22:03:20 2021 +0200

    [checkstyle] (metrics) ClassFanOutComplexity
    
    purpose of the implementation is to free users from the complexity of Jakarta Mail
---
 checkstyle-suppressions.xml | 24 ++++++++++++++++++++++++
 pom.xml                     |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
new file mode 100644
index 0000000..c59571d
--- /dev/null
+++ b/checkstyle-suppressions.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
+<suppressions>
+  <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMailService\.java"/>
+  <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMessageBuilder\.java"/>
+</suppressions>
diff --git a/pom.xml b/pom.xml
index 1732c8f..f7f77bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,6 +98,8 @@
         </dependencies>
         <configuration>
           <configLocation>checks.xml</configLocation>
+          <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
+          <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
         </configuration>
         <executions>
           <execution>

[sling-org-apache-sling-commons-messaging-mail] 13/23: [checkstyle] (coding) IllegalCatch

Posted by ol...@apache.org.
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-messaging-mail.git

commit 085abcbc02bb751c7ca29da34dee739237c00605
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 20 21:27:36 2021 +0200

    [checkstyle] (coding) IllegalCatch
---
 .../sling/commons/messaging/mail/internal/SimpleMessageBuilder.java     | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index 1270f37..b8c7827 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -472,6 +472,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         parent.addBodyPart(part);
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void addAttachments(final MimeMultipart parent, final List<Attachment> attachments) throws MessagingException {
         for (final Attachment attachment : attachments) {
             try (ByteArrayInputStream inputStream = new ByteArrayInputStream(attachment.content)) {
@@ -490,6 +491,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         }
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     private static void addInlines(final MimeMultipart parent, final List<Inline> inlines) throws MessagingException {
         for (final Inline inline : inlines) {
             try (ByteArrayInputStream inputStream = new ByteArrayInputStream(inline.content)) {

[sling-org-apache-sling-commons-messaging-mail] 06/23: [checkstyle] (misc) FinalParameters

Posted by ol...@apache.org.
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-messaging-mail.git

commit ba54c3a7bd31bdcbe007f9a9fd08647ecf93647d
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:40:29 2021 +0200

    [checkstyle] (misc) FinalParameters
---
 .../mail/internal/SimpleMessageBuilder.java        | 24 +++++++++++-----------
 .../mail/internal/SimpleMessageIdProvider.java     |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index aed5015..7427056 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -149,13 +149,13 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder to(@NotNull InternetAddress[] addresses) {
+    public @NotNull MessageBuilder to(@NotNull final InternetAddress[] addresses) {
         toRecipients.addAll(Arrays.asList(addresses));
         return this;
     }
 
     @Override
-    public @NotNull MessageBuilder to(@NotNull String[] addresses) throws AddressException {
+    public @NotNull MessageBuilder to(@NotNull final String[] addresses) throws AddressException {
         for (final String address : addresses) {
             to(address);
         }
@@ -163,7 +163,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder to(@NotNull Collection<String> addresses) throws AddressException {
+    public @NotNull MessageBuilder to(@NotNull final Collection<String> addresses) throws AddressException {
         for (final String address : addresses) {
             to(address);
         }
@@ -194,13 +194,13 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder cc(@NotNull InternetAddress[] addresses) {
+    public @NotNull MessageBuilder cc(@NotNull final InternetAddress[] addresses) {
         ccRecipients.addAll(Arrays.asList(addresses));
         return this;
     }
 
     @Override
-    public @NotNull MessageBuilder cc(@NotNull String[] addresses) throws AddressException {
+    public @NotNull MessageBuilder cc(@NotNull final String[] addresses) throws AddressException {
         for (final String address : addresses) {
             cc(address);
         }
@@ -208,7 +208,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder cc(@NotNull Collection<String> addresses) throws AddressException {
+    public @NotNull MessageBuilder cc(@NotNull final Collection<String> addresses) throws AddressException {
         for (final String address : addresses) {
             cc(address);
         }
@@ -238,13 +238,13 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder bcc(@NotNull InternetAddress[] addresses) {
+    public @NotNull MessageBuilder bcc(@NotNull final InternetAddress[] addresses) {
         bccRecipients.addAll(Arrays.asList(addresses));
         return this;
     }
 
     @Override
-    public @NotNull MessageBuilder bcc(@NotNull String[] addresses) throws AddressException {
+    public @NotNull MessageBuilder bcc(@NotNull final String[] addresses) throws AddressException {
         for (final String address : addresses) {
             bcc(address);
         }
@@ -252,7 +252,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder bcc(@NotNull Collection<String> addresses) throws AddressException {
+    public @NotNull MessageBuilder bcc(@NotNull final Collection<String> addresses) throws AddressException {
         for (final String address : addresses) {
             bcc(address);
         }
@@ -283,13 +283,13 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder replyTo(@NotNull InternetAddress[] addresses) {
+    public @NotNull MessageBuilder replyTo(@NotNull final InternetAddress[] addresses) {
         replyTos.addAll(Arrays.asList(addresses));
         return this;
     }
 
     @Override
-    public @NotNull MessageBuilder replyTo(@NotNull String[] addresses) throws AddressException {
+    public @NotNull MessageBuilder replyTo(@NotNull final String[] addresses) throws AddressException {
         for (final String address : addresses) {
             replyTo(address);
         }
@@ -297,7 +297,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
     }
 
     @Override
-    public @NotNull MessageBuilder replyTo(@NotNull Collection<String> addresses) throws AddressException {
+    public @NotNull MessageBuilder replyTo(@NotNull final Collection<String> addresses) throws AddressException {
         for (final String address : addresses) {
             replyTo(address);
         }
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
index c365926..de5543d 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
@@ -69,7 +69,7 @@ public final class SimpleMessageIdProvider implements MessageIdProvider {
     }
 
     @Override
-    public @NotNull String getMessageId(@NotNull MimeMessage message) throws MessagingException {
+    public @NotNull String getMessageId(@NotNull final MimeMessage message) throws MessagingException {
         return String.format("%s.%s@%s", UUID.randomUUID().toString(), System.currentTimeMillis(), configuration.host());
     }
 

[sling-org-apache-sling-commons-messaging-mail] 18/23: [checkstyle] (coding) OverloadMethodsDeclarationOrder

Posted by ol...@apache.org.
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-messaging-mail.git

commit 0f6a7c7f8e58cc0316d5a0cc60e2879ac34caa02
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Wed Jul 21 15:40:36 2021 +0200

    [checkstyle] (coding) OverloadMethodsDeclarationOrder
    
    keep public and private methods next to each other instead
---
 checkstyle-suppressions.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index 2e05dca..5876e15 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -22,5 +22,6 @@
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMailService\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMessageBuilder\.java"/>
   <suppress checks="ClassDataAbstractionCoupling" files=".*\/SimpleMessageBuilder\.java"/>
+  <suppress checks="OverloadMethodsDeclarationOrder" files=".*\/SimpleMessageBuilder\.java"/>
   <suppress checks="MultipleStringLiterals" files=".*\/SimpleMailServiceConfiguration\.java"/>
 </suppressions>

[sling-org-apache-sling-commons-messaging-mail] 20/23: [checkstyle] (javadoc) MissingJavadocMethod

Posted by ol...@apache.org.
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-messaging-mail.git

commit 4e6acb63cfeba9399004b44baddd953cd5f2f016
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 25 18:07:14 2021 +0200

    [checkstyle] (javadoc) MissingJavadocMethod
---
 checkstyle-suppressions.xml                        |   1 +
 .../sling/commons/messaging/mail/MailService.java  |  11 +
 .../commons/messaging/mail/MessageBuilder.java     | 342 +++++++++++++++++++++
 .../commons/messaging/mail/MessageIdProvider.java  |   8 +
 4 files changed, 362 insertions(+)

diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index 295d2af..76f9991 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -20,6 +20,7 @@
 <!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
 <suppressions>
   <suppress checks="MissingJavadocType" files=".*\/internal\/.*\.java"/>
+  <suppress checks="MissingJavadocMethod" files=".*\/internal\/.*\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMailService\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMessageBuilder\.java"/>
   <suppress checks="ClassDataAbstractionCoupling" files=".*\/SimpleMessageBuilder\.java"/>
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
index e1d176f..35fe782 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
@@ -34,8 +34,19 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public interface MailService extends MessageService<MimeMessage, Void> {
 
+    /**
+     * Provides the message builder for this service.
+     *
+     * @return the message builder for this service
+     */
     public abstract @NotNull MessageBuilder getMessageBuilder();
 
+    /**
+     * Sends the given MIME message.
+     *
+     * @param message the MIME message to send
+     * @return {@link java.util.concurrent.CompletableFuture} for signaling completion
+     */
     public abstract @NotNull CompletableFuture<Void> sendMessage(@NotNull MimeMessage message);
 
 }
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
index 3534491..eeeef5c 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
@@ -20,10 +20,15 @@ package org.apache.sling.commons.messaging.mail;
 
 import java.util.Collection;
 
+import jakarta.mail.Address;
 import jakarta.mail.Header;
+import jakarta.mail.Message.RecipientType;
 import jakarta.mail.MessagingException;
+import jakarta.mail.Part;
 import jakarta.mail.internet.AddressException;
 import jakarta.mail.internet.InternetAddress;
+import jakarta.mail.internet.InternetHeaders;
+import jakarta.mail.internet.MimeBodyPart;
 import jakarta.mail.internet.MimeMessage;
 
 import org.jetbrains.annotations.NotNull;
@@ -38,78 +43,415 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public interface MessageBuilder {
 
+    // header(s)
+
+    /**
+     * Creates a new header from given name and value and adds it to the list of headers.
+     *
+     * @param name the name of the header
+     * @param value the value of the header
+     * @return the message builder
+     * @see Header
+     * @see InternetHeaders
+     */
     public abstract @NotNull MessageBuilder header(@NotNull final String name, @Nullable final String value);
 
+    /**
+     * Adds the given headers to the list of headers.
+     *
+     * @param headers the headers to add
+     * @return the message builder
+     * @see Header
+     * @see InternetHeaders
+     */
     public abstract @NotNull MessageBuilder headers(@NotNull final Collection<Header> headers);
 
+    // from
+
+    /**
+     * Sets the given address for the RFC 822 <code>From</code> header field.
+     *
+     * @param from the address
+     * @return the message builder
+     * @see MimeMessage#setFrom(Address)
+     */
     public abstract @NotNull MessageBuilder from(@NotNull final InternetAddress from);
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and sets it for the RFC 822 <code>From</code> header field.
+     *
+     * @param address the address
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setFrom(Address)
+     */
     public abstract @NotNull MessageBuilder from(@NotNull final String address) throws AddressException;
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and name and sets it for the RFC 822 <code>From</code> header field.
+     *
+     * @param address the address
+     * @param name the (personal) name
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setFrom(Address)
+     */
     public abstract @NotNull MessageBuilder from(@NotNull final String address, @NotNull final String name) throws AddressException;
 
+    // to
+
+    /**
+     * Adds the given address to the list of primary (<code>to</code>) recipients.
+     *
+     * @param to the address
+     * @return the message builder
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#TO
+     */
     public abstract @NotNull MessageBuilder to(@NotNull final InternetAddress to);
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and adds it to the list of primary (<code>to</code>) recipients.
+     *
+     * @param address the address
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#TO
+     */
     public abstract @NotNull MessageBuilder to(@NotNull final String address) throws AddressException;
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and name and adds it to the list of primary (<code>to</code>) recipients.
+     *
+     * @param address the address
+     * @param name the (personal) name
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#TO
+     */
     public abstract @NotNull MessageBuilder to(@NotNull final String address, @NotNull final String name) throws AddressException;
 
+    /**
+     * Adds the given addresses to the list of primary (<code>to</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#TO
+     */
     public abstract @NotNull MessageBuilder to(@NotNull final InternetAddress[] addresses);
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of primary (<code>to</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#TO
+     */
     public abstract @NotNull MessageBuilder to(@NotNull final String[] addresses) throws AddressException;
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of primary (<code>to</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#TO
+     */
     public abstract @NotNull MessageBuilder to(@NotNull final Collection<String> addresses) throws AddressException;
 
+    // cc
+
+    /**
+     * Adds the given address to the list of carbon copy (<code>cc</code>) recipients.
+     *
+     * @param cc the address
+     * @return the message builder
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#CC
+     */
     public abstract @NotNull MessageBuilder cc(@NotNull final InternetAddress cc);
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and adds it to the list of carbon copy (<code>cc</code>) recipients.
+     *
+     * @param address the address
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#CC
+     */
     public abstract @NotNull MessageBuilder cc(@NotNull final String address) throws AddressException;
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and name and adds it to the list of carbon copy (<code>cc</code>) recipients.
+     *
+     * @param address the address
+     * @param name the (personal) name
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#CC
+     */
     public abstract @NotNull MessageBuilder cc(@NotNull final String address, @NotNull final String name) throws AddressException;
 
+    /**
+     * Adds the given addresses to the list of carbon copy (<code>cc</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#CC
+     */
     public abstract @NotNull MessageBuilder cc(@NotNull final InternetAddress[] addresses);
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of carbon copy (<code>cc</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#CC
+     */
     public abstract @NotNull MessageBuilder cc(@NotNull final String[] addresses) throws AddressException;
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of carbon copy (<code>cc</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#CC
+     */
     public abstract @NotNull MessageBuilder cc(@NotNull final Collection<String> addresses) throws AddressException;
 
+    // bcc
+
+    /**
+     * Adds the given address to the list of blind carbon copy (<code>bcc</code>) recipients.
+     *
+     * @param bcc the address
+     * @return the message builder
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#BCC
+     */
     public abstract @NotNull MessageBuilder bcc(@NotNull final InternetAddress bcc);
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and adds it to the list of blind carbon copy (<code>bcc</code>) recipients.
+     *
+     * @param address the address
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#BCC
+     */
     public abstract @NotNull MessageBuilder bcc(@NotNull final String address) throws AddressException;
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and name and adds it to the list of blind carbon copy (<code>bcc</code>) recipients.
+     *
+     * @param address the address
+     * @param name the (personal) name
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#BCC
+     */
     public abstract @NotNull MessageBuilder bcc(@NotNull final String address, final String name) throws AddressException;
 
+    /**
+     * Adds the given addresses to the list of blind carbon copy (<code>bcc</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#BCC
+     */
     public abstract @NotNull MessageBuilder bcc(@NotNull final InternetAddress[] addresses);
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of blind carbon copy (<code>bcc</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#BCC
+     */
     public abstract @NotNull MessageBuilder bcc(@NotNull final String[] addresses) throws AddressException;
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of blind carbon copy (<code>bcc</code>) recipients.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setRecipients(RecipientType, Address[])
+     * @see RecipientType#BCC
+     */
     public abstract @NotNull MessageBuilder bcc(@NotNull final Collection<String> addresses) throws AddressException;
 
+    // replyTo
+
+    /**
+     * Adds the given address to the list of addresses for the RFC 822 <code>Reply-To</code> header field.
+     *
+     * @param replyTo the address
+     * @return the message builder
+     * @see MimeMessage#setReplyTo(Address[])
+     */
     public abstract @NotNull MessageBuilder replyTo(@NotNull final InternetAddress replyTo);
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and adds it to the list of addresses for the RFC 822 <code>Reply-To</code> header field.
+     *
+     * @param address the address
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setReplyTo(Address[])
+     */
     public abstract @NotNull MessageBuilder replyTo(@NotNull final String address) throws AddressException;
 
+    /**
+     * Creates a new <code>InternetAddress</code> from given address and name and adds it to the list of addresses for the RFC 822 <code>Reply-To</code> header field.
+     *
+     * @param address the address
+     * @param name the (personal) name
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address string fails
+     * @see MimeMessage#setReplyTo(Address[])
+     */
     public abstract @NotNull MessageBuilder replyTo(@NotNull final String address, final String name) throws AddressException;
 
+    /**
+     * Adds the given addresses to the list of addresses for the RFC 822 <code>Reply-To</code> header field.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @see MimeMessage#setReplyTo(Address[])
+     */
     public abstract @NotNull MessageBuilder replyTo(@NotNull final InternetAddress[] addresses);
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of addresses for the RFC 822 <code>Reply-To</code> header field.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setReplyTo(Address[])
+     */
     public abstract @NotNull MessageBuilder replyTo(@NotNull final String[] addresses) throws AddressException;
 
+    /**
+     * Creates new <code>InternetAddress</code>es from given addresses and adds them to the list of addresses for the RFC 822 <code>Reply-To</code> header field.
+     *
+     * @param addresses the addresses
+     * @return the message builder
+     * @throws AddressException if creating an <code>InternetAddress</code> from given address strings fails
+     * @see MimeMessage#setReplyTo(Address[])
+     */
     public abstract @NotNull MessageBuilder replyTo(@NotNull final Collection<String> addresses) throws AddressException;
 
+    // subject
+
+    /**
+     * Sets the given subject into the <code>Subject</code> header field.
+     *
+     * @param subject the subject of the message
+     * @return the message builder
+     * @see MimeMessage#setSubject(String) 
+     */
     public abstract @NotNull MessageBuilder subject(@NotNull final String subject);
 
+    // text
+
+    /**
+     * Sets the plain text content.
+     *
+     * @param text the plain text content
+     * @return the message builder
+     * @see MimeMessage#setText(String, String)
+     * @see MimeBodyPart#setContent(Object, String)
+     */
     public abstract @NotNull MessageBuilder text(@NotNull final String text);
 
+    // html
+
+    /**
+     * Sets the HTML content.
+     *
+     * @param html the HTML content
+     * @return the message builder
+     * @see MimeBodyPart#setContent(Object, String)
+     */
     public abstract @NotNull MessageBuilder html(@NotNull final String html);
 
+    // attachment
+
+    /**
+     * Attaches the given content to the message.
+     *
+     * @param content the content to attach
+     * @param type the type of the content (content/media/MIME type)
+     * @param filename the filename of the attachment
+     * @return the message builder
+     * @see Part#ATTACHMENT
+     */
     public abstract @NotNull MessageBuilder attachment(final byte @NotNull [] content, @NotNull final String type, @NotNull final String filename);
 
+    /**
+     * Attaches the given content with headers to the message.
+     *
+     * @param content the content to attach
+     * @param type the type of the content (content/media/MIME type)
+     * @param filename the filename of the attachment
+     * @param headers the headers for the content
+     * @return the message builder
+     * @see Part#ATTACHMENT
+     */
     public abstract @NotNull MessageBuilder attachment(final byte @NotNull [] content, @NotNull final String type, @NotNull final String filename, @Nullable final Collection<Header> headers);
 
+    // inline
+
+    /**
+     * Inlines the given content into the message.
+     *
+     * @param content the content to inline
+     * @param type the type of the content (content/media/MIME type)
+     * @param cid the content identifier (<code>Content-ID</code>)
+     * @return the message builder
+     * @see Part#INLINE
+     */
     public abstract @NotNull MessageBuilder inline(final byte @NotNull [] content, @NotNull final String type, @NotNull final String cid);
 
+    /**
+     * Inlines the given content with headers into the message.
+     *
+     * @param content the content to inline
+     * @param type the type of the content (content/media/MIME type)
+     * @param cid the content identifier (<code>Content-ID</code>)
+     * @param headers the headers for the content
+     * @return the message builder
+     * @see Part#INLINE
+     */
     public abstract @NotNull MessageBuilder inline(final byte @NotNull [] content, @NotNull final String type, @NotNull final String cid, @Nullable final Collection<Header> headers);
 
+    // build
+
+    /**
+     * Builds the MIME message with the given input.
+     *
+     * @return the built message
+     * @throws MessagingException if building message fails
+     */
     public abstract @NotNull MimeMessage build() throws MessagingException;
 
 }
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
index 1948677..6113263 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
@@ -32,6 +32,14 @@ import org.osgi.annotation.versioning.ProviderType;
 @ProviderType
 public interface MessageIdProvider {
 
+    /**
+     * Provides an identifier for given message.
+     *
+     * @param message the message to provide an identifier for
+     * @return the message identifier
+     * @throws MessagingException if providing an identifier fails
+     * @see MimeMessage#getMessageID()
+     */
     public abstract @NotNull String getMessageId(@NotNull final MimeMessage message) throws MessagingException;
 
 }

[sling-org-apache-sling-commons-messaging-mail] 19/23: [checkstyle] (javadoc) MissingJavadocType

Posted by ol...@apache.org.
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-messaging-mail.git

commit 3713f9c11b264961c0ba0429fd00b561bbdd8b93
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sat Jul 24 21:44:38 2021 +0200

    [checkstyle] (javadoc) MissingJavadocType
---
 checkstyle-suppressions.xml                                          | 1 +
 .../java/org/apache/sling/commons/messaging/mail/MailService.java    | 5 +++++
 .../java/org/apache/sling/commons/messaging/mail/MessageBuilder.java | 5 +++++
 .../org/apache/sling/commons/messaging/mail/MessageIdProvider.java   | 5 +++++
 4 files changed, 16 insertions(+)

diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml
index 5876e15..295d2af 100644
--- a/checkstyle-suppressions.xml
+++ b/checkstyle-suppressions.xml
@@ -19,6 +19,7 @@
 -->
 <!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
 <suppressions>
+  <suppress checks="MissingJavadocType" files=".*\/internal\/.*\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMailService\.java"/>
   <suppress checks="ClassFanOutComplexity" files=".*\/SimpleMessageBuilder\.java"/>
   <suppress checks="ClassDataAbstractionCoupling" files=".*\/SimpleMessageBuilder\.java"/>
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
index 0b1af4a..e1d176f 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MailService.java
@@ -26,6 +26,11 @@ import org.apache.sling.commons.messaging.MessageService;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.annotation.versioning.ProviderType;
 
+/**
+ * Service for sending MIME messages.
+ *
+ * @see MimeMessage
+ */
 @ProviderType
 public interface MailService extends MessageService<MimeMessage, Void> {
 
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
index 52e926e..3534491 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MessageBuilder.java
@@ -30,6 +30,11 @@ import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.osgi.annotation.versioning.ProviderType;
 
+/**
+ * Builder for MIME messages.
+ *
+ * @see MimeMessage
+ */
 @ProviderType
 public interface MessageBuilder {
 
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
index 00259c2..1948677 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/MessageIdProvider.java
@@ -24,6 +24,11 @@ import jakarta.mail.internet.MimeMessage;
 import org.jetbrains.annotations.NotNull;
 import org.osgi.annotation.versioning.ProviderType;
 
+/**
+ * Provider for message identifiers.
+ *
+ * @see MimeMessage
+ */
 @ProviderType
 public interface MessageIdProvider {
 

[sling-org-apache-sling-commons-messaging-mail] 09/23: [checkstyle] (coding) MissingCtor

Posted by ol...@apache.org.
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-messaging-mail.git

commit dac1d87176aae07a116d2764e27b56b4473a1b9f
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 21:07:08 2021 +0200

    [checkstyle] (coding) MissingCtor
---
 .../sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
index de5543d..00f26c6 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
@@ -50,6 +50,9 @@ public final class SimpleMessageIdProvider implements MessageIdProvider {
 
     private final Logger logger = LoggerFactory.getLogger(SimpleMessageIdProvider.class);
 
+    public SimpleMessageIdProvider() { //
+    }
+
     @Activate
     private void activate(final SimpleMessageIdProviderConfiguration configuration) {
         logger.debug("activating");

[sling-org-apache-sling-commons-messaging-mail] 10/23: [checkstyle] (modifier) RedundantModifier

Posted by ol...@apache.org.
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-messaging-mail.git

commit 2561508a552e4efa116117b1f1ba8f738d1f5419
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 21:20:13 2021 +0200

    [checkstyle] (modifier) RedundantModifier
---
 .../sling/commons/messaging/mail/internal/SimpleMailService.java      | 2 +-
 .../sling/commons/messaging/mail/internal/SimpleMessageBuilder.java   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
index c9124a6..bc7d5e0 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
@@ -174,7 +174,7 @@ public final class SimpleMailService implements MailService {
             final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
             Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
             final String password = cryptoService.decrypt(configuration.password());
-            try (final Transport transport = session.getTransport(SMTPS_PROTOCOL)) {
+            try (Transport transport = session.getTransport(SMTPS_PROTOCOL)) {
                 final List<ConnectionListener> connectionListeners = this.connectionListeners;
                 connectionListeners.forEach(transport::addConnectionListener);
                 final List<TransportListener> transportListeners = this.transportListeners;
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index 6c7b7d2..62679cc 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -474,7 +474,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
 
     private static void addAttachments(final MimeMultipart parent, final List<Attachment> attachments) throws MessagingException {
         for (final Attachment attachment : attachments) {
-            try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(attachment.content)) {
+            try (ByteArrayInputStream inputStream = new ByteArrayInputStream(attachment.content)) {
                 final MimeBodyPart part = new MimeBodyPart();
                 part.setDisposition(Part.ATTACHMENT);
                 part.setFileName(attachment.filename);
@@ -492,7 +492,7 @@ public final class SimpleMessageBuilder implements MessageBuilder {
 
     private static void addInlines(final MimeMultipart parent, final List<Inline> inlines) throws MessagingException {
         for (final Inline inline : inlines) {
-            try (final ByteArrayInputStream inputStream = new ByteArrayInputStream(inline.content)) {
+            try (ByteArrayInputStream inputStream = new ByteArrayInputStream(inline.content)) {
                 final MimeBodyPart part = new MimeBodyPart();
                 part.setDisposition(Part.INLINE);
                 part.setContentID(String.format("<%s>", inline.cid));

[sling-org-apache-sling-commons-messaging-mail] 12/23: SLING-10639 Enable code checks with Checkstyle

Posted by ol...@apache.org.
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-messaging-mail.git

commit b0958ffe3deabf5d177b38da6413fe9ad20a04d1
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Tue Jul 20 21:22:26 2021 +0200

    SLING-10639 Enable code checks with Checkstyle
    
    use de.bildschirmarbeiter:checkstyle:2
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index e0547c9..1732c8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -93,7 +93,7 @@
           <dependency>
             <groupId>de.bildschirmarbeiter</groupId>
             <artifactId>checkstyle</artifactId>
-            <version>1</version>
+            <version>2</version>
           </dependency>
         </dependencies>
         <configuration>

[sling-org-apache-sling-commons-messaging-mail] 21/23: [pmd] UnusedPrivateMethod

Posted by ol...@apache.org.
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-messaging-mail.git

commit bc20713cd39aad85fb59bd1dbc8bef850f6949e7
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 25 19:05:53 2021 +0200

    [pmd] UnusedPrivateMethod
---
 .../sling/commons/messaging/mail/internal/SimpleMailService.java       | 3 +++
 .../sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
index 77e6d06..c599e36 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMailService.java
@@ -124,6 +124,7 @@ public final class SimpleMailService implements MailService {
     }
 
     @Activate
+    @SuppressWarnings("unused")
     private void activate(final SimpleMailServiceConfiguration configuration) {
         logger.debug("activating");
         this.configuration = configuration;
@@ -131,6 +132,7 @@ public final class SimpleMailService implements MailService {
     }
 
     @Modified
+    @SuppressWarnings("unused")
     private void modified(final SimpleMailServiceConfiguration configuration) {
         logger.debug("modifying");
         this.configuration = configuration;
@@ -138,6 +140,7 @@ public final class SimpleMailService implements MailService {
     }
 
     @Deactivate
+    @SuppressWarnings("unused")
     private void deactivate() {
         logger.debug("deactivating");
         this.configuration = null;
diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
index 00f26c6..16e128e 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageIdProvider.java
@@ -54,18 +54,21 @@ public final class SimpleMessageIdProvider implements MessageIdProvider {
     }
 
     @Activate
+    @SuppressWarnings("unused")
     private void activate(final SimpleMessageIdProviderConfiguration configuration) {
         logger.debug("activating");
         this.configuration = configuration;
     }
 
     @Modified
+    @SuppressWarnings("unused")
     private void modified(final SimpleMessageIdProviderConfiguration configuration) {
         logger.debug("modifying");
         this.configuration = configuration;
     }
 
     @Deactivate
+    @SuppressWarnings("unused")
     private void deactivate() {
         logger.debug("deactivating");
         this.configuration = null;

[sling-org-apache-sling-commons-messaging-mail] 22/23: [pmd] EmptyCatchBlock

Posted by ol...@apache.org.
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-messaging-mail.git

commit f29c91a7d49223c90abe54c632a07f6a7a10ee0f
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 25 21:58:29 2021 +0200

    [pmd] EmptyCatchBlock
---
 .../mail/internal/SimpleMessageBuilder.java          | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
index be2efce..1ce59b4 100644
--- a/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
+++ b/src/main/java/org/apache/sling/commons/messaging/mail/internal/SimpleMessageBuilder.java
@@ -119,8 +119,8 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         final InternetAddress from = new InternetAddress(address);
         try {
             from.setPersonal(name, StandardCharsets.UTF_8.name());
-        } catch (UnsupportedEncodingException e) {
-            //
+        } catch (UnsupportedEncodingException e) { // NOPMD
+            // fixed standard charset
         }
         return from(from);
     }
@@ -142,8 +142,8 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         final InternetAddress to = new InternetAddress(address);
         try {
             to.setPersonal(name, StandardCharsets.UTF_8.name());
-        } catch (UnsupportedEncodingException e) {
-            //
+        } catch (UnsupportedEncodingException e) { // NOPMD
+            // fixed standard charset
         }
         return to(to);
     }
@@ -187,8 +187,8 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         final InternetAddress cc = new InternetAddress(address);
         try {
             cc.setPersonal(name, StandardCharsets.UTF_8.name());
-        } catch (UnsupportedEncodingException e) {
-            //
+        } catch (UnsupportedEncodingException e) { // NOPMD
+            // fixed standard charset
         }
         return cc(cc);
     }
@@ -232,8 +232,8 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         final InternetAddress bcc = new InternetAddress(address);
         try {
             bcc.setPersonal(name, StandardCharsets.UTF_8.name());
-        } catch (UnsupportedEncodingException e) {
-            //
+        } catch (UnsupportedEncodingException e) { // NOPMD
+            // fixed standard charset
         }
         return bcc(bcc);
     }
@@ -277,8 +277,8 @@ public final class SimpleMessageBuilder implements MessageBuilder {
         final InternetAddress replyTo = new InternetAddress(address);
         try {
             replyTo.setPersonal(name, StandardCharsets.UTF_8.name());
-        } catch (UnsupportedEncodingException e) {
-            //
+        } catch (UnsupportedEncodingException e) { // NOPMD
+            // fixed standard charset
         }
         return replyTo(replyTo);
     }

[sling-org-apache-sling-commons-messaging-mail] 01/23: SLING-10639 Enable code checks with Checkstyle

Posted by ol...@apache.org.
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-messaging-mail.git

commit 89cb88fde00fe335cfacd72fc2fb6c4f55e46753
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Sun Jul 18 13:12:25 2021 +0200

    SLING-10639 Enable code checks with Checkstyle
---
 pom.xml | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/pom.xml b/pom.xml
index 98e7c4b..451607e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -80,6 +80,34 @@
           </systemPropertyVariables>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>3.1.2</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>8.44</version>
+          </dependency>
+          <dependency>
+            <groupId>de.bildschirmarbeiter</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>1</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <configLocation>checks.xml</configLocation>
+        </configuration>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>