You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by ni...@apache.org on 2004/07/31 22:31:34 UTC
svn commit: rev 31061 - in incubator/depot/trunk/update/src/java/org/apache/depot/update: tool util/net/http version
Author: nickchalko
Date: Sat Jul 31 15:31:33 2004
New Revision: 31061
Modified:
incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/Tool.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/util/net/http/HttpClientUserAgent.java
incubator/depot/trunk/update/src/java/org/apache/depot/update/version/Version.java
Log:
Use the new VersionStamp.
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/Tool.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/Tool.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/tool/Tool.java Sat Jul 31 15:31:33 2004
@@ -72,7 +72,7 @@
protected abstract String getTitle();
protected abstract void init();
protected void printVersion() {
- String version = Version.INSTANCE.getLongVersion();
+ String version = Version.getInstance().getLongVersion();
System.out.println("Apache Depot " + getTitle() + " : " + version);
}
protected void printHelp() {
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/util/net/http/HttpClientUserAgent.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/util/net/http/HttpClientUserAgent.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/util/net/http/HttpClientUserAgent.java Sat Jul 31 15:31:33 2004
@@ -35,7 +35,7 @@
* @author arb_jack
*
* A simple UserAgent
- *
+ *
*/
public class HttpClientUserAgent {
private HttpClient m_client = null;
@@ -46,13 +46,13 @@
//
// Enable a timeout
//
- // :TODO: Restore when a release has this
+ // :TODO: Restore when a release has this
// m_client.getParams().setConnectionManagerTimeout(30000);
}
/**
- * Test if a URL 'exists' by performing an HTTP HEAD and
- * testing the status code response.
+ * Test if a URL 'exists' by performing an HTTP HEAD and testing the status
+ * code response.
*
* @param url
* @return
@@ -66,13 +66,11 @@
head = getHead(url);
int resultCode = m_client.executeMethod(head);
exists = (HttpURLConnection.HTTP_OK == resultCode);
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
Logger.getLogger().error("Failed to HTTP HEAD [" + url + "]", ex);
throw ex;
- }
- finally {
- if ( null != head )
+ } finally {
+ if (null != head)
head.releaseConnection();
}
@@ -81,6 +79,7 @@
/**
* Return the contents of a GET to a URL as a String
+ *
* @param url
* @return
*/
@@ -94,13 +93,11 @@
int resultCode = m_client.executeMethod(get);
if (HttpURLConnection.HTTP_OK == resultCode)
content = get.getResponseBodyAsString();
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
Logger.getLogger().error("Failed to HTTP GET [" + url + "]", ex);
throw ex;
- }
- finally {
- if ( null != get )
+ } finally {
+ if (null != get)
get.releaseConnection();
}
@@ -109,10 +106,12 @@
/**
* Copy the contents of a GET of a URL to another stream
+ *
* @param url
* @param output
*/
- public void transferContents(String url, OutputStream output) throws Exception {
+ public void transferContents(String url, OutputStream output)
+ throws Exception {
GetMethod get = null;
try {
@@ -126,14 +125,12 @@
IOUtils.transfer(input, output);
IOUtils.close(input);
}
- }
- catch (Exception ex) {
+ } catch (Exception ex) {
Logger.getLogger().error("Failed to HTTP GET [" + url + "]", ex);
-
+
throw ex;
- }
- finally {
- if ( null != get )
+ } finally {
+ if (null != get)
get.releaseConnection();
}
@@ -141,6 +138,7 @@
/**
* Return a configured HEAD method to a URL
+ *
* @param url
* @return
*/
@@ -152,6 +150,7 @@
/**
* Return a configured HEAD method to a URL
+ *
* @param url
* @return
*/
@@ -164,19 +163,19 @@
/**
*
* Prepares a method with out standard preferences.
- *
- */
+ *
+ */
private void configureMethod(HttpMethod method) {
-
+
//
method.setFollowRedirects(true);
-
+
//
// Identify use (in case we upset any folks).
//
- method.setRequestHeader(
- "User-Agent",
- "Apache-Depot-Update/" + Version.INSTANCE.getLongVersion());
+ method.setRequestHeader("User-Agent", "Apache-Depot-Update/"
+ + Version.getInstance().getLongVersion());
+
}
public static void main(String args[]) throws Exception {
@@ -193,4 +192,4 @@
out.println("Contents : " + agent.getContents(url));
}
}
-}
+}
\ No newline at end of file
Modified: incubator/depot/trunk/update/src/java/org/apache/depot/update/version/Version.java
==============================================================================
--- incubator/depot/trunk/update/src/java/org/apache/depot/update/version/Version.java (original)
+++ incubator/depot/trunk/update/src/java/org/apache/depot/update/version/Version.java Sat Jul 31 15:31:33 2004
@@ -1,15 +1,21 @@
-/*
- * DO NOT CHECK IN.
- * This is a autogenerated file.
+/*
+ *
+ * NOTE: Automatically Generated File (see Depot Version for the Apache Incubator)
+ * NOTE: http://incubator.apache.org/depot/version
+ * NOTE: Ant Task: version-stamp
+ * NOTE: AntLib: apache-version
+ *
+ * $Header: Version.java $
+ *
*/
package org.apache.depot.update.version;
import java.util.Date;
/**
- * org.apache.depot.update version 0.1-dev-20040731 .
- * Generated at Sat Jul 31 15:05:49 PDT 2004
+ * A autogenerated VersionStamp class for org.apache.depot.update .
+ * Generated at Sat Jul 31 15:27:51 PDT 2004
* on GABRIEL/192.168.57.231
* by nick
* @author <a href="http://incubator.apache.org/depot">Depot Version</a>
@@ -38,10 +44,10 @@
public String getHost() {return "GABRIEL/192.168.57.231"; }
/**
- * org.apache.depot.update was built at Sat Jul 31 15:05:49 PDT 2004.
- * @return the Date "Sat Jul 31 15:05:49 PDT 2004"
+ * org.apache.depot.update was built at Sat Jul 31 15:27:51 PDT 2004.
+ * @return the Date "Sat Jul 31 15:27:51 PDT 2004"
*/
- public Date getDate() {return new Date(1091311549196l); }
+ public Date getDate() {return new Date(1091312871116l); }
/**
* The ID of the Version Specification.