Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4400863

URL class doesn't handle E-Mail addresses in user info

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • core-libs
    • beta
    • generic
    • generic



      Name: boT120536 Date: 12/27/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      import java.net.*;

      public class URLTest {
        public static void main(String args[]) throws Exception {
          /*********************************************************************/
          /* The URL class doesn't allow for E-Mail addresses as logins or */
          /* passwords. An example of this would be anonymous FTP requires */
          /* that you use the login 'anonymous' and your E-Mail address as */
          /* your password. It chokes even worse when you try to use an */
          /* E-Mail address as a login. Of particular interest is the */
          /* getUserInfo() which is obviously giving wrong results. */
          /*********************************************************************/
          URL myURL = new URL
      ("ftp://anonymous:###@###.###@www.address.com/file.html");

          System.out.println("getAuthority: " + myURL.getAuthority());
          System.out.println("getFile: " + myURL.getFile());
          System.out.println("getHost: " + myURL.getHost());
          System.out.println("getPath: " + myURL.getPath());
          System.out.println("getPort: " + myURL.getPort());
          System.out.println("getProtocol: " + myURL.getProtocol());
          System.out.println("getQuery: " + myURL.getQuery());
          System.out.println("getRef: " + myURL.getRef());
          System.out.println("getUserInfo: " + myURL.getUserInfo());
        }
      }
      (Review ID: 111021)
      ======================================================================

            alanb Alan Bateman
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: