noel        2003/08/16 22:52:56

  Modified:    src/java/org/apache/james/fetchpop Tag: branch_2_1_fcs
                        FetchPOP.java
  Log:
  Catch exception when retrieving message.  Add finally to ensure connection closure.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.5.4.3   +14 -9     james-server/src/java/org/apache/james/fetchpop/FetchPOP.java
  
  Index: FetchPOP.java
  ===================================================================
  RCS file: /home/cvs/james-server/src/java/org/apache/james/fetchpop/FetchPOP.java,v
  retrieving revision 1.5.4.2
  retrieving revision 1.5.4.3
  diff -u -r1.5.4.2 -r1.5.4.3
  --- FetchPOP.java     8 Mar 2003 21:54:03 -0000       1.5.4.2
  +++ FetchPOP.java     17 Aug 2003 05:52:55 -0000      1.5.4.3
  @@ -125,10 +125,10 @@
               getLogger().debug("List:" + pop.getReplyString());
               Vector received = new Vector();
               for (int i = 0; i < messages.length; i++) {
  -                InputStream in = new 
ReaderInputStream(pop.retrieveMessage(messages[i].number));
  -                getLogger().debug("Retrieve:" + pop.getReplyString());
  -                MimeMessage message = null;
                   try {
  +                    InputStream in = new 
ReaderInputStream(pop.retrieveMessage(messages[i].number));
  +                    getLogger().debug("Retrieve:" + pop.getReplyString());
  +                    MimeMessage message = null;
                       message = new MimeMessage(null, in);
                       in.close();
                       message.addHeader("X-fetched-from", fetchTaskName);
  @@ -152,15 +152,20 @@
                       getLogger().debug("Delete:" + pop.getReplyString());
                   }
               }
  -            pop.logout();
  -            if (getLogger().isDebugEnabled()) {
  -                getLogger().debug("logout:" + pop.getReplyString());
  -            }
  -            pop.disconnect();
           } catch (SocketException e) {
               getLogger().error(e.getMessage());
           } catch (IOException e) {
               getLogger().error(e.getMessage());
  +        } finally {
  +            try {
  +                pop.logout();
  +                if (getLogger().isDebugEnabled()) {
  +                    getLogger().debug("logout:" + pop.getReplyString());
  +                }
  +                pop.disconnect();
  +            } catch (IOException e) {
  +                getLogger().error(e.getMessage());
  +            }
           }
       }
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to