You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by og...@apache.org on 2004/01/29 19:33:32 UTC
cvs commit: jakarta-commons/httpclient/src/java/org/apache/commons/httpclient HttpsURL.java HttpURL.java
oglueck 2004/01/29 10:33:32
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 HttpsURL.java HttpURL.java
Log:
fixed: getScheme() and getPort() were returning wrong defaults for HttpsURL
added: testcase
PR: 26328
Revision Changes Path
No revision
No revision
1.4.2.2 +13 -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.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- TestURI.java 23 Sep 2003 13:04:14 -0000 1.4.2.1
+++ TestURI.java 29 Jan 2004 18:33:32 -0000 1.4.2.2
@@ -112,6 +112,16 @@
}
+ public void testUrl() throws URIException {
+ URI url = new HttpURL("http://jakarta.apache.org");
+ assertEquals(80, url.getPort());
+ assertEquals("http", url.getScheme());
+
+ url = new HttpsURL("https://jakarta.apache.org");
+ assertEquals(443, url.getPort());
+ assertEquals("https", url.getScheme());
+ }
+
/**
* Tests the URI(URI, String) constructor. This tests URIs ability to
* resolve relative URIs.
No revision
No revision
1.6.2.1 +34 -3 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpsURL.java
Index: HttpsURL.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpsURL.java,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- HttpsURL.java 13 Feb 2003 05:08:18 -0000 1.6
+++ HttpsURL.java 29 Jan 2004 18:33:32 -0000 1.6.2.1
@@ -440,6 +440,37 @@
*/
static final long serialVersionUID = 887844277028676648L;
+ // ------------------------------------------------------------- The scheme
+
+ /**
+ * Get the scheme. You can get the scheme explicitly.
+ *
+ * @return the scheme
+ */
+ public char[] getRawScheme() {
+ return (_scheme == null) ? null : HttpsURL.DEFAULT_SCHEME;
+ }
+
+
+ /**
+ * Get the scheme. You can get the scheme explicitly.
+ *
+ * @return the scheme null if empty or undefined
+ */
+ public String getScheme() {
+ return (_scheme == null) ? null : new String(HttpsURL.DEFAULT_SCHEME);
+ }
+
+ // --------------------------------------------------------------- The port
+
+ /**
+ * Get the port number.
+ * @return the port number
+ */
+ public int getPort() {
+ return (_port == -1) ? HttpsURL.DEFAULT_PORT : _port;
+ }
+
// ---------------------------------------------------------------- Utility
/**
1.12.2.1 +6 -6 jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java
Index: HttpURL.java
===================================================================
RCS file: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpURL.java,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -r1.12 -r1.12.2.1
--- HttpURL.java 4 Apr 2003 02:37:02 -0000 1.12
+++ HttpURL.java 29 Jan 2004 18:33:32 -0000 1.12.2.1
@@ -444,7 +444,7 @@
* @return the scheme
*/
public char[] getRawScheme() {
- return (_scheme == null) ? null : DEFAULT_SCHEME;
+ return (_scheme == null) ? null : HttpURL.DEFAULT_SCHEME;
}
@@ -454,7 +454,7 @@
* @return the scheme null if empty or undefined
*/
public String getScheme() {
- return (_scheme == null) ? null : new String(DEFAULT_SCHEME);
+ return (_scheme == null) ? null : new String(HttpURL.DEFAULT_SCHEME);
}
// --------------------------------------------------------------- The port
@@ -464,7 +464,7 @@
* @return the port number
*/
public int getPort() {
- return (_port == -1) ? DEFAULT_PORT : _port;
+ return (_port == -1) ? HttpURL.DEFAULT_PORT : _port;
}
// ----------------------------------------------------------- The userinfo
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org