一个简单的下载程序,GUI类负责界面,Download类负责下载,现在的问题是运行时出现MalFormedUrlException ,该怎么修改啊
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;class GUI extends Frame 
{
   
    final Download dl ;
    static URL url;
    URLConnection urlConn;
    String str;
    URL geturl(String str)throws Exception 
              {
               return new URL(str);
              }
     
    GUI()throws Exception 
    {
    
         setTitle("下载程序");
    setSize(600,400);
    setLocation(100,100);
    setBackground(Color.lightGray);
    Panel p=new Panel();
    Label l=new Label("Please input URL:");
    TextField tf=new TextField(30);
    TextArea ta=new TextArea(); 
    Button btn=new Button("Download");
      
    p.add(l);
    p.add(tf);
    add(p,"North");     
    add(ta,"Center");     
    p.add(btn);
   
     str=tf.getText();
    url = geturl(str);
            urlConn=url.openConnection(); 
    dl = new Download(url);
    String line=System.getProperty("line.separator");
              ta.append("Host: "+url.getHost());
              ta.append(line);
              ta.append("Port: "+url.getDefaultPort());
              ta.append(line);
              ta.append("ContentType: "+urlConn.getContentType());
              ta.append(line);
              ta.append("ContentLength: "+urlConn.getContentLength());
                      
              
    btn.addActionListener(new ActionListener()
     {
          public void actionPerformed(ActionEvent e) 
          {
            dl.downLoad();
          }
        });
    addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
           System.exit(0);
         }
       });
    }
    
  }class Download 
{
    
     URL url;   
     URLConnection urlConn;
    
    public String getFileName(URL url) 
    {
    String fileName = url.getFile();
    return fileName.substring(fileName.lastIndexOf('/') + 1);
    }
    public Download(URL url)
    {
     this.url = url;
    }
    public void downLoad()
    {    
            try 
            { 
              
              urlConn=url.openConnection();                         
              InputStream is=urlConn.getInputStream();
              InputStreamReader isr=new InputStreamReader(is);              
              FileOutputStream fos=new FileOutputStream(getFileName(url));
              int data;
              while((data=is.read())!=-1)
              {
               fos.write(data);
              }            
              is.close();
              fos.close();
            }
            catch (Exception ex) {
              ex.printStackTrace();
            }
    }
   
    
}class test
{
  public static void main(String[] args)throws Exception 
  {
  
   GUI gui = new GUI();
   gui.show();
  }
}