[ 
https://issues.apache.org/jira/browse/CXF-8768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17609725#comment-17609725
 ] 

Andriy Redko commented on CXF-8768:
-----------------------------------

Thanks [~hunter1023], it is a bit more complicated than that: {*}if pathSegment 
starts with slash{*}, theĀ *ps.getPath()* would return path *without leading* 
{*}slash{*}. Do you have a bug at hand or the test case to reproduce double 
slashes issue? Thank you.

> org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildPath append redundant slashes
> ---------------------------------------------------------------------------
>
>                 Key: CXF-8768
>                 URL: https://issues.apache.org/jira/browse/CXF-8768
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.5.0, 3.5.2
>            Reporter: hunter
>            Priority: Major
>
> the method: org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildPath()
> {*}if pathSegment starts with slash{*}, sb starts with two slashes, is this 
> method correct?
> {code:java}
> private String buildPath() {
>     StringBuilder sb = new StringBuilder();
>     Iterator<PathSegment> iter = paths.iterator();
>     while (iter.hasNext()) {
>         PathSegment ps = iter.next();
>         String p = ps.getPath();
>         if (p.length() != 0 || !iter.hasNext()) {
>             p = 
> URITemplate.createExactTemplate(p).encodeLiteralCharacters(false);
>             if (sb.length() == 0 && leadingSlash) {
>                 sb.append('/');
>             } else if (!p.startsWith("/") && sb.length() > 0) {
>                 sb.append('/');
>             }
>             sb.append(p);
>             if (iter.hasNext()) {
>                 buildMatrix(sb, ps.getMatrixParameters());
>             }
>         }
>     }
>     buildMatrix(sb, matrix);
>     return sb.toString();
> }{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to