commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mbe...@apache.org
Subject cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient URI.java
Date Tue, 23 Sep 2003 13:04:14 GMT
mbecke      2003/09/23 06:04:14

  Modified:    httpclient/src/test/org/apache/commons/httpclient Tag:
                        HTTPCLIENT_2_0_BRANCH TestURI.java
               httpclient/src/java/org/apache/commons/httpclient Tag:
                        HTTPCLIENT_2_0_BRANCH URI.java
  Log:
  Fixes bug with URI.isIPv4address().
  PR: 23284
  Submitted by: Michael Becke
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.1   +30 -3     jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURI.java
  
  Index: TestURI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/test/org/apache/commons/httpclient/TestURI.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- TestURI.java	19 Jun 2003 23:28:20 -0000	1.4
  +++ TestURI.java	23 Sep 2003 13:04:14 -0000	1.4.2.1
  @@ -85,6 +85,33 @@
           return new TestSuite(TestURI.class);
       }
       
  +    public void testIPv4Address() throws URIException {
  +
  +        URI base = new URI("http://10.0.1.10:8830");
  +        
  +        URI uri = base;        
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +           
  +        uri = new URI(base, "/04-1.html");
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI("/04-1.html");
  +        assertFalse("Should NOT be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI(base, "http://10.0.1.10:8830/04-1.html");
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI("http://10.0.1.10:8830/04-1.html");
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI(base, "http://host.org/04-1.html");
  +        assertFalse("Should NOT be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI("http://host.org/04-1.html");
  +        assertFalse("Should NOT be an IPv4 address", uri.isIPv4address());
  +        
  +    }
  +    
       /**
        * Tests the URI(URI, String) constructor.  This tests URIs ability to
        * resolve relative URIs.
  
  
  
  No                   revision
  No                   revision
  1.36.2.3  +7 -4      jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java
  
  Index: URI.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URI.java,v
  retrieving revision 1.36.2.2
  retrieving revision 1.36.2.3
  diff -u -r1.36.2.2 -r1.36.2.3
  --- URI.java	1 Aug 2003 01:46:00 -0000	1.36.2.2
  +++ URI.java	23 Sep 2003 13:04:14 -0000	1.36.2.3
  @@ -563,6 +563,9 @@
               this._fragment = relative._fragment;
           }
           this.setURI();
  +        // reparse the newly built URI, this will ensure that all flags are set correctly.
  +        // TODO there must be a better way to do this
  +        parseUriReference(new String(_uri), true);
       }
   
       // --------------------------------------------------- Instance Variables
  
  
  

Mime
View raw message