Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5497F4BAD for ; Tue, 17 May 2011 13:38:35 +0000 (UTC) Received: (qmail 68806 invoked by uid 500); 17 May 2011 13:38:35 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 68738 invoked by uid 500); 17 May 2011 13:38:35 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 68731 invoked by uid 99); 17 May 2011 13:38:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 May 2011 13:38:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 May 2011 13:38:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E0D48238890D; Tue, 17 May 2011 13:38:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1104243 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment: AttachmentUtil.java MimeBodyPartInputStream.java Date: Tue, 17 May 2011 13:38:13 -0000 To: commits@cxf.apache.org From: ffang@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110517133813.E0D48238890D@eris.apache.org> Author: ffang Date: Tue May 17 13:38:13 2011 New Revision: 1104243 URL: http://svn.apache.org/viewvc?rev=1104243&view=rev Log: [CXF-3504]ensure can't read MimeBodyPartInputStream after close it Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?rev=1104243&r1=1104242&r2=1104243&view=diff ============================================================================== --- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java (original) +++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java Tue May 17 13:38:13 2011 @@ -285,9 +285,13 @@ public final class AttachmentUtil { } catch (UnsupportedEncodingException ue) { contentId = contentId.substring(4); } - return new LazyDataSource(contentId, atts); + LazyDataSource lazyDS = new LazyDataSource(contentId, atts); + lazyDS.getContentType(); + return lazyDS; } else if (contentId.indexOf("://") == -1) { - return new LazyDataSource(contentId, atts); + LazyDataSource lazyDS = new LazyDataSource(contentId, atts); + lazyDS.getContentType(); + return lazyDS; } else { try { return new URLDataSource(new URL(contentId)); Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java?rev=1104243&r1=1104242&r2=1104243&view=diff ============================================================================== --- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java (original) +++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java Tue May 17 13:38:13 2011 @@ -32,6 +32,8 @@ public class MimeBodyPartInputStream ext byte[] boundary; byte[] boundaryBuffer; + private boolean closed; + public MimeBodyPartInputStream(PushbackInputStream inStreamParam, byte[] boundaryParam, int pbsize) { @@ -45,7 +47,7 @@ public class MimeBodyPartInputStream ext byte b[] = buf; int off = origOff; int len = origLen; - if (boundaryFound) { + if (boundaryFound || closed) { return -1; } if ((off < 0) || (off > b.length) || (len < 0) @@ -268,4 +270,8 @@ public class MimeBodyPartInputStream ext } return value; } + + public void close() throws IOException { + this.closed = true; + } }