james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [11/18] james-project git commit: JAMES-2107 Run IntelliJ inspection: "Explicit type parameter can be removed"
Date Wed, 16 Aug 2017 09:45:44 GMT
http://git-wip-us.apache.org/repos/asf/james-project/blob/03b574c9/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueueFactory.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueueFactory.java
b/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueueFactory.java
index 2229e1a..a08d152 100644
--- a/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueueFactory.java
+++ b/server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueueFactory.java
@@ -18,25 +18,25 @@
  ****************************************************************/
 package org.apache.james.queue.file;
 
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.inject.Inject;
+
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.lifecycle.api.LogEnabled;
-import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
 import org.apache.james.queue.api.MailQueue;
 import org.apache.james.queue.api.MailQueueFactory;
+import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
 import org.slf4j.Logger;
 
-import javax.inject.Inject;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * {@link MailQueueFactory} implementation which returns {@link FileMailQueue} instances
  */
 public class FileMailQueueFactory implements MailQueueFactory, LogEnabled {
 
-    private final Map<String, MailQueue> queues = new HashMap<String, MailQueue>();
+    private final Map<String, MailQueue> queues = new HashMap<>();
     private MailQueueItemDecoratorFactory mailQueueActionItemDecoratorFactory;
     private FileSystem fs;
     private Logger log;

http://git-wip-us.apache.org/repos/asf/james-project/blob/03b574c9/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
index 39a6dd5..8cfbe44 100644
--- a/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
+++ b/server/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
@@ -288,7 +288,7 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport,
MailPriori
      * @throws MessagingException
      */
     protected Map<String, Object> getJMSProperties(Mail mail, long delayInMillis) throws
MessagingException {
-        Map<String, Object> props = new HashMap<String, Object>();
+        Map<String, Object> props = new HashMap<>();
         long nextDelivery = -1;
         if (delayInMillis > 0) {
             nextDelivery = System.currentTimeMillis() + delayInMillis;
@@ -389,7 +389,7 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport,
MailPriori
         mail.setLastUpdated(new Date(message.getLongProperty(JAMES_MAIL_LAST_UPDATED)));
         mail.setName(message.getStringProperty(JAMES_MAIL_NAME));
 
-        List<MailAddress> rcpts = new ArrayList<MailAddress>();
+        List<MailAddress> rcpts = new ArrayList<>();
         String recipients = message.getStringProperty(JAMES_MAIL_RECIPIENTS);
         StringTokenizer recipientTokenizer = new StringTokenizer(recipients, JAMES_MAIL_SEPARATOR);
         while (recipientTokenizer.hasMoreTokens()) {
@@ -579,7 +579,7 @@ public class JMSMailQueue implements ManageableMailQueue, JMSSupport,
MailPriori
         Message message = null;
         MessageConsumer consumer = null;
         boolean first = true;
-        List<Message> messages = new ArrayList<Message>();
+        List<Message> messages = new ArrayList<>();
 
         try {
             session = connection.createSession(true, Session.SESSION_TRANSACTED);

http://git-wip-us.apache.org/repos/asf/james-project/blob/03b574c9/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
b/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
index 24bce75..162a5e1 100644
--- a/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
+++ b/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
@@ -29,7 +29,6 @@ import javax.annotation.PreDestroy;
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
-import com.google.common.annotations.VisibleForTesting;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.lifecycle.api.LogEnabled;
 import org.apache.james.queue.api.MailQueue;
@@ -38,6 +37,8 @@ import org.apache.james.queue.api.MailQueueManagementMBean;
 import org.apache.james.queue.api.ManageableMailQueue;
 import org.slf4j.Logger;
 
+import com.google.common.annotations.VisibleForTesting;
+
 /**
  * {@link MailQueueFactory} abstract base class which take care of register the
  * {@link MailQueue} implementations via JMX (if possible)
@@ -46,11 +47,11 @@ public abstract class AbstractMailQueueFactory implements MailQueueFactory,
LogE
 
     public static final String MBEAN_NAME_QUEUE_PREFIX = "org.apache.james:type=component,name=queue,queue=";
 
-    protected final Map<String, MailQueue> queues = new HashMap<String, MailQueue>();
+    protected final Map<String, MailQueue> queues = new HashMap<>();
     protected Logger log;
     private boolean useJMX = true;
     private MBeanServer mbeanServer;
-    private final List<String> mbeans = new ArrayList<String>();
+    private final List<String> mbeans = new ArrayList<>();
 
     public void setUseJMX(boolean useJMX) {
         this.useJMX = useJMX;

http://git-wip-us.apache.org/repos/asf/james-project/blob/03b574c9/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
b/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
index 70d5482..e0b042a 100644
--- a/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
+++ b/server/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
@@ -18,14 +18,13 @@
  ****************************************************************/
 package org.apache.james.queue.library;
 
-import org.apache.james.queue.api.MailQueue.MailQueueException;
-import org.apache.james.queue.api.MailQueueManagementMBean;
-import org.apache.james.queue.api.ManageableMailQueue;
-import org.apache.james.queue.api.ManageableMailQueue.MailQueueItemView;
-import org.apache.james.queue.api.ManageableMailQueue.MailQueueIterator;
-import org.apache.james.queue.api.ManageableMailQueue.Type;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailAddress;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javax.management.NotCompliantMBeanException;
 import javax.management.StandardMBean;
@@ -34,13 +33,15 @@ import javax.management.openmbean.CompositeDataSupport;
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+
+import org.apache.james.queue.api.MailQueue.MailQueueException;
+import org.apache.james.queue.api.MailQueueManagementMBean;
+import org.apache.james.queue.api.ManageableMailQueue;
+import org.apache.james.queue.api.ManageableMailQueue.MailQueueItemView;
+import org.apache.james.queue.api.ManageableMailQueue.MailQueueIterator;
+import org.apache.james.queue.api.ManageableMailQueue.Type;
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 /**
  * JMX MBean implementation which expose management functions by wrapping a
@@ -112,7 +113,7 @@ public class MailQueueManagement extends StandardMBean implements MailQueueManag
     @Override
     public List<CompositeData> browse() throws Exception {
         MailQueueIterator it = queue.browse();
-        List<CompositeData> data = new ArrayList<CompositeData>();
+        List<CompositeData> data = new ArrayList<>();
         String[] names = new String[]{"name", "sender", "state", "recipients", "size", "lastUpdated",
"remoteAddress", "remoteHost", "errorMessage", "attributes", "nextDelivery"};
         String[] descs = new String[]{"Unique name", "Sender", "Current state", "Recipients",
"Size in bytes", "Timestamp of last update", "IPAddress of the sender", "Hostname of the sender",
"Errormessage if any", "Attributes stored", "Timestamp of when the next delivery attempt will
be make"};
         OpenType<?>[] types = new OpenType<?>[]{SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG};
@@ -122,7 +123,7 @@ public class MailQueueManagement extends StandardMBean implements MailQueueManag
             MailQueueItemView mView = it.next();
             Mail m = mView.getMail();
             long nextDelivery = mView.getNextDelivery();
-            Map<String, Object> map = new HashMap<String, Object>();
+            Map<String, Object> map = new HashMap<>();
             map.put(names[0], m.getName());
             String sender = null;
             MailAddress senderAddress = m.getSender();
@@ -149,7 +150,7 @@ public class MailQueueManagement extends StandardMBean implements MailQueueManag
             map.put(names[6], m.getRemoteAddr());
             map.put(names[7], m.getRemoteHost());
             map.put(names[8], m.getErrorMessage());
-            Map<String, String> attrs = new HashMap<String, String>();
+            Map<String, String> attrs = new HashMap<>();
             Iterator<String> attrNames = m.getAttributeNames();
             while (attrNames.hasNext()) {
                 String attrName = attrNames.next();


---------------------------------------------------------------------
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