Uploaded image for project: 'ServiceMix Components'
  1. ServiceMix Components
  2. SMXCOMP-544

createContext method in ManagedContextManager is not normalizing paths properly

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      I'm in the process of adding unit tests for the servicemix-http component. One of the classes in this component is called ManagedContextManager. It has a method called createContext() to add a context for a given URL and HTTP processor to the map of managed contexts. There is some code in that method that is confusing.
      Following is the implementation of the method:

      public synchronized Object createContext(String strUrl, HttpProcessor processor) throws Exception {
      URI uri = new URI(strUrl);
      String path = uri.getPath();
      if (!path.startsWith("/"))

      { path = path + "/"; }
      if (!path.endsWith("/")) { path = path + "/"; }

      managedContexts.put(path, processor);
      return path;
      }

      It seems like if the path does not begin with "/" that it should be PRE-pended to the path (not appended). I will attach a patch to fix this problem.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            edelln Edell Nolan
            jjacobs Jean Jacobs
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment