Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8768

org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildPath append redundant slashes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.5.0, 3.5.2
    • None
    • JAX-RS
    • None
    • Unknown

    Description

      the method: org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildPath()

      if pathSegment starts with slash, sb starts with two slashes, is this method correct?

      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();
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            hunter1023 hunter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: