james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1054586 - /james/server/trunk/domainlist-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
Date Mon, 03 Jan 2011 11:22:08 GMT
Author: eric
Date: Mon Jan  3 11:22:08 2011
New Revision: 1054586

URL: http://svn.apache.org/viewvc?rev=1054586&view=rev
Log:
Catch NoResultException if findDomainByName query returns no result (JAMES-1171)

Modified:
    james/server/trunk/domainlist-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java

Modified: james/server/trunk/domainlist-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domainlist-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java?rev=1054586&r1=1054585&r2=1054586&view=diff
==============================================================================
--- james/server/trunk/domainlist-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
(original)
+++ james/server/trunk/domainlist-jpa/src/main/java/org/apache/james/domainlist/jpa/JPADomainList.java
Mon Jan  3 11:22:08 2011
@@ -25,6 +25,7 @@ import javax.annotation.PostConstruct;
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.EntityTransaction;
+import javax.persistence.NoResultException;
 import javax.persistence.PersistenceException;
 import javax.persistence.PersistenceUnit;
 
@@ -102,6 +103,10 @@ public class JPADomainList extends Abstr
             JPADomain jpaDomain = (JPADomain) entityManager.createNamedQuery("findDomainByName").setParameter("name",
domain).getSingleResult();
             transaction.commit();
             return (jpaDomain != null) ? true : false;
+        } catch (NoResultException e) {
+            getLogger().debug("No domain found", e);
+            transaction.commit();
+            return false;
         } catch (PersistenceException e) {
             getLogger().debug("Failed to find domain", e);
             if (transaction.isActive()) {



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