You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2002/12/03 03:50:57 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/util HttpUtils.java
jvanzyl 2002/12/02 18:50:57
Modified: src/bootstrap/org/apache/maven BootstrapTask.java
src/java/org/apache/maven AbstractMavenComponent.java
src/java/org/apache/maven/util HttpUtils.java
Log:
o changing bootstrap task which gets rid of the unused verbose flag.
o giving abstract maven components access to localized messaging.
o cleanup of httputils.
Revision Changes Path
1.8 +1 -1 jakarta-turbine-maven/src/bootstrap/org/apache/maven/BootstrapTask.java
Index: BootstrapTask.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/bootstrap/org/apache/maven/BootstrapTask.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BootstrapTask.java 26 Oct 2002 15:16:47 -0000 1.7
+++ BootstrapTask.java 3 Dec 2002 02:50:57 -0000 1.8
@@ -394,7 +394,7 @@
URL source = new URL(baseUrl + file);
- HttpUtils.getFile(source, destinationFile, file, verbose,
+ HttpUtils.getFile(source, destinationFile, file,
ignoreErrors, useTimestamp, uname, pword,
proxyHost, proxyPort, proxyUserName,
proxyPassword);
1.2 +12 -1 jakarta-turbine-maven/src/java/org/apache/maven/AbstractMavenComponent.java
Index: AbstractMavenComponent.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/AbstractMavenComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractMavenComponent.java 2 Dec 2002 07:31:11 -0000 1.1
+++ AbstractMavenComponent.java 3 Dec 2002 02:50:57 -0000 1.2
@@ -105,4 +105,15 @@
{
return context;
}
+
+ /** @see MavenUtils#getMessage */
+ public String getMessage( String messageId )
+ {
+ return MavenUtils.getMessage( messageId );
+ }
+ /** @see MavenUtils#getMessage */
+ public String getMessage( String messageId, Object variable )
+ {
+ return MavenUtils.getMessage( messageId, variable );
+ }
}
1.12 +24 -36 jakarta-turbine-maven/src/java/org/apache/maven/util/HttpUtils.java
Index: HttpUtils.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- HttpUtils.java 25 Nov 2002 18:30:24 -0000 1.11
+++ HttpUtils.java 3 Dec 2002 02:50:57 -0000 1.12
@@ -66,7 +66,6 @@
import java.net.PasswordAuthentication;
import java.net.URL;
import java.net.URLConnection;
-import java.util.Date;
/**
* Http utils for retrieving files.
@@ -87,8 +86,10 @@
* @param proxyPassword Proxy Password (if authentification is required),
* or null
*/
- public static void useProxyUser( final String proxyHost, final String proxyPort,
- final String proxyUserName, final String proxyPassword )
+ public static void useProxyUser( final String proxyHost,
+ final String proxyPort,
+ final String proxyUserName,
+ final String proxyPassword )
{
if ( proxyHost != null && proxyPort != null )
{
@@ -116,7 +117,6 @@
* @param source the {@link URL} of the file to retrieve
* @param destinationFile where to store it
* @param file <strong>doesn't appear to be used</strong>
- * @param verbose the amount of logging to be displayed
* @param ignoreErrors whether to ignore errors during I/O or throw an
* exception when they happen
* @param useTimestamp whether to check the modified timestamp on the
@@ -134,7 +134,6 @@
public static boolean getFile( URL source,
File destinationFile,
String file,
- boolean verbose,
boolean ignoreErrors,
boolean useTimestamp,
String uname,
@@ -153,12 +152,6 @@
if ( useTimestamp && destinationFile.exists() )
{
timestamp = destinationFile.lastModified();
- if ( verbose )
- {
- Date t = new Date( timestamp );
- logx( "local file date : " + t.toString() );
- }
-
hasTimestamp = true;
}
@@ -206,20 +199,12 @@
connection;
if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED )
{
- //not modified so no file download. just return instead
- //and trace out something so the user doesn't think that the
- //download happened when it didnt
- if ( verbose )
- {
- logx( "Not modified - so not downloaded" );
- }
-
return true;
}
// test for 401 result (HTTP only)
if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED )
{
- logx( "Not authorized - check " + destinationFile + " for details" );
+ //!! We need to throw an exception so a useful message can be displayed.
return false;
}
}
@@ -277,14 +262,7 @@
if ( useTimestamp )
{
long remoteTimestamp = connection.getLastModified();
- if ( verbose )
- {
- Date t = new Date( remoteTimestamp );
- logx( "last modified = " + t.toString()
- + ( ( remoteTimestamp == 0 )
- ? " - using current time instead"
- : "" ) );
- }
+
if ( remoteTimestamp != 0 )
{
touchFile( destinationFile, remoteTimestamp );
@@ -313,7 +291,6 @@
* @param source the {@link URL} of the file to retrieve
* @param destinationFile where to store it
* @param file <strong>doesn't appear to be used</strong>
- * @param verbose the amount of logging to be displayed
* @param ignoreErrors whether to ignore errors during I/O or throw an
* exception when they happen
* @param useTimestamp whether to check the modified timestamp on the
@@ -322,15 +299,26 @@
* @param pword the password to use for basic authentication
* @return true if the retrieval succeeded, false otherwise
* @deprecated
- * @see #getFile(URL,File,String,boolean,boolean,boolean,String,String,String,String,String,String)
+ * @see #getFile(URL,File,String,boolean,boolean,String,String,String,String,String,String)
*/
- public static boolean getFile( URL source, File destinationFile, String file,
- boolean verbose, boolean ignoreErrors, boolean useTimestamp,
- String uname, String pword )
+ public static boolean getFile( URL source,
+ File destinationFile,
+ String file,
+ boolean ignoreErrors,
+ boolean useTimestamp,
+ String uname,
+ String pword )
{
- return getFile( source, destinationFile, file,
- verbose, ignoreErrors, useTimestamp,
- uname, pword, null, null, null, null );
+ return getFile( source,
+ destinationFile,
+ file,
+ ignoreErrors, useTimestamp,
+ uname,
+ pword,
+ null,
+ null,
+ null,
+ null );
}
/**