Index: src/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 AttachmentFileNameIs.java
--- src/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java	6 Jun 2003 23:53:01 -0000	1.1.2.2
+++ src/java/org/apache/james/transport/matchers/AttachmentFileNameIs.java	7 Jun 2003 20:47:12 -0000
@@ -79,6 +79,9 @@
  * <P>File name masks may start with a wildcard '*'.</P>
  * <P>Multiple file name masks can be specified, e.g.: '*.scr,*.bat'.</P>
  *
+ * CVS $Id$
+ * @version 2.2.0
+ * @since 2.2.0
  */
 public class AttachmentFileNameIs extends GenericMatcher {
     /**
@@ -121,42 +124,39 @@
     /**
      * either every recipient is matching or neither of them
      */
-    public Collection match(Mail mail) throws MessagingException {
-        MimeMessage message = mail.getMessage();
-        Object content;
-        
-        /**
-         * if there is an attachment and no inline text,
-         * the content type can be anything
-         */ 
-        if (message.getContentType() == null) {
-            return null;
-        }
-        
+    public Collection match(Mail mail) {
         try {
-            content = message.getContent(); 
-        } catch (java.io.IOException e) {
-            throw new MessagingException(
-                    "Attachment file names cannot be determined", e);
-        }
-        if (content instanceof Multipart) {
-            Multipart multipart = (Multipart) content;
-            for (int i = 0; i < multipart.getCount(); i++) {
-                try {
-                    Part part = multipart.getBodyPart(i);
-                    String fileName = part.getFileName();
-                    if (fileName != null && matchFound(fileName)) {
-                        return mail.getRecipients(); // matching file found
-                    }
-                } catch (Exception ex) {} // ignore any exception and process next bodypart
+            MimeMessage message = mail.getMessage();
+            Object content;
+            
+            /**
+             * if there is an attachment and no inline text,
+             * the content type can be anything
+             */
+            if (message.getContentType() == null) {
+                return null;
             }
-        } else {
-            try {
+            
+            content = message.getContent();
+            if (content instanceof Multipart) {
+                Multipart multipart = (Multipart) content;
+                for (int i = 0; i < multipart.getCount(); i++) {
+                    try {
+                        Part part = multipart.getBodyPart(i);
+                        String fileName = part.getFileName();
+                        if (fileName != null && matchFound(fileName)) {
+                            return mail.getRecipients(); // matching file found
+                        }
+                    } catch (Throwable th) {} // ignore any Throwable and process next bodypart
+                }
+            } else {
                 String fileName = message.getFileName();
                 if (fileName != null && matchFound(fileName)) {
                     return mail.getRecipients(); // matching file found
                 }
-            } catch (Exception ex) {} // ignore any exception
+            }
+        } catch (Throwable th) {
+            log("Exception caught: attachment file names cannot be determined - will not match", th);
         }
         
         return null; // no matching attachment found
