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:08:42 GMT
mbecke      2003/09/23 06:08:42

  Modified:    httpclient/src/test/org/apache/commons/httpclient
                        TestURI.java
               httpclient/src/java/org/apache/commons/httpclient URI.java
  Log:
  Fixes bug with URI.isIPv4address().
  PR: 23284
  Submitted by: Michael Becke
  
  Revision  Changes    Path
  1.6       +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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestURI.java	19 Jul 2003 09:41:38 -0000	1.5
  +++ TestURI.java	23 Sep 2003 13:08:42 -0000	1.6
  @@ -85,6 +85,33 @@
           return new TestSuite(TestURI.class);
       }
       
  +    public void testIPv4Address() throws URIException {
  +
  +        URI base = new URI("http://10.0.1.10:8830", false);
  +        
  +        URI uri = base;        
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +            
  +        uri = new URI(base, "/04-1.html", false);
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI("/04-1.html", false);
  +        assertFalse("Should NOT be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI(base, "http://10.0.1.10:8830/04-1.html", false);
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI("http://10.0.1.10:8830/04-1.html", false);
  +        assertTrue("Should be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI(base, "http://host.org/04-1.html", false);
  +        assertFalse("Should NOT be an IPv4 address", uri.isIPv4address());
  +
  +        uri = new URI("http://host.org/04-1.html", false);
  +        assertFalse("Should NOT be an IPv4 address", uri.isIPv4address());
  +        
  +    }
  +    
       /**
        * Tests the URI(URI, String) constructor.  This tests URIs ability to
        * resolve relative URIs.
  
  
  
  1.41      +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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- URI.java	1 Aug 2003 23:18:47 -0000	1.40
  +++ URI.java	23 Sep 2003 13:08:42 -0000	1.41
  @@ -611,6 +611,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