This is an automated email from the ASF dual-hosted git repository. coheigea pushed a commit to branch 3.3.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 1f4f4dcab16036af17143fa0fe386f6a051554f7 Author: Alexey Markevich <[email protected]> AuthorDate: Tue Dec 17 16:24:38 2019 +0300 AttachmentUtil: return back correct @ character (cherry picked from commit 8c61da9ad04d116f2c1d3b05b45705f3424386df) --- core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java | 2 +- .../test/java/org/apache/cxf/attachment/AttachmentUtilTest.java | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) 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 229867a..d418293 100644 --- a/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java +++ b/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java @@ -210,7 +210,7 @@ public final class AttachmentUtil { cid = ns; } } - return ATT_UUID + '-' + Integer.toString(COUNTER.incrementAndGet()) + "%40" // '@' + return ATT_UUID + '-' + Integer.toString(COUNTER.incrementAndGet()) + '@' + URLEncoder.encode(cid, StandardCharsets.UTF_8.name()); } diff --git a/core/src/test/java/org/apache/cxf/attachment/AttachmentUtilTest.java b/core/src/test/java/org/apache/cxf/attachment/AttachmentUtilTest.java index 96f6717..547a531 100644 --- a/core/src/test/java/org/apache/cxf/attachment/AttachmentUtilTest.java +++ b/core/src/test/java/org/apache/cxf/attachment/AttachmentUtilTest.java @@ -18,13 +18,10 @@ */ package org.apache.cxf.attachment; -import java.net.URLDecoder; -import java.nio.charset.StandardCharsets; - import org.junit.Test; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertNotEquals; public class AttachmentUtilTest { @@ -122,8 +119,7 @@ public class AttachmentUtilTest { @Test public void testCreateContentID() throws Exception { - final String contentID = AttachmentUtil.createContentID(null); - assertTrue(URLDecoder.decode(contentID, StandardCharsets.UTF_8.name()).indexOf('@') > -1); + assertNotEquals(AttachmentUtil.createContentID(null), AttachmentUtil.createContentID(null)); } }
