java.lang.NullPointerException
at org.mortbay.jetty.HttpGenerator.completeHeader(HttpGenerator.java:281)
at org.mortbay.jetty.client.HttpConnection.commitRequest(HttpConnection.java:392)
at org.mortbay.jetty.client.HttpConnection.handle(HttpConnection.java:208)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:421)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:497)
I'd be happy to provide a patch if someone (Greg) can give me some input on desired behavior. I see the following options:
1) Do nothing
2) Throw an IllegalArgumentException with an explaination instead of the NPE. Reading the URL RFC I see that the "/" is not a part of the path component, so strictly speaking a URL without a path component should end with a "/".
3) Update setURL to add a "/" to the URL if the user didn't.
Since I'm the silly user who forgot my "/" in the first place, I'm personally in favor of option 3
Let me know what you think and I'll provide a patch.
Thanks,
Eirik.
Description
Passing a URL without a trailing path component in HttpExchange.setURL() leads to a NullPointerException in HttpGenerator.java:281.
With:
ContentExchange exchange = new ContentExchange();
exchange.setMethod("GET");
java.lang.NullPointerException
at org.mortbay.jetty.HttpGenerator.completeHeader(HttpGenerator.java:281)
at org.mortbay.jetty.client.HttpConnection.commitRequest(HttpConnection.java:392)
at org.mortbay.jetty.client.HttpConnection.handle(HttpConnection.java:208)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:421)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:497)
I'd be happy to provide a patch if someone (Greg) can give me some input on desired behavior. I see the following options:
1) Do nothing
2) Throw an IllegalArgumentException with an explaination instead of the NPE. Reading the URL RFC I see that the "/" is not a part of the path component, so strictly speaking a URL without a path component should end with a "/".
3) Update setURL to add a "/" to the URL if the user didn't.
Since I'm the silly user who forgot my "/" in the first place, I'm personally in favor of option 3
Let me know what you think and I'll provide a patch.
Thanks,
Eirik.
Thanks for pointing that one out. Fixed now in trunk and jetty-6 branch.
cheers
Jan