You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2004/06/07 14:02:34 UTC
cvs commit: maven/src/test/java/org/apache/maven/util HttpUtilsTest.java
brett 2004/06/07 05:02:34
Modified: src/java/org/apache/maven/util Tag: MAVEN-1_0-BRANCH
HttpUtils.java
src/test/java/org/apache/maven/util Tag: MAVEN-1_0-BRANCH
HttpUtilsTest.java
Log:
PR: MAVEN-1310
Submitted By: Jerome Lacoste
Doco and test for HttpUtils
Revision Changes Path
No revision
No revision
1.28.4.8 +7 -3 maven/src/java/org/apache/maven/util/HttpUtils.java
Index: HttpUtils.java
===================================================================
RCS file: /home/cvs/maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.28.4.7
retrieving revision 1.28.4.8
diff -u -r1.28.4.7 -r1.28.4.8
--- HttpUtils.java 28 Apr 2004 03:19:25 -0000 1.28.4.7
+++ HttpUtils.java 7 Jun 2004 12:02:34 -0000 1.28.4.8
@@ -24,7 +24,6 @@
import java.io.InputStream;
import java.net.Authenticator;
import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.URLConnection;
@@ -51,6 +50,8 @@
* or null
* @param proxyPassword Proxy Password (if authentification is required),
* or null
+ * @throws SecurityException if an operation is not authorized by the
+ * SecurityManager
*/
public static void useProxyUser( final String proxyHost,
final String proxyPort,
@@ -95,6 +96,7 @@
* or null.
* @param useChecksum Flag to indicate the use of the checksum for the retrieved
* artifact if it is available.
+ * @throws IOException If an I/O exception occurs.
*/
public static void getFile( String url,
File destinationFile,
@@ -157,6 +159,7 @@
* or null
* @param proxyPassword Proxy Password (if authentification is required),
* or null
+ * @throws IOException If an I/O exception occurs.
*/
public static void getFile( String url,
File destinationFile,
@@ -208,7 +211,7 @@
* or null
* @param proxyPassword Proxy Password (if authentification is required),
* or null
- * @exception IOException If an I/O exception occurs.
+ * @throws IOException If an I/O exception occurs.
*/
public static void getFile( String url,
File destinationFile,
@@ -340,6 +343,7 @@
*
* @param url The url to parse.
* @return The username, password and url.
+ * @throws RuntimeException if the url is (very) invalid
*/
static String[] parseUrl( String url )
{
@@ -375,7 +379,7 @@
* @param timemillis in milliseconds since the start of the era
* @return true if it succeeded. False means that this is a java1.1 system
* and that file times can not be set
- * @exception Exception Thrown in unrecoverable error. Likely this
+ * @throws RuntimeException Thrown in unrecoverable error. Likely this
* comes from file access failures.
*/
private static boolean touchFile( File file, long timemillis )
No revision
No revision
1.2.10.2 +11 -0 maven/src/test/java/org/apache/maven/util/HttpUtilsTest.java
Index: HttpUtilsTest.java
===================================================================
RCS file: /home/cvs/maven/src/test/java/org/apache/maven/util/HttpUtilsTest.java,v
retrieving revision 1.2.10.1
retrieving revision 1.2.10.2
diff -u -r1.2.10.1 -r1.2.10.2
--- HttpUtilsTest.java 2 Mar 2004 05:38:55 -0000 1.2.10.1
+++ HttpUtilsTest.java 7 Jun 2004 12:02:34 -0000 1.2.10.2
@@ -102,6 +102,17 @@
assertEquals( "http://repository.mycompany.com", up[2] );
}
+ public void testParseInvalidUrl() throws Exception
+ {
+ String invalidUrl = "a@username:http://password";
+ try {
+ String[] up = HttpUtils.parseUrl( invalidUrl );
+ fail("expected RuntimeException to be thrown but got " + up.length + " elements.");
+
+ } catch (RuntimeException e) {
+ assertTrue(true); // expected
+ }
+ }
/**
* JUnitDoclet moves marker to this method, if there is not match
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org