You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ie...@apache.org on 2012/11/29 23:53:11 UTC
svn commit: r1415429 [2/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...
Modified: james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java (original)
+++ james/mailet/crypto/trunk/src/main/java/org/apache/james/mailet/crypto/matcher/IsX509CertificateSubject.java Thu Nov 29 22:52:55 2012
@@ -55,7 +55,7 @@ public class IsX509CertificateSubject ex
public void init() throws MessagingException {
String condition = getCondition();
- if(condition == null || condition.indexOf(";") == -1)
+ if(condition == null || !condition.contains(";"))
throw new MessagingException("Invalid matcher configuration: "+condition);
int pos = condition.indexOf(";");
@@ -76,9 +76,7 @@ public class IsX509CertificateSubject ex
boolean valid = false;
- for (Iterator<X509Certificate> iter = certificates.iterator(); iter.hasNext();) {
- X509Certificate cert = iter.next();
-
+ for (X509Certificate cert : certificates) {
// Here I should use the method getSubjectX500Principal, but
// that would break the compatibility with jdk13.
Principal prin = cert.getSubjectDN();
Modified: james/mailet/crypto/trunk/src/reporting-site/site.xml
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/reporting-site/site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/reporting-site/site.xml (original)
+++ james/mailet/crypto/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/crypto/trunk/src/site/xdoc/conf.xml
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/site/xdoc/conf.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/site/xdoc/conf.xml (original)
+++ james/mailet/crypto/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
@@ -18,98 +18,101 @@
under the License.
-->
<document>
- <properties>
- <title>Configuration</title>
- <author email="server-dev@james.apache.org">
- JAMES Project Team
- </author>
- </properties>
- <body>
- <section name="JAMES Configuration">
- <p>
- To use cryptography mailets, the required
- <a href='http://www.bouncycastle.org'>Bouncy Castle</a>
- libraries must be installed in
- <code>james/lib</code>
- . It is recommended that the correct versions for the JVM are
- used.
- </p>
- <p>
- To use the mailets, the package
- <code>org.apache.james.mailet.crypto.mailet</code> must be available.
- To use the matchers, <code>org.apache.james.mailet.crypto.matcher</code> must be.
- For example:
- </p>
- <source>
- <pre>
- <mailetpackages>
- ...
- <mailetpackage>org.apache.james.mailet.crypto.mailet</mailetpackage>
- </mailetpackages>
- <matcherpackages>
- ...
- <matcherpackage>org.apache.james.mailet.crypto.matcher</matcherpackage>
- </matcherpackages>
- </pre>
- </source>
- <p>Example SMIME mailet configurations:</p>
- <source>
- <pre>
- <mailet match="IsSMIMEEncrypted" class="SMIMEDecrypt">
- <keyStoreType>pkcs12</keyStoreType>
- <keyStoreFileName>c:/path.pfx</keyStoreFileName>
- <keyStorePassword>myKeyStorePass</keyStorePassword>
- <keyAlias>myKeyAlias</keyAlias>
- <keyAliasPassword>myKeyPass</keyAliasPassword>
- </mailet>
+ <properties>
+ <title>Configuration</title>
+ <author email="server-dev@james.apache.org">
+ JAMES Project Team
+ </author>
+ </properties>
+ <body>
+ <section name="JAMES Configuration">
+ <p>
+ To use cryptography mailets, the required
+ <a href='http://www.bouncycastle.org'>Bouncy Castle</a>
+ libraries must be installed in
+ <code>james/lib</code>
+ . It is recommended that the correct versions for the JVM are
+ used.
+ </p>
+ <p>
+ To use the mailets, the package
+ <code>org.apache.james.mailet.crypto.mailet</code>
+ must be available.
+ To use the matchers,
+ <code>org.apache.james.mailet.crypto.matcher</code>
+ must be.
+ For example:
+ </p>
+ <source>
+ <pre>
+ <mailetpackages>
+ ...
+ <mailetpackage>org.apache.james.mailet.crypto.mailet</mailetpackage>
+ </mailetpackages>
+ <matcherpackages>
+ ...
+ <matcherpackage>org.apache.james.mailet.crypto.matcher</matcherpackage>
+ </matcherpackages>
+ </pre>
+ </source>
+ <p>Example SMIME mailet configurations:</p>
+ <source>
+ <pre>
+ <mailet match="IsSMIMEEncrypted" class="SMIMEDecrypt">
+ <keyStoreType>pkcs12</keyStoreType>
+ <keyStoreFileName>c:/path.pfx</keyStoreFileName>
+ <keyStorePassword>myKeyStorePass</keyStorePassword>
+ <keyAlias>myKeyAlias</keyAlias>
+ <keyAliasPassword>myKeyPass</keyAliasPassword>
+ </mailet>
- <mailet match="IsSMIMESigned" class="SMIMECheckSignature">
- <keyStoreType>pkcs12</keyStoreType>
- <keyStoreFileName>c:/path.pfx</keyStoreFileName>
- <keyStorePassword> myKeyStorePass
- </keyStorePassword> <strip>false</strip>
- <onlyTrusted>true</onlyTrusted>
- </mailet>
- </pre>
- </source>
- <p></p>
- Matcher example: messages signed by trusted users never are spam
- Messages with valid signatures will never be considered spam. This
- can be a valid policy *if* SMIMECheckSignature was invoked with
- <onlyTrusted>true</onlyTrusted>
- set
- <source>
- <pre>
- <mailet
- match="HasMailAttribute=org.apache.james.SMIMECheckSignature"
- class="ToProcessor">
- <processor>transport</processor>
- </mailet>
- </pre>
- </source>
- <p>Signing example: Add a server-side signature to all mail.</p>
- <source>
- <pre>
- <mailet
- match="HasMailAttribute=org.apache.james.SMIMECheckSignature"
- class="SetMimeHeader">
- <name>X-WasSigned</name>
- <value>true</value>
- </mailet>
-
- <mailet match="All" class="SMIMESign" onMailetException="ignore">
- <keyStoreType>jks</keyStoreType>
- <keyStoreFileName>path.keystore</keyStoreFileName>
- <keyStorePassword>myKeyStorePass</keyStorePassword>
- <keyAlias>myKeyAlias</keyAlias>
- <keyAliasPassword>myKeyPass</keyAliasPassword>
- <signerName>XXX Trusted Server</signerName>
- <rebuildFrom>true</rebuildFrom>
- <postmasterSigns>true</postmasterSigns>
- <debug>true</debug>
- </mailet>
- </pre>
- </source>
- </section>
- </body>
+ <mailet match="IsSMIMESigned" class="SMIMECheckSignature">
+ <keyStoreType>pkcs12</keyStoreType>
+ <keyStoreFileName>c:/path.pfx</keyStoreFileName>
+ <keyStorePassword> myKeyStorePass
+ </keyStorePassword> <strip>false</strip>
+ <onlyTrusted>true</onlyTrusted>
+ </mailet>
+ </pre>
+ </source>
+ <br/>
+ Matcher example: messages signed by trusted users never are spam
+ Messages with valid signatures will never be considered spam. This
+ can be a valid policy *if* SMIMECheckSignature was invoked with
+ <onlyTrusted>true</onlyTrusted>
+ set
+ <source>
+ <pre>
+ <mailet
+ match="HasMailAttribute=org.apache.james.SMIMECheckSignature"
+ class="ToProcessor">
+ <processor>transport</processor>
+ </mailet>
+ </pre>
+ </source>
+ <p>Signing example: Add a server-side signature to all mail.</p>
+ <source>
+ <pre>
+ <mailet
+ match="HasMailAttribute=org.apache.james.SMIMECheckSignature"
+ class="SetMimeHeader">
+ <name>X-WasSigned</name>
+ <value>true</value>
+ </mailet>
+
+ <mailet match="All" class="SMIMESign" onMailetException="ignore">
+ <keyStoreType>jks</keyStoreType>
+ <keyStoreFileName>path.keystore</keyStoreFileName>
+ <keyStorePassword>myKeyStorePass</keyStorePassword>
+ <keyAlias>myKeyAlias</keyAlias>
+ <keyAliasPassword>myKeyPass</keyAliasPassword>
+ <signerName>XXX Trusted Server</signerName>
+ <rebuildFrom>true</rebuildFrom>
+ <postmasterSigns>true</postmasterSigns>
+ <debug>true</debug>
+ </mailet>
+ </pre>
+ </source>
+ </section>
+ </body>
</document>
\ No newline at end of file
Modified: james/mailet/crypto/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/james/mailet/crypto/trunk/src/site/xdoc/index.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/crypto/trunk/src/site/xdoc/index.xml (original)
+++ james/mailet/crypto/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>
@@ -52,7 +52,7 @@
Is a JRE update release: upgrading dependencies and code for Java 1.5
</p>
</subsection>
- </subsection>
+ </subsection>
</section>
<section name='S/MIME Mailets'>
<p><acronym title='Secure / Multipurpose Internet Mail Extensions'>S/MIME</acronym> provides
Modified: james/mailet/current/fix-site.xml
URL: http://svn.apache.org/viewvc/james/mailet/current/fix-site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/current/fix-site.xml (original)
+++ james/mailet/current/fix-site.xml Thu Nov 29 22:52:55 2012
@@ -1,4 +1,4 @@
-<?xml version='1.0'?>
+<?xml version='1.0' encoding="UTF-8"?>
<!--
==========================================================================
@@ -22,45 +22,45 @@
==============================================================================
-->
<project name='Fix CRLFs in Site' default='fix-site'>
- <macrodef name='CopyToSite'>
- <sequential>
- <copy todir='site/api'>
- <fileset dir='api/target/site'/>
- </copy>
- <copy todir='site/base'>
- <fileset dir='base/target/site'/>
- </copy>
- <copy todir='site/crypto'>
- <fileset dir='crypto/target/site'/>
- </copy>
- <copy todir='site/maven-mailetdocs-plugin'>
- <fileset dir='maven-mailetdocs-plugin/target/site'/>
- </copy>
- <copy todir='site/standard'>
- <fileset dir='standard/target/site'/>
- </copy>
- <copy todir='site'>
- <fileset dir='target/site'/>
- </copy>
- </sequential>
- </macrodef>
-
- <macrodef name='FixSite'>
- <sequential>
- <fixcrlf srcdir='site' includes='**/*.html'/>
- </sequential>
- </macrodef>
+ <macrodef name='CopyToSite'>
+ <sequential>
+ <copy todir='site/api'>
+ <fileset dir='api/target/site'/>
+ </copy>
+ <copy todir='site/base'>
+ <fileset dir='base/target/site'/>
+ </copy>
+ <copy todir='site/crypto'>
+ <fileset dir='crypto/target/site'/>
+ </copy>
+ <copy todir='site/maven-mailetdocs-plugin'>
+ <fileset dir='maven-mailetdocs-plugin/target/site'/>
+ </copy>
+ <copy todir='site/standard'>
+ <fileset dir='standard/target/site'/>
+ </copy>
+ <copy todir='site'>
+ <fileset dir='target/site'/>
+ </copy>
+ </sequential>
+ </macrodef>
- <target name='fix-site'>
- <FixSite/>
- </target>
+ <macrodef name='FixSite'>
+ <sequential>
+ <fixcrlf srcdir='site' includes='**/*.html'/>
+ </sequential>
+ </macrodef>
- <target name='copy-to-site'>
- <CopyToSite/>
- </target>
-
- <target name='all'>
- <CopyToSite/>
- <FixSite/>
- </target>
+ <target name='fix-site'>
+ <FixSite/>
+ </target>
+
+ <target name='copy-to-site'>
+ <CopyToSite/>
+ </target>
+
+ <target name='all'>
+ <CopyToSite/>
+ <FixSite/>
+ </target>
</project>
Modified: james/mailet/current/src/reporting-site/site/site.xml
URL: http://svn.apache.org/viewvc/james/mailet/current/src/reporting-site/site/site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/current/src/reporting-site/site/site.xml (original)
+++ james/mailet/current/src/reporting-site/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/current/src/site/site.xml
URL: http://svn.apache.org/viewvc/james/mailet/current/src/site/site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/current/src/site/site.xml (original)
+++ james/mailet/current/src/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/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/AbstractMailetdocsReport.java
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/AbstractMailetdocsReport.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/AbstractMailetdocsReport.java (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/AbstractMailetdocsReport.java Thu Nov 29 22:52:55 2012
@@ -177,10 +177,10 @@ public abstract class AbstractMailetdocs
getSink().sectionTitle2_();
getSink().list();
- for (int i = 0; i < descriptors.size(); i++) {
+ for (MailetMatcherDescriptor descriptor : descriptors) {
getSink().listItem();
- getSink().link("#"+descriptors.get(i).getName());
- getSink().text(descriptors.get(i).getName());
+ getSink().link("#" + descriptor.getName());
+ getSink().text(descriptor.getName());
getSink().link_();
getSink().listItem_();
}
@@ -197,33 +197,33 @@ public abstract class AbstractMailetdocs
getSink().text(title);
getSink().sectionTitle1_();
- for (int i = 0; i < descriptors.size(); i++) {
+ for (MailetMatcherDescriptor descriptor : descriptors) {
getSink().section2();
getSink().sectionTitle2();
- getSink().anchor(descriptors.get(i).getName());
- getSink().text(descriptors.get(i).getName());
+ getSink().anchor(descriptor.getName());
+ getSink().text(descriptor.getName());
getSink().anchor_();
getSink().sectionTitle2_();
- if (descriptors.get(i).getInfo() != null) {
- getSink().paragraph();
- if (descriptors.get(i).getType() == MailetMatcherDescriptor.Type.MAILET) {
- getSink().text("Mailet Info: ");
- } else if (descriptors.get(i).getType() == MailetMatcherDescriptor.Type.MATCHER) {
- getSink().text("Matcher Info: ");
- } else {
- getSink().text("Info: ");
- }
- getSink().bold();
- getSink().text(descriptors.get(i).getInfo());
- getSink().bold_();
- getSink().lineBreak();
- getSink().paragraph_();
+ if (descriptor.getInfo() != null) {
+ getSink().paragraph();
+ if (descriptor.getType() == MailetMatcherDescriptor.Type.MAILET) {
+ getSink().text("Mailet Info: ");
+ } else if (descriptor.getType() == MailetMatcherDescriptor.Type.MATCHER) {
+ getSink().text("Matcher Info: ");
+ } else {
+ getSink().text("Info: ");
+ }
+ getSink().bold();
+ getSink().text(descriptor.getInfo());
+ getSink().bold_();
+ getSink().lineBreak();
+ getSink().paragraph_();
}
getSink().paragraph();
- getSink().rawText(descriptors.get(i).getClassDocs());
+ getSink().rawText(descriptor.getClassDocs());
getSink().paragraph_();
getSink().section2_();
Modified: james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java Thu Nov 29 22:52:55 2012
@@ -24,11 +24,7 @@ import java.lang.reflect.InvocationTarge
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import org.apache.james.mailet.MailetMatcherDescriptor.Type;
import org.apache.mailet.Mailet;
@@ -73,10 +69,9 @@ public class DefaultDescriptorsExtractor
try {
final Class<?> mailetClass = classLoader.loadClass(MAILET_CLASS_NAME);
- final Class<?> matcherClass = classLoader.loadClass(MATCHER_CLASS_NAME);
-
- for (int i = 0; i < classes.length; i++) {
- final JavaClass nextClass = classes[i];
+ final Class<?> matcherClass = classLoader.loadClass(MATCHER_CLASS_NAME);
+
+ for (final JavaClass nextClass : classes) {
addDescriptor(log, classLoader, mailetClass, matcherClass, nextClass);
}
} catch (ClassNotFoundException e) {
@@ -134,8 +129,8 @@ public class DefaultDescriptorsExtractor
if (log.isDebugEnabled()) {
if (allInterfaces.size() > 0) {
log.debug("Interfaces for " + klass.getName());
- for (int k = 0; k < allInterfaces.size(); k++) {
- log.debug("Interface: " + ((Class<?>) allInterfaces.get(k)).getName());
+ for (Class<?> allInterface : allInterfaces) {
+ log.debug("Interface: " + allInterface.getName());
}
} else {
log.debug("No interfaces for " + klass.getName());
@@ -256,10 +251,8 @@ public class DefaultDescriptorsExtractor
private JavaClass[] javaClasses(MavenProject project) {
JavaDocBuilder builder = new JavaDocBuilder();
- for (@SuppressWarnings("unchecked")
- Iterator<String> i = project.getCompileSourceRoots().iterator(); i
- .hasNext();) {
- builder.addSourceTree(new File(i.next()));
+ for (String s : (Iterable<String>) project.getCompileSourceRoots()) {
+ builder.addSourceTree(new File(s));
}
final JavaClass[] classes = builder.getClasses();
return classes;
@@ -293,9 +286,7 @@ public class DefaultDescriptorsExtractor
List<JavaClass> res = new LinkedList<JavaClass>();
if (javaClass.getImplementedInterfaces() != null) {
JavaClass[] interfaces = javaClass.getImplementedInterfaces();
- for (int n = 0; n < interfaces.length; n++) {
- res.add(interfaces[n]);
- }
+ Collections.addAll(res, interfaces);
}
if (javaClass.getSuperJavaClass() != null) {
res.addAll(getAllInterfacesQdox(javaClass.getSuperJavaClass()));
@@ -307,10 +298,10 @@ public class DefaultDescriptorsExtractor
List<Class<?>> res = new LinkedList<Class<?>>();
if (klass.getInterfaces() != null) {
Class<?>[] interfaces = klass.getInterfaces();
- for (int n = 0; n < interfaces.length; n++) {
- res.add(interfaces[n]);
+ for (Class<?> anInterface : interfaces) {
+ res.add(anInterface);
// add also interfaces extensions
- res.addAll(getAllInterfaces(interfaces[n]));
+ res.addAll(getAllInterfaces(anInterface));
}
}
if (klass.getSuperclass() != null) {
Modified: james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java (original)
+++ james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java Thu Nov 29 22:52:55 2012
@@ -23,33 +23,37 @@ package org.apache.james.mailet;
* Simple bean to describe a mailet or a matcher
*/
public class MailetMatcherDescriptor {
-
- /** Enumerates subjects of description */
+
+ /**
+ * Enumerates subjects of description
+ */
public enum Type {
-
- MAILET("mailet"),
+
+ MAILET("mailet"),
MATCHER("matcher");
-
+
private final String name;
+
private Type(final String name) {
this.name = name;
}
-
+
/**
* Human readable name for type.
+ *
* @return not null
*/
public String getName() {
return name;
}
-
+
/**
* @see #getName()
*/
public String toString() {
return getName();
}
- };
+ }
private String fullyQualifiedClassName;
Modified: james/mailet/maven-mailetdocs-plugin/trunk/src/reporting-site/site.xml
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/reporting-site/site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/reporting-site/site.xml (original)
+++ james/mailet/maven-mailetdocs-plugin/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/maven-mailetdocs-plugin/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/site/xdoc/index.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/src/site/xdoc/index.xml (original)
+++ james/mailet/maven-mailetdocs-plugin/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>
@@ -37,7 +37,7 @@
<ul>
<li><a href='examples/standard.html'>Cataloging A Large Project</a></li>
</ul>
- </subsection>
+ </subsection>
</section>
<section name='Releases'>
<p>
Modified: james/mailet/standard/trunk/src/assemble/bin.xml
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/assemble/bin.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/assemble/bin.xml (original)
+++ james/mailet/standard/trunk/src/assemble/bin.xml Thu Nov 29 22:52:55 2012
@@ -1,86 +1,87 @@
+<?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/standard/trunk/src/assemble/src.xml
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/assemble/src.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/assemble/src.xml (original)
+++ james/mailet/standard/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>**/bin/**</exclude>
- <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>**/bin/**</exclude>
+ <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/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddFooter.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddFooter.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddFooter.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddFooter.java Thu Nov 29 22:52:55 2012
@@ -61,7 +61,7 @@ public class AddFooter extends AbstractA
*/
public String getFooterHTML() {
String text = getFooterText();
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(text, "\r\n", true);
while (st.hasMoreTokens()) {
String token = st.nextToken();
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddSubjectPrefix.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddSubjectPrefix.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddSubjectPrefix.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/AddSubjectPrefix.java Thu Nov 29 22:52:55 2012
@@ -65,14 +65,14 @@ public class AddSubjectPrefix extends Ge
* if an error arises during message processing
*/
public void service(Mail mail) throws MessagingException {
- String newSubject = null;
+ String newSubject;
MimeMessage m = mail.getMessage();
String subject = m.getSubject();
if (subject != null) {
// m.setSubject(subjectPrefix + " " + subject);
- newSubject = subjectPrefix + " " + m.getSubject().toString();
+ newSubject = subjectPrefix + " " + m.getSubject();
} else {
newSubject = subjectPrefix;
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClamAVScan.java Thu Nov 29 22:52:55 2012
@@ -269,7 +269,7 @@ public class ClamAVScan extends GenericM
*/
protected void initDebug() {
String debugParam = getInitParameter("debug");
- setDebug((debugParam == null) ? false : new Boolean(debugParam).booleanValue());
+ setDebug((debugParam == null) ? false : Boolean.valueOf(debugParam));
}
/**
@@ -506,7 +506,7 @@ public class ClamAVScan extends GenericM
*/
protected Socket getClamdSocket() throws MessagingException {
- InetAddress address = null;
+ InetAddress address;
Set<InetAddress> usedAddresses = new HashSet<InetAddress>(getAddressesCount());
for (;;) {
@@ -619,7 +619,7 @@ public class ClamAVScan extends GenericM
bos.close();
streamSocket.close();
- String answer = null;
+ String answer;
boolean virusFound = false;
String logMessage = "";
for (;;) {
@@ -648,8 +648,8 @@ public class ClamAVScan extends GenericM
} else {
errorMessage += "\r\n";
}
- StringBuffer sb = new StringBuffer(errorMessage);
- sb.append(logMessage + "\r\n");
+ StringBuilder sb = new StringBuilder(errorMessage);
+ sb.append(logMessage).append("\r\n");
// write mail and message info to log
logMailInfo(mail);
@@ -925,29 +925,29 @@ public class ClamAVScan extends GenericM
if (mimeMessage.getSentDate() != null) {
out.println(" Sent date: " + mimeMessage.getSentDate());
}
- String[] sender = null;
+ String[] sender;
sender = mimeMessage.getHeader(RFC2822Headers.FROM);
if (sender != null) {
out.print(" From: ");
- for (int i = 0; i < sender.length; i++) {
- out.print(sender[i] + " ");
+ for (String aSender : sender) {
+ out.print(aSender + " ");
}
out.println();
}
- String[] rcpts = null;
+ String[] rcpts;
rcpts = mimeMessage.getHeader(RFC2822Headers.TO);
if (rcpts != null) {
out.print(" To: ");
- for (int i = 0; i < rcpts.length; i++) {
- out.print(rcpts[i] + " ");
+ for (String rcpt : rcpts) {
+ out.print(rcpt + " ");
}
out.println();
}
rcpts = mimeMessage.getHeader(RFC2822Headers.CC);
if (rcpts != null) {
out.print(" CC: ");
- for (int i = 0; i < rcpts.length; i++) {
- out.print(rcpts[i] + " ");
+ for (String rcpt : rcpts) {
+ out.print(rcpt + " ");
}
out.println();
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ClassifyBounce.java Thu Nov 29 22:52:55 2012
@@ -117,7 +117,7 @@ public class ClassifyBounce extends Gene
int messageNature = TYPE_NORMAL;
- boolean outOfOffice = false;
+ boolean outOfOffice;
boolean mailBoxFull = false;
boolean failure = false;
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/LogMessage.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/LogMessage.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/LogMessage.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/LogMessage.java Thu Nov 29 22:52:55 2012
@@ -55,9 +55,9 @@ public class LogMessage extends GenericM
*/
public void init() {
try {
- passThrough = (getInitParameter("passThrough") == null) ? true : new Boolean(getInitParameter("passThrough")).booleanValue();
- headers = (getInitParameter("headers") == null) ? true : new Boolean(getInitParameter("headers")).booleanValue();
- body = (getInitParameter("body") == null) ? true : new Boolean(getInitParameter("body")).booleanValue();
+ passThrough = (getInitParameter("passThrough") == null) ? true : Boolean.valueOf(getInitParameter("passThrough"));
+ headers = (getInitParameter("headers") == null) ? true : Boolean.valueOf(getInitParameter("headers"));
+ body = (getInitParameter("body") == null) ? true : Boolean.valueOf(getInitParameter("body"));
bodyMax = (getInitParameter("maxBody") == null) ? 0 : Integer.parseInt(getInitParameter("maxBody"));
comment = getInitParameter("comment");
} catch (Exception e) {
@@ -77,10 +77,10 @@ public class LogMessage extends GenericM
if (headers) log(getMessageHeaders(mail.getMessage()));
if (body) {
int len = bodyMax > 0 ? bodyMax : mail.getMessage().getSize();
- StringBuffer text = new StringBuffer(len);
+ StringBuilder text = new StringBuilder(len);
InputStream is = mail.getMessage().getRawInputStream();
byte[] buf = new byte[1024];
- int read = 0;
+ int read;
while (text.length() < len && (read = is.read(buf)) > -1) {
text.append(new String(buf, 0, Math.min(read, len - text.length())));
}
@@ -106,7 +106,7 @@ public class LogMessage extends GenericM
*/
private String getMessageHeaders(MimeMessage message) throws MessagingException {
Enumeration heads = message.getAllHeaderLines();
- StringBuffer headBuffer = new StringBuffer(1024).append("\n");
+ StringBuilder headBuffer = new StringBuilder(1024).append("\n");
while(heads.hasMoreElements()) {
headBuffer.append(heads.nextElement().toString()).append("\n");
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.java Thu Nov 29 22:52:55 2012
@@ -87,10 +87,7 @@ public class MailAttributesToMimeHeaders
try {
message = mail.getMessage();
- Iterator<String> keys = map.keySet().iterator();
-
- while (keys.hasNext()) {
- String key = keys.next();
+ for (String key : map.keySet()) {
String value = (String) mail.getAttribute(key);
String headerName = map.get(key);
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/OnlyText.java Thu Nov 29 22:52:55 2012
@@ -160,15 +160,15 @@ public class OnlyText extends GenericMai
public String decodeEntities(String data) {
StringBuffer buffer = new StringBuffer();
- StringBuffer res = new StringBuffer();
+ StringBuilder res = new StringBuilder();
int lastAmp = -1;
for (int i = 0; i < data.length(); i++) {
char c = data.charAt(i);
if (c == '&' && lastAmp == -1) lastAmp = buffer.length();
else if (c == ';' && (lastAmp > -1)) { // && (lastAmp > (buffer.length() - 7))) { // max: &#xxxx;
- if (charMap.containsKey(buffer.toString())) res.append((String) charMap.get(buffer.toString()));
- else res.append("&" + buffer.toString() + ";");
+ if (charMap.containsKey(buffer.toString())) res.append(charMap.get(buffer.toString()));
+ else res.append("&").append(buffer.toString()).append(";");
lastAmp = -1;
buffer = new StringBuffer();
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/PostmasterAlias.java Thu Nov 29 22:52:55 2012
@@ -54,10 +54,9 @@ public class PostmasterAlias extends Gen
MailetContext mailetContext = getMailetContext();
boolean postmasterAddressed = false;
- for (Iterator<MailAddress> i = recipients.iterator(); i.hasNext(); ) {
- MailAddress addr = (MailAddress)i.next();
+ for (MailAddress addr : recipients) {
if (addr.getLocalPart().equalsIgnoreCase("postmaster") &&
- mailetContext.isLocalServer(addr.getDomain()) && !mailetContext.isLocalEmail(addr)) {
+ mailetContext.isLocalServer(addr.getDomain()) && !mailetContext.isLocalEmail(addr)) {
//Should remove this address... we want to replace it with
// the server's postmaster address
if (recipientsToRemove == null) {
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RecoverAttachment.java Thu Nov 29 22:52:55 2012
@@ -92,7 +92,7 @@ public class RecoverAttachment extends G
Map<String, byte[]> attachments = (Map<String, byte[]>) mail.getAttribute(attributeName);
if (attachments != null) {
- MimeMessage message = null;
+ MimeMessage message;
try {
message = mail.getMessage();
} catch (MessagingException e) {
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMailAttribute.java Thu Nov 29 22:52:55 2012
@@ -84,10 +84,9 @@ public class RemoveMailAttribute extends
* @throws MessagingException in all cases
*/
public void service(Mail mail) throws MessagingException {
- Iterator<String> iter = attributesToRemove.iterator();
- while (iter.hasNext()) {
- String attribute_name = iter.next().toString();
- mail.removeAttribute (attribute_name);
+ for (String anAttributesToRemove : attributesToRemove) {
+ String attribute_name = anAttributesToRemove;
+ mail.removeAttribute(attribute_name);
}
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/RemoveMimeHeader.java Thu Nov 29 22:52:55 2012
@@ -78,8 +78,8 @@ public class RemoveMimeHeader extends Ge
MimeMessage message = mail.getMessage();
// loop through the headers
- for (int i = 0; i < headers.size(); i++) {
- message.removeHeader((String) headers.get(i));
+ for (String header : headers) {
+ message.removeHeader(header);
}
message.saveChanges();
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ReplaceContent.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ReplaceContent.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ReplaceContent.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ReplaceContent.java Thu Nov 29 22:52:55 2012
@@ -133,11 +133,11 @@ public class ReplaceContent extends Gene
int flags = 0;
if (pieces[2].indexOf('r') >= 0) flags += FLAG_REPEAT;
- if (pieces[1].indexOf("\\r") >= 0) pieces[1] = pieces[1].replaceAll("\\\\r", "\r");
- if (pieces[1].indexOf("\\n") >= 0) pieces[1] = pieces[1].replaceAll("\\\\n", "\n");
- if (pieces[1].indexOf("\\t") >= 0) pieces[1] = pieces[1].replaceAll("\\\\t", "\t");
+ if (pieces[1].contains("\\r")) pieces[1] = pieces[1].replaceAll("\\\\r", "\r");
+ if (pieces[1].contains("\\n")) pieces[1] = pieces[1].replaceAll("\\\\n", "\n");
+ if (pieces[1].contains("\\t")) pieces[1] = pieces[1].replaceAll("\\\\t", "\t");
- return new PatternBean (Pattern.compile(pieces[0], options), pieces[1] , new Integer(flags));
+ return new PatternBean (Pattern.compile(pieces[0], options), pieces[1] , flags);
}
protected static PatternList getPatternsFromString(String pattern) throws MailetException {
@@ -147,8 +147,8 @@ public class ReplaceContent extends Gene
String[] patternArray = StringUtils.split(pattern, "/,/");
PatternList patternList= new PatternList();
- for (int i = 0; i < patternArray.length; i++) {
- PatternBean o = getPattern(patternArray[i]);
+ for (String aPatternArray : patternArray) {
+ PatternBean o = getPattern(aPatternArray);
patternList.getPatterns().add(o.getPatterns());
patternList.getSubstitutions().add(o.getSubstitutions());
patternList.getFlags().add(o.getFlag());
@@ -211,8 +211,8 @@ public class ReplaceContent extends Gene
protected static String applyPatterns(Pattern[] patterns, String[] substitutions, Integer[] pflags, String text, int debug, GenericMailet logOwner) {
for (int i = 0; i < patterns.length; i ++) {
- int flags = pflags[i].intValue();
- boolean changed = false;
+ int flags = pflags[i];
+ boolean changed;
do {
changed = false;
String replaced = patterns[i].matcher(text).replaceAll(substitutions[i]);
@@ -275,12 +275,12 @@ public class ReplaceContent extends Gene
}
ReplaceConfig rConfig = new ReplaceConfig();
- rConfig.subjectPatterns = (Pattern[]) subjectPatternsList.toArray(new Pattern[0]);
- rConfig.subjectSubstitutions = (String[]) subjectSubstitutionsList.toArray(new String[0]);
- rConfig.subjectFlags = (Integer[]) subjectFlagsList.toArray(new Integer[0]);
- rConfig.bodyPatterns = (Pattern[]) bodyPatternsList.toArray(new Pattern[0]);
- rConfig.bodySubstitutions = (String[]) bodySubstitutionsList.toArray(new String[0]);
- rConfig.bodyFlags = (Integer[]) bodyFlagsList.toArray(new Integer[0]);
+ rConfig.subjectPatterns = subjectPatternsList.toArray(new Pattern[0]);
+ rConfig.subjectSubstitutions = subjectSubstitutionsList.toArray(new String[0]);
+ rConfig.subjectFlags = subjectFlagsList.toArray(new Integer[0]);
+ rConfig.bodyPatterns = bodyPatternsList.toArray(new Pattern[0]);
+ rConfig.bodySubstitutions = bodySubstitutionsList.toArray(new String[0]);
+ rConfig.bodyFlags = bodyFlagsList.toArray(new Integer[0]);
return rConfig;
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ServerTime.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ServerTime.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ServerTime.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ServerTime.java Thu Nov 29 22:52:55 2012
@@ -46,8 +46,8 @@ public class ServerTime extends GenericM
public void service(Mail mail) throws javax.mail.MessagingException {
MimeMessage response = (MimeMessage)mail.getMessage().reply(false);
response.setSubject("The time is now...");
- StringBuffer textBuffer =
- new StringBuffer(128)
+ StringBuilder textBuffer =
+ new StringBuilder(128)
.append("This mail server thinks it's ")
.append((new java.util.Date()).toString())
.append(".");
@@ -59,7 +59,7 @@ public class ServerTime extends GenericM
// MAIL FROM/RCPT TO commands used to send the inquiry.
if (response.getFrom() == null) {
- response.setFrom(((MailAddress)mail.getRecipients().iterator().next()).toInternetAddress());
+ response.setFrom(mail.getRecipients().iterator().next().toInternetAddress());
}
if (response.getAllRecipients() == null) {
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/SetMailAttribute.java Thu Nov 29 22:52:55 2012
@@ -70,7 +70,7 @@ public class SetMailAttribute extends Ge
{
Iterator<String> iter = getInitParameterNames();
while (iter.hasNext()) {
- String name = iter.next().toString();
+ String name = iter.next();
String value = getInitParameter (name);
attributesToSet.put (name,value);
}
@@ -86,10 +86,8 @@ public class SetMailAttribute extends Ge
*/
public void service(Mail mail) throws MessagingException {
if (entries != null) {
- Iterator<Map.Entry<String, String>> iter = entries.iterator();
- while (iter.hasNext()) {
- Map.Entry<String, String> entry = iter.next();
- mail.setAttribute (entry.getKey(), entry.getValue());
+ for (Map.Entry<String, String> entry : entries) {
+ mail.setAttribute(entry.getKey(), entry.getValue());
}
}
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/StripAttachment.java Thu Nov 29 22:52:55 2012
@@ -166,7 +166,7 @@ public class StripAttachment extends Gen
if (directoryName != null) {
try {
- File saveDirectory = null;
+ File saveDirectory;
saveDirectory = new File(directoryName);
if (!saveDirectory.exists()) {
saveDirectory.mkdirs();
@@ -210,7 +210,7 @@ public class StripAttachment extends Gen
* Thrown when an error situation is encountered.
*/
public void service(Mail mail) throws MailetException {
- MimeMessage message = null;
+ MimeMessage message;
try {
message = mail.getMessage();
} catch (MessagingException e) {
@@ -291,7 +291,7 @@ public class StripAttachment extends Gen
private boolean checkMessageRemoved(Part part, Mail mail)
throws MessagingException, Exception {
- String fileName = null;
+ String fileName;
fileName = part.getFileName();
// filename or name of part can be null, so we have to be careful
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ToProcessor.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ToProcessor.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ToProcessor.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/ToProcessor.java Thu Nov 29 22:52:55 2012
@@ -31,7 +31,8 @@ import javax.mail.MessagingException;
* <p>This mailet redirects the mail to the named processor</p>
*
* <p>Sample configuration:</p>
- * <pre><code>
+ * <pre><code
+ * >
* <mailet match="All" class="ToProcessor">
* <processor>spam</processor>
* <notice>Notice attached to the message (optional)</notice>
@@ -62,7 +63,7 @@ public class ToProcessor extends Generic
* @throws MailetException if the processor parameter is missing
*/
public void init() throws MailetException {
- isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
+ isDebug = (getInitParameter("debug") == null) ? false : Boolean.valueOf(getInitParameter("debug"));
processor = getInitParameter("processor");
if (processor == null) {
throw new MailetException("processor parameter is required");
@@ -79,8 +80,8 @@ public class ToProcessor extends Generic
*/
public void service(Mail mail) throws MessagingException {
if (isDebug) {
- StringBuffer logBuffer =
- new StringBuffer(128)
+ StringBuilder logBuffer =
+ new StringBuilder(128)
.append("Sending mail ")
.append(mail)
.append(" to ")
@@ -92,8 +93,8 @@ public class ToProcessor extends Generic
if (mail.getErrorMessage() == null) {
mail.setErrorMessage(noticeText);
} else {
- StringBuffer errorMessageBuffer =
- new StringBuffer(256)
+ StringBuilder errorMessageBuffer =
+ new StringBuilder(256)
.append(mail.getErrorMessage())
.append("\r\n")
.append(noticeText);
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UnwrapText.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UnwrapText.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UnwrapText.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UnwrapText.java Thu Nov 29 22:52:55 2012
@@ -118,7 +118,7 @@ public class UnwrapText extends GenericM
if (width < 40) return text;
if (qwidth < 0) qwidth = width - qwidth;
- StringBuffer result = new StringBuffer();
+ StringBuilder result = new StringBuilder();
int prevWrapped = 0;
for (int i = 0; i < lines.length; i++) {
if (prevWrapped != 0) {
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/mailets/UseHeaderRecipients.java Thu Nov 29 22:52:55 2012
@@ -67,7 +67,7 @@ public class UseHeaderRecipients extends
* initializes the DEBUG flag
*/
public void init() {
- isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
+ isDebug = (getInitParameter("debug") == null) ? false : Boolean.valueOf(getInitParameter("debug"));
}
/**
@@ -123,8 +123,8 @@ public class UseHeaderRecipients extends
private Collection<MailAddress> getHeaderMailAddresses(MimeMessage message, String name) throws MessagingException {
if (isDebug) {
- StringBuffer logBuffer =
- new StringBuffer(64)
+ StringBuilder logBuffer =
+ new StringBuilder(64)
.append("Checking ")
.append(name)
.append(" headers");
@@ -135,8 +135,8 @@ public class UseHeaderRecipients extends
String addressString;
InternetAddress iAddress;
if (headers != null) {
- for(int i = 0; i < headers.length; i++) {
- StringTokenizer st = new StringTokenizer(headers[i], ",", false);
+ for (String header : headers) {
+ StringTokenizer st = new StringTokenizer(header, ",", false);
while (st.hasMoreTokens()) {
addressString = st.nextToken();
iAddress = new InternetAddress(addressString);
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AbstractQuotaMatcher.java Thu Nov 29 22:52:55 2012
@@ -52,8 +52,7 @@ abstract public class AbstractQuotaMatch
Collection<MailAddress> matching = null;
if (isSenderChecked(mail.getSender())) {
matching = new ArrayList<MailAddress>();
- for (Iterator<MailAddress> i = mail.getRecipients().iterator(); i.hasNext(); ) {
- MailAddress recipient = i.next();
+ for (MailAddress recipient : mail.getRecipients()) {
if (isRecipientChecked(recipient) && isOverQuota(recipient, mail)) {
matching.add(recipient);
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java Thu Nov 29 22:52:55 2012
@@ -121,7 +121,7 @@ public class AttachmentFileNameIs extend
mask.matchString = cleanFileName(mask.matchString);
theMasks.add(mask);
}
- masks = (Mask[])theMasks.toArray(new Mask[0]);
+ masks = theMasks.toArray(new Mask[0]);
}
/**
@@ -219,10 +219,10 @@ public class AttachmentFileNameIs extend
* @param fileName
*/
protected boolean matchFound(String fileName) {
- for (int j = 0; j < masks.length; j++) {
+ for (Mask mask1 : masks) {
boolean fMatch;
- Mask mask = masks[j];
-
+ Mask mask = mask1;
+
//XXX: file names in mail may contain directory - theoretically
if (mask.suffixMatch) {
fMatch = fileName.endsWith(mask.matchString);
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/CompareNumericHeaderValue.java Thu Nov 29 22:52:55 2012
@@ -134,7 +134,7 @@ public class CompareNumericHeaderValue e
throw new IllegalStateException("Null headerName");
}
- MimeMessage message = (MimeMessage) mail.getMessage();
+ MimeMessage message = mail.getMessage();
String [] headerArray = message.getHeader(headerName);
if (headerArray != null && headerArray.length > 0) {
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/GenericRegexMatcher.java Thu Nov 29 22:52:55 2012
@@ -67,16 +67,16 @@ abstract public class GenericRegexMatche
MimeMessage message = mail.getMessage();
//Loop through all the patterns
- if (patterns != null) for (int i = 0; i < patterns.length; i++) {
+ if (patterns != null) for (Object[] pattern1 : patterns) {
//Get the header name
- String headerName = (String)patterns[i][0];
+ String headerName = (String) pattern1[0];
//Get the patterns for that header
- Pattern pattern = (Pattern)patterns[i][1];
+ Pattern pattern = (Pattern) pattern1[1];
//Get the array of header values that match that
String headers[] = message.getHeader(headerName);
//Loop through the header values
- if (headers != null) for (int j = 0; j < headers.length; j++) {
- if (pattern.matcher(headers[j]).matches()) {
+ if (headers != null) for (String header : headers) {
+ if (pattern.matcher(header).matches()) {
// log("Match: " + headerName + "[" + j + "]: " + headers[j]);
return mail.getRecipients();
}
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHabeasWarrantMark.java Thu Nov 29 22:52:55 2012
@@ -87,25 +87,23 @@ public class HasHabeasWarrantMark extend
MimeMessage message = mail.getMessage();
//Loop through all the patterns
- for (int i = 0; i < warrantMark.length; i++) try
- {
- String headerName = warrantMark[i][0]; //Get the header name
- String requiredValue = warrantMark[i][1]; //Get the required value
- String headerValue = message.getHeader(headerName, null); //Get the header value(s)
-
- // We want an exact match, so only test the first value.
- // If there are multiple values, the header may be
- // (illegally) forged. I'll leave it as an exercise to
- // others if they want to detect and report potentially
- // forged headers.
-
- if (!(requiredValue.equals(headerValue))) return null;
- }
- catch (Exception e)
- {
- log(e.toString());
- return null; //if we get an exception, don't validate the mark
- }
+ for (String[] aWarrantMark : warrantMark)
+ try {
+ String headerName = aWarrantMark[0]; //Get the header name
+ String requiredValue = aWarrantMark[1]; //Get the required value
+ String headerValue = message.getHeader(headerName, null); //Get the header value(s)
+
+ // We want an exact match, so only test the first value.
+ // If there are multiple values, the header may be
+ // (illegally) forged. I'll leave it as an exercise to
+ // others if they want to detect and report potentially
+ // forged headers.
+
+ if (!(requiredValue.equals(headerValue))) return null;
+ } catch (Exception e) {
+ log(e.toString());
+ return null; //if we get an exception, don't validate the mark
+ }
// If we get here, all headers are present and match.
return mail.getRecipients();
Modified: james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHeader.java
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHeader.java?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHeader.java (original)
+++ james/mailet/standard/trunk/src/main/java/org/apache/james/transport/matchers/HasHeader.java Thu Nov 29 22:52:55 2012
@@ -62,53 +62,52 @@ public class HasHeader extends GenericMa
header:
// goes through the headernames one by one
- for (Iterator<String> it=conditionline_.iterator(); it.hasNext(); ) {
- String element = it.next();
- StringTokenizer st = new StringTokenizer(element, "=", false);
- String header = new String();
-
- // read the headername
- if (st.hasMoreTokens()) {
- header = st.nextToken().trim();
- } else {
- throw new MessagingException("Missing headerName");
- }
+ for (String element : conditionline_) {
+ StringTokenizer st = new StringTokenizer(element, "=", false);
+ String header;
+
+ // read the headername
+ if (st.hasMoreTokens()) {
+ header = st.nextToken().trim();
+ } else {
+ throw new MessagingException("Missing headerName");
+ }
- // try to read headervalue
- String headerValue = new String();
- if (st.hasMoreTokens()) {
- headerValue = st.nextToken().trim();
- } else {
- headerValue = null;
- }
+ // try to read headervalue
+ String headerValue;
+ if (st.hasMoreTokens()) {
+ headerValue = st.nextToken().trim();
+ } else {
+ headerValue = null;
+ }
- // find headername in Mailheaders
- String [] headerArray = message.getHeader(header);
- if (headerArray != null && headerArray.length > 0) {
- // if there is the headername specified without the headervalue
- // only the existence of the headername ist performed
- if (headerValue != null) {
- //
- if (headerArray[0].trim().equalsIgnoreCase(headerValue)) {
- // headername and value found and match to the condition
- match = true;
- } else {
- // headername and value found but the value does not match the condition
- match = false;
- // if one condition fails the matcher returns false
- break header;
- };
- } else {
- // just the headername is specified
+ // find headername in Mailheaders
+ String[] headerArray = message.getHeader(header);
+ if (headerArray != null && headerArray.length > 0) {
+ // if there is the headername specified without the headervalue
+ // only the existence of the headername ist performed
+ if (headerValue != null) {
+ //
+ if (headerArray[0].trim().equalsIgnoreCase(headerValue)) {
+ // headername and value found and match to the condition
match = true;
+ } else {
+ // headername and value found but the value does not match the condition
+ match = false;
+ // if one condition fails the matcher returns false
+ break header;
}
} else {
- // no headername is found
- match = false;
- // if one condition fails the matcher returns false
- break header;
+ // just the headername is specified
+ match = true;
}
+ } else {
+ // no headername is found
+ match = false;
+ // if one condition fails the matcher returns false
+ break header;
}
+ }
return (match) ? mail.getRecipients() : null;
Modified: james/mailet/standard/trunk/src/reporting-site/site.xml
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/reporting-site/site.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/reporting-site/site.xml (original)
+++ james/mailet/standard/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/standard/trunk/src/site/xdoc/conf.xml
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/site/xdoc/conf.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/site/xdoc/conf.xml (original)
+++ james/mailet/standard/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/standard/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/james/mailet/standard/trunk/src/site/xdoc/index.xml?rev=1415429&r1=1415428&r2=1415429&view=diff
==============================================================================
--- james/mailet/standard/trunk/src/site/xdoc/index.xml (original)
+++ james/mailet/standard/trunk/src/site/xdoc/index.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
@@ -17,19 +17,19 @@
specific language governing permissions and limitations
under the License.
-->
-<document>
- <properties>
- <title>Overview</title>
- <author email="server-dev@james.apache.org">JAMES Project Team</author>
- </properties>
- <body>
- <section name="Standard Mailets">
- <p>A collection of generally useful reusable mailets and matchers with minimal dependencies.</p>
- <p>These mailets form the mail processing backbone of the
- <a href='http://james.apache.org/server' rel='tag'>Apache James Server</a>.
- They are coupled only to the
- <a href='http://james.apache.org/mailet/'>Mailet API</a>
- and so are independent of the server.
+<document>
+ <properties>
+ <title>Overview</title>
+ <author email="server-dev@james.apache.org">JAMES Project Team</author>
+ </properties>
+ <body>
+ <section name="Standard Mailets">
+ <p>A collection of generally useful reusable mailets and matchers with minimal dependencies.</p>
+ <p>These mailets form the mail processing backbone of the
+ <a href='http://james.apache.org/server' rel='tag'>Apache James Server</a>.
+ They are coupled only to the
+ <a href='http://james.apache.org/mailet/'>Mailet API</a>
+ and so are independent of the server.
</p>
<subsection name='Releases'>
<p>
@@ -43,10 +43,10 @@
Earlier versions were released as part of the
<a href='http://james.apache.org/server/index.html' rel='tag'>Apache James Server</a> and are versioned accordingly.
</p>
- </subsection>
- <subsection name='Catalog'>
- <p>A full category is available <a href='mailet-report.html'>here</a>.</p>
- </subsection>
- </section>
- </body>
+ </subsection>
+ <subsection name='Catalog'>
+ <p>A full category is available <a href='mailet-report.html'>here</a>.</p>
+ </subsection>
+ </section>
+ </body>
</document>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org