james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [1/2] james-mime4j git commit: MIME4J-280 Wrapping the underlying exception rather then ignoring it.
Date Thu, 13 Sep 2018 06:58:56 GMT
Repository: james-mime4j
Updated Branches:
  refs/heads/master 64b332b33 -> ae77907e3


MIME4J-280 Wrapping the underlying exception rather then ignoring it.

Project: http://git-wip-us.apache.org/repos/asf/james-mime4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-mime4j/commit/c0513d9c
Tree: http://git-wip-us.apache.org/repos/asf/james-mime4j/tree/c0513d9c
Diff: http://git-wip-us.apache.org/repos/asf/james-mime4j/diff/c0513d9c

Branch: refs/heads/master
Commit: c0513d9c83966fa68d3101a85cfa4e7db43ccc1b
Parents: d384c40
Author: Dmitry Katsubo <dmitry.katsubo@gmail.com>
Authored: Wed May 23 12:25:03 2018 +0200
Committer: Dmitry Katsubo <dmitry.katsubo@gmail.com>
Committed: Tue May 29 18:57:25 2018 +0200

----------------------------------------------------------------------
 .../field/ContentDispositionFieldImpl.java      |  2 +-
 .../mime4j/field/ContentTypeFieldImpl.java      |  2 +-
 .../james/mime4j/field/DateTimeFieldImpl.java   |  2 +-
 .../james/mime4j/field/address/Builder.java     | 22 ++++++++++----------
 .../field/mimeversion/MimeVersionParser.jj      |  2 +-
 .../mime4j/field/address/AddressListParser.jjt  |  6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/c0513d9c/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
b/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
index fcccd70..345df49 100644
--- a/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
+++ b/dom/src/main/java/org/apache/james/mime4j/field/ContentDispositionFieldImpl.java
@@ -224,7 +224,7 @@ public class ContentDispositionFieldImpl extends AbstractField implements
Conten
         } catch (ParseException e) {
             parseException = e;
         } catch (TokenMgrError e) {
-            parseException = new ParseException(e.getMessage());
+            parseException = new ParseException(e);
         }
 
         final String dispositionType = parser.getDispositionType();

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/c0513d9c/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java b/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
index eb5a7a4..01a9f81 100644
--- a/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
+++ b/dom/src/main/java/org/apache/james/mime4j/field/ContentTypeFieldImpl.java
@@ -197,7 +197,7 @@ public class ContentTypeFieldImpl extends AbstractField implements ContentTypeFi
         } catch (ParseException e) {
             parseException = e;
         } catch (TokenMgrError e) {
-            parseException = new ParseException(e.getMessage());
+            parseException = new ParseException(e);
         }
 
         mediaType = parser.getType();

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/c0513d9c/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java b/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
index cc854ed..6a76200 100644
--- a/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
+++ b/dom/src/main/java/org/apache/james/mime4j/field/DateTimeFieldImpl.java
@@ -73,7 +73,7 @@ public class DateTimeFieldImpl extends AbstractField implements DateTimeField
{
         } catch (ParseException e) {
             parseException = e;
         } catch (TokenMgrError e) {
-            parseException = new ParseException(e.getMessage());
+            parseException = new ParseException(e);
         }
 
         parsed = true;

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/c0513d9c/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java
----------------------------------------------------------------------
diff --git a/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java b/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java
index 0b6ae66..d796c82 100644
--- a/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java
+++ b/dom/src/main/java/org/apache/james/mime4j/field/address/Builder.java
@@ -70,16 +70,16 @@ class Builder {
                 try {
                     name = DecoderUtil.decodeEncodedWords(name, monitor);
                 } catch (IllegalArgumentException e) {
-                    throw new ParseException(e.getMessage());
+                    throw new ParseException(e);
                 }
                 Mailbox mb = buildAngleAddr((ASTangle_addr) n2);
                 return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
                         mb.getDomain());
             } else {
-                throw new ParseException();
+                throw new ParseException("Address \"group_body\" or \"angle_addr\" is expected
but got \"" + n + "\"");
             }
         } else {
-            throw new ParseException();
+            throw new ParseException("Address \"phrase\" is expected but got \"" + n + "\"");
         }
     }
 
@@ -91,7 +91,7 @@ class Builder {
             if (n instanceof ASTmailbox)
                 results.add(buildMailbox((ASTmailbox) n, monitor));
             else
-                throw new ParseException();
+                throw new ParseException("Address \"mailbox\" is expected but got \"" + n
+ "\"");
         }
         return new MailboxList(results, true);
     }
