Skip to content

Instantly share code, notes, and snippets.

@pjstadig
Created July 9, 2012 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pjstadig/3077895 to your computer and use it in GitHub Desktop.
Save pjstadig/3077895 to your computer and use it in GitHub Desktop.
diff --git a/mail/src/main/java/javax/mail/internet/MimeMultipart.java b/mail/src/main/java/javax/mail/internet/MimeMultipart.java
index 58537ef..0278d12 100644
--- a/mail/src/main/java/javax/mail/internet/MimeMultipart.java
+++ b/mail/src/main/java/javax/mail/internet/MimeMultipart.java
@@ -468,6 +468,10 @@ public class MimeMultipart extends Multipart {
los.writeln(boundary + "--");
}
+ private boolean getWithSystemDefault(Properties props, String name, boolean df) {
+ return PropUtil.getBooleanProperty(props, name, PropUtil.getBooleanSystemProperty(name, df));
+ }
+
/**
* Parse the InputStream from our DataSource, constructing the
* appropriate MimeBodyParts. The <code>parsed</code> flag is
@@ -482,22 +486,22 @@ public class MimeMultipart extends Multipart {
return;
// read properties that control parsing
+
+ Properties props = new MessageContext(this.parent).getSession().getProperties();
// default to true
- ignoreMissingEndBoundary = PropUtil.getBooleanSystemProperty(
- "mail.mime.multipart.ignoremissingendboundary", true);
+ ignoreMissingEndBoundary = getWithSystemDefault(props,
+ "mail.mime.multipart.ignoremissingendboundary", true);
// default to true
- ignoreMissingBoundaryParameter = PropUtil.getBooleanSystemProperty(
+ ignoreMissingBoundaryParameter = getWithSystemDefault(props,
"mail.mime.multipart.ignoremissingboundaryparameter", true);
// default to false
- ignoreExistingBoundaryParameter = PropUtil.getBooleanSystemProperty(
+ ignoreExistingBoundaryParameter = getWithSystemDefault(props,
"mail.mime.multipart.ignoreexistingboundaryparameter", false);
// default to false
- allowEmpty = PropUtil.getBooleanSystemProperty(
- "mail.mime.multipart.allowempty", false);
+ allowEmpty = getWithSystemDefault(props, "mail.mime.multipart.allowempty", false);
// default to true
- bmparse = PropUtil.getBooleanSystemProperty(
- "mail.mime.multipart.bmparse", true);
+ bmparse = getWithSystemDefault(props, "mail.mime.multipart.bmparse", true);
if (bmparse) {
parsebm();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment