james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [1/2] james-project git commit: JAMES-2475 Fix deprecation warnings from dependencies
Date Thu, 23 Aug 2018 07:17:52 GMT
Repository: james-project
Updated Branches:
  refs/heads/master 0084a26ee -> 2db93fb01


JAMES-2475 Fix deprecation warnings from dependencies


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5798d5c0
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5798d5c0
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5798d5c0

Branch: refs/heads/master
Commit: 5798d5c041490837172b6e12367fd09d4a62a4c8
Parents: 0084a26
Author: Antoine Duprat <aduprat@linagora.com>
Authored: Tue Aug 21 15:21:59 2018 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu Aug 23 07:15:25 2018 +0000

----------------------------------------------------------------------
 .../eventsourcing/EventSourcingSystemTest.java  |  4 +--
 mailbox/api/pom.xml                             |  4 +++
 .../mailbox/model/MailboxAnnotationKey.java     | 12 ++++----
 .../mpt/imapmailbox/cyrus/host/Docker.java      |  3 +-
 pom.xml                                         |  5 ++++
 server/container/util/pom.xml                   |  4 +++
 .../org/apache/james/util/UnicodeSetUtils.java  | 30 ++++++++++++++++++++
 .../james/util/CompletableFutureUtilTest.java   |  3 +-
 .../apache/james/user/jpa/model/JPAUser.java    |  1 +
 .../integration/cucumber/DownloadStepdefs.java  |  2 +-
 .../integration/cucumber/UploadStepdefs.java    |  2 +-
 .../org/apache/james/jmap/DownloadServlet.java  |  2 +-
 .../org/apache/james/jmap/model/Keyword.java    | 16 ++++++-----
 .../util/docker/SwarmGenericContainer.java      |  2 +-
 src/site/xdoc/server/config-users.xml           |  3 +-
 15 files changed, 71 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java
