Hi,

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

Why would one append "/" if the path did not start with "/"?  Couldn't
this possibly lead to a path with "//" at the end?  Is this the intended
behavior?  I searched all of the smx4 code to see where this class is
used and I could not find where it is used.  Is it possible that this
class is not used?

Thanks for your help,

Jean

***********************************************
Jean Jacobs
Software QA Architect
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
[email protected]
***********************************************


Reply via email to