Two Laptop Bag
The moose likes Beginning Java and the fly likes Why the MalformedURLException? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Why the MalformedURLException?" Watch "Why the MalformedURLException?" New topic

Why the MalformedURLException?

Thomas Kennedy
Ranch Hand

Joined: Jan 20, 2008
Posts: 137
Can anyone tell me why I get a MalformedURLException -- see line 05 below -- when I run this code? I am using JDK 1.3. (I know it's ancient; using a newer jdk is not an option.) no protocol:

Costs matter. Justice lies in processes not outcomes. Crime is caused by criminals.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
You shouldn't encode the URL before creating the URL instance.
It is sorta covered in the JavaRanch Style Guide.
subject: Why the MalformedURLException?
It's not a secret anymore!