geronimo-mail_2.1/geronimo-mail_2.1_provider/src/main/java/org/apache/geronimo/mail/transport/smtp/SMTPConnection.java [394:441]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected boolean convertTransferEncoding(MimePart bodyPart)
    {
        boolean converted = false;
        try {
            // if this is a multipart element, apply the conversion rules
            // to each of the parts.
            if (bodyPart.isMimeType("multipart/")) {
                MimeMultipart parts = (MimeMultipart)bodyPart.getContent();
                for (int i = 0; i < parts.getCount(); i++) {
                    // convert each body part, and accumulate the conversion result
                    converted = converted && convertTransferEncoding((MimePart)parts.getBodyPart(i));
                }
            }
            else {
                // we only do this if the encoding is quoted-printable or base64
                String encoding =  bodyPart.getEncoding();
                if (encoding != null) {
                    encoding = encoding.toLowerCase();
                    if (encoding.equals("quoted-printable") || encoding.equals("base64")) {
                        // this requires encoding.  Read the actual content to see if
                        // it conforms to the 8bit encoding rules.
                        if (isValid8bit(bodyPart.getInputStream())) {
                            // There's a huge hidden gotcha lurking under the covers here.
                            // If the content just exists as an encoded byte array, then just
                            // switching the transfer encoding will mess things up because the
                            // already encoded data gets transmitted in encoded form, but with
                            // and 8bit encoding style.  As a result, it doesn't get unencoded on
                            // the receiving end.  This is a nasty problem to debug.
                            //
                            // The solution is to get the content as it's object type, set it back
                            // on the the message in raw form.  Requesting the content will apply the
                            // current transfer encoding value to the data.  Once we have set the
                            // content value back, we can reset the transfer encoding.
                            bodyPart.setContent(bodyPart.getContent(), bodyPart.getContentType());

                            // it's valid, so change the transfer encoding to just
                            // pass the data through.
                            bodyPart.setHeader("Content-Transfer-Encoding", "8bit");
                            converted = true;   // we've changed something
                        }
                    }
                }
            }
        } catch (MessagingException e) {
        } catch (IOException e) {
        }
        return converted;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.4/geronimo-javamail_1.4_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java [399:446]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected boolean convertTransferEncoding(MimePart bodyPart)
    {
        boolean converted = false;
        try {
            // if this is a multipart element, apply the conversion rules
            // to each of the parts.
            if (bodyPart.isMimeType("multipart/")) {
                MimeMultipart parts = (MimeMultipart)bodyPart.getContent();
                for (int i = 0; i < parts.getCount(); i++) {
                    // convert each body part, and accumulate the conversion result
                    converted = converted && convertTransferEncoding((MimePart)parts.getBodyPart(i));
                }
            }
            else {
                // we only do this if the encoding is quoted-printable or base64
                String encoding =  bodyPart.getEncoding();
                if (encoding != null) {
                    encoding = encoding.toLowerCase();
                    if (encoding.equals("quoted-printable") || encoding.equals("base64")) {
                        // this requires encoding.  Read the actual content to see if
                        // it conforms to the 8bit encoding rules.
                        if (isValid8bit(bodyPart.getInputStream())) {
                            // There's a huge hidden gotcha lurking under the covers here.
                            // If the content just exists as an encoded byte array, then just
                            // switching the transfer encoding will mess things up because the
                            // already encoded data gets transmitted in encoded form, but with
                            // and 8bit encoding style.  As a result, it doesn't get unencoded on
                            // the receiving end.  This is a nasty problem to debug.
                            //
                            // The solution is to get the content as it's object type, set it back
                            // on the the message in raw form.  Requesting the content will apply the
                            // current transfer encoding value to the data.  Once we have set the
                            // content value back, we can reset the transfer encoding.
                            bodyPart.setContent(bodyPart.getContent(), bodyPart.getContentType());

                            // it's valid, so change the transfer encoding to just
                            // pass the data through.
                            bodyPart.setHeader("Content-Transfer-Encoding", "8bit");
                            converted = true;   // we've changed something
                        }
                    }
                }
            }
        } catch (MessagingException e) {
        } catch (IOException e) {
        }
        return converted;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.5/geronimo-javamail_1.5_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java [399:446]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected boolean convertTransferEncoding(MimePart bodyPart)
    {
        boolean converted = false;
        try {
            // if this is a multipart element, apply the conversion rules
            // to each of the parts.
            if (bodyPart.isMimeType("multipart/")) {
                MimeMultipart parts = (MimeMultipart)bodyPart.getContent();
                for (int i = 0; i < parts.getCount(); i++) {
                    // convert each body part, and accumulate the conversion result
                    converted = converted && convertTransferEncoding((MimePart)parts.getBodyPart(i));
                }
            }
            else {
                // we only do this if the encoding is quoted-printable or base64
                String encoding =  bodyPart.getEncoding();
                if (encoding != null) {
                    encoding = encoding.toLowerCase();
                    if (encoding.equals("quoted-printable") || encoding.equals("base64")) {
                        // this requires encoding.  Read the actual content to see if
                        // it conforms to the 8bit encoding rules.
                        if (isValid8bit(bodyPart.getInputStream())) {
                            // There's a huge hidden gotcha lurking under the covers here.
                            // If the content just exists as an encoded byte array, then just
                            // switching the transfer encoding will mess things up because the
                            // already encoded data gets transmitted in encoded form, but with
                            // and 8bit encoding style.  As a result, it doesn't get unencoded on
                            // the receiving end.  This is a nasty problem to debug.
                            //
                            // The solution is to get the content as it's object type, set it back
                            // on the the message in raw form.  Requesting the content will apply the
                            // current transfer encoding value to the data.  Once we have set the
                            // content value back, we can reset the transfer encoding.
                            bodyPart.setContent(bodyPart.getContent(), bodyPart.getContentType());

                            // it's valid, so change the transfer encoding to just
                            // pass the data through.
                            bodyPart.setHeader("Content-Transfer-Encoding", "8bit");
                            converted = true;   // we've changed something
                        }
                    }
                }
            }
        } catch (MessagingException e) {
        } catch (IOException e) {
        }
        return converted;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



geronimo-javamail_1.6/geronimo-javamail_1.6_provider/src/main/java/org/apache/geronimo/javamail/transport/smtp/SMTPConnection.java [399:446]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    protected boolean convertTransferEncoding(MimePart bodyPart)
    {
        boolean converted = false;
        try {
            // if this is a multipart element, apply the conversion rules
            // to each of the parts.
            if (bodyPart.isMimeType("multipart/")) {
                MimeMultipart parts = (MimeMultipart)bodyPart.getContent();
                for (int i = 0; i < parts.getCount(); i++) {
                    // convert each body part, and accumulate the conversion result
                    converted = converted && convertTransferEncoding((MimePart)parts.getBodyPart(i));
                }
            }
            else {
                // we only do this if the encoding is quoted-printable or base64
                String encoding =  bodyPart.getEncoding();
                if (encoding != null) {
                    encoding = encoding.toLowerCase();
                    if (encoding.equals("quoted-printable") || encoding.equals("base64")) {
                        // this requires encoding.  Read the actual content to see if
                        // it conforms to the 8bit encoding rules.
                        if (isValid8bit(bodyPart.getInputStream())) {
                            // There's a huge hidden gotcha lurking under the covers here.
                            // If the content just exists as an encoded byte array, then just
                            // switching the transfer encoding will mess things up because the
                            // already encoded data gets transmitted in encoded form, but with
                            // and 8bit encoding style.  As a result, it doesn't get unencoded on
                            // the receiving end.  This is a nasty problem to debug.
                            //
                            // The solution is to get the content as it's object type, set it back
                            // on the the message in raw form.  Requesting the content will apply the
                            // current transfer encoding value to the data.  Once we have set the
                            // content value back, we can reset the transfer encoding.
                            bodyPart.setContent(bodyPart.getContent(), bodyPart.getContentType());

                            // it's valid, so change the transfer encoding to just
                            // pass the data through.
                            bodyPart.setHeader("Content-Transfer-Encoding", "8bit");
                            converted = true;   // we've changed something
                        }
                    }
                }
            }
        } catch (MessagingException e) {
        } catch (IOException e) {
        }
        return converted;
    }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



