james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ieu...@apache.org
Subject svn commit: r1415429 [1/3] - in /james/mailet: ai/trunk/classic/src/main/java/org/apache/james/ai/classic/ ai/trunk/src/site/xdoc/ base/trunk/ base/trunk/src/assemble/ base/trunk/src/main/java/org/apache/mailet/base/ base/trunk/src/main/java/org/apache...
Date Thu, 29 Nov 2012 22:53:11 GMT
Author: ieugen
Date: Thu Nov 29 22:52:55 2012
New Revision: 1415429

URL: http://svn.apache.org/viewvc?rev=1415429&view=rev
Log:
MAILET-38

BIG cleaning, used Intellij IDEA code inspection and fixes:
 
 - XML files have UTF-8 encoding, are refactored and small fixes
 - for -> for each for better readability
 - StringBuffer -> StringBuilder
 - while(iterator) -> for each
 - other fixes

Modified:
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalyzer.java
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/SqlResources.java
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenCounter.java
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenProbabilityStrength.java
    james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/Tokenizer.java
    james/mailet/ai/trunk/src/site/xdoc/conf.xml
    james/mailet/ai/trunk/src/site/xdoc/index.xml
    james/mailet/base/trunk/RELEASE_NOTES.txt
    james/mailet/base/trunk/src/assemble/bin.xml
    james/mailet/base/trunk/src/assemble/src.xml
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MailetUtil.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/RFC977DateFormat.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java
    james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java
    james/mailet/base/trunk/src/reporting-site/site.xml
    james/mailet/base/trunk/src/site/xdoc/index.xml
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java
    james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java
    james/mailet/crypto/trunk/src/assemble/bin.xml
    james/mailet/crypto/trunk/src/assemble/src.xml
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMESign.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/Sign.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java
    james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java
    james/mailet/crypto/trunk/src/reporting-site/site.xml
    james/mailet/crypto/trunk/src/site/xdoc/conf.xml
    james/mailet/crypto/trunk/src/site/xdoc/index.xml
    james/mailet/current/fix-site.xml
    james/mailet/current/src/reporting-site/site/site.xml
    james/mailet/current/src/site/site.xml
    james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/AbstractMailetdocsReport.java
    james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
    james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
    james/mailet/maven-mailetdocs-plugin/trunk/src/reporting-site/site.xml
    james/mailet/maven-mailetdocs-plugin/trunk/src/site/xdoc/index.xml
    james/mailet/standard/trunk/src/assemble/bin.xml
    james/mailet/standard/trunk/src/assemble/src.xml
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddFooter.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddSubjectPrefix.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/LogMessage.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ReplaceContent.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ServerTime.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ToProcessor.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UnwrapText.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java
    james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHeader.java
    james/mailet/standard/trunk/src/reporting-site/site.xml
    james/mailet/standard/trunk/src/site/xdoc/conf.xml
    james/mailet/standard/trunk/src/site/xdoc/index.xml
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/mailets/AddFooterTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/mailets/NullTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/mailets/StripAttachmentTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/mailets/ToProcessorTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/AbstractHasMailAttributeTest.java
    james/mailet/standard/trunk/src/test/java/org/apache/james/transport/matchers/SizeGreaterThanTest.java

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalysis.java Thu Nov 29 22:52:55 2012
@@ -226,7 +226,7 @@ public class BayesianAnalysis extends Ge
 
         headerName = getInitParameter("headerName", HEADER_NAME);
 
-        ignoreLocalSender = Boolean.valueOf(getInitParameter("ignoreLocalSender")).booleanValue();
+        ignoreLocalSender = Boolean.valueOf(getInitParameter("ignoreLocalSender"));
 
         if (ignoreLocalSender) {
             log("Will ignore messages coming from local senders");
@@ -303,7 +303,7 @@ public class BayesianAnalysis extends Ge
                 probability = 0.0;
             }
 
-            mail.setAttribute(MAIL_ATTRIBUTE_NAME, new Double(probability));
+            mail.setAttribute(MAIL_ATTRIBUTE_NAME, probability);
             message.setHeader(headerName, Double.toString(probability));
 
             DecimalFormat probabilityForm = (DecimalFormat) DecimalFormat.getInstance();
