pgoldstein    2002/10/28 09:33:24

  Modified:    src/java/org/apache/james/mailrepository
                        JDBCMailRepository.java
  Log:
  Making JDBCMailRepository obey its contract - should return null when no key is 
found
  rather than throwing an exception.
  
  Thanks to Noel Bergman
  
  Revision  Changes    Path
  1.30      +10 -7     
jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
  
  Index: JDBCMailRepository.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/mailrepository/JDBCMailRepository.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- JDBCMailRepository.java   4 Oct 2002 08:17:49 -0000       1.29
  +++ JDBCMailRepository.java   28 Oct 2002 17:33:24 -0000      1.30
  @@ -630,13 +630,16 @@
                   System.err.println("ran the query " + key);
               }
               if (!rsMessage.next()) {
  -                StringBuffer exceptionBuffer =
  -                    new StringBuffer(64)
  -                            .append("Did not find a record ")
  -                            .append(key)
  -                            .append(" in ")
  -                            .append(repositoryName);
  -                throw new RuntimeException(exceptionBuffer.toString());
  +                if (getLogger().isDebugEnabled()) {
  +                    StringBuffer debugBuffer =
  +                        new StringBuffer(64)
  +                                .append("Did not find a record ")
  +                                .append(key)
  +                                .append(" in ")
  +                                .append(repositoryName);
  +                    getLogger().debug(debugBuffer.toString());
  +                }
  +                return null;
               }
               MailImpl mc = new MailImpl();
               mc.setName(key);
  
  
  

--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@;jakarta.apache.org>

Reply via email to