james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r911932 - in /james/server/trunk: core-function/src/main/java/org/apache/james/domain/JDBCDomainList.java spring-deployment/src/main/config/james/domainlist.xml spring-deployment/src/main/config/james/log4j.properties
Date Fri, 19 Feb 2010 19:01:06 GMT
Author: norman
Date: Fri Feb 19 19:01:05 2010
New Revision: 911932

URL: http://svn.apache.org/viewvc?rev=911932&view=rev
Log:
Fix NPE when using JDBCDomainList (JAMES-972)

Modified:
    james/server/trunk/core-function/src/main/java/org/apache/james/domain/JDBCDomainList.java
    james/server/trunk/spring-deployment/src/main/config/james/domainlist.xml
    james/server/trunk/spring-deployment/src/main/config/james/log4j.properties

Modified: james/server/trunk/core-function/src/main/java/org/apache/james/domain/JDBCDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-function/src/main/java/org/apache/james/domain/JDBCDomainList.java?rev=911932&r1=911931&r2=911932&view=diff
==============================================================================
--- james/server/trunk/core-function/src/main/java/org/apache/james/domain/JDBCDomainList.java
(original)
+++ james/server/trunk/core-function/src/main/java/org/apache/james/domain/JDBCDomainList.java
Fri Feb 19 19:01:05 2010
@@ -36,9 +36,9 @@
 import javax.annotation.Resource;
 import javax.sql.DataSource;
 
-import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.james.lifecycle.Configurable;
 import org.apache.james.services.DataSourceSelector;
 import org.apache.james.services.FileSystem;
 import org.apache.james.util.sql.JDBCUtil;
@@ -47,7 +47,7 @@
 /**
  * Allow to query a costum table for domains
  */
-public class JDBCDomainList extends AbstractDomainList {
+public class JDBCDomainList extends AbstractDomainList implements Configurable{
 
     private DataSourceSelector datasources;
     private DataSource dataSourceComponent;
@@ -70,8 +70,12 @@
     
     private HierarchicalConfiguration configuration;
 
-    public void configure(Configuration configuration) throws ConfigurationException{
-        this.configuration = (HierarchicalConfiguration)configuration;
+    /*
+     * (non-Javadoc)
+     * @see org.apache.james.lifecycle.Configurable#configure(org.apache.commons.configuration.HierarchicalConfiguration)
+     */
+    public void configure(HierarchicalConfiguration configuration) throws ConfigurationException{
+        this.configuration = configuration;
     }
 
     public void setDataSource(DataSource dataSourceComponent) {
@@ -136,7 +140,7 @@
             getLogger().debug(logBuffer.toString());
         }
     
-        sqlFileName = configuration.getString("sqlFile",null);
+        sqlFileName = configuration.getString("sqlFile","file://conf/sqlResources.xml");
         
         setAutoDetect(configuration.getBoolean("autodetect", true));    
         setAutoDetectIP(configuration.getBoolean("autodetectIP", true));    
@@ -311,10 +315,8 @@
 
             ResultSet mappingRS = null;
             try {
-            mappingStmt.setString(1, domain);
-                if (mappingStmt.executeUpdate() > 0) {
-                    return true;
-                }
+                mappingStmt.setString(1, domain);
+                return mappingStmt.execute();
             } finally {
                 theJDBCUtil.closeJDBCResultSet(mappingRS);
             }

Modified: james/server/trunk/spring-deployment/src/main/config/james/domainlist.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/config/james/domainlist.xml?rev=911932&r1=911931&r2=911932&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/src/main/config/james/domainlist.xml (original)
+++ james/server/trunk/spring-deployment/src/main/config/james/domainlist.xml Fri Feb 19 19:01:05
2010
@@ -35,9 +35,17 @@
     <!-- -->
     <!-- Warning: If you are using fetchmail it is important to include the -->
     <!-- fetched domains in the server name list to prevent looping.       -->
+    
+    <!-- comment this if you use JDBCDomainList -->
     <domainnames>
         <domainname>localhost</domainname>
     </domainnames>
+    
+    <!-- uncomment this if you use JDBCDomainList -->
+    <!--  
+    <repositoryPath>db://maildb/domain</repositoryPath>
+    <sqlFile>file://conf/sqlResources.xml</sqlFile>
+    -->
     <autodetect>true</autodetect>
     <autodetectIP>true</autodetectIP>
 </domainlist>

Modified: james/server/trunk/spring-deployment/src/main/config/james/log4j.properties
URL: http://svn.apache.org/viewvc/james/server/trunk/spring-deployment/src/main/config/james/log4j.properties?rev=911932&r1=911931&r2=911932&view=diff
==============================================================================
--- james/server/trunk/spring-deployment/src/main/config/james/log4j.properties (original)
+++ james/server/trunk/spring-deployment/src/main/config/james/log4j.properties Fri Feb 19
19:01:05 2010
@@ -121,6 +121,13 @@
 log4j.appender.FETCHMAIL.layout=org.apache.log4j.PatternLayout
 log4j.appender.FETCHMAIL.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
 
+log4j.appender.DOMAINLIST=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.DOMAINLIST.File=../log/domainlist.log
+log4j.appender.DOMAINLIST.DatePattern='.'yyyy-MM-dd
+log4j.appender.DOMAINLIST.layout=org.apache.log4j.PatternLayout
+log4j.appender.DOMAINLIST.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+
 
 
 log4j.logger.org.springframework=WARN, CONS, FILE
@@ -144,6 +151,6 @@
 log4j.logger.james.users-store=INFO, USERS-STORE
 log4j.logger.james.objectstorage=INFO, OBJECTSTORAGE
 log4j.logger.james.fetchmail=INFO, FETCHMAIL
-
+log4j.logger.james.domainlist=INFO, DOMAINLIST
 
 



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


Mime
View raw message