You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Jean Jacobs (JIRA)" <ji...@apache.org> on 2009/05/18 16:09:50 UTC

[jira] Created: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

createContext method in ManagedContextManager is not normalizing paths properly
-------------------------------------------------------------------------------

                 Key: SMXCOMP-544
                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
             Project: ServiceMix Components
          Issue Type: Bug
          Components: servicemix-http
    Affects Versions: servicemix-http-2009.01
            Reporter: Jean Jacobs
            Priority: Minor


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

Posted by "Edell Nolan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52040#action_52040 ] 

Edell Nolan commented on SMXCOMP-544:
-------------------------------------

applied patch on behalf of Jean Jacobs.

thanks Jean for your contribution.

> createContext method in ManagedContextManager is not normalizing paths properly
> -------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-544
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-http
>    Affects Versions: servicemix-http-2009.01
>            Reporter: Jean Jacobs
>            Assignee: Edell Nolan
>            Priority: Minor
>         Attachments: httpManagedContextManager.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

Posted by "Edell Nolan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edell Nolan reassigned SMXCOMP-544:
-----------------------------------

    Assignee: Edell Nolan

this is related to SMXCOMP-528  - I will apply this as those tests need this fix.

> createContext method in ManagedContextManager is not normalizing paths properly
> -------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-544
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-http
>    Affects Versions: servicemix-http-2009.01
>            Reporter: Jean Jacobs
>            Assignee: Edell Nolan
>            Priority: Minor
>         Attachments: httpManagedContextManager.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

Posted by "Edell Nolan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52122#action_52122 ] 

Edell Nolan commented on SMXCOMP-544:
-------------------------------------

Merge for smx3: 

http://svn.apache.org/viewvc?rev=781749&view=rev

> createContext method in ManagedContextManager is not normalizing paths properly
> -------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-544
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-http
>    Affects Versions: servicemix-http-2009.01
>            Reporter: Jean Jacobs
>            Assignee: Edell Nolan
>            Priority: Minor
>             Fix For: servicemix-http-2009.02
>
>         Attachments: httpManagedContextManager.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

Posted by "Edell Nolan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/SMXCOMP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52042#action_52042 ] 

Edell Nolan commented on SMXCOMP-544:
-------------------------------------

Merge for smx4:
http://svn.apache.org/viewvc?rev=781404&view=rev

> createContext method in ManagedContextManager is not normalizing paths properly
> -------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-544
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-http
>    Affects Versions: servicemix-http-2009.01
>            Reporter: Jean Jacobs
>            Assignee: Edell Nolan
>            Priority: Minor
>             Fix For: servicemix-http-2009.02
>
>         Attachments: httpManagedContextManager.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

Posted by "Jean Jacobs (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jean Jacobs updated SMXCOMP-544:
--------------------------------

    Attachment: httpManagedContextManager.patch

Attached is a patch to fix the problem with the normalized paths in createContext().  I also fixed the code that was producing warnings for the generic types for Map, Set, and Iterator by parameterizing them.

> createContext method in ManagedContextManager is not normalizing paths properly
> -------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-544
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-http
>    Affects Versions: servicemix-http-2009.01
>            Reporter: Jean Jacobs
>            Priority: Minor
>         Attachments: httpManagedContextManager.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SMXCOMP-544) createContext method in ManagedContextManager is not normalizing paths properly

Posted by "Edell Nolan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/SMXCOMP-544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edell Nolan resolved SMXCOMP-544.
---------------------------------

       Resolution: Fixed
    Fix Version/s: servicemix-http-2009.02

> createContext method in ManagedContextManager is not normalizing paths properly
> -------------------------------------------------------------------------------
>
>                 Key: SMXCOMP-544
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-544
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-http
>    Affects Versions: servicemix-http-2009.01
>            Reporter: Jean Jacobs
>            Assignee: Edell Nolan
>            Priority: Minor
>             Fix For: servicemix-http-2009.02
>
>         Attachments: httpManagedContextManager.patch
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.