@@ -368,7 +368,7 @@ public class BayesianAnalysis extends Ge
         }
 
         Iterator<MailAddress> iter = addresses.iterator();
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         sb.append('[');
         for (int i = 0; iter.hasNext(); i++) {
             sb.append(iter.next());

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalyzer.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalyzer.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalyzer.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/BayesianAnalyzer.java Thu Nov 29 22:52:55 2012
@@ -241,10 +241,8 @@ public class BayesianAnalyzer {
 
         // Iterate through all the tokens and compute their new
         // individual probabilities.
-        Iterator<String> i = set.iterator();
-        while (i.hasNext()) {
-            String token = i.next();
-            tempCorpus.put(token, new Double(computeProbability(token)));
+        for (String token : set) {
+            tempCorpus.put(token, computeProbability(token));
         }
         setCorpus(tempCorpus);
     }
@@ -351,14 +349,14 @@ public class BayesianAnalyzer {
         }
 
         if (foundInHam) {
-            hamFactor = 2 * ((Integer) hamTokenCounts.get(token)).doubleValue();
+            hamFactor = 2 * hamTokenCounts.get(token).doubleValue();
             if (!foundInSpam) {
                 minThreshold = (hamFactor > 20) ? 0.0001 : 0.0002;
             }
         }
 
         if (foundInSpam) {
-            spamFactor = ((Integer) spamTokenCounts.get(token)).doubleValue();
+            spamFactor = spamTokenCounts.get(token).doubleValue();
             if (!foundInHam) {
                 maxThreshold = (spamFactor > 10) ? 0.9999 : 0.9998;
             }
@@ -388,30 +386,29 @@ public class BayesianAnalyzer {
         // Convert to a SortedSet of token probability strengths.
         SortedSet<TokenProbabilityStrength> tokenProbabilityStrengths = new TreeSet<TokenProbabilityStrength>();
 
-        Iterator<String> i = tokens.iterator();
-        while (i.hasNext()) {
+        for (String token : tokens) {
             TokenProbabilityStrength tps = new TokenProbabilityStrength();
 
-            tps.token = (String) i.next();
+            tps.token = token;
 
             if (workCorpus.containsKey(tps.token)) {
-                tps.strength = Math.abs(0.5 - ((Double) workCorpus.get(tps.token)).doubleValue());
+                tps.strength = Math.abs(0.5 - workCorpus.get(tps.token));
             } else {
                 // This token has never been seen before,
                 // we'll give it initially the default probability.
-                Double corpusProbability = new Double(DEFAULT_TOKEN_PROBABILITY);
+                Double corpusProbability = DEFAULT_TOKEN_PROBABILITY;
                 tps.strength = Math.abs(0.5 - DEFAULT_TOKEN_PROBABILITY);
                 boolean isTokenDegeneratedFound = false;
 
                 Collection<String> degeneratedTokens = buildDegenerated(tps.token);
                 Iterator<String> iDegenerated = degeneratedTokens.iterator();
-                String tokenDegenerated = null;
+                String tokenDegenerated;
                 double strengthDegenerated;
                 while (iDegenerated.hasNext()) {
-                    tokenDegenerated = (String) iDegenerated.next();
+                    tokenDegenerated = iDegenerated.next();
                     if (workCorpus.containsKey(tokenDegenerated)) {
-                        Double probabilityTemp = (Double) workCorpus.get(tokenDegenerated);
-                        strengthDegenerated = Math.abs(0.5 - probabilityTemp.doubleValue());
+                        Double probabilityTemp = workCorpus.get(tokenDegenerated);
+                        strengthDegenerated = Math.abs(0.5 - probabilityTemp);
                         if (strengthDegenerated > tps.strength) {
                             isTokenDegeneratedFound = true;
                             tps.strength = strengthDegenerated;
@@ -506,11 +503,11 @@ public class BayesianAnalyzer {
 
             double theDoubleValue = DEFAULT_TOKEN_PROBABILITY; // initialize it
                                                                // to the default
-            Double theDoubleObject = (Double) workCorpus.get(tps.token);
+            Double theDoubleObject = workCorpus.get(tps.token);
             // if either the original token or a degeneration was found use the
             // double value, otherwise use the default
             if (theDoubleObject != null) {
-                theDoubleValue = theDoubleObject.doubleValue();
+                theDoubleValue = theDoubleObject;
             }
             p *= theDoubleValue;
             np *= (1.0 - theDoubleValue);

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/JDBCBayesianAnalyzer.java Thu Nov 29 22:52:55 2012
@@ -178,7 +178,7 @@ public class JDBCBayesianAnalyzer extend
                 int count = rs.getInt(2);
                 // to reduce memory, use the token only if the count is > 1
                 if (count > 1) {
-                    ham.put(token, Integer.valueOf(count));
+                    ham.put(token, count);
                 }
             }
             // Verbose.
@@ -197,7 +197,7 @@ public class JDBCBayesianAnalyzer extend
                 int count = rs.getInt(2);
                 // to reduce memory, use the token only if the count is > 1
                 if (count > 1) {
-                    spam.put(token, new Integer(count));
+                    spam.put(token, count);
                 }
             }
 

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/SqlResources.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/SqlResources.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/SqlResources.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/SqlResources.java Thu Nov 29 22:52:55 2012
@@ -349,7 +349,7 @@ class SqlResources {
      * @return the requested resource
      */
     public String getSqlString(String name) {
-        return (String) m_sql.get(name);
+        return m_sql.get(name);
     }
 
     /**
@@ -383,7 +383,7 @@ class SqlResources {
      * @return the requested dbOption value
      */
     public String getDbOption(String name) {
-        return (String) m_dbOptions.get(name);
+        return m_dbOptions.get(name);
     }
 
 }

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenCounter.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenCounter.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenCounter.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenCounter.java Thu Nov 29 22:52:55 2012
@@ -57,12 +57,12 @@ public class TokenCounter extends Tokeni
      */
     @Override
     protected void next(String token) {
-        Integer value = null;
+        Integer value;
 
         if (countsByToken.containsKey(token)) {
-            value = Integer.valueOf(((Integer) countsByToken.get(token)).intValue() + 1);
+            value = countsByToken.get(token) + 1;
         } else {
-            value = Integer.valueOf(1);
+            value = 1;
         }
 
         countsByToken.put(token, value);        

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenProbabilityStrength.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenProbabilityStrength.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenProbabilityStrength.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/TokenProbabilityStrength.java Thu Nov 29 22:52:55 2012
@@ -49,9 +49,9 @@ class TokenProbabilityStrength implement
      * @return The result of the comparison (before, equal, after).
      */
     public final int compareTo(TokenProbabilityStrength anotherTokenProbabilityStrength) {
-        int result = (int) ((((TokenProbabilityStrength) anotherTokenProbabilityStrength).strength - strength) * 1000000);
+        int result = (int) ((anotherTokenProbabilityStrength.strength - strength) * 1000000);
         if (result == 0) {
-            return this.token.compareTo(((TokenProbabilityStrength) anotherTokenProbabilityStrength).token);
+            return this.token.compareTo(anotherTokenProbabilityStrength.token);
         } else {
             return result;
         }
@@ -63,7 +63,7 @@ class TokenProbabilityStrength implement
      * @return String representation of this object.
      */
     public String toString() {
-        StringBuffer sb = new StringBuffer(30);
+        StringBuilder sb = new StringBuilder(30);
 
         sb.append(token).append("=").append(strength);
 

Modified: james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/Tokenizer.java
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/Tokenizer.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/Tokenizer.java (original)
+++ james/mailet/ai/trunk/classic/src/main/java/org/apache/james/ai/classic/Tokenizer.java Thu Nov 29 22:52:55 2012
@@ -79,7 +79,7 @@ public abstract class Tokenizer {
     }
     
     private String nextToken(Reader reader) throws java.io.IOException {
-        StringBuffer token = new StringBuffer();
+        StringBuilder token = new StringBuilder();
         int i;
         char ch, ch2;
         boolean previousWasDigit = false;

Modified: james/mailet/ai/trunk/src/site/xdoc/conf.xml
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/src/site/xdoc/conf.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/src/site/xdoc/conf.xml (original)
+++ james/mailet/ai/trunk/src/site/xdoc/conf.xml Thu Nov 29 22:52:55 2012
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?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

Modified: james/mailet/ai/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/james/mailet/ai/trunk/src/site/xdoc/index.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/ai/trunk/src/site/xdoc/index.xml (original)
+++ james/mailet/ai/trunk/src/site/xdoc/index.xml Thu Nov 29 22:52:55 2012
@@ -1,22 +1,22 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  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.    
--->
+<?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.    
+-->
 <document>
   <properties>
     <title>Overview</title>
@@ -26,8 +26,8 @@
     <section name="Artificial Intelligence Mailets">
       	<p>Mail processors with artificial intelligence (AI).</p>
         <subsection name='Releases'>
-          <p>
-          Previously released in <a href='/server/index.html'>Apache James Server</a> 2.
+          <p>
+          Previously released in <a href='/server/index.html'>Apache James Server</a> 2.
           Apache James AI Mailets 0.1 is expect to be the first independent release of this code.
           </p>
         </subsection>
@@ -39,7 +39,7 @@
               JIRA
             </a>.
           </p>
-        </subsection>
+        </subsection>
     </section>
   </body>
 </document>
\ No newline at end of file

Modified: james/mailet/base/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/RELEASE_NOTES.txt?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/RELEASE_NOTES.txt (original)
+++ james/mailet/base/trunk/RELEASE_NOTES.txt Thu Nov 29 22:52:55 2012
@@ -1,7 +1,7 @@
                      James Mailets Base
                      ------------------
 
-Apache James Mailets Base collects a number of utilites and lightweight
+Apache James Mailets Base collects a number of utilities and lightweight
 frameworks useful when working with the Apache Mailet API (a framework
 assisting the rapid development of email processing functionality
 see http://james.apache.org/mailet). Mailets base is used as the basis

Modified: james/mailet/base/trunk/src/assemble/bin.xml
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/assemble/bin.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/assemble/bin.xml (original)
+++ james/mailet/base/trunk/src/assemble/bin.xml Thu Nov 29 22:52:55 2012
@@ -1,87 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <assembly>
-  <!--
-  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.
-  -->
-  <id>bin</id>
-  <!-- 
-  Generates a jar file including the binary jar and the runtime dependencies.
-  including NOTICE and LICENSE in the root.
-  -->
-  <formats>
-    <format>zip</format>
-    <format>tar.gz</format>
-  </formats>
-  <includeSiteDirectory>false</includeSiteDirectory>  
-  <fileSets>
-    <fileSet>
-      <directory>target/maven-shared-archive-resources/META-INF/</directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>*</include>
-      </includes>
-    </fileSet>
-    <fileSet>
-      <directory>target</directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>${artifactId}*.jar</include>
-      </includes>
-    </fileSet>
-    <fileSet>
-      <directory></directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>RELEASE_NOTES.txt</include>
-      </includes>
-    </fileSet>
-   
-    <fileSet>
-      <directory>target/site/apidocs</directory>
-      <outputDirectory>javadocs</outputDirectory>
-    </fileSet>
-  </fileSets>
-   <files>
-    <file>
-      <source>LICENSE.apache</source>
-      <outputDirectory>lib</outputDirectory>
-      <destName>apache-mailet.LICENSE</destName>
-    </file>
-    <file>
-      <source>LICENSE.apache</source>
-      <outputDirectory>lib</outputDirectory>
-      <destName>apache-mailet-base.LICENSE</destName>
-    </file>
-    <file>
-      <source>LICENSE.mail</source>
-      <outputDirectory>lib</outputDirectory>
-      <destName>mail.LICENSE</destName>
-    </file>
-    <file>
-      <source>LICENSE.activation</source>
-      <outputDirectory>lib</outputDirectory>
-      <destName>activation.LICENSE</destName>
-    </file>
-  </files>
-  <dependencySets>
-    <dependencySet>
-      <outputDirectory>/lib/</outputDirectory>
-      <useProjectArtifact>false</useProjectArtifact>
-      <scope>runtime</scope>
-    </dependencySet>
-  </dependencySets>
+    <!--
+    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.
+    -->
+    <id>bin</id>
+    <!--
+    Generates a jar file including the binary jar and the runtime dependencies.
+    including NOTICE and LICENSE in the root.
+    -->
+    <formats>
+        <format>zip</format>
+        <format>tar.gz</format>
+    </formats>
+    <includeSiteDirectory>false</includeSiteDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>target/maven-shared-archive-resources/META-INF/</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>*</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>${artifactId}*.jar</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory></directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>RELEASE_NOTES.txt</include>
+            </includes>
+        </fileSet>
+
+        <fileSet>
+            <directory>target/site/apidocs</directory>
+            <outputDirectory>javadocs</outputDirectory>
+        </fileSet>
+    </fileSets>
+    <files>
+        <file>
+            <source>LICENSE.apache</source>
+            <outputDirectory>lib</outputDirectory>
+            <destName>apache-mailet.LICENSE</destName>
+        </file>
+        <file>
+            <source>LICENSE.apache</source>
+            <outputDirectory>lib</outputDirectory>
+            <destName>apache-mailet-base.LICENSE</destName>
+        </file>
+        <file>
+            <source>LICENSE.mail</source>
+            <outputDirectory>lib</outputDirectory>
+            <destName>mail.LICENSE</destName>
+        </file>
+        <file>
+            <source>LICENSE.activation</source>
+            <outputDirectory>lib</outputDirectory>
+            <destName>activation.LICENSE</destName>
+        </file>
+    </files>
+    <dependencySets>
+        <dependencySet>
+            <outputDirectory>/lib/</outputDirectory>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>runtime</scope>
+        </dependencySet>
+    </dependencySets>
 </assembly>
\ No newline at end of file

Modified: james/mailet/base/trunk/src/assemble/src.xml
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/assemble/src.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/assemble/src.xml (original)
+++ james/mailet/base/trunk/src/assemble/src.xml Thu Nov 29 22:52:55 2012
@@ -1,45 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <assembly>
-  <!--
-  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.
-  -->
-  <id>src</id>
-  <!-- 
-  Generates a file including all the source tree excluding files/folders
-  starting with "." , *.bak and the target
-  -->
-  <formats>
-    <format>zip</format>
-    <format>tar.gz</format>
-  </formats>
-  <fileSets>
-    <fileSet>
-      <directory>.</directory>
-      <outputDirectory></outputDirectory>
-      <excludes>
-        <exclude>**/target/**</exclude>
-        <exclude>.*</exclude>
-        <exclude>.*/**</exclude>
-        <exclude>**.bak</exclude>
-        <exclude>*.jar</exclude>
-        <exclude>*.log</exclude>
-        <exclude>**/bin/**</exclude>
-      </excludes>
-      <useDefaultExcludes>true</useDefaultExcludes>
-    </fileSet>
-  </fileSets>
+    <!--
+    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.
+    -->
+    <id>src</id>
+    <!--
+    Generates a file including all the source tree excluding files/folders
+    starting with "." , *.bak and the target
+    -->
+    <formats>
+        <format>zip</format>
+        <format>tar.gz</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <directory>.</directory>
+            <outputDirectory></outputDirectory>
+            <excludes>
+                <exclude>**/target/**</exclude>
+                <exclude>.*</exclude>
+                <exclude>.*/**</exclude>
+                <exclude>**.bak</exclude>
+                <exclude>*.jar</exclude>
+                <exclude>*.log</exclude>
+                <exclude>**/bin/**</exclude>
+            </excludes>
+            <useDefaultExcludes>true</useDefaultExcludes>
+        </fileSet>
+    </fileSets>
 </assembly>
\ No newline at end of file

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/FlowedMessageUtils.java Thu Nov 29 22:52:55 2012
@@ -157,7 +157,7 @@ public final class FlowedMessageUtils {
             ct.getParameterList().remove("format");
             ct.getParameterList().remove("delsp");
             
-            if (ct.toString().indexOf("flowed") >= 0) 
+            if (ct.toString().contains("flowed"))
                 System.out.println("\n\n*************************\n* ERROR!!! FlowedMessageUtils dind't remove the flowed correctly!\n******************\n\n" + ct.toString() + " \n " + ct.toString() + "\n");
             
             m.setContent(deflowed, ct.toString());
@@ -177,7 +177,7 @@ public final class FlowedMessageUtils {
      * Decodes a text.
      */
     public static String flow(String text, boolean delSp, int width) {
-        StringBuffer result = new StringBuffer();
+        StringBuilder result = new StringBuilder();
         String[] lines = text.split("\r\n|\n", -1);
         for (int i = 0; i < lines.length; i ++) {
             String line = lines[i];

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericMailet.java Thu Nov 29 22:52:55 2012
@@ -28,10 +28,7 @@ import org.apache.mailet.MailetConfig;
 import org.apache.mailet.MailetContext;
 import org.apache.mailet.MailetContext.LogLevel;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Iterator;
+import java.util.*;
 
 /**
  * GenericMailet makes writing mailets easier. It provides simple
@@ -245,10 +242,8 @@ public abstract class GenericMailet impl
         
         Collection<String> allowed = new HashSet<String>();
         Collection<String> bad = new ArrayList<String>();
-        
-        for (int i = 0; i < allowedArray.length; i++) {
-            allowed.add(allowedArray[i]);
-        }
+
+        Collections.addAll(allowed, allowedArray);
         
         Iterator<String> iterator = getInitParameterNames();
         while (iterator.hasNext()) {
@@ -271,7 +266,7 @@ public abstract class GenericMailet impl
         if (array == null) {
             return "null";
         }
-        StringBuffer sb = new StringBuffer(1024);
+        StringBuilder sb = new StringBuilder(1024);
         sb.append("[");
         for (int i = 0; i < array.length; i++) {
             if (i > 0) {

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/GenericRecipientMatcher.java Thu Nov 29 22:52:55 2012
@@ -49,8 +49,7 @@ public abstract class GenericRecipientMa
      */
     public final Collection<MailAddress> match(Mail mail) throws MessagingException {
         Collection<MailAddress> matching = new Vector<MailAddress>();
-        for (Iterator<MailAddress> i = mail.getRecipients().iterator(); i.hasNext(); ) {
-            MailAddress rec = (MailAddress) i.next();
+        for (MailAddress rec : mail.getRecipients()) {
             if (matchRecipient(rec)) {
                 matching.add(rec);
             }

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MailetUtil.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MailetUtil.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MailetUtil.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/MailetUtil.java Thu Nov 29 22:52:55 2012
@@ -45,7 +45,7 @@ public class MailetUtil {
      * enabled.</p>
      */
     public static String normalizeSubject(String subj, String prefix) {
-        StringBuffer subject = new StringBuffer(subj);
+        StringBuilder subject = new StringBuilder(subj);
         int prefixLength = prefix.length();
 
         // If the "prefix" is not at the beginning the subject line, remove it

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/RFC977DateFormat.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/RFC977DateFormat.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/RFC977DateFormat.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/RFC977DateFormat.java Thu Nov 29 22:52:55 2012
@@ -151,7 +151,7 @@ public class RFC977DateFormat implements
      * Overrides hashCode
      */
     public int hashCode() {
-        return (int)(internalLongDateFormat.hashCode() & internalShortDateFormat.hashCode());
+        return internalLongDateFormat.hashCode() & internalShortDateFormat.hashCode();
     }
 
 }

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/StringUtils.java Thu Nov 29 22:52:55 2012
@@ -54,11 +54,11 @@ public final class StringUtils {
             }
             if (!escaped) list.add(array[i]);
             else {
-                String prev = (String) list.remove(list.size() - 1); 
+                String prev = list.remove(list.size() - 1);
                 list.add(prev.substring(0, prev.length() - 1) + pattern + array[i]);
             }
         }
-        return (String[]) list.toArray(new String[0]);
+        return list.toArray(new String[0]);
     }
 
     /**
@@ -70,12 +70,12 @@ public final class StringUtils {
     public static String md5(java.lang.String message) {
         try {
             MessageDigest md = MessageDigest.getInstance("MD5");
-            StringBuffer sb = new StringBuffer();
+            StringBuilder sb = new StringBuilder();
             byte buf[] = message.getBytes();
             byte[] md5 = md.digest(buf);
             //System.out.println(message);
-            for (int i = 0; i < md5.length; i++) {
-                String tmpStr = "0" + Integer.toHexString((0xff & md5[i]));
+            for (byte aMd5 : md5) {
+                String tmpStr = "0" + Integer.toHexString((0xff & aMd5));
                 sb.append(tmpStr.substring(tmpStr.length() - 2));
             }
             return sb.toString();
@@ -94,7 +94,7 @@ public final class StringUtils {
      */
     public static String capitalizeWords(String data) {
         if (data==null) return null;
-        StringBuffer res = new StringBuffer();
+        StringBuilder res = new StringBuilder();
         char ch;
         char prevCh = '.';
         for ( int i = 0;  i < data.length();  i++ ) {

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/AbstractDataContentHandler.java Thu Nov 29 22:52:55 2012
@@ -122,7 +122,7 @@ public abstract class AbstractDataConten
      */
     protected ActivationDataFlavor getDataFlavor()
     {
-        ActivationDataFlavor dataFlavor = null;
+        ActivationDataFlavor dataFlavor;
         if (null == (dataFlavor = getDataFlavorBasic()))
         {
             updateDataFlavor();

Modified: james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java (original)
+++ james/mailet/base/trunk/src/main/java/org/apache/mailet/base/mail/message_disposition_notification.java Thu Nov 29 22:52:55 2012
@@ -130,7 +130,7 @@ public class message_disposition_notific
                     + "\" is not supported.");
 
         String encoding = getCharacterSet(getDataFlavor().getMimeType());
-        Writer writer = null;
+        Writer writer;
         try
         {
             writer = new BufferedWriter(new OutputStreamWriter(aStream,

Modified: james/mailet/base/trunk/src/reporting-site/site.xml
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/reporting-site/site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/reporting-site/site.xml (original)
+++ james/mailet/base/trunk/src/reporting-site/site.xml Thu Nov 29 22:52:55 2012
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?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

Modified: james/mailet/base/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/site/xdoc/index.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/site/xdoc/index.xml (original)
+++ james/mailet/base/trunk/src/site/xdoc/index.xml Thu Nov 29 22:52:55 2012
@@ -1,22 +1,22 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  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.    
--->
+<?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.    
+-->
 <document>
   <properties>
     <title>Overview</title>

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/MatcherInverterTest.java Thu Nov 29 22:52:55 2012
@@ -40,7 +40,7 @@ public class MatcherInverterTest extends
             }
         });
         FakeMail mail = new FakeMail();
-        mail.setRecipients(Arrays.asList(new MailAddress[] { new MailAddress("user", "domain") }));
+        mail.setRecipients(Arrays.asList(new MailAddress("user", "domain")));
 
         assertNotNull("Should match all recipients", inverter.match(mail));
     }
@@ -56,7 +56,7 @@ public class MatcherInverterTest extends
             }
         });
         FakeMail mail = new FakeMail();
-        mail.setRecipients(Arrays.asList(new MailAddress[] { address1, address2 }));
+        mail.setRecipients(Arrays.asList(address1, address2));
 
         assertNull("Should match all recipients", inverter.match(mail));
     }
@@ -68,11 +68,11 @@ public class MatcherInverterTest extends
         MatcherInverter inverter = new MatcherInverter(new GenericMatcher() {
 
             public Collection<MailAddress> match(Mail mail) throws MessagingException {
-                return Arrays.asList(new MailAddress[] {address1});
+                return Arrays.asList(address1);
             }
         });
         FakeMail mail = new FakeMail();
-        mail.setRecipients(Arrays.asList(new MailAddress[] { address1, address2 }));
+        mail.setRecipients(Arrays.asList(address1, address2));
 
         assertEquals("Should match one recipient", address2.toString(), inverter.match(mail).iterator().next().toString());
     }

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMail.java Thu Nov 29 22:52:55 2012
@@ -119,7 +119,7 @@ public class FakeMail implements Mail {
     }
 
     public Serializable getAttribute(String name) {
-        return (Serializable) attributes.get(name);
+        return attributes.get(name);
     }
 
     public Iterator<String> getAttributeNames() {
@@ -131,7 +131,7 @@ public class FakeMail implements Mail {
     }
 
     public Serializable removeAttribute(String name) {
-        return (Serializable) attributes.remove(name);
+        return attributes.remove(name);
 
     }
 
@@ -141,7 +141,7 @@ public class FakeMail implements Mail {
 
     public Serializable setAttribute(String name, Serializable object) {
 
-        return (Serializable) attributes.put(name, (Serializable)object);
+        return attributes.put(name, object);
     }
 
     public long getMessageSize() throws MessagingException {

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMatcherConfig.java Thu Nov 29 22:52:55 2012
@@ -38,7 +38,7 @@ public class FakeMatcherConfig implement
     }
 
     public String getCondition() {
-        if (matcherName.indexOf("=") >= 0) {
+        if (matcherName.contains("=")) {
             return matcherName.substring(getMatcherName().length() + 1);
         } else {
             return null;
@@ -50,7 +50,7 @@ public class FakeMatcherConfig implement
     }
 
     public String getMatcherName() {
-        if (matcherName.indexOf("=") >= 0) {
+        if (matcherName.contains("=")) {
             return matcherName.split("=")[0];
         } else {
             return matcherName;

Modified: james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java
URL: http://svn.apache.org/viewvc/james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java (original)
+++ james/mailet/base/trunk/src/test/java/org/apache/mailet/base/test/FakeMimeMessage.java Thu Nov 29 22:52:55 2012
@@ -18,24 +18,18 @@
  ****************************************************************/
 
 
-
 package org.apache.mailet.base.test;
 
 import org.apache.mailet.base.RFC2822Headers;
 
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.InternetHeaders;
-import javax.mail.internet.InternetAddress;
+import javax.activation.DataHandler;
 import javax.mail.*;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.InternetHeaders;
+import javax.mail.internet.MimeMessage;
 import javax.mail.search.SearchTerm;
-import javax.activation.DataHandler;
+import java.io.*;
 import java.util.*;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
 
 public class FakeMimeMessage extends MimeMessage {
 
@@ -58,11 +52,11 @@ public class FakeMimeMessage extends Mim
     private boolean m_doMatch;
 
     public FakeMimeMessage() throws MessagingException {
-        super((Session)null);
+        super((Session) null);
     }
 
     public FakeMimeMessage(int messageNumber) throws MessagingException {
-        super((Session)null);
+        super((Session) null);
         m_iMessageNumber = messageNumber;
     }
 
@@ -71,9 +65,9 @@ public class FakeMimeMessage extends Mim
     }
 
     public Address[] getFrom() throws MessagingException {
-        return (Address[])m_fromAddresses.toArray(new Address[m_fromAddresses.size()]);
+        return m_fromAddresses.toArray(new Address[m_fromAddresses.size()]);
     }
-    
+
     public void setFrom(Address address) throws MessagingException {
         m_fromAddresses.clear();
         m_fromAddresses.add(address);
@@ -99,20 +93,20 @@ public class FakeMimeMessage extends Mim
     public Address[] getRecipients(Message.RecipientType recipientType) throws MessagingException {
         List<Serializable> recipientsList = getRecipientsList(recipientType);
         List<Serializable> recipientAddresses = new ArrayList<Serializable>();
-        for (Iterator<Serializable> iterator = recipientsList.iterator(); iterator.hasNext();) {
-            String recipient = (String) iterator.next();
+        for (Serializable aRecipientsList : recipientsList) {
+            String recipient = (String) aRecipientsList;
             recipientAddresses.add(new InternetAddress(recipient));
         }
-        return (Address[]) (recipientAddresses.toArray(new Address[]{}));
+        return recipientAddresses.toArray(new Address[]{});
     }
 
     private List<Serializable> getRecipientsList(Message.RecipientType recipientType) {
-        if (Message.RecipientType.TO.equals(recipientType)) return m_toRecepients; 
-        if (Message.RecipientType.CC.equals(recipientType)) return m_ccRecepients; 
+        if (Message.RecipientType.TO.equals(recipientType)) return m_toRecepients;
+        if (Message.RecipientType.CC.equals(recipientType)) return m_ccRecepients;
         if (Message.RecipientType.BCC.equals(recipientType)) return m_bccRecepients;
         return null;
     }
-    
+
     public Address[] getAllRecipients() throws MessagingException {
         List<Serializable> allRecipients = new ArrayList<Serializable>();
         allRecipients.addAll(m_toRecepients);
@@ -154,8 +148,7 @@ public class FakeMimeMessage extends Mim
     }
 
     public void setSubject(String subject, String charset) throws MessagingException {
-        if (subject == null)
-        {
+        if (subject == null) {
             m_subject = null;
             return;
         }
@@ -226,7 +219,7 @@ public class FakeMimeMessage extends Mim
         return getHeader("Content-Description", null);
     }
 
-    public void setDescription(String description) throws MessagingException { 
+    public void setDescription(String description) throws MessagingException {
         setHeader("Content-Description", description);
     }
 
@@ -296,7 +289,7 @@ public class FakeMimeMessage extends Mim
 
     public void setText(String string, String charset) throws MessagingException {
         try {
-            setContent(new String(string.getBytes(charset)) , "text/plain");
+            setContent(new String(string.getBytes(charset)), "text/plain");
         } catch (UnsupportedEncodingException e) {
             throw new MessagingException("setting text content failed", e);
         }
@@ -311,17 +304,17 @@ public class FakeMimeMessage extends Mim
     }
 
     public void writeTo(OutputStream outputStream) throws IOException, MessagingException {
-        ; // trivial implementation
+        // trivial implementation
     }
 
     public void writeTo(OutputStream outputStream, String[] strings) throws IOException, MessagingException {
-        ; // trivial implementation
+        // trivial implementation
     }
 
     public String[] getHeader(String name) throws MessagingException {
-        String value = (String) m_contentHeaders.get(name);
+        String value = m_contentHeaders.get(name);
         if (value == null) return null;
-        return new String[] {value};
+        return new String[]{value};
     }
 
     public String getHeader(String name, String delimiter) throws MessagingException {
@@ -348,36 +341,33 @@ public class FakeMimeMessage extends Mim
 
     public Enumeration<String> getMatchingHeaders(String[] names) throws MessagingException {
         ArrayList<String> matchingHeaders = new ArrayList<String>();
-        for (int i = 0; i < names.length; i++) {
-            String name = names[i];
+        for (String name : names) {
             String value = getHeader(name, null);
             if (value == null) continue;
             matchingHeaders.add(value);
         }
-        return Collections.enumeration(matchingHeaders); 
+        return Collections.enumeration(matchingHeaders);
     }
 
     public Enumeration<String> getNonMatchingHeaders(String[] names) throws MessagingException {
         List<String> existingHeaders = Arrays.asList(names);
 
         ArrayList<String> nonMatchingHeaders = new ArrayList<String>();
-        
-        Iterator<String> iterator = m_contentHeaders.keySet().iterator();
-        while (iterator.hasNext()) {
-            String name = (String) iterator.next();
+
+        for (String name : m_contentHeaders.keySet()) {
             if (existingHeaders.contains(name)) continue;
             String value = getHeader(name, null);
             if (value == null) continue;
             nonMatchingHeaders.add(value);
         }
-        return Collections.enumeration(nonMatchingHeaders); 
+        return Collections.enumeration(nonMatchingHeaders);
     }
 
     public void addHeaderLine(String headerLine) throws MessagingException {
         int separatorIndex = headerLine.indexOf(":");
         if (separatorIndex < 0) throw new MessagingException("header line does not conform to standard");
-        
-        addHeader(headerLine.substring(0,separatorIndex), headerLine.substring(separatorIndex,headerLine.length()));
+
+        addHeader(headerLine.substring(0, separatorIndex), headerLine.substring(separatorIndex, headerLine.length()));
     }
 
     public Enumeration<String> getAllHeaderLines() throws MessagingException {
@@ -386,10 +376,8 @@ public class FakeMimeMessage extends Mim
 
     private ArrayList<String> getHeadersAsStrings(HashMap<String, String> contentHeaders) {
         ArrayList<String> headerLines = new ArrayList<String>();
-        Iterator<String> iterator = contentHeaders.keySet().iterator();
-        while (iterator.hasNext()) {
-            String key = (String) iterator.next();
-            String value = (String) contentHeaders.get(key);
+        for (String key : contentHeaders.keySet()) {
+            String value = contentHeaders.get(key);
             headerLines.add(key + ":" + value);
         }
         return headerLines;
@@ -397,29 +385,26 @@ public class FakeMimeMessage extends Mim
 
     public Enumeration<String> getMatchingHeaderLines(String[] names) throws MessagingException {
         ArrayList<String> matchingHeaders = new ArrayList<String>();
-        for (int i = 0; i < names.length; i++) {
-            String name = names[i];
+        for (String name : names) {
             String value = getHeader(name, null);
             if (value == null) continue;
             matchingHeaders.add(name + ":" + value);
         }
-        return Collections.enumeration(matchingHeaders); 
+        return Collections.enumeration(matchingHeaders);
     }
 
     public Enumeration<String> getNonMatchingHeaderLines(String[] names) throws MessagingException {
         List<String> existingHeaders = names != null ? Arrays.asList(names) : null;
 
         ArrayList<String> nonMatchingHeaders = new ArrayList<String>();
-        
-        Iterator<String> iterator = m_contentHeaders.keySet().iterator();
-        while (iterator.hasNext()) {
-            String name = (String) iterator.next();
-            if (existingHeaders!=null && existingHeaders.contains(name)) continue;
+
+        for (String name : m_contentHeaders.keySet()) {
+            if (existingHeaders != null && existingHeaders.contains(name)) continue;
             String value = getHeader(name, null);
             if (value == null) continue;
             nonMatchingHeaders.add(name + ":" + value);
         }
-        return Collections.enumeration(nonMatchingHeaders); 
+        return Collections.enumeration(nonMatchingHeaders);
     }
 
     public synchronized Flags getFlags() throws MessagingException {
@@ -436,11 +421,11 @@ public class FakeMimeMessage extends Mim
     }
 
     public void saveChanges() throws MessagingException {
-        ; // trivial implementation
+        // trivial implementation
     }
 
     protected void updateHeaders() throws MessagingException {
-        ; // trivial implementation 
+        // trivial implementation
     }
 
     protected InternetHeaders createInternetHeaders(InputStream inputStream) throws MessagingException {
@@ -483,8 +468,8 @@ public class FakeMimeMessage extends Mim
     public void setShouldMatch(boolean doMatch) {
         m_doMatch = doMatch;
     }
-    
+
     public boolean match(SearchTerm searchTerm) throws MessagingException {
-        return m_doMatch; 
+        return m_doMatch;
     }
 }

Modified: james/mailet/crypto/trunk/src/assemble/bin.xml
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/assemble/bin.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/assemble/bin.xml (original)
+++ james/mailet/crypto/trunk/src/assemble/bin.xml Thu Nov 29 22:52:55 2012
@@ -1,66 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <assembly>
-  <!--
-  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.
-  -->
-  <id>bin</id>
-  <!-- 
-  Generates a jar file including the binary jar and the runtime dependencies.
-  including NOTICE and LICENSE in the root.
-  -->
-  <formats>
-    <format>zip</format>
-    <format>tar.gz</format>
-  </formats>
-  <includeSiteDirectory>false</includeSiteDirectory>  
-  <fileSets>
-    <fileSet>
-      <directory>target</directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>${artifactId}*.jar</include>
-      </includes>
-    </fileSet>
-    <fileSet>
-      <directory></directory>
-      <outputDirectory>/</outputDirectory>
-      <includes>
-        <include>RELEASE_NOTES.txt</include>
-        <include>README.txt</include>
-        <include>NOTICE.txt</include>
-      </includes>
-    </fileSet>
-    <fileSet>
-      <directory>target/site/apidocs</directory>
-      <outputDirectory>javadocs</outputDirectory>
-    </fileSet>
-  </fileSets>
-  <files>
-    <file>
-      <source>src/assemble/LICENSE-binary.txt</source>
-      <outputDirectory>/</outputDirectory>
-      <destName>LICENSE.txt</destName>
-    </file>
-  </files>
-  <dependencySets>
-    <dependencySet>
-      <outputDirectory>/lib/</outputDirectory>
-      <useProjectArtifact>false</useProjectArtifact>
-      <scope>runtime</scope>
-    </dependencySet>
-  </dependencySets>
+    <!--
+    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.
+    -->
+    <id>bin</id>
+    <!--
+    Generates a jar file including the binary jar and the runtime dependencies.
+    including NOTICE and LICENSE in the root.
+    -->
+    <formats>
+        <format>zip</format>
+        <format>tar.gz</format>
+    </formats>
+    <includeSiteDirectory>false</includeSiteDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>target</directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>${artifactId}*.jar</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory></directory>
+            <outputDirectory>/</outputDirectory>
+            <includes>
+                <include>RELEASE_NOTES.txt</include>
+                <include>README.txt</include>
+                <include>NOTICE.txt</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>target/site/apidocs</directory>
+            <outputDirectory>javadocs</outputDirectory>
+        </fileSet>
+    </fileSets>
+    <files>
+        <file>
+            <source>src/assemble/LICENSE-binary.txt</source>
+            <outputDirectory>/</outputDirectory>
+            <destName>LICENSE.txt</destName>
+        </file>
+    </files>
+    <dependencySets>
+        <dependencySet>
+            <outputDirectory>/lib/</outputDirectory>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>runtime</scope>
+        </dependencySet>
+    </dependencySets>
 </assembly>
\ No newline at end of file

Modified: james/mailet/crypto/trunk/src/assemble/src.xml
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/assemble/src.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/assemble/src.xml (original)
+++ james/mailet/crypto/trunk/src/assemble/src.xml Thu Nov 29 22:52:55 2012
@@ -1,44 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <assembly>
-  <!--
-  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.
-  -->
-  <id>src</id>
-  <!-- 
-  Generates a file including all the source tree excluding files/folders
-  starting with "." , *.bak and the target
-  -->
-  <formats>
-    <format>zip</format>
-    <format>tar.gz</format>
-  </formats>
-  <fileSets>
-    <fileSet>
-      <directory>.</directory>
-      <outputDirectory></outputDirectory>
-      <excludes>
-        <exclude>**/target/**</exclude>
-        <exclude>.*</exclude>
-        <exclude>.*/**</exclude>
-        <exclude>**.bak</exclude>
-        <exclude>*.jar</exclude>
-        <exclude>*.log</exclude>
-      </excludes>
-      <useDefaultExcludes>true</useDefaultExcludes>
-    </fileSet>
-  </fileSets>
+    <!--
+    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.
+    -->
+    <id>src</id>
+    <!--
+    Generates a file including all the source tree excluding files/folders
+    starting with "." , *.bak and the target
+    -->
+    <formats>
+        <format>zip</format>
+        <format>tar.gz</format>
+    </formats>
+    <fileSets>
+        <fileSet>
+            <directory>.</directory>
+            <outputDirectory></outputDirectory>
+            <excludes>
+                <exclude>**/target/**</exclude>
+                <exclude>.*</exclude>
+                <exclude>.*/**</exclude>
+                <exclude>**.bak</exclude>
+                <exclude>*.jar</exclude>
+                <exclude>*.log</exclude>
+            </excludes>
+            <useDefaultExcludes>true</useDefaultExcludes>
+        </fileSet>
+    </fileSets>
 </assembly>
\ No newline at end of file

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/SMIMEKeyHolder.java Thu Nov 29 22:52:55 2012
@@ -38,6 +38,7 @@ import java.security.cert.CertificateExc
 import java.security.cert.CollectionCertStoreParameters;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 
 import javax.mail.internet.MimeBodyPart;
@@ -133,7 +134,7 @@ public class SMIMEKeyHolder implements K
         Enumeration<String> aliases = keyStore.aliases();
         if (keyAlias == null) {
             if(aliases.hasMoreElements()) {
-                keyAlias = (String) aliases.nextElement();
+                keyAlias = aliases.nextElement();
             } else {
                 throw new KeyStoreException("No alias was found in keystore.");
             }
@@ -161,9 +162,7 @@ public class SMIMEKeyHolder implements K
         if (certificateChain == null) {
             certList.add(this.certificate);
         } else {
-            for (int i = 0; i < certificateChain.length; i++) {
-                certList.add(certificateChain[i]);
-            }
+            Collections.addAll(certList, certificateChain);
         }
         
         // create a CertStore containing the certificates we want carried

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/AbstractSign.java Thu Nov 29 22:52:55 2012
@@ -157,7 +157,7 @@ public abstract class AbstractSign exten
      * Initializer for property debug.
      */
     protected void initDebug() {
-        setDebug((getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue());
+        setDebug((getInitParameter("debug") == null) ? false : Boolean.valueOf(getInitParameter("debug")));
     }
     
     /**
@@ -241,7 +241,7 @@ public abstract class AbstractSign exten
      * Initializer for property keyHolder.
      */
     protected void initKeyHolder() throws Exception {
-        Constructor<?> keyHolderConstructor = null;
+        Constructor<?> keyHolderConstructor;
         try {
             keyHolderConstructor = keyHolderClass.getConstructor(new Class[] {String.class, String.class, String.class, String.class, String.class});
         } catch (NoSuchMethodException nsme) {
@@ -282,8 +282,8 @@ public abstract class AbstractSign exten
         }
         
         if (isDebug()) {
-            StringBuffer logBuffer =
-            new StringBuffer(1024)
+            StringBuilder logBuffer =
+            new StringBuilder(1024)
             .append("KeyStore related parameters:")
             .append("  keyStoreFileName=").append(keyStoreFileName)
             .append(", keyStoreType=").append(keyStoreType)
@@ -327,7 +327,7 @@ public abstract class AbstractSign exten
      * Initializer for property postmasterSigns.
      */
     protected void initPostmasterSigns() {
-        setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? false : new Boolean(getInitParameter("postmasterSigns")).booleanValue());
+        setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? false : Boolean.valueOf(getInitParameter("postmasterSigns")));
     }
     
     /**
@@ -351,7 +351,7 @@ public abstract class AbstractSign exten
      * Initializer for property rebuildFrom.
      */
     protected void initRebuildFrom() throws MessagingException {
-        setRebuildFrom((getInitParameter("rebuildFrom") == null) ? false : new Boolean(getInitParameter("rebuildFrom")).booleanValue());
+        setRebuildFrom((getInitParameter("rebuildFrom") == null) ? false : Boolean.valueOf(getInitParameter("rebuildFrom")));
         if (isDebug()) {
             if (isRebuildFrom()) {
                 log("Will modify the \"From:\" header.");
@@ -450,8 +450,8 @@ public abstract class AbstractSign exten
             throw new MessagingException("Exception thrown", e);
         } finally {
             if (isDebug()) {
-                StringBuffer logBuffer =
-                new StringBuffer(1024)
+                StringBuilder logBuffer =
+                new StringBuilder(1024)
                 .append("Other parameters:")
                 .append(", signerName=").append(getSignerName())
                 .append(", postmasterSigns=").append(postmasterSigns)
@@ -626,12 +626,12 @@ public abstract class AbstractSign exten
         try {
             InternetAddress[] fromArray = (InternetAddress[]) mail.getMessage().getFrom();
             if (fromArray != null) {
-                for (int i = 0; i < fromArray.length; i++) {
-                    MailAddress mailAddress  = null;
+                for (InternetAddress aFromArray : fromArray) {
+                    MailAddress mailAddress;
                     try {
-                        mailAddress = new MailAddress(fromArray[i]);
+                        mailAddress = new MailAddress(aFromArray);
                     } catch (ParseException pe) {
-                        log("Unable to parse a \"FROM\" header address: " + fromArray[i].toString() + "; ignoring.");
+                        log("Unable to parse a \"FROM\" header address: " + aFromArray.toString() + "; ignoring.");
                         continue;
                     }
                     if (mailAddress.equals(reversePath)) {
@@ -654,7 +654,7 @@ public abstract class AbstractSign exten
      */
     protected final String getMessageHeaders(MimeMessage message) throws MessagingException {
         Enumeration heads = message.getAllHeaderLines();
-        StringBuffer headBuffer = new StringBuffer(1024);
+        StringBuilder headBuffer = new StringBuilder(1024);
         while(heads.hasMoreElements()) {
             headBuffer.append(heads.nextElement().toString()).append("\r\n");
         }
@@ -694,7 +694,7 @@ public abstract class AbstractSign exten
      */    
     private String getReplacedString(String template, String pattern, String actual) {
          if (actual != null) {
-             StringBuffer sb = new StringBuffer(template.length());
+             StringBuilder sb = new StringBuilder(template.length());
             int fromIndex = 0;
             int index;
             while ((index = template.indexOf(pattern, fromIndex)) >= 0) {
@@ -707,7 +707,7 @@ public abstract class AbstractSign exten
             }
             return sb.toString();
         } else {
-            return new String(template);
+            return template;
         }
     }
     

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMECheckSignature.java Thu Nov 29 22:52:55 2012
@@ -118,10 +118,10 @@ public class SMIMECheckSignature extends
         MailetConfig config = getMailetConfig();
 
         String stripSignatureConf = config.getInitParameter("strip");
-        if (stripSignatureConf != null) stripSignature = Boolean.valueOf(stripSignatureConf).booleanValue();
+        if (stripSignatureConf != null) stripSignature = Boolean.valueOf(stripSignatureConf);
         
         String onlyTrustedConf = config.getInitParameter("onlyTrusted");
-        if (onlyTrustedConf != null) onlyTrusted = Boolean.valueOf(onlyTrustedConf).booleanValue();
+        if (onlyTrustedConf != null) onlyTrusted = Boolean.valueOf(onlyTrustedConf);
         
         String mailAttributeConf = config.getInitParameter("mailAttribute");
         if (mailAttributeConf != null) mailAttribute = mailAttributeConf;
@@ -165,7 +165,7 @@ public class SMIMECheckSignature extends
             else signed = null;
             
             if (signed != null) {
-                signers = (List<SMIMESignerInfo>)trustedCertificateStore.verifySignatures(signed);
+                signers = trustedCertificateStore.verifySignatures(signed);
                 strippedMessage = signed.getContent();
             } else log("Content not identified as signed");
             
@@ -193,12 +193,10 @@ public class SMIMECheckSignature extends
         if (signers != null) {
             ArrayList<X509Certificate> signerinfolist = new ArrayList<X509Certificate>();
 
-            for (Iterator<SMIMESignerInfo> iter = signers.iterator(); iter.hasNext();) {
-                SMIMESignerInfo info = (SMIMESignerInfo) iter.next();
-
+            for (SMIMESignerInfo info : signers) {
                 if (info.isSignValid()
                         && (!onlyTrusted || info.getCertPath() != null)) {
-                    signerinfolist.add((X509Certificate) info.getSignerCertificate());
+                    signerinfolist.add(info.getSignerCertificate());
                 }
             }
 

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMEDecrypt.java Thu Nov 29 22:52:55 2012
@@ -114,8 +114,9 @@ public class SMIMEDecrypt extends Generi
             try {
                 SMIMEEnveloped env = new SMIMEEnveloped(message);
                 Collection<RecipientInformation> recipients = env.getRecipientInfos().getRecipients();
-                for (Iterator<RecipientInformation> iter = recipients.iterator();iter.hasNext();) {
-                    RecipientInformation info = (RecipientInformation) iter.next();
+                Iterator<RecipientInformation> iter = recipients.iterator();
+                while (iter.hasNext()) {
+                    RecipientInformation info = iter.next();
                     RecipientId id = info.getRID();
                     if (id.match(keyHolder.getCertificate())) {
                         try {
@@ -123,7 +124,7 @@ public class SMIMEDecrypt extends Generi
                             // strippedMessage contains the decrypted message.
                             strippedMessage = part;
                             log("Encrypted message decrypted");
-                        } catch (Exception e) { 
+                        } catch (Exception e) {
                             throw new MessagingException("Error during the decryption of the message", e); }
                     } else {
                         log("Found an encrypted message but it isn't encrypted for the supplied key");

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMESign.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMESign.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMESign.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/SMIMESign.java Thu Nov 29 22:52:55 2012
@@ -143,14 +143,14 @@ public class SMIMESign extends Sign {
      * If the <CODE>&lt;postmasterSigns&gt;</CODE> init parameter is missing sets it to <I>true</I>.
      */
     protected void initPostmasterSigns() {
-        setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? true : new Boolean(getInitParameter("postmasterSigns")).booleanValue());
+        setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? true : Boolean.valueOf(getInitParameter("postmasterSigns")));
     }
     
     /**
      * If the <CODE>&lt;rebuildFrom&gt;</CODE> init parameter is missing sets it to <I>true</I>.
      */
     protected void initRebuildFrom() throws MessagingException {
-        setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : new Boolean(getInitParameter("rebuildFrom")).booleanValue());
+        setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : Boolean.valueOf(getInitParameter("rebuildFrom")));
         if (isDebug()) {
             if (isRebuildFrom()) {
                 log("Will modify the \"From:\" header.");

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/Sign.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/Sign.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/Sign.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/mailet/Sign.java Thu Nov 29 22:52:55 2012
@@ -134,14 +134,14 @@ public class Sign extends AbstractSign {
      * If the <CODE>&lt;postmasterSigns&gt;</CODE> init parameter is missing sets it to <I>true</I>.
      */
     protected void initPostmasterSigns() {
-        setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? true : new Boolean(getInitParameter("postmasterSigns")).booleanValue());
+        setPostmasterSigns((getInitParameter("postmasterSigns") == null) ? true : Boolean.valueOf(getInitParameter("postmasterSigns")));
     }
     
     /**
      * If the <CODE>&lt;rebuildFrom&gt;</CODE> init parameter is missing sets it to <I>true</I>.
      */
     protected void initRebuildFrom() throws MessagingException {
-        setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : new Boolean(getInitParameter("rebuildFrom")).booleanValue());
+        setRebuildFrom((getInitParameter("rebuildFrom") == null) ? true : Boolean.valueOf(getInitParameter("rebuildFrom")));
         if (isDebug()) {
             if (isRebuildFrom()) {
                 log("Will modify the \"From:\" header.");

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMEEncrypted.java Thu Nov 29 22:52:55 2012
@@ -45,7 +45,7 @@ public class IsSMIMEEncrypted extends Ge
         if (message == null) return null;
         
         if ((message.isMimeType("application/x-pkcs7-mime") 
-                || message.isMimeType("application/pkcs7-mime")) && (message.getContentType().indexOf("smime-type=enveloped-data") != -1)) {
+                || message.isMimeType("application/pkcs7-mime")) && (message.getContentType().contains("smime-type=enveloped-data"))) {
             return mail.getRecipients();
         } else return null;
     }

Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsSMIMESigned.java Thu Nov 29 22:52:55 2012
@@ -49,7 +49,7 @@ public class IsSMIMESigned extends Gener
                 || message.isMimeType("application/pkcs7-signature")
                 || message.isMimeType("application/x-pkcs7-signature")
                 || ((message.isMimeType("application/pkcs7-mime") || message.isMimeType("application/x-pkcs7-mime")) 
-                        && message.getContentType().indexOf("signed-data") != -1)) {
+                        && message.getContentType().contains("signed-data"))) {
             return mail.getRecipients();
         } else return null;
     }



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