Author: ffang
Date: Wed May 18 09:51:41 2011
New Revision: 1124152
URL: http://svn.apache.org/viewvc?rev=1124152&view=rev
Log:
Merged revisions 1104697 via svnmerge from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1104697 | ffang | 2011-05-18 14:28:11 +0800 (δΈ‰, 18 5 2011) | 1 line
[CXF-3505]CXF attachment doesn't compatible with SUN's ACTIVATION library
........
Modified:
cxf/branches/2.3.x-fixes/ (props changed)
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified:
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?rev=1124152&r1=1124151&r2=1124152&view=diff
==============================================================================
---
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
(original)
+++
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
Wed May 18 09:51:41 2011
@@ -285,9 +285,9 @@ public final class AttachmentUtil {
} catch (UnsupportedEncodingException ue) {
contentId = contentId.substring(4);
}
- return new LazyDataSource(contentId, atts);
+ return loadDataSource(contentId, atts);
} else if (contentId.indexOf("://") == -1) {
- return new LazyDataSource(contentId, atts);
+ return loadDataSource(contentId, atts);
} else {
try {
return new URLDataSource(new URL(contentId));
@@ -297,5 +297,12 @@ public final class AttachmentUtil {
}
}
+
+ private static DataSource loadDataSource(String contentId,
Collection<Attachment> atts) {
+ LazyDataSource lazyDS = new LazyDataSource(contentId, atts);
+ //ensure the attachment DS is loaded to make it also work with SUN's
activation lib
+ lazyDS.getContentType();
+ return lazyDS;
+ }
}