----------------------------------------------------------------------
diff --git a/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java
b/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java
index 9d1bc23..13a4ed2 100644
--- a/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java
+++ b/event-sourcing/event-sourcing-core/src/test/java/org/apache/james/eventsourcing/EventSourcingSystemTest.java
@@ -22,7 +22,7 @@ package org.apache.james.eventsourcing;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyListOf;
+import static org.mockito.ArgumentMatchers.anyList;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -89,7 +89,7 @@ public interface EventSourcingSystemTest {
     @Test
     default void throwingStoreShouldNotLeadToPusblishing() {
         EventStore eventStore = mock(EventStore.class);
-        doThrow(new RuntimeException()).when(eventStore).appendAll(anyListOf(Event.class));
+        doThrow(new RuntimeException()).when(eventStore).appendAll(anyList());
         when(eventStore.getEventsOfAggregate(any())).thenReturn(History.empty());
 
         DataCollectorSubscriber subscriber = new DataCollectorSubscriber();

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/mailbox/api/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/api/pom.xml b/mailbox/api/pom.xml
index 4f35923..18578c1 100644
--- a/mailbox/api/pom.xml
+++ b/mailbox/api/pom.xml
@@ -62,6 +62,10 @@
             <artifactId>guava</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ibm.icu</groupId>
+            <artifactId>icu4j</artifactId>
+        </dependency>
+        <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
----------------------------------------------------------------------
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
index 8bb500e..1e7349d 100644
--- a/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/model/MailboxAnnotationKey.java
@@ -22,18 +22,20 @@ package org.apache.james.mailbox.model;
 import java.util.Locale;
 
 import org.apache.commons.lang3.StringUtils;
+import org.apache.james.util.UnicodeSetUtils;
 
-import com.google.common.base.CharMatcher;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
+import com.ibm.icu.text.UnicodeSet;
 
 public class MailboxAnnotationKey {
-    public static final String SLASH_CHARACTER = "/";
 
+    public static final String SLASH_CHARACTER = "/";
     public static final String TWO_SLASH_CHARACTER = "//";
 
-    private static final CharMatcher NAME_ANNOTATION_PATTERN = CharMatcher.JAVA_LETTER_OR_DIGIT
-        .or(CharMatcher.is('/'));
+    private static final UnicodeSet NAME_ANNOTATION_PATTERN = UnicodeSetUtils.letterOrDigitUnicodeSet()
+            .add(SLASH_CHARACTER)
+            .freeze();
     public static final int MINIMUM_COMPONENTS = 2;
     public static final int MINIMUM_COMPONENTS_OF_VENDOR = 4;
     public static final int SECOND_COMPONENT_INDEX = 1;
@@ -63,7 +65,7 @@ public class MailboxAnnotationKey {
         if (key.endsWith(SLASH_CHARACTER)) {
             return false;
         }
-        if (!NAME_ANNOTATION_PATTERN.matchesAllOf(key)) {
+        if (!NAME_ANNOTATION_PATTERN.containsAll(key)) {
             return false;
         }
         int componentsNo = countComponents();

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java
b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java
index f79cb88..e44fe48 100644
--- a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java
+++ b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/Docker.java
@@ -28,6 +28,7 @@ import org.awaitility.Awaitility;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.spotify.docker.client.DefaultDockerClient;
+import com.spotify.docker.client.DockerClient.RemoveContainerParam;
 import com.spotify.docker.client.exceptions.DockerException;
 import com.spotify.docker.client.messages.ContainerConfig;
 import com.spotify.docker.client.messages.ContainerCreation;
@@ -89,7 +90,7 @@ public class Docker {
     public void stop(ContainerCreation container) {
         try {
             dockerClient.killContainer(container.id());
-            dockerClient.removeContainer(container.id(), true);
+            dockerClient.removeContainer(container.id(), RemoveContainerParam.removeVolumes());
         } catch (DockerException | InterruptedException e) {
             throw new RuntimeException(e);
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 93f3497..5cd48c8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1717,6 +1717,11 @@
                 <version>4.0</version>
             </dependency>
             <dependency>
+                <groupId>com.ibm.icu</groupId>
+                <artifactId>icu4j</artifactId>
+                <version>62.1</version>
+            </dependency>
+            <dependency>
                 <groupId>com.jayway.awaitility</groupId>
                 <artifactId>awaitility</artifactId>
                 <version>1.6.5</version>

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/container/util/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/util/pom.xml b/server/container/util/pom.xml
index d10a795..8e367d1 100644
--- a/server/container/util/pom.xml
+++ b/server/container/util/pom.xml
@@ -55,6 +55,10 @@
             <artifactId>guava</artifactId>
         </dependency>
         <dependency>
+            <groupId>com.ibm.icu</groupId>
+            <artifactId>icu4j</artifactId>
+        </dependency>
+        <dependency>
             <groupId>com.sun.mail</groupId>
             <artifactId>javax.mail</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/container/util/src/main/java/org/apache/james/util/UnicodeSetUtils.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/main/java/org/apache/james/util/UnicodeSetUtils.java
b/server/container/util/src/main/java/org/apache/james/util/UnicodeSetUtils.java
new file mode 100644
index 0000000..26b05a0
--- /dev/null
+++ b/server/container/util/src/main/java/org/apache/james/util/UnicodeSetUtils.java
@@ -0,0 +1,30 @@
+/****************************************************************
+ * 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.                                           *
+ ****************************************************************/
+package org.apache.james.util;
+
+import com.ibm.icu.text.UnicodeSet;
+
+public class UnicodeSetUtils {
+
+    private static final String LETTER_OR_DIGIT_PATTERN = "[[a-z][A-Z][0-9]]";
+
+    public static UnicodeSet letterOrDigitUnicodeSet() {
+        return new UnicodeSet(LETTER_OR_DIGIT_PATTERN);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
----------------------------------------------------------------------
diff --git a/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
b/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
index 6f333cf..a42fb39 100644
--- a/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
+++ b/server/container/util/src/test/java/org/apache/james/util/CompletableFutureUtilTest.java
@@ -36,7 +36,6 @@ import org.junit.Before;
 import org.junit.Test;
 
 import com.github.steveash.guavate.Guavate;
-import com.google.common.base.Throwables;
 import com.google.common.collect.ImmutableList;
 
 public class CompletableFutureUtilTest {
@@ -89,7 +88,7 @@ public class CompletableFutureUtilTest {
                 try {
                     Thread.sleep(itemCount - i);
                 } catch (InterruptedException e) {
-                    throw Throwables.propagate(e);
+                    throw new RuntimeException(e);
                 }
                 queue.add(i);
                 return i;

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/model/JPAUser.java
----------------------------------------------------------------------
diff --git a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/model/JPAUser.java
b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/model/JPAUser.java
index 271ea38..079845e 100644
--- a/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/model/JPAUser.java
+++ b/server/data/data-jpa/src/main/java/org/apache/james/user/jpa/model/JPAUser.java
@@ -72,6 +72,7 @@ public class JPAUser implements User {
         }
     }
 
+    @SuppressWarnings("deprecation")
     private static HashFunction chooseHashing(String algorithm) {
         switch (algorithm) {
             case "MD5":

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
index 6f611a4..fefe803 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
@@ -444,7 +444,7 @@ public class DownloadStepdefs {
 
     @Then("^the attachment is named \"([^\"]*)\"$")
     public void assertContentDisposition(String name) {
-        if (!CharMatcher.ASCII.matchesAllOf(name)) {
+        if (!CharMatcher.ascii().matchesAllOf(name)) {
             assertEncodedFilenameMatches(name);
         } else {
             assertThat(response.getFirstHeader("Content-Disposition").getValue()).isEqualTo("attachment;
filename=\"" + name + "\"");

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UploadStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UploadStepdefs.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UploadStepdefs.java
index 4e3171c..757bd26 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UploadStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/UploadStepdefs.java
@@ -198,7 +198,7 @@ public class UploadStepdefs {
     }
 
     private String normalizeContentType(String input) {
-        return CharMatcher.WHITESPACE.removeFrom(input.toLowerCase(Locale.US));
+        return CharMatcher.whitespace().removeFrom(input.toLowerCase(Locale.US));
     }
 
     @Then("^\"([^\"]*)\" should be able to retrieve the content$")

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
index 0c7f085..f70d407 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
@@ -143,7 +143,7 @@ public class DownloadServlet extends HttpServlet {
     }
 
     private void addContentDispositionHeaderRegardingEncoding(String name, HttpServletResponse
resp) {
-        if (CharMatcher.ASCII.matchesAllOf(name)) {
+        if (CharMatcher.ascii().matchesAllOf(name)) {
             resp.addHeader("Content-Disposition", "attachment; filename=\"" + name + "\"");
         } else {
             resp.addHeader("Content-Disposition", "attachment; filename*=\"" + EncoderUtil.encodeEncodedWord(name,
Usage.TEXT_TOKEN) + "\"");

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keyword.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keyword.java
b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keyword.java
index 761d41d..8d0f76c 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keyword.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/model/Keyword.java
@@ -24,22 +24,24 @@ import java.util.Optional;
 import javax.mail.Flags;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.james.util.UnicodeSetUtils;
 
-import com.google.common.base.CharMatcher;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Objects;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableBiMap;
 import com.google.common.collect.ImmutableList;
+import com.ibm.icu.text.UnicodeSet;
 
 public class Keyword {
     private static final int FLAG_NAME_MIN_LENGTH = 1;
     private static final int FLAG_NAME_MAX_LENGTH = 255;
-    private static final CharMatcher FLAG_NAME_PATTERN =
-            CharMatcher.JAVA_LETTER_OR_DIGIT
-                .or(CharMatcher.is('$'))
-                .or(CharMatcher.is('_')
-                .or(CharMatcher.is('-')));
+    private static final UnicodeSet FLAG_NAME_PATTERN =
+            UnicodeSetUtils.letterOrDigitUnicodeSet()
+                .add('$')
+                .add('_')
+                .add('-')
+                .freeze();
 
     public static final Keyword DRAFT = new Keyword("$Draft");
     public static final Keyword SEEN = new Keyword("$Seen");
@@ -80,7 +82,7 @@ public class Keyword {
         if (flagName.length() < FLAG_NAME_MIN_LENGTH || flagName.length() > FLAG_NAME_MAX_LENGTH)
{
             return false;
         }
-        if (!FLAG_NAME_PATTERN.matchesAllOf(flagName)) {
+        if (!FLAG_NAME_PATTERN.containsAll(flagName)) {
             return false;
         }
         return true;

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/server/testing/src/main/java/org/apache/james/util/docker/SwarmGenericContainer.java
----------------------------------------------------------------------
diff --git a/server/testing/src/main/java/org/apache/james/util/docker/SwarmGenericContainer.java
b/server/testing/src/main/java/org/apache/james/util/docker/SwarmGenericContainer.java
index 59488c0..6c361c8 100644
--- a/server/testing/src/main/java/org/apache/james/util/docker/SwarmGenericContainer.java
+++ b/server/testing/src/main/java/org/apache/james/util/docker/SwarmGenericContainer.java
@@ -158,7 +158,7 @@ public class SwarmGenericContainer implements TestRule {
 
     @Override
     public Statement apply(Statement statement, Description description) {
-        return container.apply(statement, description);
+        return statement;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/5798d5c0/src/site/xdoc/server/config-users.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/server/config-users.xml b/src/site/xdoc/server/config-users.xml
index 2b9831c..198ad80 100644
--- a/src/site/xdoc/server/config-users.xml
+++ b/src/site/xdoc/server/config-users.xml
@@ -45,7 +45,8 @@
 
       <dl>
         <dt><strong>algorithm</strong></dt>
-        <dd>Algorithm to has passwords. Supported password algorithm are: MD5, SHA-256,
SHA-512, NONE</dd>
+        <dd>Algorithm to hash passwords. Supported password algorithm are: MD5, SHA-256,
SHA-512, NONE(then SHA-1 will be used).</dd>
+        <dd>MD5 and SHA-1 are deprecated.</dd>
         <dt><strong>enableVirtualHosting</strong></dt>
         <dd>true (default) or false. Defines if the usernames must (true) or may not
contain (false) a domain part (user@domain.tld).</dd>
       </dl>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message