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 fe...@apache.org on 2011/04/04 14:26:37 UTC

svn commit: r1088591 [2/4] - in /james/server/trunk: cli/src/main/java/org/apache/james/cli/ container-spring/src/main/java/org/apache/james/container/spring/ container-spring/src/main/java/org/apache/james/container/spring/bean/ container-spring/src/m...

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProvider.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProvider.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProvider.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProvider.java Mon Apr  4 12:26:35 2011
@@ -27,21 +27,26 @@ import org.apache.commons.configuration.
 public interface ConfigurationProvider {
 
     /**
-     * Register a {@link HierarchicalConfiguration} for a bean name.
+     * Register a {@link HierarchicalConfiguration} for a bean name.<br>
      * It is not mandatory to use the registerConfiguration to have the
-     * configuration available as the {@link getConfiguration} method may 
-     * load it based on conventions (naming,...).
+     * configuration available as the {@link getConfiguration} method may load
+     * it based on conventions (naming,...).
      * 
-     * @param beanName The bean name for which the configuration has to be registered.
-     * @param conf The hierarchical configuration to register for the bean name. 
+     * @param beanName
+     *            The bean name for which the configuration has to be
+     *            registered.
+     * @param conf
+     *            The hierarchical configuration to register for the bean name.
      */
     void registerConfiguration(String beanName, HierarchicalConfiguration conf);
 
     /**
-     * Load and return the configuration for the bean with the given name.
-     * The configuration may already be loaded from a previous method invocation 
-     * or from a previous configuration registration via the {@link registerConfiguation}.
-     * This method may implement convention based configuration loading based on naming,...
+     * Load and return the configuration for the bean with the given name. The
+     * configuration may already be loaded from a previous method invocation or
+     * from a previous configuration registration via the
+     * {@link registerConfiguation}.<br>
+     * This method may implement convention based configuration loading based on
+     * naming,...
      * 
      * @param beanName
      * @return config

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProviderImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProviderImpl.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProviderImpl.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/configuration/ConfigurationProviderImpl.java Mon Apr  4 12:26:35 2011
@@ -33,7 +33,6 @@ import org.springframework.core.io.Resou
 
 /**
  * Register Configuration and act as Configuration Provider.
- *
  */
 public class ConfigurationProviderImpl implements ConfigurationProvider, ResourceLoaderAware, InitializingBean {
 
@@ -41,39 +40,44 @@ public class ConfigurationProviderImpl i
      * A map of loaded configuration per bean.
      */
     private Map<String, HierarchicalConfiguration> configurations = new HashMap<String, HierarchicalConfiguration>();
-    
+
     /**
-     * Mappings for bean names associated with their related "resourceName.configPart" pattern.
-     * The resourceName is the XML configuration file name, the configPart is the tag within 
-     * the XML to look for.
+     * Mappings for bean names associated with their related
+     * "resourceName.configPart" pattern.<br>
+     * The resourceName is the XML configuration file name, the configPart is
+     * the tag within the XML to look for.
      */
     private Map<String, String> configurationMappings;
 
     /**
-     * The Spring Resource Loader. Injected via setResourceLoader 
-     * because this class implements ResourceLoaderAware.
+     * The Spring Resource Loader. Injected via setResourceLoader because this
+     * class implements ResourceLoaderAware.
      */
     private ResourceLoader loader;
-    
+
     /**
      * Inject the needed configuration mappings.
      * 
      * @param configurationMappings
      */
-    public void setConfigurationMappings(Map<String,String> configurationMappings) {
+    public void setConfigurationMappings(Map<String, String> configurationMappings) {
         this.configurationMappings = configurationMappings;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.james.container.spring.provider.configuration.ConfigurationProvider#registerConfiguration(java.lang.String, org.apache.commons.configuration.HierarchicalConfiguration)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.james.container.spring.provider.configuration.
+     * ConfigurationProvider#registerConfiguration(java.lang.String,
+     * org.apache.commons.configuration.HierarchicalConfiguration)
      */
     public void registerConfiguration(String beanName, HierarchicalConfiguration conf) {
         configurations.put(beanName, conf);
     }
 
     /**
-     * Responsible to register additional configurations 
-     * for the injected configurationMappings.
+     * Responsible to register additional configurations for the injected
+     * configurationMappings.
      * 
      * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
      */
@@ -88,35 +92,39 @@ public class ConfigurationProviderImpl i
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.james.container.spring.provider.configuration.ConfigurationProvider#getConfiguration(java.lang.String)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.james.container.spring.provider.configuration.
+     * ConfigurationProvider#getConfiguration(java.lang.String)
      */
     public HierarchicalConfiguration getConfiguration(String name) throws ConfigurationException {
 
         HierarchicalConfiguration conf = configurations.get(name);
-        
+
         // Simply return the configuration if it is already loaded.
         if (conf != null) {
             return conf;
-        } 
-        
+        }
+
         // Load the configuration.
         else {
-            
-            // Compute resourceName and configPart (if any, configPart can remain null).
+
+            // Compute resourceName and configPart (if any, configPart can
+            // remain null).
             int i = name.indexOf(".");
             String resourceName;
             String configPart = null;
-            
+
             if (i > -1) {
                 resourceName = name.substring(0, i);
-                configPart = name.substring(i+1);
+                configPart = name.substring(i + 1);
             } else {
                 resourceName = name;
             }
 
-            Resource resource = loader.getResource(getConfigPrefix()+ resourceName + ".xml");
-            
+            Resource resource = loader.getResource(getConfigPrefix() + resourceName + ".xml");
+
             if (resource.exists()) {
                 try {
                     HierarchicalConfiguration config = getConfig(resource);
@@ -125,26 +133,29 @@ public class ConfigurationProviderImpl i
                     } else {
                         return config;
                     }
-                    
+
                 } catch (Exception e) {
-                    throw new ConfigurationException("Unable to load configuration for component " + name, e);                    
+                    throw new ConfigurationException("Unable to load configuration for component " + name, e);
                 }
             }
         }
 
         // Configuration was not loaded, throw exception.
         throw new ConfigurationException("Unable to load configuration for component " + name);
-    
+
     }
 
     /*
      * (non-Javadoc)
-     * @see org.springframework.context.ResourceLoaderAware#setResourceLoader(org.springframework.core.io.ResourceLoader)
+     * 
+     * @see
+     * org.springframework.context.ResourceLoaderAware#setResourceLoader(org
+     * .springframework.core.io.ResourceLoader)
      */
     public void setResourceLoader(ResourceLoader loader) {
         this.loader = loader;
     }
-    
+
     /**
      * Load the xmlConfiguration from the given resource.
      * 
@@ -156,14 +167,15 @@ public class ConfigurationProviderImpl i
     private XMLConfiguration getConfig(Resource r) throws ConfigurationException, IOException {
         XMLConfiguration config = new XMLConfiguration();
         config.setDelimiterParsingDisabled(true);
-        // Use InputStream so we are not bound to File implementations of the config
+        // Use InputStream so we are not bound to File implementations of the
+        // config
         config.load(r.getInputStream());
         return config;
     }
 
     /**
-     * Return the configuration prefix to load the configuration.
-     * In this case its file://conf/
+     * Return the configuration prefix to load the configuration. In this case
+     * its file://conf/
      * 
      * @return prefix
      */

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProvider.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProvider.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProvider.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProvider.java Mon Apr  4 12:26:35 2011
@@ -22,8 +22,6 @@ import org.slf4j.Logger;
 
 /**
  * Provide {@link Logger} instances for Beans
- * 
- *
  */
 public interface LogProvider {
 
@@ -34,9 +32,10 @@ public interface LogProvider {
      * @return log
      */
     Logger getLog(String beanName);
-    
+
     /**
-     * Register a {@link Logger} for a beanName. The registered Log will get returned by {@link #getLog(String)}
+     * Register a {@link Logger} for a beanName. The registered Log will get
+     * returned by {@link #getLog(String)}
      * 
      * @param beanName
      * @param log

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderImpl.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderImpl.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderImpl.java Mon Apr  4 12:26:35 2011
@@ -33,8 +33,6 @@ import org.springframework.beans.factory
 
 /**
  * Provide a Log object for components
- * 
- *
  */
 public class LogProviderImpl implements LogProvider, InitializingBean, LogProviderManagementMBean {
 
@@ -52,19 +50,20 @@ public class LogProviderImpl implements 
         return LoggerFactory.getLogger(loggerName);
     }
 
-
-    public void setLogMappings(Map<String,String> logs) {
+    public void setLogMappings(Map<String, String> logs) {
         this.logs = logs;
     }
 
     /*
      * (non-Javadoc)
-     * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+     * 
+     * @see
+     * org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
      */
     public void afterPropertiesSet() throws Exception {
         if (logs != null) {
             Iterator<String> it = logs.keySet().iterator();
-            while(it.hasNext()) {
+            while (it.hasNext()) {
                 String key = it.next();
                 String value = logs.get(key);
                 registerLog(key, createLog(PREFIX + value));
@@ -74,7 +73,10 @@ public class LogProviderImpl implements 
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.container.spring.lifecycle.LogProvider#getLog(java.lang.String)
+     * 
+     * @see
+     * org.apache.james.container.spring.lifecycle.LogProvider#getLog(java.lang
+     * .String)
      */
     public Logger getLog(String name) {
         logMap.putIfAbsent(name, createLog(PREFIX + name));
@@ -83,49 +85,59 @@ public class LogProviderImpl implements 
 
     /*
      * (non-Javadoc)
-     * @see org.apache.james.container.spring.lifecycle.LogProvider#registerLog(java.lang.String, org.slf4j.Logger)
+     * 
+     * @see
+     * org.apache.james.container.spring.lifecycle.LogProvider#registerLog(java
+     * .lang.String, org.slf4j.Logger)
      */
     public void registerLog(String beanName, Logger log) {
         logMap.put(beanName, log);
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.container.spring.provider.log.LogProviderManagementMBean#getSupportedLogLevels()
+     * 
+     * @see
+     * org.apache.james.container.spring.provider.log.LogProviderManagementMBean
+     * #getSupportedLogLevels()
      */
     public List<String> getSupportedLogLevels() {
         return Arrays.asList("DEBUG", "INFO", "WARN", "ERROR", "OFF");
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.container.spring.provider.log.LogProviderManagementMBean#getLogLevels()
+     * 
+     * @see
+     * org.apache.james.container.spring.provider.log.LogProviderManagementMBean
+     * #getLogLevels()
      */
     public Map<String, String> getLogLevels() {
         TreeMap<String, String> levels = new TreeMap<String, String>();
         Iterator<String> names = logMap.keySet().iterator();
-        while(names.hasNext()) {
+        while (names.hasNext()) {
             String name = names.next();
             String level = getLogLevel(name);
-            if (level != null) levels.put(name, level);
+            if (level != null)
+                levels.put(name, level);
         }
         return levels;
 
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.container.spring.provider.log.LogProviderManagementMBean#getLogLevel(java.lang.String)
+     * 
+     * @see
+     * org.apache.james.container.spring.provider.log.LogProviderManagementMBean
+     * #getLogLevel(java.lang.String)
      */
     public String getLogLevel(String component) {
         Logger log = logMap.get(component);
         if (log == null) {
-            throw new IllegalArgumentException("No Log for component "+ component);
+            throw new IllegalArgumentException("No Log for component " + component);
         }
-        org.apache.log4j.Logger logger = ((org.apache.log4j.Logger)log).getRootLogger();
+        org.apache.log4j.Logger logger = ((org.apache.log4j.Logger) log).getRootLogger();
         if (logger == null || logger.getLevel() == null) {
             return null;
         }
@@ -133,17 +145,19 @@ public class LogProviderImpl implements 
         return level.toString();
     }
 
-
     /*
      * (non-Javadoc)
-     * @see org.apache.james.container.spring.provider.log.LogProviderManagementMBean#setLogLevel(java.lang.String, java.lang.String)
+     * 
+     * @see
+     * org.apache.james.container.spring.provider.log.LogProviderManagementMBean
+     * #setLogLevel(java.lang.String, java.lang.String)
      */
     public void setLogLevel(String component, String loglevel) {
         if (getSupportedLogLevels().contains(loglevel) == false) {
             throw new IllegalArgumentException("Not supported loglevel given");
         } else {
-            ((org.apache.log4j.Logger)logMap.get(component)).getRootLogger().setLevel(Level.toLevel(loglevel));
+            ((org.apache.log4j.Logger) logMap.get(component)).getRootLogger().setLevel(Level.toLevel(loglevel));
         }
     }
-    
+
 }

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderManagementMBean.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderManagementMBean.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/provider/log/LogProviderManagementMBean.java Mon Apr  4 12:26:35 2011
@@ -23,16 +23,15 @@ import java.util.Map;
 
 /**
  * Allow to change loglevel via JMX
- *
  */
 public interface LogProviderManagementMBean {
-    
+
     List<String> getSupportedLogLevels();
-    
+
     Map<String, String> getLogLevels();
-    
+
     String getLogLevel(String component);
-    
+
     void setLogLevel(String component, String loglevel);
 
 }

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/AbstractJamesResourceLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/AbstractJamesResourceLoader.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/AbstractJamesResourceLoader.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/AbstractJamesResourceLoader.java Mon Apr  4 12:26:35 2011
@@ -28,17 +28,14 @@ import org.springframework.core.io.FileS
 import org.springframework.core.io.Resource;
 
 /**
- * Abstract base class which load JAMES files based on the prefix. This can be used in different 
- * {@link ApplicationContext} implementations
- * 
- *
+ * Abstract base class which load JAMES files based on the prefix. This can be
+ * used in different {@link ApplicationContext} implementations
  */
-public abstract class AbstractJamesResourceLoader extends DefaultResourceLoader implements JamesResourceLoader{
+public abstract class AbstractJamesResourceLoader extends DefaultResourceLoader implements JamesResourceLoader {
 
-    
-    
     /**
-     * Return the {@link Resource} for the given url. If the resource can not be found null get returned
+     * Return the {@link Resource} for the given url. If the resource can not be
+     * found null get returned
      * 
      * @see org.springframework.core.io.ResourceLoader#getResource(java.lang.String)
      */
@@ -65,6 +62,5 @@ public abstract class AbstractJamesResou
         }
         return r;
     }
-    
-}
 
+}

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/JamesResourceLoader.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/JamesResourceLoader.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/JamesResourceLoader.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/resource/JamesResourceLoader.java Mon Apr  4 12:26:35 2011
@@ -21,11 +21,10 @@ package org.apache.james.container.sprin
 import org.springframework.core.io.ResourceLoader;
 
 /**
- * {@link ResourceLoader} which offer extra methods to retrieve the Path to all important
- * Directories, which are in use by JAMES.
- *
+ * {@link ResourceLoader} which offer extra methods to retrieve the Path to all
+ * important Directories, which are in use by JAMES.
  */
-public interface JamesResourceLoader extends ResourceLoader{
+public interface JamesResourceLoader extends ResourceLoader {
 
     /**
      * Return the configuration directory of the application
@@ -34,7 +33,6 @@ public interface JamesResourceLoader ext
      */
     String getAbsoluteDirectory();
 
-    
     /**
      * Return the var directory of the application
      * 
@@ -42,7 +40,6 @@ public interface JamesResourceLoader ext
      */
     String getConfDirectory();
 
-    
     /**
      * Return the absolute directory of the application
      * 
@@ -57,5 +54,4 @@ public interface JamesResourceLoader ext
      */
     String getRootDirectory();
 
-    
 }

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java Mon Apr  4 12:26:35 2011
@@ -48,34 +48,34 @@ import org.slf4j.Logger;
  * Tool to import James 2.3 users and mails into James 3.0.
  */
 public class James23Importer implements LogEnabled {
-    
+
     /**
      * The logger.
      */
     private Logger log;
-    
+
     /**
      * James 3.0 users repository.
      */
-    @Resource(name="usersrepository")
+    @Resource(name = "usersrepository")
     private UsersRepository james30UsersRepository;
 
     /**
      * James 3.0 users repository.
      */
-    @Resource(name="mailrepositorystore")
+    @Resource(name = "mailrepositorystore")
     private MailRepositoryStore mailRepositoryStore;
 
     /**
      * James 3.0 domain list.
      */
-    @Resource(name="domainlist")
+    @Resource(name = "domainlist")
     private DomainList domainList;
 
     /**
      * The mailbox manager needed to copy the mails to.
      */
-    @Resource(name="mailboxmanager")
+    @Resource(name = "mailboxmanager")
     private MailboxManager mailboxManager;
 
     /**
@@ -83,23 +83,23 @@ public class James23Importer implements 
      */
     @Resource(name = "usersrepository23")
     private UsersRepository james23UsersRepository;
-    
+
     /**
-     * Import 2.3 users to 3.0 users (taking virtualDomains into account)
+     * Import 2.3 users to 3.0 users (taking virtualDomains into account)<br>
      * Import 2.3 mails to 3.0 mails.
      * 
      * @throws MailRepositoryStoreException
      * @throws MessagingException
-     * @throws UsersRepositoryException 
-     * @throws DomainListException 
-     * @throws IOException 
-     * @throws MailboxException 
+     * @throws UsersRepositoryException
+     * @throws DomainListException
+     * @throws IOException
+     * @throws MailboxException
      */
     public void importUsersAndMailsFromJames23(String james23MailRepositoryPath, String defaultPassword) throws MailRepositoryStoreException, MessagingException, UsersRepositoryException, DomainListException, MailboxException, IOException {
         importUsersFromJames23(defaultPassword);
         importMailsFromJames23(james23MailRepositoryPath);
     }
-    
+
     /**
      * Import 2.3 users to 3.0 users (taking virtualDomains into account)
      * 
@@ -117,33 +117,35 @@ public class James23Importer implements 
             log.info("New user is copied from 2.3 to 3.0 with username=" + userName30);
         }
     }
-    
+
     /**
      * Import 2.3 mails to 3.0 mails.
      * 
-     * @param james23MailRepositoryPath the 2.3 mail repository path to import from e.g. file://var/mail/inboxes
+     * @param james23MailRepositoryPath
+     *            the 2.3 mail repository path to import from e.g.
+     *            file://var/mail/inboxes
      * @throws MessagingException
      * @throws MailRepositoryStoreException
      * @throws UsersRepositoryException
-     * @throws IOException 
-     * @throws MailboxException 
-     * @throws DomainListException 
+     * @throws IOException
+     * @throws MailboxException
+     * @throws DomainListException
      */
     public void importMailsFromJames23(String james23MailRepositoryPath) throws MessagingException, MailRepositoryStoreException, UsersRepositoryException, MailboxException, IOException, DomainListException {
-        
+
         Flags flags = new Flags();
         boolean isRecent = false;
-        
+
         Iterator<String> james23userRepositoryIterator = james23UsersRepository.list();
-        
+
         while (james23userRepositoryIterator.hasNext()) {
-            
+
             String userName23 = james23userRepositoryIterator.next();
             MailRepository mailRepository = mailRepositoryStore.select(james23MailRepositoryPath + "/" + userName23);
             Iterator<String> mailRepositoryIterator = mailRepository.list();
-            
+
             String userName30 = convert23UserTo30(userName23);
-            
+
             MailboxPath mailboxPath = MailboxPath.inbox(userName30);
 
             MailboxSession mailboxSession = mailboxManager.createSystemSession(userName30, log);
@@ -151,8 +153,7 @@ public class James23Importer implements 
             mailboxManager.startProcessingRequest(mailboxSession);
             try {
                 mailboxManager.createMailbox(mailboxPath, mailboxSession);
-            }
-            catch (MailboxExistsException e) {
+            } catch (MailboxExistsException e) {
                 // Do nothing, the mailbox already exists.
             }
             mailboxManager.endProcessingRequest(mailboxSession);
@@ -162,29 +163,27 @@ public class James23Importer implements 
             while (mailRepositoryIterator.hasNext()) {
                 Mail mail = mailRepository.retrieve(mailRepositoryIterator.next());
                 mailboxManager.startProcessingRequest(mailboxSession);
-                messageManager.appendMessage(new MimeMessageInputStream(mail.getMessage()), 
-                        new Date(), 
-                        mailboxSession, 
-                        isRecent, 
-                        flags);
+                messageManager.appendMessage(new MimeMessageInputStream(mail.getMessage()), new Date(), mailboxSession, isRecent, flags);
                 mailboxManager.endProcessingRequest(mailboxSession);
             }
-            
+
         }
-        
+
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.james.lifecycle.api.LogEnabled#setLog(org.slf4j.Logger)
      */
     public void setLog(Logger log) {
         this.log = log;
     }
-    
+
     /**
-     * Utility method to convert a James 2.3 username to a 
-     * James 3.0 username. To achieve this, we need to add 
-     * the default James 3.0 domain because 2.3 users have no domains.
+     * Utility method to convert a James 2.3 username to a James 3.0 username.
+     * To achieve this, we need to add the default James 3.0 domain because 2.3
+     * users have no domains.
      * 
      * @param userName23
      * @return

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java Mon Apr  4 12:26:35 2011
@@ -36,11 +36,15 @@ public class James23ImporterManagement i
     /**
      * 
      */
-    @Resource(name="james23importer")
+    @Resource(name = "james23importer")
     private James23Importer james23Importer;
-    
-    /* (non-Javadoc)
-     * @see org.apache.james.container.spring.tool.James23ImporterManagementMBean#importUsersAndMailsFromJames23(java.lang.String, java.lang.String)
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.james.container.spring.tool.James23ImporterManagementMBean
+     * #importUsersAndMailsFromJames23(java.lang.String, java.lang.String)
      */
     public void importUsersAndMailsFromJames23(String james23MailRepositoryPath, String defaultPassword) throws Exception {
         try {
@@ -58,8 +62,12 @@ public class James23ImporterManagement i
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.james.container.spring.tool.James23ImporterManagementMBean#importUsersFromJames23(java.lang.String)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.james.container.spring.tool.James23ImporterManagementMBean
+     * #importUsersFromJames23(java.lang.String)
      */
     public void importUsersFromJames23(String defaultPassword) throws Exception {
         try {
@@ -73,8 +81,12 @@ public class James23ImporterManagement i
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.james.container.spring.tool.James23ImporterManagementMBean#importMailsFromJames23(java.lang.String)
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.james.container.spring.tool.James23ImporterManagementMBean
+     * #importMailsFromJames23(java.lang.String)
      */
     public void importMailsFromJames23(String james23MailRepositoryPath) throws Exception {
         try {
@@ -82,21 +94,21 @@ public class James23ImporterManagement i
         } catch (Exception e) {
             e.printStackTrace();
             throw new Exception(e.getMessage());
-//        } catch (MailboxException e) {
-//            e.printStackTrace();
-//            throw new Exception(e.getMessage());
-//        } catch (MailRepositoryStoreException e) {
-//            e.printStackTrace();
-//            throw new Exception(e.getMessage());
-//        } catch (MessagingException e) {
-//            e.printStackTrace();
-//            throw new Exception(e.getMessage());
-//        } catch (UsersRepositoryException e) {
-//            e.printStackTrace();
-//            throw new Exception(e.getMessage());
-//        } catch (IOException e) {
-//            e.printStackTrace();
-//            throw new Exception(e.getMessage());
+            // } catch (MailboxException e) {
+            // e.printStackTrace();
+            // throw new Exception(e.getMessage());
+            // } catch (MailRepositoryStoreException e) {
+            // e.printStackTrace();
+            // throw new Exception(e.getMessage());
+            // } catch (MessagingException e) {
+            // e.printStackTrace();
+            // throw new Exception(e.getMessage());
+            // } catch (UsersRepositoryException e) {
+            // e.printStackTrace();
+            // throw new Exception(e.getMessage());
+            // } catch (IOException e) {
+            // e.printStackTrace();
+            // throw new Exception(e.getMessage());
         }
     }
 

Modified: james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagementMBean.java
URL: http://svn.apache.org/viewvc/james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagementMBean.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagementMBean.java (original)
+++ james/server/trunk/container-spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagementMBean.java Mon Apr  4 12:26:35 2011
@@ -22,8 +22,6 @@ import org.apache.james.mailbox.MailboxM
 
 /**
  * Allow to copy {@link MailboxManager} contents from one to the other via JMX
- * 
- *
  */
 public interface James23ImporterManagementMBean {
     

Modified: james/server/trunk/core/src/main/java/org/apache/james/core/InternetHeadersInputStream.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core/src/main/java/org/apache/james/core/InternetHeadersInputStream.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/core/src/main/java/org/apache/james/core/InternetHeadersInputStream.java (original)
+++ james/server/trunk/core/src/main/java/org/apache/james/core/InternetHeadersInputStream.java Mon Apr  4 12:26:35 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.core;
 
 import java.io.IOException;
@@ -29,27 +27,27 @@ import java.util.Enumeration;
 import javax.mail.internet.InternetHeaders;
 
 /**
- * Provide an {@link InputStream} over an {@link InternetHeaders} instance. When the end of {@link InternetHeaders} are reached a {@link #LINE_SEPERATOR} is append
- * 
- *
+ * Provide an {@link InputStream} over an {@link InternetHeaders} instance. When
+ * the end of {@link InternetHeaders} are reached a {@link #LINE_SEPERATOR} is
+ * append
  */
-public class InternetHeadersInputStream extends InputStream{
+public class InternetHeadersInputStream extends InputStream {
 
     private final static String LINE_SEPERATOR = "\r\n";
-    
+
     private Enumeration<String> headerLines;
     private byte[] currLine;
     private int pos = 0;
-    
+
     @SuppressWarnings("unchecked")
     public InternetHeadersInputStream(InternetHeaders headers) {
         this(headers.getAllHeaderLines());
     }
-    
+
     public InternetHeadersInputStream(Enumeration<String> headerLines) {
         this.headerLines = headerLines;
     }
-    
+
     @Override
     public int read() throws IOException {
         if (currLine == null || pos == currLine.length) {
@@ -67,11 +65,11 @@ public class InternetHeadersInputStream 
      * 
      * @throws IOException
      */
-    private boolean readNextLine() throws IOException{
+    private boolean readNextLine() throws IOException {
         if (headerLines.hasMoreElements()) {
             try {
                 pos = 0;
-                String line =  (headerLines.nextElement() + LINE_SEPERATOR);
+                String line = (headerLines.nextElement() + LINE_SEPERATOR);
                 // Add seperator to show that headers are complete
                 if (headerLines.hasMoreElements() == false) {
                     line += LINE_SEPERATOR;
@@ -86,11 +84,10 @@ public class InternetHeadersInputStream 
             return false;
         }
     }
-    
+
     @Override
     public void close() throws IOException {
         currLine = null;
     }
-    
-    
+
 }

Modified: james/server/trunk/core/src/main/java/org/apache/james/core/MailHeaders.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core/src/main/java/org/apache/james/core/MailHeaders.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/core/src/main/java/org/apache/james/core/MailHeaders.java (original)
+++ james/server/trunk/core/src/main/java/org/apache/james/core/MailHeaders.java Mon Apr  4 12:26:35 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.core;
 
 import java.io.ByteArrayOutputStream;
@@ -34,54 +32,60 @@ import org.apache.mailet.base.RFC2822Hea
 
 /**
  * This interface defines a container for mail headers. Each header must use
- * MIME format: <pre>name: value</pre>.
- *
+ * MIME format:
+ * 
+ * <pre>
+ * name: value
+ * </pre>
  */
 public class MailHeaders extends InternetHeaders implements Serializable, Cloneable {
 
     private static final long serialVersionUID = 238748126601L;
     private boolean modified = false;
     private long size = -1;
-    
-	/**
+
+    /**
      * No argument constructor
-     *
-     * @throws MessagingException if the super class cannot be properly instantiated
+     * 
+     * @throws MessagingException
+     *             if the super class cannot be properly instantiated
      */
     public MailHeaders() throws MessagingException {
         super();
     }
 
     /**
-     * Constructor that takes an InputStream containing the contents
-     * of the set of mail headers.
-     *
-     * @param in the InputStream containing the header data
-     *
-     * @throws MessagingException if the super class cannot be properly instantiated
-     *                            based on the stream
+     * Constructor that takes an InputStream containing the contents of the set
+     * of mail headers.
+     * 
+     * @param in
+     *            the InputStream containing the header data
+     * 
+     * @throws MessagingException
+     *             if the super class cannot be properly instantiated based on
+     *             the stream
      */
     public MailHeaders(InputStream in) throws MessagingException {
         super();
         load(in);
     }
 
-
     /**
      * Write the headers to an output stream
-     *
-     * @param out the OutputStream to which to write the headers
+     * 
+     * @param out
+     *            the OutputStream to which to write the headers
      */
-    public void writeTo(OutputStream out) throws MessagingException{
+    public void writeTo(OutputStream out) throws MessagingException {
         MimeMessageUtil.writeHeadersTo(getAllHeaderLines(), out);
     }
 
     /**
      * Generate a representation of the headers as a series of bytes.
-     *
+     * 
      * @return the byte array containing the headers
      */
-    public byte[] toByteArray() throws MessagingException{
+    public byte[] toByteArray() throws MessagingException {
         ByteArrayOutputStream headersBytes = new ByteArrayOutputStream();
         writeTo(headersBytes);
         return headersBytes.toByteArray();
@@ -89,7 +93,7 @@ public class MailHeaders extends Interne
 
     /**
      * Check if a particular header is present.
-     *
+     * 
      * @return true if the header is present, false otherwise
      */
     public boolean isSet(String name) {
@@ -99,10 +103,11 @@ public class MailHeaders extends Interne
 
     /**
      * If the new header is a Return-Path we get sure that we add it to the top
-     * Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with 
-     * a return-path in the middle.
-     *
-     * @see javax.mail.internet.InternetHeaders#addHeader(java.lang.String, java.lang.String)
+     * Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream
+     * with a return-path in the middle.
+     * 
+     * @see javax.mail.internet.InternetHeaders#addHeader(java.lang.String,
+     *      java.lang.String)
      */
     public synchronized void addHeader(String arg0, String arg1) {
         if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) {
@@ -115,17 +120,18 @@ public class MailHeaders extends Interne
 
     /**
      * If the new header is a Return-Path we get sure that we add it to the top
-     * Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream with 
-     * a return-path in the middle.
-     *
-     * @see javax.mail.internet.InternetHeaders#setHeader(java.lang.String, java.lang.String)
+     * Javamail, at least until 1.4.0 does the wrong thing if it loaded a stream
+     * with a return-path in the middle.
+     * 
+     * @see javax.mail.internet.InternetHeaders#setHeader(java.lang.String,
+     *      java.lang.String)
      */
     public synchronized void setHeader(String arg0, String arg1) {
         if (RFC2822Headers.RETURN_PATH.equalsIgnoreCase(arg0)) {
             super.removeHeader(arg0);
         }
         super.setHeader(arg0, arg1);
-        
+
         modified();
     }
 
@@ -145,17 +151,16 @@ public class MailHeaders extends Interne
         modified = true;
         size = -1;
     }
-    
+
     /**
-     * Check if all REQUIRED headers fields as specified in RFC 822
-     * are present.
-     *
+     * Check if all REQUIRED headers fields as specified in RFC 822 are present.
+     * 
      * @return true if the headers are present, false otherwise
      */
     public boolean isValid() {
         return (isSet(RFC2822Headers.DATE) && isSet(RFC2822Headers.TO) && isSet(RFC2822Headers.FROM));
     }
-    
+
     /**
      * Return the size of the headers
      * 

Modified: james/server/trunk/core/src/main/java/org/apache/james/core/MailImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core/src/main/java/org/apache/james/core/MailImpl.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/core/src/main/java/org/apache/james/core/MailImpl.java (original)
+++ james/server/trunk/core/src/main/java/org/apache/james/core/MailImpl.java Mon Apr  4 12:26:35 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.core;
 
 import org.apache.james.lifecycle.api.Disposable;
@@ -47,22 +45,31 @@ import java.util.Iterator;
 import java.util.UUID;
 
 /**
- * <P>Wraps a MimeMessage adding routing information (from SMTP) and some simple
- * API enhancements.</P>
- * <P>From James version > 2.2.0a8 "mail attributes" have been added.
- * Backward and forward compatibility is supported:
- * messages stored in file repositories <I>without</I> attributes by James version <= 2.2.0a8
- * will be processed by later versions as having an empty attributes hashmap;
- * messages stored in file repositories <I>with</I> attributes by James version > 2.2.0a8
- * will be processed by previous versions, ignoring the attributes.</P>
- *
- * @version CVS $Revision$ $Date$
+ * <p>
+ * Wraps a MimeMessage adding routing information (from SMTP) and some simple
+ * API enhancements.
+ * </p>
+ * <p>
+ * From James version > 2.2.0a8 "mail attributes" have been added. Backward and
+ * forward compatibility is supported:
+ * <ul>
+ * <li>messages stored in file repositories <i>without</i> attributes by James
+ * version <= 2.2.0a8 will be processed by later versions as having an empty
+ * attributes hashmap;</li>
+ * <li>messages stored in file repositories <i>with</i> attributes by James
+ * version > 2.2.0a8 will be processed by previous versions, ignoring the
+ * attributes.</li>
+ * </ul>
+ * </p>
+ * 
+ * @version CVS $Revision$ $Date: 2010-12-16 15:18:27 +0100 (Thu, 16
+ *          Dec 2010) $
  */
 public class MailImpl implements Disposable, Mail {
-    
+
     /**
-     * We hardcode the serialVersionUID so that from James 1.2 on,
-     * MailImpl will be deserializable (so your mail doesn't get lost)
+     * We hardcode the serialVersionUID so that from James 1.2 on, MailImpl will
+     * be deserializable (so your mail doesn't get lost)
      */
     public static final long serialVersionUID = -4289663364703986260L;
     /**
@@ -105,6 +112,7 @@ public class MailImpl implements Disposa
      * Attributes added to this MailImpl instance
      */
     private HashMap attributes;
+
     /**
      * A constructor that creates a new, uninitialized MailImpl
      */
@@ -112,13 +120,17 @@ public class MailImpl implements Disposa
         setState(Mail.DEFAULT);
         attributes = new HashMap();
     }
+
     /**
-     * A constructor that creates a MailImpl with the specified name,
-     * sender, and recipients.
-     *
-     * @param name the name of the MailImpl
-     * @param sender the sender for this MailImpl
-     * @param recipients the collection of recipients of this MailImpl
+     * A constructor that creates a MailImpl with the specified name, sender,
+     * and recipients.
+     * 
+     * @param name
+     *            the name of the MailImpl
+     * @param sender
+     *            the sender for this MailImpl
+     * @param recipients
+     *            the collection of recipients of this MailImpl
      */
     public MailImpl(String name, MailAddress sender, Collection recipients) {
         this();
@@ -135,12 +147,14 @@ public class MailImpl implements Disposa
             }
         }
     }
-    
+
     /**
      * Create a copy of the input mail and assign it a new name
      * 
-     * @param mail original mail
-     * @throws MessagingException when the message is not clonable
+     * @param mail
+     *            original mail
+     * @throws MessagingException
+     *             when the message is not clonable
      */
     public MailImpl(Mail mail) throws MessagingException {
         this(mail, newName(mail));
@@ -161,9 +175,9 @@ public class MailImpl implements Disposa
                 setAttributesRaw((HashMap) cloneSerializableObject(((MailImpl) mail).getAttributesRaw()));
             } else {
                 HashMap attribs = new HashMap();
-                for (Iterator i = mail.getAttributeNames(); i.hasNext(); ) {
+                for (Iterator i = mail.getAttributeNames(); i.hasNext();) {
                     String hashKey = (String) i.next();
-                    attribs.put(hashKey,cloneSerializableObject(mail.getAttribute(hashKey)));
+                    attribs.put(hashKey, cloneSerializableObject(mail.getAttribute(hashKey)));
                 }
                 setAttributesRaw(attribs);
             }
@@ -177,16 +191,19 @@ public class MailImpl implements Disposa
     }
 
     /**
-     * A constructor that creates a MailImpl with the specified name,
-     * sender, recipients, and message data.
-     *
-     * @param name the name of the MailImpl
-     * @param sender the sender for this MailImpl
-     * @param recipients the collection of recipients of this MailImpl
-     * @param messageIn a stream containing the message source
+     * A constructor that creates a MailImpl with the specified name, sender,
+     * recipients, and message data.
+     * 
+     * @param name
+     *            the name of the MailImpl
+     * @param sender
+     *            the sender for this MailImpl
+     * @param recipients
+     *            the collection of recipients of this MailImpl
+     * @param messageIn
+     *            a stream containing the message source
      */
-    public MailImpl(String name, MailAddress sender, Collection recipients, InputStream messageIn)
-        throws MessagingException {
+    public MailImpl(String name, MailAddress sender, Collection recipients, InputStream messageIn) throws MessagingException {
         this(name, sender, recipients);
         MimeMessageSource source = new MimeMessageInputStreamSource(name, messageIn);
         // if MimeMessageCopyOnWriteProxy throws an error in the constructor we
@@ -200,161 +217,183 @@ public class MailImpl implements Disposa
     }
 
     /**
-     * A constructor that creates a MailImpl with the specified name,
-     * sender, recipients, and MimeMessage.
-     *
-     * @param name the name of the MailImpl
-     * @param sender the sender for this MailImpl
-     * @param recipients the collection of recipients of this MailImpl
-     * @param message the MimeMessage associated with this MailImpl
+     * A constructor that creates a MailImpl with the specified name, sender,
+     * recipients, and MimeMessage.
+     * 
+     * @param name
+     *            the name of the MailImpl
+     * @param sender
+     *            the sender for this MailImpl
+     * @param recipients
+     *            the collection of recipients of this MailImpl
+     * @param message
+     *            the MimeMessage associated with this MailImpl
      */
     public MailImpl(String name, MailAddress sender, Collection recipients, MimeMessage message) throws MessagingException {
         this(name, sender, recipients);
         this.setMessage(new MimeMessageCopyOnWriteProxy(message));
     }
 
-
     /**
      * Duplicate the MailImpl.
-     *
+     * 
      * @return a MailImpl that is a duplicate of this one
      */
     public Mail duplicate() {
         return duplicate(name);
     }
+
     /**
-     * Duplicate the MailImpl, replacing the mail name with the one
-     * passed in as an argument.
-     *
-     * @param newName the name for the duplicated mail
-     *
+     * Duplicate the MailImpl, replacing the mail name with the one passed in as
+     * an argument.
+     * 
+     * @param newName
+     *            the name for the duplicated mail
+     * 
      * @return a MailImpl that is a duplicate of this one with a different name
      */
     public Mail duplicate(String newName) {
         try {
             return new MailImpl(this, newName);
         } catch (MessagingException me) {
-            // Ignored.  Return null in the case of an error.
+            // Ignored. Return null in the case of an error.
         }
         return null;
     }
+
     /**
      * Get the error message associated with this MailImpl.
-     *
+     * 
      * @return the error message associated with this MailImpl
      */
     public String getErrorMessage() {
         return errorMessage;
     }
+
     /**
      * Get the MimeMessage associated with this MailImpl.
-     *
+     * 
      * @return the MimeMessage associated with this MailImpl
      */
     public MimeMessage getMessage() throws MessagingException {
         return message;
     }
-    
+
     /**
      * Set the name of this MailImpl.
-     *
-     * @param name the name of this MailImpl
+     * 
+     * @param name
+     *            the name of this MailImpl
      */
     public void setName(String name) {
         this.name = name;
     }
+
     /**
      * Get the name of this MailImpl.
-     *
+     * 
      * @return the name of this MailImpl
      */
     public String getName() {
         return name;
     }
+
     /**
      * Get the recipients of this MailImpl.
-     *
+     * 
      * @return the recipients of this MailImpl
      */
     public Collection getRecipients() {
         return recipients;
     }
+
     /**
      * Get the sender of this MailImpl.
-     *
+     * 
      * @return the sender of this MailImpl
      */
     public MailAddress getSender() {
         return sender;
     }
+
     /**
      * Get the state of this MailImpl.
-     *
+     * 
      * @return the state of this MailImpl
      */
     public String getState() {
         return state;
     }
+
     /**
      * Get the remote host associated with this MailImpl.
-     *
+     * 
      * @return the remote host associated with this MailImpl
      */
     public String getRemoteHost() {
         return remoteHost;
     }
+
     /**
      * Get the remote address associated with this MailImpl.
-     *
+     * 
      * @return the remote address associated with this MailImpl
      */
     public String getRemoteAddr() {
         return remoteAddr;
     }
+
     /**
      * Get the last updated time for this MailImpl.
-     *
+     * 
      * @return the last updated time for this MailImpl
      */
     public Date getLastUpdated() {
         return lastUpdated;
     }
-    
+
     /**
-     * <p>Return the size of the message including its headers.
-     * MimeMessage.getSize() method only returns the size of the
-     * message body.</p>
-     *
-     * <p>Note: this size is not guaranteed to be accurate - see Sun's
-     * documentation of MimeMessage.getSize().</p>
-     *
+     * <p>
+     * Return the size of the message including its headers.
+     * MimeMessage.getSize() method only returns the size of the message body.
+     * </p>
+     * 
+     * <p>
+     * Note: this size is not guaranteed to be accurate - see Sun's
+     * documentation of MimeMessage.getSize().
+     * </p>
+     * 
      * @return approximate size of full message including headers.
-     *
-     * @throws MessagingException if a problem occurs while computing the message size
+     * 
+     * @throws MessagingException
+     *             if a problem occurs while computing the message size
      */
     public long getMessageSize() throws MessagingException {
         return MimeMessageUtil.getMessageSize(message);
     }
-    
+
     /**
      * Set the error message associated with this MailImpl.
-     *
-     * @param msg the new error message associated with this MailImpl
+     * 
+     * @param msg
+     *            the new error message associated with this MailImpl
      */
     public void setErrorMessage(String msg) {
         this.errorMessage = msg;
     }
+
     /**
      * Set the MimeMessage associated with this MailImpl.
-     *
-     * @param message the new MimeMessage associated with this MailImpl
+     * 
+     * @param message
+     *            the new MimeMessage associated with this MailImpl
      */
     public void setMessage(MimeMessage message) {
-    
-        //TODO: We should use the MimeMessageCopyOnWriteProxy
-        //      everytime we set the MimeMessage. We should
-        //      investigate if we should wrap it here
-    
+
+        // TODO: We should use the MimeMessageCopyOnWriteProxy
+        // everytime we set the MimeMessage. We should
+        // investigate if we should wrap it here
+
         if (this.message != message) {
             // If a setMessage is called on a Mail that already have a message
             // (discouraged) we have to make sure that the message we remove is
@@ -365,50 +404,62 @@ public class MailImpl implements Disposa
             this.message = message;
         }
     }
+
     /**
      * Set the recipients for this MailImpl.
-     *
-     * @param recipients the recipients for this MailImpl
+     * 
+     * @param recipients
+     *            the recipients for this MailImpl
      */
     public void setRecipients(Collection recipients) {
         this.recipients = recipients;
     }
+
     /**
      * Set the sender of this MailImpl.
-     *
-     * @param sender the sender of this MailImpl
+     * 
+     * @param sender
+     *            the sender of this MailImpl
      */
     public void setSender(MailAddress sender) {
         this.sender = sender;
     }
+
     /**
      * Set the state of this MailImpl.
-     *
-     * @param state the state of this MailImpl
+     * 
+     * @param state
+     *            the state of this MailImpl
      */
     public void setState(String state) {
         this.state = state;
     }
+
     /**
      * Set the remote address associated with this MailImpl.
-     *
-     * @param remoteHost the new remote host associated with this MailImpl
+     * 
+     * @param remoteHost
+     *            the new remote host associated with this MailImpl
      */
     public void setRemoteHost(String remoteHost) {
         this.remoteHost = remoteHost;
     }
+
     /**
      * Set the remote address associated with this MailImpl.
-     *
-     * @param remoteAddr the new remote address associated with this MailImpl
+     * 
+     * @param remoteAddr
+     *            the new remote address associated with this MailImpl
      */
     public void setRemoteAddr(String remoteAddr) {
         this.remoteAddr = remoteAddr;
     }
+
     /**
      * Set the date this mail was last updated.
-     *
-     * @param lastUpdated the date the mail was last updated
+     * 
+     * @param lastUpdated
+     *            the date the mail was last updated
      */
     public void setLastUpdated(Date lastUpdated) {
         // Make a defensive copy to ensure that the date
@@ -418,13 +469,17 @@ public class MailImpl implements Disposa
         }
         this.lastUpdated = lastUpdated;
     }
+
     /**
      * Writes the message out to an OutputStream.
-     *
-     * @param out the OutputStream to which to write the content
-     *
-     * @throws MessagingException if the MimeMessage is not set for this MailImpl
-     * @throws IOException if an error occurs while reading or writing from the stream
+     * 
+     * @param out
+     *            the OutputStream to which to write the content
+     * 
+     * @throws MessagingException
+     *             if the MimeMessage is not set for this MailImpl
+     * @throws IOException
+     *             if an error occurs while reading or writing from the stream
      */
     public void writeMessageTo(OutputStream out) throws IOException, MessagingException {
         if (message != null) {
@@ -433,21 +488,24 @@ public class MailImpl implements Disposa
             throw new MessagingException("No message set for this MailImpl.");
         }
     }
-    
+
     // Serializable Methods
-    // TODO: These need some work.  Currently very tightly coupled to
-    //       the internal representation.
+    // TODO: These need some work. Currently very tightly coupled to
+    // the internal representation.
     /**
      * Read the MailImpl from an <code>ObjectInputStream</code>.
-     *
-     * @param in the ObjectInputStream from which the object is read
-     *
-     * @throws IOException if an error occurs while reading from the stream
-     * @throws ClassNotFoundException ?
-     * @throws ClassCastException if the serialized objects are not of the appropriate type
+     * 
+     * @param in
+     *            the ObjectInputStream from which the object is read
+     * 
+     * @throws IOException
+     *             if an error occurs while reading from the stream
+     * @throws ClassNotFoundException
+     *             ?
+     * @throws ClassCastException
+     *             if the serialized objects are not of the appropriate type
      */
-    private void readObject(java.io.ObjectInputStream in)
-        throws IOException, ClassNotFoundException {
+    private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
         try {
             Object obj = in.readObject();
             if (obj == null) {
@@ -479,12 +537,15 @@ public class MailImpl implements Disposa
             }
         }
     }
+
     /**
      * Write the MailImpl to an <code>ObjectOutputStream</code>.
-     *
-     * @param out the ObjectOutputStream to which the object is written
-     *
-     * @throws IOException if an error occurs while writing to the stream
+     * 
+     * @param out
+     *            the ObjectOutputStream to which the object is written
+     * 
+     * @throws IOException
+     *             if an error occurs while writing to the stream
      */
     private void writeObject(java.io.ObjectOutputStream out) throws IOException {
         out.writeObject(sender);
@@ -507,27 +568,37 @@ public class MailImpl implements Disposa
     }
 
     /**
-     * This method is necessary, when Mail repositories needs to deal
-     * explicitly with storing Mail attributes as a Serializable
-     * Note: This method is not exposed in the Mail interface,
+     * <p>
+     * This method is necessary, when Mail repositories needs to deal explicitly
+     * with storing Mail attributes as a Serializable
+     * </p>
+     * <p>
+     * <strong>Note</strong>: This method is not exposed in the Mail interface,
      * it is for internal use by James only.
+     * </p>
+     * 
      * @return Serializable of the entire attributes collection
      * @since 2.2.0
      **/
-    public HashMap getAttributesRaw () {
+    public HashMap getAttributesRaw() {
         return attributes;
     }
-    
+
     /**
-     * This method is necessary, when Mail repositories needs to deal
-     * explicitly with retriving Mail attributes as a Serializable
-     * Note: This method is not exposed in the Mail interface,
+     * <p>
+     * This method is necessary, when Mail repositories needs to deal explicitly
+     * with retriving Mail attributes as a Serializable
+     * </p>
+     * <p>
+     * <strong>Note</strong>: This method is not exposed in the Mail interface,
      * it is for internal use by James only.
-     * @param attr Serializable of the entire attributes collection
+     * </p>
+     * 
+     * @param attr
+     *            Serializable of the entire attributes collection
      * @since 2.2.0
      **/
-    public void setAttributesRaw (HashMap attr)
-    {
+    public void setAttributesRaw(HashMap attr) {
         this.attributes = (attr == null) ? new HashMap() : attr;
     }
 
@@ -536,22 +607,25 @@ public class MailImpl implements Disposa
      * @since 2.2.0
      */
     public Serializable getAttribute(String key) {
-        return (Serializable)attributes.get(key);
+        return (Serializable) attributes.get(key);
     }
+
     /**
      * @see org.apache.mailet.Mail#setAttribute(String,Serializable)
      * @since 2.2.0
      */
     public Serializable setAttribute(String key, Serializable object) {
-        return (Serializable)attributes.put(key, object);
+        return (Serializable) attributes.put(key, object);
     }
+
     /**
      * @see org.apache.mailet.Mail#removeAttribute(String)
      * @since 2.2.0
      */
     public Serializable removeAttribute(String key) {
-        return (Serializable)attributes.remove(key);
+        return (Serializable) attributes.remove(key);
     }
+
     /**
      * @see org.apache.mailet.Mail#removeAllAttributes()
      * @since 2.2.0
@@ -559,6 +633,7 @@ public class MailImpl implements Disposa
     public void removeAllAttributes() {
         attributes.clear();
     }
+
     /**
      * @see org.apache.mailet.Mail#getAttributeNames()
      * @since 2.2.0
@@ -566,6 +641,7 @@ public class MailImpl implements Disposa
     public Iterator getAttributeNames() {
         return attributes.keySet().iterator();
     }
+
     /**
      * @see org.apache.mailet.Mail#hasAttributes()
      * @since 2.2.0
@@ -574,12 +650,12 @@ public class MailImpl implements Disposa
         return !attributes.isEmpty();
     }
 
-
     /**
-     * This methods provide cloning for serializable objects.
-     * Mail Attributes are Serializable but not Clonable so we need a deep copy
-     *
-     * @param o Object to be cloned
+     * This methods provide cloning for serializable objects. Mail Attributes
+     * are Serializable but not Clonable so we need a deep copy
+     * 
+     * @param o
+     *            Object to be cloned
      * @return the cloned Object
      * @throws IOException
      * @throws ClassNotFoundException
@@ -590,27 +666,33 @@ public class MailImpl implements Disposa
         out.writeObject(o);
         out.flush();
         out.close();
-        ByteArrayInputStream bi=new ByteArrayInputStream(b.toByteArray());
+        ByteArrayInputStream bi = new ByteArrayInputStream(b.toByteArray());
         ObjectInputStream in = new ObjectInputStream(bi);
         Object no = in.readObject();
         return no;
     }
-    
 
-    private static final java.util.Random random = new java.util.Random();  // Used to generate new mail names
-    
+    private static final java.util.Random random = new java.util.Random(); // Used
+                                                                           // to
+                                                                           // generate
+                                                                           // new
+                                                                           // mail
+                                                                           // names
+
     /**
      * Create a unique new primary key name for the given MailObject.
-     *
-     * @param mail the mail to use as the basis for the new mail name
+     * 
+     * @param mail
+     *            the mail to use as the basis for the new mail name
      * @return a new name
      */
     public static String newName(Mail mail) throws MessagingException {
         String oldName = mail.getName();
-        
+
         // Checking if the original mail name is too long, perhaps because of a
         // loop caused by a configuration error.
-        // it could cause a "null pointer exception" in AvalonMailRepository much
+        // it could cause a "null pointer exception" in AvalonMailRepository
+        // much
         // harder to understand.
         if (oldName.length() > 76) {
             int count = 0;
@@ -620,35 +702,24 @@ public class MailImpl implements Disposa
             }
             // It looks like a configuration loop. It's better to stop.
             if (count > 7) {
-                throw new MessagingException("Unable to create a new message name: too long."
-                                             + " Possible loop in config.xml.");
-            }
-            else {
+                throw new MessagingException("Unable to create a new message name: too long." + " Possible loop in config.xml.");
+            } else {
                 oldName = oldName.substring(0, 76);
             }
         }
-        
-        StringBuffer nameBuffer =
-                                 new StringBuffer(64)
-                                 .append(oldName)
-                                 .append("-!")
-                                 .append(random.nextInt(1048576));
+
+        StringBuffer nameBuffer = new StringBuffer(64).append(oldName).append("-!").append(random.nextInt(1048576));
         return nameBuffer.toString();
     }
-    
+
     /**
      * Generate a new identifier/name for a mail being processed by this server.
-     *
+     * 
      * @return the new identifier
      */
     public static String getId() {
-        StringBuilder idBuffer = new StringBuilder()
-                    .append("Mail")
-                    .append(System.currentTimeMillis())
-                    .append("-")
-                    .append(UUID.randomUUID());
+        StringBuilder idBuffer = new StringBuilder().append("Mail").append(System.currentTimeMillis()).append("-").append(UUID.randomUUID());
         return idBuffer.toString();
     }
 
-
 }

Modified: james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageCopyOnWriteProxy.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageCopyOnWriteProxy.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageCopyOnWriteProxy.java (original)
+++ james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageCopyOnWriteProxy.java Mon Apr  4 12:26:35 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.core;
 
 import javax.activation.DataHandler;
@@ -46,13 +44,11 @@ import java.util.Enumeration;
  * This object wraps a "possibly shared" MimeMessage tracking copies and
  * automatically cloning it (if shared) when a write operation is invoked.
  */
-public class MimeMessageCopyOnWriteProxy extends MimeMessage implements
-        Disposable {
+public class MimeMessageCopyOnWriteProxy extends MimeMessage implements Disposable {
 
     /**
-     * Used internally to track the reference count
-     * It is important that this is static otherwise it will keep a reference to
-     * the parent object.
+     * Used internally to track the reference count It is important that this is
+     * static otherwise it will keep a reference to the parent object.
      */
     protected static class MessageReferenceTracker {
 
@@ -60,37 +56,37 @@ public class MimeMessageCopyOnWriteProxy
          * reference counter
          */
         private int referenceCount = 1;
-        
+
         /**
          * The mime message in memory
          */
         private MimeMessage wrapped = null;
-        
+
         public MessageReferenceTracker(MimeMessage ref) {
             wrapped = ref;
         }
 
         protected synchronized void incrementReferenceCount() {
-            /* Used to track references while debugging
-            try {
-                throw new Exception("incrementReferenceCount: "+(wrapped != null ? System.identityHashCode(wrapped)+"" : "null")+" ["+referenceCount+"]");
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            */
+            /*
+             * Used to track references while debugging try { throw new
+             * Exception("incrementReferenceCount: "+(wrapped != null ?
+             * System.identityHashCode(wrapped)+"" :
+             * "null")+" ["+referenceCount+"]"); } catch (Exception e) {
+             * e.printStackTrace(); }
+             */
             referenceCount++;
         }
 
         protected synchronized void decrementReferenceCount() {
-            /* Used to track references while debugging
-            try {
-                throw new Exception("decrementReferenceCount: "+(wrapped != null ? System.identityHashCode(wrapped)+"" : "null")+" ["+referenceCount+"]");
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            */
+            /*
+             * Used to track references while debugging try { throw new
+             * Exception("decrementReferenceCount: "+(wrapped != null ?
+             * System.identityHashCode(wrapped)+"" :
+             * "null")+" ["+referenceCount+"]"); } catch (Exception e) {
+             * e.printStackTrace(); }
+             */
             referenceCount--;
-            if (referenceCount<=0) {
+            if (referenceCount <= 0) {
                 LifecycleUtil.dispose(wrapped);
                 wrapped = null;
             }
@@ -113,8 +109,7 @@ public class MimeMessageCopyOnWriteProxy
      *            MimeMessageWrapper
      * @throws MessagingException
      */
-    public MimeMessageCopyOnWriteProxy(MimeMessage original)
-            throws MessagingException {
+    public MimeMessageCopyOnWriteProxy(MimeMessage original) throws MessagingException {
         this(original, false);
     }
 
@@ -123,8 +118,7 @@ public class MimeMessageCopyOnWriteProxy
      *            MimeMessageSource
      * @throws MessagingException
      */
-    public MimeMessageCopyOnWriteProxy(MimeMessageSource original)
-            throws MessagingException {
+    public MimeMessageCopyOnWriteProxy(MimeMessageSource original) throws MessagingException {
         this(new MimeMessageWrapper(original), true);
     }
 
@@ -135,9 +129,7 @@ public class MimeMessageCopyOnWriteProxy
      * @param writeable
      * @throws MessagingException
      */
-    private MimeMessageCopyOnWriteProxy(MimeMessage original,
-            boolean writeable)
-            throws MessagingException {
+    private MimeMessageCopyOnWriteProxy(MimeMessage original, boolean writeable) throws MessagingException {
         super(Session.getDefaultInstance(System.getProperties(), null));
 
         if (original instanceof MimeMessageCopyOnWriteProxy) {
@@ -145,7 +137,7 @@ public class MimeMessageCopyOnWriteProxy
         } else {
             refCount = new MessageReferenceTracker(original);
         }
-        
+
         if (!writeable) {
             refCount.incrementReferenceCount();
         }
@@ -165,7 +157,7 @@ public class MimeMessageCopyOnWriteProxy
         }
         return refCount.getWrapped();
     }
-    
+
     /**
      * Return wrapped mimeMessage
      * 
@@ -175,7 +167,6 @@ public class MimeMessageCopyOnWriteProxy
         return refCount.getWrapped();
     }
 
-
     /**
      * @see org.apache.james.lifecycle.api.avalon.framework.activity.Disposable#dispose()
      */
@@ -196,15 +187,14 @@ public class MimeMessageCopyOnWriteProxy
     /**
      * Rewritten for optimization purposes
      */
-    public void writeTo(OutputStream os, String[] ignoreList)
-            throws IOException, MessagingException {
+    public void writeTo(OutputStream os, String[] ignoreList) throws IOException, MessagingException {
         getWrappedMessage().writeTo(os, ignoreList);
     }
 
-    /**
+    /*
      * Various reader methods
      */
-    
+
     /**
      * @see javax.mail.Message#getFrom()
      */
@@ -215,8 +205,7 @@ public class MimeMessageCopyOnWriteProxy
     /**
      * @see javax.mail.Message#getRecipients(javax.mail.Message.RecipientType)
      */
-    public Address[] getRecipients(Message.RecipientType type)
-            throws MessagingException {
+    public Address[] getRecipients(Message.RecipientType type) throws MessagingException {
         return getWrappedMessage().getRecipients(type);
     }
 
@@ -368,10 +357,10 @@ public class MimeMessageCopyOnWriteProxy
     }
 
     /**
-     * @see javax.mail.internet.MimePart#getHeader(java.lang.String, java.lang.String)
+     * @see javax.mail.internet.MimePart#getHeader(java.lang.String,
+     *      java.lang.String)
      */
-    public String getHeader(String name, String delimiter)
-            throws MessagingException {
+    public String getHeader(String name, String delimiter) throws MessagingException {
         return getWrappedMessage().getHeader(name, delimiter);
     }
 
@@ -385,16 +374,14 @@ public class MimeMessageCopyOnWriteProxy
     /**
      * @see javax.mail.Part#getMatchingHeaders(java.lang.String[])
      */
-    public Enumeration getMatchingHeaders(String[] names)
-            throws MessagingException {
+    public Enumeration getMatchingHeaders(String[] names) throws MessagingException {
         return getWrappedMessage().getMatchingHeaders(names);
     }
 
     /**
      * @see javax.mail.Part#getNonMatchingHeaders(java.lang.String[])
      */
-    public Enumeration getNonMatchingHeaders(String[] names)
-            throws MessagingException {
+    public Enumeration getNonMatchingHeaders(String[] names) throws MessagingException {
         return getWrappedMessage().getNonMatchingHeaders(names);
     }
 
@@ -408,16 +395,14 @@ public class MimeMessageCopyOnWriteProxy
     /**
      * @see javax.mail.internet.MimePart#getMatchingHeaderLines(java.lang.String[])
      */
-    public Enumeration getMatchingHeaderLines(String[] names)
-            throws MessagingException {
+    public Enumeration getMatchingHeaderLines(String[] names) throws MessagingException {
         return getWrappedMessage().getMatchingHeaderLines(names);
     }
 
     /**
      * @see javax.mail.internet.MimePart#getNonMatchingHeaderLines(java.lang.String[])
      */
-    public Enumeration getNonMatchingHeaderLines(String[] names)
-            throws MessagingException {
+    public Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException {
         return getWrappedMessage().getNonMatchingHeaderLines(names);
     }
 
@@ -524,18 +509,18 @@ public class MimeMessageCopyOnWriteProxy
     }
 
     /**
-     * @see javax.mail.Message#setRecipients(javax.mail.Message.RecipientType, javax.mail.Address[])
+     * @see javax.mail.Message#setRecipients(javax.mail.Message.RecipientType,
+     *      javax.mail.Address[])
      */
-    public void setRecipients(Message.RecipientType type, Address[] addresses)
-            throws MessagingException {
+    public void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
         getWrappedMessageForWriting().setRecipients(type, addresses);
     }
 
     /**
-     * @see javax.mail.Message#addRecipients(javax.mail.Message.RecipientType, javax.mail.Address[])
+     * @see javax.mail.Message#addRecipients(javax.mail.Message.RecipientType,
+     *      javax.mail.Address[])
      */
-    public void addRecipients(Message.RecipientType type, Address[] addresses)
-            throws MessagingException {
+    public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException {
         getWrappedMessageForWriting().addRecipients(type, addresses);
     }
 
@@ -554,10 +539,10 @@ public class MimeMessageCopyOnWriteProxy
     }
 
     /**
-     * @see javax.mail.internet.MimeMessage#setSubject(java.lang.String, java.lang.String)
+     * @see javax.mail.internet.MimeMessage#setSubject(java.lang.String,
+     *      java.lang.String)
      */
-    public void setSubject(String subject, String charset)
-            throws MessagingException {
+    public void setSubject(String subject, String charset) throws MessagingException {
         getWrappedMessageForWriting().setSubject(subject, charset);
     }
 
@@ -597,18 +582,17 @@ public class MimeMessageCopyOnWriteProxy
     }
 
     /**
-     * @see javax.mail.internet.MimeMessage#setDescription(java.lang.String, java.lang.String)
+     * @see javax.mail.internet.MimeMessage#setDescription(java.lang.String,
+     *      java.lang.String)
      */
-    public void setDescription(String description, String charset)
-            throws MessagingException {
+    public void setDescription(String description, String charset) throws MessagingException {
         getWrappedMessageForWriting().setDescription(description, charset);
     }
 
     /**
      * @see javax.mail.internet.MimePart#setContentLanguage(java.lang.String[])
      */
-    public void setContentLanguage(String[] languages)
-            throws MessagingException {
+    public void setContentLanguage(String[] languages) throws MessagingException {
         getWrappedMessageForWriting().setContentLanguage(languages);
     }
 
@@ -641,7 +625,8 @@ public class MimeMessageCopyOnWriteProxy
     }
 
     /**
-     * @see javax.mail.internet.MimePart#setText(java.lang.String, java.lang.String)
+     * @see javax.mail.internet.MimePart#setText(java.lang.String,
+     *      java.lang.String)
      */
     public void setText(String text, String charset) throws MessagingException {
         getWrappedMessageForWriting().setText(text, charset);
@@ -656,6 +641,7 @@ public class MimeMessageCopyOnWriteProxy
 
     /**
      * This does not need a writable message
+     * 
      * @see javax.mail.Message#reply(boolean)
      */
     public Message reply(boolean replyToAll) throws MessagingException {
@@ -709,18 +695,18 @@ public class MimeMessageCopyOnWriteProxy
      */
 
     /**
-     * @see javax.mail.internet.MimeMessage#addRecipients(javax.mail.Message.RecipientType, java.lang.String)
+     * @see javax.mail.internet.MimeMessage#addRecipients(javax.mail.Message.RecipientType,
+     *      java.lang.String)
      */
-    public void addRecipients(Message.RecipientType type, String addresses)
-            throws MessagingException {
+    public void addRecipients(Message.RecipientType type, String addresses) throws MessagingException {
         getWrappedMessageForWriting().addRecipients(type, addresses);
     }
 
     /**
-     * @see javax.mail.internet.MimeMessage#setRecipients(javax.mail.Message.RecipientType, java.lang.String)
+     * @see javax.mail.internet.MimeMessage#setRecipients(javax.mail.Message.RecipientType,
+     *      java.lang.String)
      */
-    public void setRecipients(Message.RecipientType type, String addresses)
-            throws MessagingException {
+    public void setRecipients(Message.RecipientType type, String addresses) throws MessagingException {
         getWrappedMessageForWriting().setRecipients(type, addresses);
     }
 
@@ -732,10 +718,10 @@ public class MimeMessageCopyOnWriteProxy
     }
 
     /**
-     * @see javax.mail.Message#addRecipient(javax.mail.Message.RecipientType, javax.mail.Address)
+     * @see javax.mail.Message#addRecipient(javax.mail.Message.RecipientType,
+     *      javax.mail.Address)
      */
-    public void addRecipient(RecipientType arg0, Address arg1)
-            throws MessagingException {
+    public void addRecipient(RecipientType arg0, Address arg1) throws MessagingException {
         getWrappedMessageForWriting().addRecipient(arg0, arg1);
     }
 
@@ -748,12 +734,11 @@ public class MimeMessageCopyOnWriteProxy
 
     /**
      * @return the message size
-     * @throws MessagingException 
+     * @throws MessagingException
      */
     public long getMessageSize() throws MessagingException {
         return MimeMessageUtil.getMessageSize(getWrappedMessage());
     }
-    
 
     /**
      * Since javamail 1.4

Modified: james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStream.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStream.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStream.java (original)
+++ james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStream.java Mon Apr  4 12:26:35 2011
@@ -27,25 +27,27 @@ import java.io.InputStream;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
-
 /**
  * Provide an {@link InputStream} over an {@link MimeMessage}
- * 
  */
 public class MimeMessageInputStream extends InputStream {
     private InputStream in;
 
     /**
-     * Provide an {@link InputStream} over a {@link MimeMessage}. 
+     * Provide an {@link InputStream} over a {@link MimeMessage}.
      * 
-     * @param message the message to wrap
-     * @param tryCast try to cast the {@link MimeMessage} to {@link MimeMessageCopyOnWriteProxy} / {@link MimeMessageWrapper} to do some optimized processing
-     *                if possible
+     * @param message
+     *            the message to wrap
+     * @param tryCast
+     *            try to cast the {@link MimeMessage} to
+     *            {@link MimeMessageCopyOnWriteProxy} /
+     *            {@link MimeMessageWrapper} to do some optimized processing if
+     *            possible
      * @throws MessagingException
      */
     public MimeMessageInputStream(MimeMessage message, boolean tryCast) throws MessagingException {
         MimeMessage m = message;
-               
+
         // check if we need to use the wrapped message
         if (tryCast && m instanceof MimeMessageCopyOnWriteProxy) {
             m = ((MimeMessageCopyOnWriteProxy) m).getWrappedMessage();
@@ -76,7 +78,7 @@ public class MimeMessageInputStream exte
     public MimeMessageInputStream(MimeMessage message) throws MessagingException {
         this(message, true);
     }
-    
+
     @Override
     public int read() throws IOException {
         return in.read();
@@ -84,7 +86,7 @@ public class MimeMessageInputStream exte
 
     @Override
     public void close() throws IOException {
-       in.close();
+        in.close();
     }
 
     @Override

Modified: james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStreamSource.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStreamSource.java?rev=1088591&r1=1088590&r2=1088591&view=diff
==============================================================================
--- james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStreamSource.java (original)
+++ james/server/trunk/core/src/main/java/org/apache/james/core/MimeMessageInputStreamSource.java Mon Apr  4 12:26:35 2011
@@ -17,8 +17,6 @@
  * under the License.                                           *
  ****************************************************************/
 
-
-
 package org.apache.james.core;
 
 import javax.mail.MessagingException;
@@ -39,23 +37,21 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Takes an input stream and creates a repeatable input stream source
- * for a MimeMessageWrapper.  It does this by completely reading the
- * input stream and saving that to a temporary file that should delete on exit,
- * or when this object is GC'd.
- *
+ * Takes an input stream and creates a repeatable input stream source for a
+ * MimeMessageWrapper. It does this by completely reading the input stream and
+ * saving that to a temporary file that should delete on exit, or when this
+ * object is GC'd.
+ * 
  * @see MimeMessageWrapper
- *
- *
+ * 
+ * 
  */
-public class MimeMessageInputStreamSource
-    extends MimeMessageSource implements Disposable{
+public class MimeMessageInputStreamSource extends MimeMessageSource implements Disposable {
 
     private final List<InputStream> streams = new ArrayList<InputStream>();
 
     private OutputStream out;
-    
-    
+
     /**
      * A temporary file used to hold the message stream
      */
@@ -68,20 +64,20 @@ public class MimeMessageInputStreamSourc
 
     /**
      * Construct a new MimeMessageInputStreamSource from an
-     * <code>InputStream</code> that contains the bytes of a
-     * MimeMessage.
-     *
-     * @param key the prefix for the name of the temp file
-     * @param in the stream containing the MimeMessage
-     *
-     * @throws MessagingException if an error occurs while trying to store
-     *                            the stream
+     * <code>InputStream</code> that contains the bytes of a MimeMessage.
+     * 
+     * @param key
+     *            the prefix for the name of the temp file
+     * @param in
+     *            the stream containing the MimeMessage
+     * 
+     * @throws MessagingException
+     *             if an error occurs while trying to store the stream
      */
-    public MimeMessageInputStreamSource(String key, InputStream in)
-            throws MessagingException {
+    public MimeMessageInputStreamSource(String key, InputStream in) throws MessagingException {
         super();
-        //We want to immediately read this into a temporary file
-        //Create a temp file and channel the input stream into it
+        // We want to immediately read this into a temporary file
+        // Create a temp file and channel the input stream into it
         OutputStream fout = null;
         try {
             file = File.createTempFile(key, ".m64");
@@ -106,7 +102,7 @@ public class MimeMessageInputStreamSourc
             } catch (IOException ioe) {
                 // Ignored - logging unavailable to log this non-fatal error.
             }
-            
+
             // if sourceId is null while file is not null then we had
             // an IOxception and we have to clean the file.
             if (sourceId == null && file != null) {
@@ -130,10 +126,10 @@ public class MimeMessageInputStreamSourc
             }
         }
     }
-    
+
     /**
      * Returns the unique identifier of this input stream source
-     *
+     * 
      * @return the unique identifier for this MimeMessageInputStreamSource
      */
     public String getSourceId() {
@@ -142,7 +138,7 @@ public class MimeMessageInputStreamSourc
 
     /**
      * Get an input stream to retrieve the data stored in the temporary file
-     *
+     * 
      * @return a <code>BufferedInputStream</code> containing the data
      */
     public synchronized InputStream getInputStream() throws IOException {
@@ -153,10 +149,12 @@ public class MimeMessageInputStreamSourc
 
     /**
      * Get the size of the temp file
-     *
+     * 
      * @return the size of the temp file
-     *
-     * @throws IOException if an error is encoutered while computing the size of the message
+     * 
+     * @throws IOException
+     *             if an error is encoutered while computing the size of the
+     *             message
      */
     public long getMessageSize() throws IOException {
         return file.length();
@@ -175,19 +173,19 @@ public class MimeMessageInputStreamSourc
 
     /*
      * (non-Javadoc)
+     * 
      * @see org.apache.james.core.MimeMessageSource#disposeSource()
      */
     public void dispose() {
-     // explicit close all streams
+        // explicit close all streams
         for (int i = 0; i < streams.size(); i++) {
             IOUtils.closeQuietly(streams.get(i));
         }
         IOUtils.closeQuietly(out);
         out = null;
-        
+
         FileUtils.deleteQuietly(file);
         file = null;
     }
 
-
 }



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