URL.openStream() gives an NPE for a URL with a bad hostname component

Project:JNode Net
Component:Code
Category:bug report
Priority:normal
Assigned:Stephen Crawley
Status:postponed
Description

To reproduce, initialise the JNode network, set "jnode.debug" to "true" and run the command 'wget http://www/amazon.com' to see the stacktrace for the NPE. Note the misplaced '/'!!

The stacktrace suggests that this bug is in the URL / HTTP / TCP stack, not in 'wget'.

#1

Assigned to:Anonymous» Stephen Crawley

#2

The problem is in the INET stack. When you attempt to create a URL stream for a URL with an unresolvable hostname, an "unresolved" InetSocketAddress is created which has a null address component. The previous code (in org.jnode.net.ipv4.tcp.TCPSocketImpl) did not notice this, and was throwing an NPE. I've changed the code to throw an UnresolvedAddressException like the GNU reference TCP stack does.

But I don't think that this should be the end of it. URE doesn't feel like the right exception, not least because it provides no information about the underlying cause ,,, or even the hostname that couldn't be resolved. This is GNU Classpath code, so I checked on savannah.gnu.org. We don't appear to be missing any updates in this area.

Is there a plan to replace the remaining GNU network code with the equivalent code from OpenJDK? If so, I think this issue should be postponed.

#3

Yes, there is a plan for the complete integration of the java.net code of OpenJDK.

#4

Status:active» postponed

Postponing further work on this issue until we've switched to the OpenJDK codebase for networking.

#7

I have seen recent commits from lsantha that might fix that but I haven't checked. Can someone have a look with latest from trunk ?