Skip to content
Permalink
Browse files
Merge remote-tracking branch 'mbaechler/fix-warnings'
  • Loading branch information
Antoine Duprat committed Oct 21, 2016
2 parents 8bba513 + 26912fd commit f8993a19fa844f9bd7ae0bf54c73f5d2768ad92b
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 28 deletions.
@@ -19,15 +19,13 @@

package org.apache.james.transport.matchers;

import org.apache.mailet.base.GenericRecipientMatcher;
import org.apache.mailet.MailAddress;

import java.util.Set;
import java.util.StringTokenizer;
import java.util.Vector;

import javax.mail.MessagingException;

import org.apache.mailet.MailAddress;
import org.apache.mailet.base.GenericRecipientMatcher;

import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
@@ -20,10 +20,9 @@
package org.apache.james.transport.mailets;

import static org.assertj.core.api.Assertions.assertThat;

import javax.mail.MessagingException;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.mailet.Mail;
import org.apache.mailet.Mailet;
import org.apache.mailet.MailetException;
@@ -33,8 +32,6 @@
import org.junit.Before;
import org.junit.Test;

import java.io.Serializable;

public class RemoveMailAttributeTest {

private static final String ATTRIBUTE_1 = "attribute1";
@@ -93,6 +93,7 @@ protected void configure() {
checkState(!isTypeConflicts, " Found multiple annotation @%s for type: %s; binding skipped!.",
Mock.class.getSimpleName(), type);
for (final Field field : fields) {
@SuppressWarnings("rawtypes")
final TypeLiteral literal = TypeLiteral.get(type);
final Mock annoBy = field.getAnnotation(Mock.class);
final Object mock = this.mockedFields.get(field);
@@ -129,8 +129,6 @@ public class OnamiSuite extends Suite {

private static final Logger LOGGER = Logger.getLogger(OnamiSuite.class.getName());

private Injector injector;

private final List<Module> allModules;

private final Map<Field, Object> mocked = new HashMap<Field, Object>(1);
@@ -195,7 +193,7 @@ public void run(final RunNotifier notifier) {
LOGGER.finer(" #### Creating injector ####");
}

this.injector = createInjector(allModules);
createInjector(allModules);
super.run(notifier);
this.flush();

@@ -218,7 +216,6 @@ private static List<Runner> runners(Class<?> suite, Class<?>[] children) throws
* {@inheritDoc}
*/
private void flush() {
this.injector = null;
this.allModules.clear();
this.mocked.clear();
}
@@ -42,7 +42,7 @@ public class ActionDispatcher {
* handle the Action.
* <Action, MailAction>
*/
private ConcurrentMap<Class, MailAction> fieldMailActionMap;
private ConcurrentMap<Class<?>, MailAction> fieldMailActionMap;

/**
* Constructor for ActionDispatcher.
@@ -73,7 +73,7 @@ public void execute(final Action anAction, final Mail aMail, final ActionContext
*
* @return Map
*/
public ConcurrentMap<Class, MailAction> getMethodMap() {
public ConcurrentMap<Class<?>, MailAction> getMethodMap() {
return fieldMailActionMap;
}

@@ -82,8 +82,8 @@ public ConcurrentMap<Class, MailAction> getMethodMap() {
*
* @return Map
*/
private ConcurrentMap<Class, MailAction> defaultMethodMap() {
final ConcurrentMap<Class, MailAction> actionMap = new ConcurrentHashMap<Class, MailAction>(4);
private ConcurrentMap<Class<?>, MailAction> defaultMethodMap() {
final ConcurrentMap<Class<?>, MailAction> actionMap = new ConcurrentHashMap<Class<?>, MailAction>(4);
actionMap.put(ActionFileInto.class, new FileIntoAction());
actionMap.put(ActionKeep.class, new KeepAction());
actionMap.put(ActionRedirect.class, new RedirectAction());
@@ -97,7 +97,7 @@ private ConcurrentMap<Class, MailAction> defaultMethodMap() {
*
* @param mailActionMap <Action, MailAction> not null
*/
protected void setMethodMap(ConcurrentMap<Class, MailAction> mailActionMap) {
protected void setMethodMap(ConcurrentMap<Class<?>, MailAction> mailActionMap) {
fieldMailActionMap = mailActionMap;
}
}
@@ -178,7 +178,7 @@ public void executeActions() throws SieveException
{
final List<Action> actions = getActions();
for (final Action action: actions) {
getMailetContext().log("Executing action: " + action.toString());
getMailetContext().log(MailetContext.LogLevel.INFO, "Executing action: " + action.toString());
try
{
dispatcher.execute(action, getMail(), this);
@@ -231,9 +231,8 @@ public List<String> getHeaderNames() throws SieveMailException
Set<String> headerNames = new HashSet<String>();
try
{
Enumeration allHeaders = getMessage().getAllHeaders();
while (allHeaders.hasMoreElements())
{
Enumeration<?> allHeaders = getMessage().getAllHeaders();
while (allHeaders.hasMoreElements()) {
headerNames.add(((Header) allHeaders.nextElement()).getName());
}
return new ArrayList<String>(headerNames);
@@ -445,7 +444,7 @@ public void post(String uri, MimeMessage mail) throws MessagingException {
poster.post(uri, mail);
}

public void post(MailAddress sender, Collection recipients, MimeMessage mail) throws MessagingException {
public void post(MailAddress sender, Collection<MailAddress> recipients, MimeMessage mail) throws MessagingException {
getMailetContext().sendMail(sender, recipients, mail);
}

@@ -224,7 +224,6 @@ public void init(MailetConfig config) throws MessagingException {
* @throws MessagingException
* if an error occurs while storing the mail
*/
@SuppressWarnings("unchecked")
@Override
public void service(Mail mail) throws MessagingException {
Collection<MailAddress> recipients = mail.getRecipients();
@@ -245,7 +244,7 @@ public void service(Mail mail) throws MessagingException {
+ ">"));
}

Enumeration headers;
Enumeration<?> headers;
InternetHeaders deliveredTo = new InternetHeaders();
if (deliveryHeader != null) {
// Copy any Delivered-To headers from the message
@@ -88,7 +88,7 @@ private MailAddress retrieveAddressFromString(String address, ActionContext cont
}

private boolean isMailingList(Mail mail) throws MessagingException {
Enumeration enumeration = mail.getMessage().getAllHeaderLines();
Enumeration<?> enumeration = mail.getMessage().getAllHeaderLines();
while (enumeration.hasMoreElements()) {
String headerName = (String) enumeration.nextElement();
if (headerName.startsWith("List-")) {
@@ -35,7 +35,6 @@
import javax.inject.Inject;
import javax.mail.Flags;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.fluent.Request;
@@ -188,7 +188,6 @@
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-mime4j-dom</artifactId>
<version>${apache-mime4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.james</groupId>

0 comments on commit f8993a1

Please sign in to comment.