@@ -106,7 +106,7 @@ class Builder {
         } else if (n instanceof ASTname_addr) {
             return buildNameAddr((ASTname_addr) n, monitor);
         } else {
-            throw new ParseException();
+            throw new ParseException("Address \"addr_spec\" or \"angle_addr\" or \"name_addr\"
is expected but got \"" + n + "\"");
         }
     }
 
@@ -117,7 +117,7 @@ class Builder {
         if (n instanceof ASTphrase) {
             name = buildString((ASTphrase) n, false);
         } else {
-            throw new ParseException();
+            throw new ParseException("Address \"phrase\" is expected but got \"" + n + "\"");
         }
 
         n = it.next();
@@ -125,13 +125,13 @@ class Builder {
             try {
                 name = DecoderUtil.decodeEncodedWords(name, monitor);
             } catch (IllegalArgumentException e) {
-                throw new ParseException(e.getMessage());
+                throw new ParseException(e);
             }
             Mailbox mb = buildAngleAddr((ASTangle_addr) n);
             return new Mailbox(name, mb.getRoute(), mb.getLocalPart(),
                     mb.getDomain());
         } else {
-            throw new ParseException();
+            throw new ParseException("Address \"angle_addr\" is expected but got \"" + n
+ "\"");
         }
     }
 
@@ -146,12 +146,12 @@ class Builder {
             // do nothing
         }
         else
-            throw new ParseException();
+            throw new ParseException("Address \"route\" or \"addr_spec\" is expected but
got \"" + n + "\"");
 
         if (n instanceof ASTaddr_spec)
             return buildAddrSpec(route, (ASTaddr_spec) n);
         else
-            throw new ParseException();
+            throw new ParseException("Address \"addr_spec\" is expected but got \"" + n +
"\"");
     }
 
     private DomainList buildRoute(ASTroute node) throws ParseException {
@@ -162,7 +162,7 @@ class Builder {
             if (n instanceof ASTdomain)
                 results.add(buildString((ASTdomain) n, true));
             else
-                throw new ParseException();
+                throw new ParseException("Address \"domain\" is expected but got \"" + n
+ "\"");
         }
         return new DomainList(results);
     }

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/c0513d9c/dom/src/main/javacc/org/apache/james/mime4j/field/mimeversion/MimeVersionParser.jj
----------------------------------------------------------------------
diff --git a/dom/src/main/javacc/org/apache/james/mime4j/field/mimeversion/MimeVersionParser.jj
b/dom/src/main/javacc/org/apache/james/mime4j/field/mimeversion/MimeVersionParser.jj
index 39b6bb5..54a25a4 100644
--- a/dom/src/main/javacc/org/apache/james/mime4j/field/mimeversion/MimeVersionParser.jj
+++ b/dom/src/main/javacc/org/apache/james/mime4j/field/mimeversion/MimeVersionParser.jj
@@ -84,7 +84,7 @@ void parse() :
 			this.major = Integer.parseInt(major.image);
 			this.minor = Integer.parseInt(minor.image);
 		} catch (NumberFormatException e) {
-			throw new ParseException(e.getMessage());
+			throw new ParseException(e);
 		}
 	}
 }

http://git-wip-us.apache.org/repos/asf/james-mime4j/blob/c0513d9c/dom/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
----------------------------------------------------------------------
diff --git a/dom/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
b/dom/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
index b6a7cd8..51feff1 100644
--- a/dom/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
+++ b/dom/src/main/jjtree/org/apache/james/mime4j/field/address/AddressListParser.jjt
@@ -77,7 +77,7 @@ public class AddressListParser {
             parseAddressList0();
             return (ASTaddress_list) jjtree.rootNode();
         } catch (TokenMgrError tme) {
-            throw new ParseException(tme.getMessage());
+            throw new ParseException(tme);
         }
     }
 
@@ -86,7 +86,7 @@ public class AddressListParser {
             parseAddress0();
             return (ASTaddress) jjtree.rootNode();
         } catch (TokenMgrError tme) {
-            throw new ParseException(tme.getMessage());
+            throw new ParseException(tme);
         }
     }
 
@@ -95,7 +95,7 @@ public class AddressListParser {
             parseMailbox0();
             return (ASTmailbox) jjtree.rootNode();
         } catch (TokenMgrError tme) {
-            throw new ParseException(tme.getMessage());
+            throw new ParseException(tme);
         }
     }
 


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