GR 1.0b12 - Invalid URL doesn't display error message to use

drees

Joined: 2002-11-20
Posts: 16
Posted: Wed, 2002-11-20 17:06

I just installed GR 1.0b12. The first thing I did was accidently type in an invalid URL for my gallery:

http:/www.greenhydrant.com/gallery/

I would think that you would want to verify the URL using Java's URL object:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
try {
URL url = new URL(usergalleryURL);
} catch (MalformedURLException mue) {
// display error message to user - check your spelling!
}
</TD></TR></TABLE><!-- BBCode End -->

Here's the relavant portions of stack trace from the log file:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
1037811479460|ERROR|GalComm |java.net.UnknownHostException: http
at java.net.InetAddress.getAllByName0(InetAddress.java:953)
at java.net.InetAddress.getAllByName0(InetAddress.java:918)
at java.net.InetAddress.getAllByName(InetAddress.java:912)
at HTTPClient.HTTPConnection.getSocket(HTTPConnection.java:3104)
at HTTPClient.HTTPConnection.sendRequest(HTTPConnection.java:2879)
at HTTPClient.HTTPConnection.handleRequest(HTTPConnection.java:2715)
at HTTPClient.HTTPConnection.setupRequest(HTTPConnection.java:2507)
at HTTPClient.HTTPConnection.Head(HTTPConnection.java:809)
at HTTPClient.HTTPConnection.Head(HTTPConnection.java:725)
at com.gallery.GalleryRemote.GalleryComm.tryComm(GalleryComm.java:156)
at com.gallery.GalleryRemote.GalleryComm.getCommInstance(GalleryComm.java:141)
at com.gallery.GalleryRemote.model.Gallery.getComm(Gallery.java:334)
at com.gallery.GalleryRemote.model.Gallery.fetchAlbums(Gallery.java:83)
at com.gallery.GalleryRemote.MainFrame.fetchAlbums(MainFrame.java:547)
at com.gallery.GalleryRemote.MainFrame.actionPerformed(MainFrame.java:852)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1764)
</TD></TR></TABLE><!-- BBCode End -->

Maybe if I get some time, I'll get involved with the development team, this is a great product.

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Fri, 2002-11-22 00:41

What happens is not that the URL is malformed, it's that we attempt to fix the URL by prepending http:// when it doesn't start with http://.

So in your case what happens is that it tries to look for http://http:/your.site.com. Which is not good.

So, still bad exception handling...

I've added better exception trapping to the next build (not sure when this will happen, because we're trying to ship 1.0 concurrently with G 1.3.2 and that's getting delayed daily). You can check out the CVS tree if you want to be more current.

Thanks for the report.