Repository: cxf Updated Branches: refs/heads/2.7.x-fixes a70005059 -> 2ed09a67d
cxf-6484 Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f7a8009f Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f7a8009f Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f7a8009f Branch: refs/heads/2.7.x-fixes Commit: f7a8009fc9cffd40d34d23279ca25d7f5e4880cb Parents: 0c637e9 Author: Chris Dolphy <[email protected]> Authored: Thu Jul 2 22:43:32 2015 -0500 Committer: Chris Dolphy <[email protected]> Committed: Thu Jul 2 22:43:32 2015 -0500 ---------------------------------------------------------------------- .../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/f7a8009f/api/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java b/api/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java index e027d75..7ca5877 100644 --- a/api/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java +++ b/api/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"); }
