[
https://issues.apache.org/jira/browse/CXF-8768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
hunter updated CXF-8768:
------------------------
Description:
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}
was:
the method: org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildPath()
{*}if pathSegment start 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}
> 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)