voyent
Messages posted by: greg.hopkins  XML
Profile for greg.hopkins -> Messages posted by greg.hopkins [1]
Author Message
I have found what I think is a small bug in HttpAdapter.

Here is a code snippet: (from 1.8.0, line 214)
Code:
 _connection =
                     (HttpURLConnection)
                         new URL(
                             "http",
                             localAddress,
                             localPort,
                             "/" +
                                 message.getStringProperty(
                                     Message.DESTINATION_SERVLET_CONTEXT_PATH) +
                                 "/block/message"
                         ).openConnection();
 


As you can see, the URL is being prefixed with a "/". After a great deal of debugging, I discovered that the String property in the message already has a leading "/", so the URL being formed is something like "//<app context>/block/message" for example. I am running on WebSphere 6.1, and get an error regarding the previously mentioned "//" not being available. I believe the error is happening on an HTTP GET.

I propose this change... does it make sense??
Code:
 String destinationServletContextPath = message.getStringProperty(Message.DESTINATION_SERVLET_CONTEXT_PATH);
 _connection =
                     (HttpURLConnection)
                         new URL(
                             "http",
                             localAddress,
                             localPort,
                             (desinationServletContextPath.charAt(0) == '/' ? "" : "/") + destinationServletContextPath +
                                 "/block/message"
                         ).openConnection();
 
 
Profile for greg.hopkins -> Messages posted by greg.hopkins [1]
Go to:   
Powered by JForum 2.1.7ice © JForum Team