summaryrefslogtreecommitdiff
path: root/gnu/java/net/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/java/net/protocol')
-rw-r--r--gnu/java/net/protocol/file/Connection.java148
-rw-r--r--gnu/java/net/protocol/file/Handler.java16
-rw-r--r--gnu/java/net/protocol/ftp/ActiveModeDTP.java9
-rw-r--r--gnu/java/net/protocol/ftp/BlockInputStream.java3
-rw-r--r--gnu/java/net/protocol/ftp/BlockOutputStream.java3
-rw-r--r--gnu/java/net/protocol/ftp/CompressedInputStream.java9
-rw-r--r--gnu/java/net/protocol/ftp/CompressedOutputStream.java7
-rw-r--r--gnu/java/net/protocol/ftp/DTP.java3
-rw-r--r--gnu/java/net/protocol/ftp/DTPInputStream.java5
-rw-r--r--gnu/java/net/protocol/ftp/DTPOutputStream.java2
-rw-r--r--gnu/java/net/protocol/ftp/FTPConnection.java67
-rw-r--r--gnu/java/net/protocol/ftp/FTPException.java5
-rw-r--r--gnu/java/net/protocol/ftp/FTPResponse.java3
-rw-r--r--gnu/java/net/protocol/ftp/FTPURLConnection.java15
-rw-r--r--gnu/java/net/protocol/ftp/Handler.java3
-rw-r--r--gnu/java/net/protocol/ftp/PassiveModeDTP.java9
-rw-r--r--gnu/java/net/protocol/ftp/StreamInputStream.java5
-rw-r--r--gnu/java/net/protocol/ftp/StreamOutputStream.java9
-rw-r--r--gnu/java/net/protocol/http/Authenticator.java5
-rw-r--r--gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java5
-rw-r--r--gnu/java/net/protocol/http/ChunkedInputStream.java27
-rw-r--r--gnu/java/net/protocol/http/Cookie.java5
-rw-r--r--gnu/java/net/protocol/http/CookieManager.java4
-rw-r--r--gnu/java/net/protocol/http/Credentials.java5
-rw-r--r--gnu/java/net/protocol/http/HTTPConnection.java21
-rw-r--r--gnu/java/net/protocol/http/HTTPDateFormat.java19
-rw-r--r--gnu/java/net/protocol/http/HTTPURLConnection.java209
-rw-r--r--gnu/java/net/protocol/http/Handler.java3
-rw-r--r--gnu/java/net/protocol/http/Headers.java54
-rw-r--r--gnu/java/net/protocol/http/Request.java39
-rw-r--r--gnu/java/net/protocol/http/RequestBodyWriter.java5
-rw-r--r--gnu/java/net/protocol/http/Response.java15
-rw-r--r--gnu/java/net/protocol/http/ResponseHeaderHandler.java5
-rw-r--r--gnu/java/net/protocol/http/SimpleCookieManager.java5
-rw-r--r--gnu/java/net/protocol/https/Handler.java3
-rw-r--r--gnu/java/net/protocol/jar/Connection.java96
-rw-r--r--gnu/java/net/protocol/jar/Handler.java50
37 files changed, 433 insertions, 463 deletions
diff --git a/gnu/java/net/protocol/file/Connection.java b/gnu/java/net/protocol/file/Connection.java
index 04278d46a..80155af0d 100644
--- a/gnu/java/net/protocol/file/Connection.java
+++ b/gnu/java/net/protocol/file/Connection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,7 +89,7 @@ public class Connection extends URLConnection
SystemProperties.getProperty("line.separator");
}
-
+
/**
* This is a File object for this connection
*/
@@ -109,7 +109,7 @@ public class Connection extends URLConnection
* OutputStream if we are writing to the file
*/
private OutputStream outputStream;
-
+
/**
* FilePermission to read the file
*/
@@ -124,7 +124,7 @@ public class Connection extends URLConnection
permission = new FilePermission(getURL().getFile(), DEFAULT_PERMISSION);
}
-
+
/**
* Unquote "%" + hex quotes characters
*
@@ -146,38 +146,38 @@ public class Connection extends URLConnection
int pos = 0;
for (int i = 0; i < str.length(); i++)
{
- char c = str.charAt(i);
- if (c == '%')
- {
- if (i + 2 >= str.length())
- throw new MalformedURLException(str + " : Invalid quoted character");
- int hi = Character.digit(str.charAt(++i), 16);
- int lo = Character.digit(str.charAt(++i), 16);
- if (lo < 0 || hi < 0)
- throw new MalformedURLException(str + " : Invalid quoted character");
- buf[pos++] = (byte) (hi * 16 + lo);
- }
- else if (c > 127) {
- try {
- byte [] c_as_bytes = Character.toString(c).getBytes("utf-8");
- final int c_length = c_as_bytes.length;
- System.arraycopy(c_as_bytes, 0, buf, pos, c_length);
- pos += c_length;
- }
- catch (java.io.UnsupportedEncodingException x2) {
- throw (Error) new InternalError().initCause(x2);
- }
- }
- else
- buf[pos++] = (byte) c;
+ char c = str.charAt(i);
+ if (c == '%')
+ {
+ if (i + 2 >= str.length())
+ throw new MalformedURLException(str + " : Invalid quoted character");
+ int hi = Character.digit(str.charAt(++i), 16);
+ int lo = Character.digit(str.charAt(++i), 16);
+ if (lo < 0 || hi < 0)
+ throw new MalformedURLException(str + " : Invalid quoted character");
+ buf[pos++] = (byte) (hi * 16 + lo);
+ }
+ else if (c > 127) {
+ try {
+ byte [] c_as_bytes = Character.toString(c).getBytes("utf-8");
+ final int c_length = c_as_bytes.length;
+ System.arraycopy(c_as_bytes, 0, buf, pos, c_length);
+ pos += c_length;
+ }
+ catch (java.io.UnsupportedEncodingException x2) {
+ throw (Error) new InternalError().initCause(x2);
+ }
+ }
+ else
+ buf[pos++] = (byte) c;
}
try
{
- return new String(buf, 0, pos, "utf-8");
+ return new String(buf, 0, pos, "utf-8");
}
catch (java.io.UnsupportedEncodingException x2)
{
- throw (Error) new InternalError().initCause(x2);
+ throw (Error) new InternalError().initCause(x2);
}
}
@@ -189,30 +189,30 @@ public class Connection extends URLConnection
// Call is ignored if already connected.
if (connected)
return;
-
+
// If not connected, then file needs to be openned.
file = new File (unquote(getURL().getFile()));
if (! file.isDirectory())
{
- if (doInput)
- inputStream = new BufferedInputStream(new FileInputStream(file));
-
- if (doOutput)
- outputStream = new BufferedOutputStream(new FileOutputStream(file));
+ if (doInput)
+ inputStream = new BufferedInputStream(new FileInputStream(file));
+
+ if (doOutput)
+ outputStream = new BufferedOutputStream(new FileOutputStream(file));
}
else
{
- if (doInput)
- {
+ if (doInput)
+ {
inputStream = new ByteArrayInputStream(getDirectoryListing());
- }
+ }
- if (doOutput)
- throw new ProtocolException
- ("file: protocol does not support output on directories");
+ if (doOutput)
+ throw new ProtocolException
+ ("file: protocol does not support output on directories");
}
-
+
connected = true;
}
@@ -228,9 +228,9 @@ public class Connection extends URLConnection
ByteArrayOutputStream sink = new ByteArrayOutputStream();
// NB uses default character encoding for this system
Writer writer = new OutputStreamWriter(sink);
-
+
String[] files = file.list();
-
+
for (int i = 0; i < files.length; i++)
{
writer.write(files[i]);
@@ -239,9 +239,9 @@ public class Connection extends URLConnection
directoryListing = sink.toByteArray();
}
- return directoryListing;
+ return directoryListing;
}
-
+
/**
* Opens the file for reading and returns a stream for it.
*
@@ -254,10 +254,10 @@ public class Connection extends URLConnection
{
if (!doInput)
throw new ProtocolException("Can't open InputStream if doInput is false");
-
+
if (!connected)
connect();
-
+
return inputStream;
}
@@ -273,11 +273,11 @@ public class Connection extends URLConnection
{
if (!doOutput)
throw new
- ProtocolException("Can't open OutputStream if doOutput is false");
+ ProtocolException("Can't open OutputStream if doOutput is false");
if (!connected)
connect();
-
+
return outputStream;
}
@@ -290,30 +290,30 @@ public class Connection extends URLConnection
{
try
{
- if (!connected)
- connect();
+ if (!connected)
+ connect();
- return file.lastModified();
+ return file.lastModified();
}
catch (IOException e)
{
- return -1;
+ return -1;
}
}
-
+
/**
- * Get an http-style header field. Just handle a few common ones.
+ * Get an http-style header field. Just handle a few common ones.
*/
public String getHeaderField(String field)
{
try
{
- if (!connected)
- connect();
+ if (!connected)
+ connect();
- if (field.equals("content-type"))
+ if (field.equals("content-type"))
return guessContentTypeFromName(file.getName());
- else if (field.equals("content-length"))
+ else if (field.equals("content-length"))
{
if (file.isDirectory())
{
@@ -321,14 +321,14 @@ public class Connection extends URLConnection
}
return Long.toString(file.length());
}
- else if (field.equals("last-modified"))
- {
- synchronized (StaticData.dateFormat)
- {
- return StaticData.dateFormat.format(
+ else if (field.equals("last-modified"))
+ {
+ synchronized (StaticData.dateFormat)
+ {
+ return StaticData.dateFormat.format(
new Date(file.lastModified()));
- }
- }
+ }
+ }
}
catch (IOException e)
{
@@ -346,21 +346,21 @@ public class Connection extends URLConnection
{
try
{
- if (!connected)
- connect();
-
+ if (!connected)
+ connect();
+
if (file.isDirectory())
{
return getDirectoryListing().length;
}
- return (int) file.length();
+ return (int) file.length();
}
catch (IOException e)
{
- return -1;
+ return -1;
}
}
-
+
/**
* This method returns a <code>Permission</code> object representing the
* permissions required to access this URL. This method returns a
diff --git a/gnu/java/net/protocol/file/Handler.java b/gnu/java/net/protocol/file/Handler.java
index fc560491d..58ebe4c46 100644
--- a/gnu/java/net/protocol/file/Handler.java
+++ b/gnu/java/net/protocol/file/Handler.java
@@ -76,14 +76,14 @@ public class Handler extends URLStreamHandler
String host = url.getHost();
if ((host != null) && (! host.equals("")))
{
- // Reset the protocol (and implicitly the handler) for this URL.
- // Then have the URL attempt the connection again, as it will
- // get the changed handler the next time around.
- // If the ftp protocol handler is not installed, an
- // exception will be thrown from the new openConnection() call.
- setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
- url.getRef());
- return url.openConnection();
+ // Reset the protocol (and implicitly the handler) for this URL.
+ // Then have the URL attempt the connection again, as it will
+ // get the changed handler the next time around.
+ // If the ftp protocol handler is not installed, an
+ // exception will be thrown from the new openConnection() call.
+ setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
+ url.getRef());
+ return url.openConnection();
}
return new Connection(url);
diff --git a/gnu/java/net/protocol/ftp/ActiveModeDTP.java b/gnu/java/net/protocol/ftp/ActiveModeDTP.java
index aa3c412b6..1ed31b830 100644
--- a/gnu/java/net/protocol/ftp/ActiveModeDTP.java
+++ b/gnu/java/net/protocol/ftp/ActiveModeDTP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -128,7 +128,7 @@ final class ActiveModeDTP
}
acceptThread = null;
}
-
+
/**
* Returns an input stream from which a remote file can be read.
*/
@@ -213,7 +213,7 @@ final class ActiveModeDTP
transferComplete();
return inProgress;
}
-
+
public void transferComplete()
{
if (socket == null)
@@ -247,6 +247,5 @@ final class ActiveModeDTP
}
}
}
-
-}
+}
diff --git a/gnu/java/net/protocol/ftp/BlockInputStream.java b/gnu/java/net/protocol/ftp/BlockInputStream.java
index 63897f1d6..09915e7ff 100644
--- a/gnu/java/net/protocol/ftp/BlockInputStream.java
+++ b/gnu/java/net/protocol/ftp/BlockInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -147,4 +147,3 @@ class BlockInputStream
}
}
-
diff --git a/gnu/java/net/protocol/ftp/BlockOutputStream.java b/gnu/java/net/protocol/ftp/BlockOutputStream.java
index 85481c95b..d181f9dec 100644
--- a/gnu/java/net/protocol/ftp/BlockOutputStream.java
+++ b/gnu/java/net/protocol/ftp/BlockOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -108,4 +108,3 @@ class BlockOutputStream
}
}
-
diff --git a/gnu/java/net/protocol/ftp/CompressedInputStream.java b/gnu/java/net/protocol/ftp/CompressedInputStream.java
index f2e65b7d3..638d780e6 100644
--- a/gnu/java/net/protocol/ftp/CompressedInputStream.java
+++ b/gnu/java/net/protocol/ftp/CompressedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -133,13 +133,13 @@ class CompressedInputStream
n--;
return c;
}
-
+
public int read(byte[] buf)
throws IOException
{
return read(buf, 0, buf.length);
}
-
+
public int read(byte[] buf, int off, int len)
throws IOException
{
@@ -186,7 +186,7 @@ class CompressedInputStream
return l;
*/
}
-
+
/**
* Reads the block header.
*/
@@ -212,4 +212,3 @@ class CompressedInputStream
}
}
-
diff --git a/gnu/java/net/protocol/ftp/CompressedOutputStream.java b/gnu/java/net/protocol/ftp/CompressedOutputStream.java
index b960fb3af..ec3aef930 100644
--- a/gnu/java/net/protocol/ftp/CompressedOutputStream.java
+++ b/gnu/java/net/protocol/ftp/CompressedOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -57,7 +57,7 @@ class CompressedOutputStream
{
super(dtp, out);
}
-
+
/**
* Just one byte cannot be compressed.
* It takes 5 bytes to transmit - hardly very compressed!
@@ -190,7 +190,7 @@ class CompressedOutputStream
System.arraycopy(buf, 0, ret, 3, pos);
return ret;
}
-
+
int flush_compressed(byte[] buf, int pos, int count, byte c)
{
buf[pos++] = (byte) (0x80 | count);
@@ -225,4 +225,3 @@ class CompressedOutputStream
}
}
-
diff --git a/gnu/java/net/protocol/ftp/DTP.java b/gnu/java/net/protocol/ftp/DTP.java
index 25580af40..9ba4b7c6c 100644
--- a/gnu/java/net/protocol/ftp/DTP.java
+++ b/gnu/java/net/protocol/ftp/DTP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,4 +89,3 @@ interface DTP
void transferComplete();
}
-
diff --git a/gnu/java/net/protocol/ftp/DTPInputStream.java b/gnu/java/net/protocol/ftp/DTPInputStream.java
index 363a5590f..7280b0133 100644
--- a/gnu/java/net/protocol/ftp/DTPInputStream.java
+++ b/gnu/java/net/protocol/ftp/DTPInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -74,7 +74,7 @@ abstract class DTPInputStream
{
transferComplete = flag;
}
-
+
/**
* Notifies the controlling DTP that this stream has completed transfer.
*/
@@ -85,4 +85,3 @@ abstract class DTPInputStream
}
}
-
diff --git a/gnu/java/net/protocol/ftp/DTPOutputStream.java b/gnu/java/net/protocol/ftp/DTPOutputStream.java
index 83f0be1e3..105c6f095 100644
--- a/gnu/java/net/protocol/ftp/DTPOutputStream.java
+++ b/gnu/java/net/protocol/ftp/DTPOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/gnu/java/net/protocol/ftp/FTPConnection.java b/gnu/java/net/protocol/ftp/FTPConnection.java
index 98e8a868d..4e253fcb9 100644
--- a/gnu/java/net/protocol/ftp/FTPConnection.java
+++ b/gnu/java/net/protocol/ftp/FTPConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -125,7 +125,7 @@ public class FTPConnection
protected static final String STAT = "STAT";
protected static final String HELP = "HELP";
protected static final String NOOP = "NOOP";
-
+
protected static final String AUTH = "AUTH";
protected static final String PBSZ = "PBSZ";
protected static final String PROT = "PROT";
@@ -211,7 +211,7 @@ public class FTPConnection
{
this(hostname, -1, 0, 0, false);
}
-
+
/**
* Creates a new connection to the server.
* @param hostname the hostname of the server to connect to
@@ -242,7 +242,7 @@ public class FTPConnection
{
port = FTP_PORT;
}
-
+
// Set up socket
socket = new Socket();
InetSocketAddress address = new InetSocketAddress(hostname, port);
@@ -258,7 +258,7 @@ public class FTPConnection
{
socket.setSoTimeout(timeout);
}
-
+
InputStream in = socket.getInputStream();
in = new BufferedInputStream(in);
in = new CRLFInputStream(in);
@@ -266,7 +266,7 @@ public class FTPConnection
OutputStream out = socket.getOutputStream();
out = new BufferedOutputStream(out);
this.out = new CRLFOutputStream(out);
-
+
// Read greeting
FTPResponse response = getResponse();
switch (response.getCode())
@@ -277,7 +277,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Authenticate using the specified username and password.
* If the username suffices for the server, the password will not be used
@@ -331,7 +331,7 @@ public class FTPConnection
{
return starttls(confidential, new EmptyX509TrustManager());
}
-
+
/**
* Negotiates TLS over the current connection.
* See IETF draft-murray-auth-ftp-ssl-15.txt for details.
@@ -351,7 +351,7 @@ public class FTPConnection
TrustManager[] trust = new TrustManager[] { tm };
context.init(null, trust, null);
SSLSocketFactory factory = context.getSocketFactory();
-
+
send(AUTH + ' ' + TLS);
FTPResponse response = getResponse();
switch (response.getCode())
@@ -367,7 +367,7 @@ public class FTPConnection
default:
throw new FTPException(response);
}
-
+
String hostname = socket.getInetAddress().getHostName();
int port = socket.getPort();
SSLSocket ss =
@@ -403,7 +403,7 @@ public class FTPConnection
default:
throw new FTPException(response);
}
-
+
if (confidential)
{
// Set up streams
@@ -422,7 +422,7 @@ public class FTPConnection
return false;
}
}
-
+
/**
* Changes directory to the specified path.
* @param path an absolute or relative pathname
@@ -447,7 +447,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Changes directory to the parent of the current working directory.
* @return true on success, false otherwise
@@ -521,7 +521,7 @@ public class FTPConnection
{
}
}
-
+
/**
* Initialise the data transfer process.
*/
@@ -533,7 +533,7 @@ public class FTPConnection
dtp.complete();
dtp = null;
}
-
+
InetAddress localhost = socket.getLocalAddress();
if (passive)
{
@@ -568,7 +568,7 @@ public class FTPConnection
{
c = message.charAt((++end) + 1);
}
-
+
String address =
message.substring(start, mid1).replace(',', '.');
int port_hi =
@@ -576,7 +576,7 @@ public class FTPConnection
int port_lo =
Integer.parseInt(message.substring(mid2 + 1, end + 1));
int port = (port_hi << 8) | port_lo;
-
+
/*System.out.println("Entering passive mode: " + address +
":" + port);*/
dtp = new PassiveModeDTP(address, port, localhost,
@@ -621,7 +621,7 @@ public class FTPConnection
}
}
}
-
+
// Send PORT command
CPStringBuilder buf = new CPStringBuilder(PORT);
buf.append(' ');
@@ -657,7 +657,7 @@ public class FTPConnection
}
dtp.setTransferMode(transferMode);
}
-
+
/**
* Set passive mode.
* @param flag true if we should use passive mode, false otherwise
@@ -671,7 +671,7 @@ public class FTPConnection
initialiseDTP();
}
}
-
+
/**
* Returns the current representation type of the transfer data.
* @return TYPE_ASCII, TYPE_EBCDIC, or TYPE_BINARY
@@ -809,7 +809,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Retrieves the specified file.
* @param filename the filename of the file to retrieve
@@ -849,7 +849,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns a stream for uploading a file.
* If a file with the same filename already exists on the server, it will
@@ -903,7 +903,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* This command may be required by some servers to reserve sufficient
* storage to accommodate the new file to be transferred.
@@ -926,7 +926,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Renames a file.
* @param oldName the current name of the file
@@ -963,7 +963,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Aborts the transfer in progress.
* @return true if a transfer was in progress, false otherwise
@@ -993,7 +993,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Causes the file specified to be deleted at the server site.
* @param filename the file to delete
@@ -1015,7 +1015,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Causes the directory specified to be deleted.
* This may be an absolute or relative pathname.
@@ -1059,7 +1059,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns the current working directory.
*/
@@ -1097,7 +1097,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns a listing of information about the specified pathname.
* If the pathname specifies a directory or other group of files, the
@@ -1133,7 +1133,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns a directory listing. The pathname should specify a
* directory or other system-specific file group descriptor; a null
@@ -1179,7 +1179,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Returns the type of operating system at the server.
*/
@@ -1205,7 +1205,7 @@ public class FTPConnection
throw new FTPException(response);
}
}
-
+
/**
* Does nothing.
* This method can be used to ensure that the connection does not time
@@ -1316,7 +1316,7 @@ public class FTPConnection
throw new ProtocolException(line);
}
}
-
+
/*
* Parses the 3-digit numeric code at the beginning of the given line.
* Returns -1 on failure.
@@ -1350,4 +1350,3 @@ public class FTPConnection
}
}
-
diff --git a/gnu/java/net/protocol/ftp/FTPException.java b/gnu/java/net/protocol/ftp/FTPException.java
index 14ad3813f..1a7fcb85d 100644
--- a/gnu/java/net/protocol/ftp/FTPException.java
+++ b/gnu/java/net/protocol/ftp/FTPException.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -63,7 +63,7 @@ public class FTPException
super(response.getMessage());
this.response = response;
}
-
+
/**
* Returns the response that provoked this exception.
*/
@@ -73,4 +73,3 @@ public class FTPException
}
}
-
diff --git a/gnu/java/net/protocol/ftp/FTPResponse.java b/gnu/java/net/protocol/ftp/FTPResponse.java
index ec72c732c..2620f0d70 100644
--- a/gnu/java/net/protocol/ftp/FTPResponse.java
+++ b/gnu/java/net/protocol/ftp/FTPResponse.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -109,4 +109,3 @@ public final class FTPResponse
}
}
-
diff --git a/gnu/java/net/protocol/ftp/FTPURLConnection.java b/gnu/java/net/protocol/ftp/FTPURLConnection.java
index cfad5a7c1..8cc1fafd1 100644
--- a/gnu/java/net/protocol/ftp/FTPURLConnection.java
+++ b/gnu/java/net/protocol/ftp/FTPURLConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -137,7 +137,7 @@ public class FTPURLConnection
connection.setTransferMode(transferMode);
}
}
-
+
/**
* This connection supports doInput.
*/
@@ -153,7 +153,7 @@ public class FTPURLConnection
{
doOutput = dooutput;
}
-
+
/**
* Returns an input stream that reads from this open connection.
*/
@@ -174,7 +174,7 @@ public class FTPURLConnection
return this.new ClosingInputStream(connection.retrieve(path));
}
}
-
+
/**
* Returns an output stream that writes to this connection.
*/
@@ -252,7 +252,7 @@ public class FTPURLConnection
l.add(value);
map.put(key, l);
}
-
+
public void setRequestProperty(String key, String value)
{
if (connected)
@@ -351,7 +351,7 @@ public class FTPURLConnection
super.close();
connection.logout();
}
-
+
}
class ClosingOutputStream
@@ -369,8 +369,7 @@ public class FTPURLConnection
super.close();
connection.logout();
}
-
+
}
}
-
diff --git a/gnu/java/net/protocol/ftp/Handler.java b/gnu/java/net/protocol/ftp/Handler.java
index 88491b3c1..7638b6664 100644
--- a/gnu/java/net/protocol/ftp/Handler.java
+++ b/gnu/java/net/protocol/ftp/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -67,4 +67,3 @@ public class Handler
}
}
-
diff --git a/gnu/java/net/protocol/ftp/PassiveModeDTP.java b/gnu/java/net/protocol/ftp/PassiveModeDTP.java
index 6f4fd6341..a74346c74 100644
--- a/gnu/java/net/protocol/ftp/PassiveModeDTP.java
+++ b/gnu/java/net/protocol/ftp/PassiveModeDTP.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -118,7 +118,7 @@ final class PassiveModeDTP
in.setTransferComplete(false);
return in;
}
-
+
/**
* Returns an output stream to which a local file can be written for
* upload.
@@ -147,12 +147,12 @@ final class PassiveModeDTP
out.setTransferComplete(false);
return out;
}
-
+
public void setTransferMode(int mode)
{
transferMode = mode;
}
-
+
public void complete()
{
completed = true;
@@ -198,4 +198,3 @@ final class PassiveModeDTP
}
}
-
diff --git a/gnu/java/net/protocol/ftp/StreamInputStream.java b/gnu/java/net/protocol/ftp/StreamInputStream.java
index 93eee4e19..beee14bcb 100644
--- a/gnu/java/net/protocol/ftp/StreamInputStream.java
+++ b/gnu/java/net/protocol/ftp/StreamInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,7 +54,7 @@ class StreamInputStream
{
super(dtp, in);
}
-
+
public int read()
throws IOException
{
@@ -92,4 +92,3 @@ class StreamInputStream
}
}
-
diff --git a/gnu/java/net/protocol/ftp/StreamOutputStream.java b/gnu/java/net/protocol/ftp/StreamOutputStream.java
index a6e28ece3..2df1a87d8 100644
--- a/gnu/java/net/protocol/ftp/StreamOutputStream.java
+++ b/gnu/java/net/protocol/ftp/StreamOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,7 +54,7 @@ class StreamOutputStream
{
super(dtp, out);
}
-
+
public void write(int c)
throws IOException
{
@@ -70,7 +70,7 @@ class StreamOutputStream
{
write(b, 0, b.length);
}
-
+
public void write(byte[] b, int off, int len)
throws IOException
{
@@ -80,6 +80,5 @@ class StreamOutputStream
}
out.write(b, off, len);
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/Authenticator.java b/gnu/java/net/protocol/http/Authenticator.java
index 0d7c98819..b4ee41e11 100644
--- a/gnu/java/net/protocol/http/Authenticator.java
+++ b/gnu/java/net/protocol/http/Authenticator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,6 +54,5 @@ public interface Authenticator
* unsuccessful attempt
*/
Credentials getCredentials(String realm, int attempt);
-
-}
+}
diff --git a/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java b/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
index 35ad2bccf..22a33ccd3 100644
--- a/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
+++ b/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -102,6 +102,5 @@ public class ByteArrayRequestBodyWriter
}
return len;
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/ChunkedInputStream.java b/gnu/java/net/protocol/http/ChunkedInputStream.java
index 8a30e51db..33df0df95 100644
--- a/gnu/java/net/protocol/http/ChunkedInputStream.java
+++ b/gnu/java/net/protocol/http/ChunkedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -158,15 +158,15 @@ public class ChunkedInputStream
}
else
{
- int canRead = Math.min(size - count, length);
- int len = in.read(buffer, offset, canRead);
- if (len == -1)
- {
- // This is an error condition but it isn't clear what we
- // should do with it.
- eof = true;
- return -1;
- }
+ int canRead = Math.min(size - count, length);
+ int len = in.read(buffer, offset, canRead);
+ if (len == -1)
+ {
+ // This is an error condition but it isn't clear what we
+ // should do with it.
+ eof = true;
+ return -1;
+ }
count += len;
if (count == size)
{
@@ -205,20 +205,19 @@ public class ChunkedInputStream
{
if (meta)
return 0;
-
+
return Math.min(in.available(), size - count);
}
/**
* This method closes the ChunkedInputStream by closing the underlying
* InputStream.
- *
+ *
* @exception IOException If an error occurs
*/
public void close() throws IOException
{
in.close();
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/Cookie.java b/gnu/java/net/protocol/http/Cookie.java
index 4482a121e..122a23f79 100644
--- a/gnu/java/net/protocol/http/Cookie.java
+++ b/gnu/java/net/protocol/http/Cookie.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -138,7 +138,7 @@ public class Cookie
{
return toString(true, true);
}
-
+
public String toString(boolean showPath, boolean showDomain)
{
CPStringBuilder buf = new CPStringBuilder();
@@ -159,4 +159,3 @@ public class Cookie
}
}
-
diff --git a/gnu/java/net/protocol/http/CookieManager.java b/gnu/java/net/protocol/http/CookieManager.java
index cc1225c49..da3686689 100644
--- a/gnu/java/net/protocol/http/CookieManager.java
+++ b/gnu/java/net/protocol/http/CookieManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -61,5 +61,5 @@ public interface CookieManager
* @param path the path to access
*/
Cookie[] getCookies(String host, boolean secure, String path);
-
+
}
diff --git a/gnu/java/net/protocol/http/Credentials.java b/gnu/java/net/protocol/http/Credentials.java
index 9e5fcd172..f95b4b53c 100644
--- a/gnu/java/net/protocol/http/Credentials.java
+++ b/gnu/java/net/protocol/http/Credentials.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -83,6 +83,5 @@ public class Credentials
{
return password;
}
-
-}
+}
diff --git a/gnu/java/net/protocol/http/HTTPConnection.java b/gnu/java/net/protocol/http/HTTPConnection.java
index 44b1a608a..b96bf4c54 100644
--- a/gnu/java/net/protocol/http/HTTPConnection.java
+++ b/gnu/java/net/protocol/http/HTTPConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -201,7 +201,7 @@ public class HTTPConnection
this(hostname, secure ? HTTPS_PORT : HTTP_PORT, secure,
connectionTimeout, timeout);
}
-
+
/**
* Creates a new HTTP connection on the specified port.
* @param hostname the name of the host to connect to
@@ -222,7 +222,7 @@ public class HTTPConnection
{
this(hostname, port, secure, 0, 0);
}
-
+
/**
* Creates a new HTTP or HTTPS connection on the specified port.
* @param hostname the name of the host to connect to
@@ -239,7 +239,7 @@ public class HTTPConnection
{
if (connectionTimeout < 0 || timeout < 0)
throw new IllegalArgumentException();
-
+
this.hostname = hostname;
this.port = port;
this.secure = secure;
@@ -477,8 +477,8 @@ public class HTTPConnection
*/
synchronized HTTPConnection get(String host,
int port,
- boolean secure,
- int connectionTimeout, int timeout)
+ boolean secure,
+ int connectionTimeout, int timeout)
{
String ttl =
SystemProperties.getProperty("classpath.net.http.keepAliveTTL");
@@ -510,7 +510,7 @@ public class HTTPConnection
}
HTTPConnection c = null;
-
+
ListIterator it = connectionPool.listIterator(0);
while (it.hasNext())
{
@@ -584,7 +584,7 @@ public class HTTPConnection
}
}
}
-
+
/**
* The number of times this HTTPConnection has be used via keep-alive.
*/
@@ -618,7 +618,7 @@ public class HTTPConnection
{
useCount++;
pool.put(this);
-
+
}
else
{
@@ -878,7 +878,7 @@ public class HTTPConnection
}
// -- Events --
-
+
void addHandshakeCompletedListener(HandshakeCompletedListener l)
{
synchronized (handshakeCompletedListeners)
@@ -895,4 +895,3 @@ public class HTTPConnection
}
}
-
diff --git a/gnu/java/net/protocol/http/HTTPDateFormat.java b/gnu/java/net/protocol/http/HTTPDateFormat.java
index 2f59e4318..743f8e8e2 100644
--- a/gnu/java/net/protocol/http/HTTPDateFormat.java
+++ b/gnu/java/net/protocol/http/HTTPDateFormat.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -145,7 +145,7 @@ public class HTTPDateFormat
// Get time offset in minutes
int zoneOffset =(calendar.get(Calendar.ZONE_OFFSET) +
calendar.get(Calendar.DST_OFFSET)) / 60000;
-
+
// Apply + or - appropriately
if (zoneOffset < 0)
{
@@ -156,7 +156,7 @@ public class HTTPDateFormat
{
buf.append('+');
}
-
+
// Set the 2 2-char fields as specified above
int tzhours = zoneOffset / 60;
buf.append(Character.forDigit(tzhours / 10, 10));
@@ -340,14 +340,14 @@ public class HTTPDateFormat
}
second = Integer.parseInt(text.substring(start, end));
}
-
+
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month);
calendar.set(Calendar.DAY_OF_MONTH, date);
calendar.set(Calendar.HOUR, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, second);
-
+
if (end != len)
{
// Timezone
@@ -380,7 +380,7 @@ public class HTTPDateFormat
}
}
pos.setIndex(end);
-
+
return calendar.getTime();
}
catch (NumberFormatException e)
@@ -400,7 +400,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
private int skipNonWhitespace(String text, int pos)
@@ -409,7 +409,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
private int skipTo(String text, int pos, char c)
@@ -418,7 +418,7 @@ public class HTTPDateFormat
{
pos++;
}
- return pos;
+ return pos;
}
/**
@@ -438,4 +438,3 @@ public class HTTPDateFormat
}
}
-
diff --git a/gnu/java/net/protocol/http/HTTPURLConnection.java b/gnu/java/net/protocol/http/HTTPURLConnection.java
index b31f42669..9ba5c4793 100644
--- a/gnu/java/net/protocol/http/HTTPURLConnection.java
+++ b/gnu/java/net/protocol/http/HTTPURLConnection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -151,7 +151,7 @@ public class HTTPURLConnection
}
final Credentials creds = (username == null) ? null :
new Credentials (username, password);
-
+
if ("POST".equals(method))
{
String contentType = requestHeaders.getValue("Content-Type");
@@ -241,113 +241,113 @@ public class HTTPURLConnection
throw ioe;
}
}
-
+
if (response.isRedirect() && getInstanceFollowRedirects())
{
- // Read the response body, if there is one. If the
- // redirect points us back at the same server, we will use
- // the cached connection, so we must make sure there is no
- // pending data in it.
+ // Read the response body, if there is one. If the
+ // redirect points us back at the same server, we will use
+ // the cached connection, so we must make sure there is no
+ // pending data in it.
InputStream body = response.getBody();
- if (body != null)
- {
- byte[] ignore = new byte[1024];
- while (true)
- {
- int n = body.read(ignore, 0, ignore.length);
- if (n == -1)
- break;
- }
- }
+ if (body != null)
+ {
+ byte[] ignore = new byte[1024];
+ while (true)
+ {
+ int n = body.read(ignore, 0, ignore.length);
+ if (n == -1)
+ break;
+ }
+ }
// Follow redirect
String location = response.getHeader("Location");
- if (location != null)
- {
- String connectionUri = connection.getURI();
- int start = connectionUri.length();
- if (location.startsWith(connectionUri) &&
- location.charAt(start) == '/')
- {
- file = location.substring(start);
- retry = true;
- }
- else if (location.startsWith("http:"))
- {
- connection.close();
- connection = null;
- secure = false;
- start = 7;
- int end = location.indexOf('/', start);
+ if (location != null)
+ {
+ String connectionUri = connection.getURI();
+ int start = connectionUri.length();
+ if (location.startsWith(connectionUri) &&
+ location.charAt(start) == '/')
+ {
+ file = location.substring(start);
+ retry = true;
+ }
+ else if (location.startsWith("http:"))
+ {
+ connection.close();
+ connection = null;
+ secure = false;
+ start = 7;
+ int end = location.indexOf('/', start);
if (end == -1)
end = location.length();
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTP_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.startsWith("https:"))
- {
- connection.close();
- connection = null;
- secure = true;
- start = 8;
- int end = location.indexOf('/', start);
+ host = location.substring(start, end);
+ int ci = host.lastIndexOf(':');
+ if (ci != -1)
+ {
+ port = Integer.parseInt(host.substring (ci + 1));
+ host = host.substring(0, ci);
+ }
+ else
+ {
+ port = HTTPConnection.HTTP_PORT;
+ }
+ file = location.substring(end);
+ retry = true;
+ }
+ else if (location.startsWith("https:"))
+ {
+ connection.close();
+ connection = null;
+ secure = true;
+ start = 8;
+ int end = location.indexOf('/', start);
if (end == -1)
end = location.length();
- host = location.substring(start, end);
- int ci = host.lastIndexOf(':');
- if (ci != -1)
- {
- port = Integer.parseInt(host.substring (ci + 1));
- host = host.substring(0, ci);
- }
- else
- {
- port = HTTPConnection.HTTPS_PORT;
- }
- file = location.substring(end);
- retry = true;
- }
- else if (location.length() > 0)
- {
- // Malformed absolute URI, treat as file part of URI
- if (location.charAt(0) == '/')
- {
- // Absolute path
- file = location;
- }
- else
- {
- // Relative path
- int lsi = file.lastIndexOf('/');
- file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
- file += location;
- }
- retry = true;
- }
- }
+ host = location.substring(start, end);
+ int ci = host.lastIndexOf(':');
+ if (ci != -1)
+ {
+ port = Integer.parseInt(host.substring (ci + 1));
+ host = host.substring(0, ci);
+ }
+ else
+ {
+ port = HTTPConnection.HTTPS_PORT;
+ }
+ file = location.substring(end);
+ retry = true;
+ }
+ else if (location.length() > 0)
+ {
+ // Malformed absolute URI, treat as file part of URI
+ if (location.charAt(0) == '/')
+ {
+ // Absolute path
+ file = location;
+ }
+ else
+ {
+ // Relative path
+ int lsi = file.lastIndexOf('/');
+ file = (lsi == -1) ? "/" : file.substring(0, lsi + 1);
+ file += location;
+ }
+ retry = true;
+ }
+ }
}
else
{
responseSink = response.getBody();
-
+
if (response.isError())
- errorSink = responseSink;
+ errorSink = responseSink;
}
}
while (retry);
connected = true;
- }
+ }
/**
* Returns a connection, from the pool if necessary.
@@ -425,7 +425,7 @@ public class HTTPURLConnection
}
public String getRequestProperty(String key)
- {
+ {
return requestHeaders.getValue(key);
}
@@ -433,7 +433,7 @@ public class HTTPURLConnection
{
if (connected)
throw new IllegalStateException("Already connected");
-
+
Map<String, List<String>> m = requestHeaders.getAsMap();
return Collections.unmodifiableMap(m);
}
@@ -441,7 +441,7 @@ public class HTTPURLConnection
public void setRequestProperty(String key, String value)
{
super.setRequestProperty(key, value);
-
+
requestHeaders.put(key, value);
}
@@ -477,9 +477,9 @@ public class HTTPURLConnection
}
return requestSink;
}
-
+
// -- Response --
-
+
public InputStream getInputStream()
throws IOException
{
@@ -491,17 +491,17 @@ public class HTTPURLConnection
{
throw new ProtocolException("doInput is false");
}
-
+
if (response.isError())
{
int code = response.getCode();
if (code == 404 || code == 410)
throw new FileNotFoundException(url.toString());
-
+
throw new IOException("Server returned HTTP response code " + code
+ " for URL " + url.toString());
}
-
+
return responseSink;
}
@@ -535,7 +535,7 @@ public class HTTPURLConnection
" " + response.getCode() +
" " + response.getMessage();
}
-
+
public String getHeaderField(int index)
{
if (!connected)
@@ -641,7 +641,7 @@ public class HTTPURLConnection
}
return handshakeEvent.getCipherSuite();
}
-
+
public Certificate[] getLocalCertificates()
{
if (!connected)
@@ -681,14 +681,13 @@ public class HTTPURLConnection
super.setReadTimeout(timeout);
if (connection == null)
return;
- try
+ try
{
- connection.getSocket().setSoTimeout(timeout);
- }
+ connection.getSocket().setSoTimeout(timeout);
+ }
catch (IOException se)
{
- // Ignore socket exceptions.
+ // Ignore socket exceptions.
}
}
}
-
diff --git a/gnu/java/net/protocol/http/Handler.java b/gnu/java/net/protocol/http/Handler.java
index 640542513..30810321d 100644
--- a/gnu/java/net/protocol/http/Handler.java
+++ b/gnu/java/net/protocol/http/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -70,4 +70,3 @@ public class Handler
}
}
-
diff --git a/gnu/java/net/protocol/http/Headers.java b/gnu/java/net/protocol/http/Headers.java
index 690a0c65b..faf5eb195 100644
--- a/gnu/java/net/protocol/http/Headers.java
+++ b/gnu/java/net/protocol/http/Headers.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -71,7 +71,7 @@ class Headers implements Iterable<Headers.HeaderElement>
*/
private final ArrayList<HeaderElement> headers
= new ArrayList<HeaderElement>();
-
+
/**
* The HTTP dateformat used to parse date header fields.
*/
@@ -111,11 +111,11 @@ class Headers implements Iterable<Headers.HeaderElement>
{
return headers.iterator();
}
-
+
/**
* Returns the value of the specified header as a string. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>null</code> if not found.
*/
@@ -135,7 +135,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Returns the value of the specified header as an integer. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>-1</code> if not present or
* not an integer value.
@@ -161,7 +161,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Returns the value of the specified header as a long. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>-1</code> if not present or
* not a long value.
@@ -187,7 +187,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Returns the value of the specified header as a date. If
* multiple values are present, the last one is returned.
- *
+ *
* @param header the header name (case insensitive search)
* @return The header value or <code>null</code> if not present or
* not a date value.
@@ -212,7 +212,7 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Add a header to this set of headers. If there is an existing
* header with the same name it's value is replaced with the new value.
- * If multiple headers of the same name exist only the last one's value
+ * If multiple headers of the same name exist only the last one's value
* is replaced.
*
* @param name the header name
@@ -221,7 +221,7 @@ class Headers implements Iterable<Headers.HeaderElement>
* @see #addValue(String, String)
*/
public void put(String name, String value)
- {
+ {
for (int i = headers.size() - 1; i >= 0; i--)
{
HeaderElement e = headers.get(i);
@@ -231,14 +231,14 @@ class Headers implements Iterable<Headers.HeaderElement>
return;
}
}
-
+
// nothing was replaced so add it as new HeaderElement
addValue(name, value);
}
-
+
/**
- * Add all headers from a set of headers to this set. Any existing header
- * with the same (case insensitive) name as one of the new headers will
+ * Add all headers from a set of headers to this set. Any existing header
+ * with the same (case insensitive) name as one of the new headers will
* be overridden.
*
* @param o the headers to be added
@@ -280,7 +280,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
LineInputStream lin = (in instanceof LineInputStream) ?
(LineInputStream) in : new LineInputStream(in);
-
+
String name = null;
CPStringBuilder value = new CPStringBuilder();
while (true)
@@ -307,9 +307,9 @@ class Headers implements Iterable<Headers.HeaderElement>
if (c1 == ' ' || c1 == '\t')
{
// Continuation
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
+ int last = len - 1;
+ if (line.charAt(last) != '\r')
+ ++last;
value.append(line.substring(0, last));
}
else
@@ -318,7 +318,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
addValue(name, value.toString());
}
-
+
int di = line.indexOf(':');
name = line.substring(0, di);
value.setLength(0);
@@ -327,14 +327,14 @@ class Headers implements Iterable<Headers.HeaderElement>
di++;
}
while (di < len && line.charAt(di) == ' ');
- int last = len - 1;
- if (line.charAt(last) != '\r')
- ++last;
+ int last = len - 1;
+ if (line.charAt(last) != '\r')
+ ++last;
value.append(line.substring(di, last));
}
}
}
-
+
/**
* Add a header to this set of headers. If there is an existing
@@ -352,12 +352,12 @@ class Headers implements Iterable<Headers.HeaderElement>
/**
* Get a new Map containing all the headers. The keys of the Map
- * are Strings (the header names). The headers will be included
+ * are Strings (the header names). The headers will be included
* case-sensitive in the map so that querying must be done with the
* correct case of the needed header name. The values of the Map are
* unmodifiable Lists containing Strings (the header values).
*
- * <p>
+ * <p>
* The returned map is modifiable. Changing it will not effect this
* collection of Headers in any way.</p>
*
@@ -387,7 +387,7 @@ class Headers implements Iterable<Headers.HeaderElement>
}
return m;
}
-
+
/**
* Get the name of the Nth header.
*
@@ -401,7 +401,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
if (i >= headers.size() || i < 0)
return null;
-
+
return headers.get(i).name;
}
@@ -418,7 +418,7 @@ class Headers implements Iterable<Headers.HeaderElement>
{
if (i >= headers.size() || i < 0)
return null;
-
+
return headers.get(i).value;
}
}
diff --git a/gnu/java/net/protocol/http/Request.java b/gnu/java/net/protocol/http/Request.java
index 88e2fd077..534213eed 100644
--- a/gnu/java/net/protocol/http/Request.java
+++ b/gnu/java/net/protocol/http/Request.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -280,14 +280,14 @@ public class Request
setHeader("Content-Length", Integer.toString(contentLength));
}
}
-
+
try
{
// Loop while authentication fails or continue
do
{
retry = false;
-
+
// Get socket output and input streams
OutputStream out = connection.getOutputStream();
@@ -314,7 +314,7 @@ public class Request
byte[] buffer = new byte[4096];
int len;
int count = 0;
-
+
requestBodyWriter.reset();
do
{
@@ -372,13 +372,13 @@ public class Request
}
return response;
}
-
+
Response readResponse(InputStream in)
throws IOException
{
String line;
int len;
-
+
// Read response status line
LineInputStream lis = new LineInputStream(in);
@@ -414,7 +414,7 @@ public class Request
responseHeaders.parse(lis);
notifyHeaderHandlers(responseHeaders);
InputStream body = null;
-
+
switch (code)
{
case 100:
@@ -459,7 +459,7 @@ public class Request
throws IOException
{
long contentLength = -1;
-
+
// Persistent connections are the default in HTTP/1.1
boolean doClose = "close".equalsIgnoreCase(getHeader("Connection")) ||
"close".equalsIgnoreCase(responseHeaders.getValue("Connection")) ||
@@ -475,9 +475,9 @@ public class Request
else if ("chunked".equalsIgnoreCase(transferCoding))
{
in = new LimitedLengthInputStream(in, -1, false, connection, doClose);
-
+
in = new ChunkedInputStream(in, responseHeaders);
- }
+ }
else
{
contentLength = responseHeaders.getLongValue("Content-Length");
@@ -505,9 +505,9 @@ public class Request
throw new ProtocolException("Unsupported Content-Encoding: " +
contentCoding);
}
- // Remove the Content-Encoding header because the content is
- // no longer compressed.
- responseHeaders.remove("Content-Encoding");
+ // Remove the Content-Encoding header because the content is
+ // no longer compressed.
+ responseHeaders.remove("Content-Encoding");
}
return in;
}
@@ -551,7 +551,7 @@ public class Request
{
MessageDigest md5 = MessageDigest.getInstance("MD5");
final byte[] COLON = { 0x3a };
-
+
// Calculate H(A1)
md5.reset();
md5.update(username.getBytes("US-ASCII"));
@@ -572,7 +572,7 @@ public class Request
ha1 = md5.digest();
}
String ha1Hex = toHexString(ha1);
-
+
// Calculate H(A2)
md5.reset();
md5.update(method.getBytes("US-ASCII"));
@@ -586,7 +586,7 @@ public class Request
}
byte[] ha2 = md5.digest();
String ha2Hex = toHexString(ha2);
-
+
// Calculate response
md5.reset();
md5.update(ha1Hex.getBytes("US-ASCII"));
@@ -606,8 +606,8 @@ public class Request
md5.update(COLON);
md5.update(ha2Hex.getBytes("US-ASCII"));
String digestResponse = toHexString(md5.digest());
-
- String authorization = scheme +
+
+ String authorization = scheme +
" username=\"" + username + "\"" +
" realm=\"" + realm + "\"" +
" nonce=\"" + nonce + "\"" +
@@ -652,7 +652,7 @@ public class Request
buf.setLength(0);
}
else if (c != ',' || (i <(len - 1) && text.charAt(i + 1) != ' '))
- {
+ {
buf.append(c);
}
}
@@ -855,4 +855,3 @@ public class Request
}
}
-
diff --git a/gnu/java/net/protocol/http/RequestBodyWriter.java b/gnu/java/net/protocol/http/RequestBodyWriter.java
index 05d98ebb8..aa5b78a54 100644
--- a/gnu/java/net/protocol/http/RequestBodyWriter.java
+++ b/gnu/java/net/protocol/http/RequestBodyWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,6 +64,5 @@ public interface RequestBodyWriter
* @return the number of bytes written
*/
int write(byte[] buffer);
-
-}
+}
diff --git a/gnu/java/net/protocol/http/Response.java b/gnu/java/net/protocol/http/Response.java
index 76fac9344..084cf75fa 100644
--- a/gnu/java/net/protocol/http/Response.java
+++ b/gnu/java/net/protocol/http/Response.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -61,7 +61,7 @@ public class Response
/**
* The HTTP status code of the response.
- */
+ */
protected final int code;
/**
@@ -114,7 +114,7 @@ public class Response
/**
* Returns the HTTP status code of the response.
* @see #code
- */
+ */
public int getCode()
{
return code;
@@ -188,22 +188,22 @@ public class Response
{
return headers.getDateValue(name);
}
-
+
/**
* Tests whether this response indicates a redirection.
- *
+ *
* @return <code>true</code> if, <code>false</code> otherwise.
*/
public boolean isRedirect()
{
return (code != 304 && getCodeClass() == 3);
}
-
+
/**
* Tests whether this response indicates an error.
* Errors are the response codes <code>4xx</code> - Client error and
* <code>5xx</code> - Server error.
- *
+ *
* @return <code>true</code> if, <code>false</code> otherwise.
*/
public boolean isError()
@@ -221,4 +221,3 @@ public class Response
return body;
}
}
-
diff --git a/gnu/java/net/protocol/http/ResponseHeaderHandler.java b/gnu/java/net/protocol/http/ResponseHeaderHandler.java
index 4c5261da1..ca863440e 100644
--- a/gnu/java/net/protocol/http/ResponseHeaderHandler.java
+++ b/gnu/java/net/protocol/http/ResponseHeaderHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,6 +52,5 @@ public interface ResponseHeaderHandler
* Sets the value for the header associated with this handler.
*/
void setValue(String value);
-
-}
+}
diff --git a/gnu/java/net/protocol/http/SimpleCookieManager.java b/gnu/java/net/protocol/http/SimpleCookieManager.java
index fe05ba09e..f08204769 100644
--- a/gnu/java/net/protocol/http/SimpleCookieManager.java
+++ b/gnu/java/net/protocol/http/SimpleCookieManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -133,6 +133,5 @@ public class SimpleCookieManager
}
}
}
-
-}
+}
diff --git a/gnu/java/net/protocol/https/Handler.java b/gnu/java/net/protocol/https/Handler.java
index 2b1375170..dbb619905 100644
--- a/gnu/java/net/protocol/https/Handler.java
+++ b/gnu/java/net/protocol/https/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -73,4 +73,3 @@ public class Handler
}
}
-
diff --git a/gnu/java/net/protocol/jar/Connection.java b/gnu/java/net/protocol/jar/Connection.java
index 386aacef6..85d27bfc9 100644
--- a/gnu/java/net/protocol/jar/Connection.java
+++ b/gnu/java/net/protocol/jar/Connection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -73,13 +73,13 @@ public final class Connection extends JarURLConnection
private JarFile jar_file;
private JarEntry jar_entry;
private URL jar_url;
-
+
public static class JarFileCache
{
private static Hashtable<URL, JarFile> cache
= new Hashtable<URL, JarFile>();
private static final int READBUFSIZE = 4*1024;
-
+
public static synchronized JarFile get (URL url, boolean useCaches)
throws IOException
{
@@ -92,31 +92,31 @@ public final class Connection extends JarURLConnection
}
if ("file".equals (url.getProtocol()))
- {
- String fn = url.getFile();
- fn = gnu.java.net.protocol.file.Connection.unquote(fn);
- File f = new File (fn);
- jf = new JarFile (f, true, ZipFile.OPEN_READ);
- }
+ {
+ String fn = url.getFile();
+ fn = gnu.java.net.protocol.file.Connection.unquote(fn);
+ File f = new File (fn);
+ jf = new JarFile (f, true, ZipFile.OPEN_READ);
+ }
else
- {
- URLConnection urlconn = url.openConnection();
- InputStream is = urlconn.getInputStream();
- byte[] buf = new byte [READBUFSIZE];
- File f = File.createTempFile ("cache", "jar");
- FileOutputStream fos = new FileOutputStream (f);
- int len = 0;
-
- while ((len = is.read (buf)) != -1)
- {
- fos.write (buf, 0, len);
- }
-
- fos.close();
- // Always verify the Manifest, open read only and delete when done.
- jf = new JarFile (f, true,
- ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
- }
+ {
+ URLConnection urlconn = url.openConnection();
+ InputStream is = urlconn.getInputStream();
+ byte[] buf = new byte [READBUFSIZE];
+ File f = File.createTempFile ("cache", "jar");
+ FileOutputStream fos = new FileOutputStream (f);
+ int len = 0;
+
+ while ((len = is.read (buf)) != -1)
+ {
+ fos.write (buf, 0, len);
+ }
+
+ fos.close();
+ // Always verify the Manifest, open read only and delete when done.
+ jf = new JarFile (f, true,
+ ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
+ }
if (useCaches)
cache.put (url, jf);
@@ -140,7 +140,7 @@ public final class Connection extends JarURLConnection
jar_url = getJarFileURL();
jar_file = JarFileCache.get (jar_url, useCaches);
String entry_name = getEntryName();
-
+
if (entry_name != null
&& !entry_name.equals (""))
{
@@ -160,7 +160,7 @@ public final class Connection extends JarURLConnection
if (! doInput)
throw new ProtocolException("Can't open InputStream if doInput is false");
-
+
return jar_file.getInputStream (jar_entry);
}
@@ -179,26 +179,26 @@ public final class Connection extends JarURLConnection
{
try
{
- if (!connected)
- connect();
+ if (!connected)
+ connect();
- if (field.equals("content-type"))
+ if (field.equals("content-type"))
return guessContentTypeFromName(getJarEntry().getName());
- else if (field.equals("content-length"))
+ else if (field.equals("content-length"))
return Long.toString(getJarEntry().getSize());
- else if (field.equals("last-modified"))
- {
- // Both creating and manipulating dateFormat need synchronization.
- synchronized (Connection.class)
- {
- if (dateFormat == null)
- dateFormat = new SimpleDateFormat
- ("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
- new Locale ("En", "Us", "Unix"));
-
- return dateFormat.format(new Date(getJarEntry().getTime()));
- }
- }
+ else if (field.equals("last-modified"))
+ {
+ // Both creating and manipulating dateFormat need synchronization.
+ synchronized (Connection.class)
+ {
+ if (dateFormat == null)
+ dateFormat = new SimpleDateFormat
+ ("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
+ new Locale ("En", "Us", "Unix"));
+
+ return dateFormat.format(new Date(getJarEntry().getTime()));
+ }
+ }
}
catch (IOException e)
{
@@ -222,11 +222,11 @@ public final class Connection extends JarURLConnection
try
{
- return getJarEntry().getTime();
+ return getJarEntry().getTime();
}
catch (IOException e)
{
- return -1;
+ return -1;
}
}
}
diff --git a/gnu/java/net/protocol/jar/Handler.java b/gnu/java/net/protocol/jar/Handler.java
index 66f0fb6d9..7d6103e93 100644
--- a/gnu/java/net/protocol/jar/Handler.java
+++ b/gnu/java/net/protocol/jar/Handler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -91,34 +91,34 @@ public class Handler extends URLStreamHandler
// strategy when we encounter an error in parsing is to return without
// doing anything.
String file = url.getFile();
-
+
if (!file.equals(""))
{ //has context url
- url_string = url_string.substring (start, end);
+ url_string = url_string.substring (start, end);
if (url_string.startsWith("/"))
{ //url string is an absolute path
int idx = file.lastIndexOf ("!/");
-
- if (idx < 0)
- throw new URLParseError("no !/ in spec");
-
- file = file.substring (0, idx + 1) + url_string;
+
+ if (idx < 0)
+ throw new URLParseError("no !/ in spec");
+
+ file = file.substring (0, idx + 1) + url_string;
}
else if (url_string.length() > 0)
{
int idx = file.lastIndexOf ("/");
if (idx == -1) //context path is weird
- file = "/" + url_string;
+ file = "/" + url_string;
else if (idx == (file.length() - 1))
//just concatenate two parts
file = file + url_string;
else
- // according to Java API Documentation, here is a little different
+ // according to Java API Documentation, here is a little different
// with URLStreamHandler.parseURL
// but JDK seems doesn't handle it well
file = file.substring(0, idx + 1) + url_string;
}
-
+
setURL (url, "jar", url.getHost(), url.getPort(), flat(file), null);
return;
}
@@ -130,7 +130,7 @@ public class Handler extends URLStreamHandler
return;
if (start > url_string.length())
return;
-
+
// Skip remains of protocol
url_string = url_string.substring (start, end);
@@ -140,16 +140,16 @@ public class Handler extends URLStreamHandler
try
{
- new URL(url_string.substring (0, jar_stop));
+ new URL(url_string.substring (0, jar_stop));
}
catch (MalformedURLException e)
{
- throw new URLParseError("invalid inner URL: " + e.getMessage());
+ throw new URLParseError("invalid inner URL: " + e.getMessage());
}
-
+
if (!url.getProtocol().equals ("jar") )
throw new URLParseError("unexpected protocol " + url.getProtocol());
-
+
setURL (url, "jar", url.getHost(), url.getPort(), url_string, null);
}
@@ -170,16 +170,16 @@ public class Handler extends URLStreamHandler
StringTokenizer st = new StringTokenizer(jar_path, "/");
while (st.hasMoreTokens())
{
- String token = st.nextToken();
+ String token = st.nextToken();
if (token.equals("."))
continue;
else if (token.equals(".."))
- {
- if (! tokens.isEmpty())
- tokens.remove(tokens.size() - 1);
- }
- else
- tokens.add(token);
+ {
+ if (! tokens.isEmpty())
+ tokens.remove(tokens.size() - 1);
+ }
+ else
+ tokens.add(token);
}
CPStringBuilder path = new CPStringBuilder(url_string.length());
@@ -203,8 +203,8 @@ public class Handler extends URLStreamHandler
String ref = url.getRef();
// return "jar:" + file;
- // Performance!!:
- // Do the concatenation manually to avoid resize StringBuffer's
+ // Performance!!:
+ // Do the concatenation manually to avoid resize StringBuffer's
// internal buffer. The length of ref is not taken into consideration
// as it's a rare path.
CPStringBuilder sb = new CPStringBuilder (file.length() + 5);