Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 4eb8d15a2 -> 5d021211f


[CXF-6484] Regression in Content-id format - applying patch from 2.7.x pull 
request - Thanks Chris Dolphy


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

Branch: refs/heads/3.0.x-fixes
Commit: c10ec21f253508989a90ba6304dbba69dfc22b1a
Parents: 4eb8d15
Author: Alessio Soldano <asold...@redhat.com>
Authored: Wed Jul 22 21:24:32 2015 +0200
Committer: Alessio Soldano <asold...@redhat.com>
Committed: Wed Jul 22 21:29:23 2015 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/cxf/attachment/AttachmentUtil.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c10ec21f/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java 
b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
index ba82579..a054ca2 100644
--- a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
+++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
@@ -24,6 +24,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
+import java.net.URI;
 import java.net.URL;
 import java.net.URLDecoder;
 import java.net.URLEncoder;
@@ -196,7 +197,12 @@ public final class AttachmentUtil {
         
         String name = ATT_UUID + "-" + String.valueOf(++counter);
         if (ns != null && (ns.length() > 0)) {
-            cid = ns;
+            try {
+                URI uri = new URI(ns);
+                cid = uri.getHost();
+            } catch (Exception e) {
+                cid = ns;
+            }
         }
         return URLEncoder.encode(name, "UTF-8") + "@" + URLEncoder.encode(cid, 
"UTF-8");
     }

Reply via email to