You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "hunter (Jira)" <ji...@apache.org> on 2022/12/06 10:42:00 UTC

[jira] [Closed] (CXF-8768) org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildPath append redundant slashes

     [ https://issues.apache.org/jira/browse/CXF-8768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

hunter closed CXF-8768.
-----------------------
    Resolution: Not A Problem

> 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)