diff options
Diffstat (limited to 'libjava/classpath/gnu/java/net')
56 files changed, 526 insertions, 562 deletions
diff --git a/libjava/classpath/gnu/java/net/CRLFInputStream.java b/libjava/classpath/gnu/java/net/CRLFInputStream.java index ac34826..5e394ae 100644 --- a/libjava/classpath/gnu/java/net/CRLFInputStream.java +++ b/libjava/classpath/gnu/java/net/CRLFInputStream.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,7 +64,7 @@ public class CRLFInputStream * The underlying input stream. */ protected InputStream in; - + private boolean doReset; /** @@ -100,7 +100,7 @@ public class CRLFInputStream } return c; } - + /** * Reads up to b.length bytes of data from this input stream into * an array of bytes. @@ -176,4 +176,3 @@ public class CRLFInputStream } } - diff --git a/libjava/classpath/gnu/java/net/CRLFOutputStream.java b/libjava/classpath/gnu/java/net/CRLFOutputStream.java index f27e0f2..0e94283 100644 --- a/libjava/classpath/gnu/java/net/CRLFOutputStream.java +++ b/libjava/classpath/gnu/java/net/CRLFOutputStream.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 @@ -43,7 +43,7 @@ import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; -/** +/** * An output stream that filters LFs into CR/LF pairs. * * @author Chris Burdess (dog@gnu.org) @@ -105,7 +105,7 @@ public class CRLFOutputStream } last = ch; } - + /** * Writes a byte array to the underlying stream. * @exception IOException if an I/O error occurred @@ -150,7 +150,7 @@ public class CRLFOutputStream out.write (b, d, len - d); } } - + /** * Writes the specified ASCII string to the underlying stream. * @exception IOException if an I/O error occurred @@ -180,4 +180,3 @@ public class CRLFOutputStream out.write(CRLF, 0, 2); } } - diff --git a/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java b/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java index e3d1b8e..1d113b9 100644 --- a/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.java +++ b/libjava/classpath/gnu/java/net/DefaultContentHandlerFactory.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 @@ -49,7 +49,7 @@ import java.util.HashSet; class ImageHandler extends ContentHandler { static ImageHandler instance = new ImageHandler(); - + public Object getContent(URLConnection urlc) throws IOException { // FIXME: implement using ImageIO @@ -80,7 +80,7 @@ public class DefaultContentHandlerFactory implements ContentHandlerFactory "image/x-xbitmap", "image/x-xpixmap" }; - + private static HashSet<String> imageTypes = new HashSet<String>(Arrays.asList(known_image_types)); diff --git a/libjava/classpath/gnu/java/net/DefaultProxySelector.java b/libjava/classpath/gnu/java/net/DefaultProxySelector.java index 31f861e..f0215a0 100644 --- a/libjava/classpath/gnu/java/net/DefaultProxySelector.java +++ b/libjava/classpath/gnu/java/net/DefaultProxySelector.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 @@ -50,13 +50,13 @@ public final class DefaultProxySelector extends ProxySelector { private static final List<Proxy> proxies = new ArrayList<Proxy>(); - + static { // The default proxy selector supports only direct connections. proxies.add(Proxy.NO_PROXY); } - + public DefaultProxySelector() { // Do nothing by default. @@ -69,7 +69,7 @@ public final class DefaultProxySelector // Do nothing by default. } - + public List<Proxy> select(URI uri) { if (uri == null) diff --git a/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java b/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java index b8faf41..466b49e 100644 --- a/libjava/classpath/gnu/java/net/EmptyX509TrustManager.java +++ b/libjava/classpath/gnu/java/net/EmptyX509TrustManager.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 EmptyX509TrustManager return new X509Certificate[0]; } } - diff --git a/libjava/classpath/gnu/java/net/GetLocalHostAction.java b/libjava/classpath/gnu/java/net/GetLocalHostAction.java index fa76015..1e18877 100644 --- a/libjava/classpath/gnu/java/net/GetLocalHostAction.java +++ b/libjava/classpath/gnu/java/net/GetLocalHostAction.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 @@ -62,4 +62,3 @@ public class GetLocalHostAction } } } - diff --git a/libjava/classpath/gnu/java/net/HeaderFieldHelper.java b/libjava/classpath/gnu/java/net/HeaderFieldHelper.java index a8d13ce..ca3b9d2 100644 --- a/libjava/classpath/gnu/java/net/HeaderFieldHelper.java +++ b/libjava/classpath/gnu/java/net/HeaderFieldHelper.java @@ -1,4 +1,4 @@ -/* HeaderFieldHelper.java -- Helps manage headers fields +/* HeaderFieldHelper.java -- Helps manage headers fields Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -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 @@ -105,12 +105,12 @@ public class HeaderFieldHelper try { - value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key)); + value = headerFieldValues.elementAt(headerFieldKeys.indexOf(key)); } catch (ArrayIndexOutOfBoundsException e) { } - + return value; } @@ -121,8 +121,8 @@ public class HeaderFieldHelper for (int index = 0; index < max; index++) { - headers.put(headerFieldKeys.elementAt(index), - headerFieldValues.elementAt(index)); + headers.put(headerFieldKeys.elementAt(index), + headerFieldValues.elementAt(index)); } return headers; @@ -134,4 +134,3 @@ public class HeaderFieldHelper } } // class HeaderFieldHelper - diff --git a/libjava/classpath/gnu/java/net/IndexListParser.java b/libjava/classpath/gnu/java/net/IndexListParser.java index 2d90ceb..bf274b1 100644 --- a/libjava/classpath/gnu/java/net/IndexListParser.java +++ b/libjava/classpath/gnu/java/net/IndexListParser.java @@ -1,4 +1,4 @@ -/* IndexListParser.java -- +/* IndexListParser.java -- Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -47,11 +47,11 @@ import java.util.Set; import java.util.jar.JarFile; /** - * The INDEX.LIST file contains sections each separated by a blank line. + * The INDEX.LIST file contains sections each separated by a blank line. * Each section defines the content of a jar, with a * header defining the jar file path name, followed by a list of paths. * The jar file paths are relative to the codebase of the root jar. - * + * Specification index file : version-info blankline section* version-info : JarIndex-Version: version-number @@ -60,7 +60,7 @@ import java.util.jar.JarFile; body : header name* header : char+.jar newline name : char+ newline - + * @author langel at redhat dot com */ public class IndexListParser @@ -73,10 +73,10 @@ public class IndexListParser // This is intentionally kept in insertion order. LinkedHashMap<URL, Set<String>> prefixes = new LinkedHashMap<URL, Set<String>>(); - + /** * Parses the given jarfile's INDEX.LIST file if it exists. - * + * * @param jarfile - the given jar file * @param baseJarURL - the codebase of the jar file * @param baseURL - the base url for the headers @@ -90,13 +90,13 @@ public class IndexListParser { BufferedReader br = new BufferedReader(new InputStreamReader(new URL(baseJarURL, JAR_INDEX_FILE).openStream())); - + // Must start with version info String line = br.readLine(); if (!line.startsWith(JAR_INDEX_VERSION_KEY)) return; versionNumber = Double.parseDouble(line.substring(JAR_INDEX_VERSION_KEY.length()).trim()); - + // Blank line must be next line = br.readLine(); if (! "".equals(line)) @@ -104,13 +104,13 @@ public class IndexListParser clearAll(); return; } - + // May contain sections. while ((line = br.readLine()) != null) { URL jarURL = new URL(baseURL, line); HashSet<String> values = new HashSet<String>(); - + // Read the names in the section. while ((line = br.readLine()) != null) { @@ -138,7 +138,7 @@ public class IndexListParser clearAll(); } } - + /** * Clears all the variables. This is called when parsing fails. */ @@ -147,33 +147,33 @@ public class IndexListParser versionNumber = 0; prefixes = null; } - + /** * Gets the version info for the file. - * + * * @return the version info. */ public String getVersionInfo() { return JAR_INDEX_VERSION_KEY + getVersionNumber(); } - + /** * Gets the version number of the file. - * + * * @return the version number. */ public double getVersionNumber() { return versionNumber; } - + /** * Gets the map of all the headers found in the file. * The keys in the map are URLs of jars. The values in the map * are Sets of package prefixes (and top-level file names), as * specifed in INDEX.LIST. - * + * * @return an map of all the headers, or null if no INDEX.LIST was found */ public LinkedHashMap<URL, Set<String>> getHeaders() diff --git a/libjava/classpath/gnu/java/net/LineInputStream.java b/libjava/classpath/gnu/java/net/LineInputStream.java index da307db..8bd4b69 100644 --- a/libjava/classpath/gnu/java/net/LineInputStream.java +++ b/libjava/classpath/gnu/java/net/LineInputStream.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 @@ -56,7 +56,7 @@ public class LineInputStream * The underlying input stream. */ protected InputStream in; - + /* * Line buffer. */ @@ -112,7 +112,7 @@ public class LineInputStream { return in.read(buf); } - + public int read(byte[] buf, int off, int len) throws IOException { @@ -221,4 +221,3 @@ public class LineInputStream return -1; } } - diff --git a/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java b/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java index a84525e..639c9ff 100644 --- a/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.java +++ b/libjava/classpath/gnu/java/net/PlainDatagramSocketImpl.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 @@ -69,19 +69,19 @@ import java.nio.ByteBuffer; public final class PlainDatagramSocketImpl extends DatagramSocketImpl { private final VMChannel channel; - + /** * The platform-specific socket implementation. */ private final VMPlainSocketImpl impl; - + /** - * Lock object to serialize threads wanting to receive + * Lock object to serialize threads wanting to receive */ private final Object RECEIVE_LOCK = new Object(); - + /** - * Lock object to serialize threads wanting to send + * Lock object to serialize threads wanting to send */ private final Object SEND_LOCK = new Object(); @@ -99,7 +99,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl synchronized (this) { if (channel.getState().isValid()) - close(); + close(); } super.finalize(); }*/ diff --git a/libjava/classpath/gnu/java/net/PlainSocketImpl.java b/libjava/classpath/gnu/java/net/PlainSocketImpl.java index 5bda0a5..72db531 100644 --- a/libjava/classpath/gnu/java/net/PlainSocketImpl.java +++ b/libjava/classpath/gnu/java/net/PlainSocketImpl.java @@ -8,7 +8,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 @@ -93,13 +93,13 @@ public class PlainSocketImpl extends SocketImpl * is being invoked on this socket. */ private boolean inChannelOperation; - + /** * The socket channel we use for IO operation. Package-private for * use by inner classes. */ SocketChannelImpl channel; - + /** * Indicates whether we should ignore whether any associated * channel is set to non-blocking mode. Certain operations @@ -111,7 +111,7 @@ public class PlainSocketImpl extends SocketImpl { return inChannelOperation; } - + /** * Sets our indicator of whether an I/O operation is being * initiated by a channel. @@ -120,7 +120,7 @@ public class PlainSocketImpl extends SocketImpl { inChannelOperation = b; } - + /** * Default do nothing constructor. */ @@ -149,7 +149,7 @@ public class PlainSocketImpl extends SocketImpl case SO_BROADCAST: case SO_KEEPALIVE: case SO_OOBINLINE: - case TCP_NODELAY: + case TCP_NODELAY: case IP_TOS: case SO_RCVBUF: case SO_SNDBUF: @@ -188,7 +188,7 @@ public class PlainSocketImpl extends SocketImpl throw se; } } - + // This filters options which are invalid for TCP. switch (optionId) { @@ -197,7 +197,7 @@ public class PlainSocketImpl extends SocketImpl case SO_BROADCAST: case SO_KEEPALIVE: case SO_OOBINLINE: - case TCP_NODELAY: + case TCP_NODELAY: case IP_TOS: case SO_RCVBUF: case SO_SNDBUF: @@ -207,7 +207,7 @@ public class PlainSocketImpl extends SocketImpl default: throw new SocketException("Unrecognized TCP option: " + optionId); } - + } public void shutdownInput() throws IOException @@ -281,10 +281,10 @@ public class PlainSocketImpl extends SocketImpl boolean connected = channel.connect(address, timeout); if (!connected) throw new SocketTimeoutException("connect timed out"); - + // Using the given SocketAddress is important to preserve // hostnames given by the caller. - InetSocketAddress addr = (InetSocketAddress) address; + InetSocketAddress addr = (InetSocketAddress) address; this.address = addr.getAddress(); this.port = addr.getPort(); } @@ -314,7 +314,7 @@ public class PlainSocketImpl extends SocketImpl * number, additional connections will be refused. * * @param queuelen The length of the pending connection queue - * + * * @throws IOException If an error occurs */ protected synchronized void listen(int queuelen) @@ -324,7 +324,7 @@ public class PlainSocketImpl extends SocketImpl } /** - * Accepts a new connection on this socket and returns in in the + * Accepts a new connection on this socket and returns in in the * passed in SocketImpl. * * @param impl The SocketImpl object to accept this connection. @@ -349,7 +349,7 @@ public class PlainSocketImpl extends SocketImpl /** * Returns the number of bytes that the caller can read from this socket - * without blocking. + * without blocking. * * @return the number of readable bytes before blocking * @@ -377,7 +377,7 @@ public class PlainSocketImpl extends SocketImpl { if (impl.getState().isValid()) impl.close(); - + address = null; port = -1; } @@ -418,7 +418,7 @@ public class PlainSocketImpl extends SocketImpl return out; } - + public VMChannel getVMChannel() { if (channel == null) @@ -433,7 +433,7 @@ public class PlainSocketImpl extends SocketImpl { if (channel == null) return null; - + try { InetSocketAddress remote = channel.getVMChannel().getPeerAddress(); @@ -444,7 +444,7 @@ public class PlainSocketImpl extends SocketImpl // was created by the native layer (this preserves exact hostnames). if (address != null) return address; - + return remote.getAddress(); } catch (IOException ioe) @@ -472,7 +472,7 @@ public class PlainSocketImpl extends SocketImpl return -1; } } - + public InetSocketAddress getLocalAddress() { if (channel == null) @@ -494,7 +494,7 @@ public class PlainSocketImpl extends SocketImpl { if (channel == null) return -1; - + try { InetSocketAddress remote = channel.getVMChannel().getPeerAddress(); @@ -509,7 +509,7 @@ public class PlainSocketImpl extends SocketImpl } /** - * This class contains an implementation of <code>InputStream</code> for + * This class contains an implementation of <code>InputStream</code> for * sockets. It in an internal only class used by <code>PlainSocketImpl</code>. * * @author Nic Ferrier <nferrier@tapsellferrier.co.uk> @@ -536,7 +536,7 @@ public class PlainSocketImpl extends SocketImpl } /** - * Reads the next byte of data and returns it as an int. + * Reads the next byte of data and returns it as an int. * * @return The byte read (as an int) or -1 if end of stream); * @@ -599,8 +599,8 @@ public class PlainSocketImpl extends SocketImpl } /** - * This class is used internally by <code>PlainSocketImpl</code> to be the - * <code>OutputStream</code> subclass returned by its + * This class is used internally by <code>PlainSocketImpl</code> to be the + * <code>OutputStream</code> subclass returned by its * <code>getOutputStream method</code>. It expects only to be used in that * context. * @@ -623,7 +623,7 @@ public class PlainSocketImpl extends SocketImpl /** * Writes a byte (passed in as an int) to the given output stream - * + * * @param b The byte to write * * @exception IOException If an error occurs diff --git a/libjava/classpath/gnu/java/net/loader/FileResource.java b/libjava/classpath/gnu/java/net/loader/FileResource.java index 8071bbf..4715840 100644 --- a/libjava/classpath/gnu/java/net/loader/FileResource.java +++ b/libjava/classpath/gnu/java/net/loader/FileResource.java @@ -79,4 +79,4 @@ public final class FileResource extends Resource throw ie; } } -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/loader/FileURLLoader.java b/libjava/classpath/gnu/java/net/loader/FileURLLoader.java index 39d33a4..58b6dcf 100644 --- a/libjava/classpath/gnu/java/net/loader/FileURLLoader.java +++ b/libjava/classpath/gnu/java/net/loader/FileURLLoader.java @@ -66,7 +66,7 @@ public final class FileURLLoader extends URLLoader /** get resource with the name "name" in the file url */ public Resource getResource(String name) { - try + try { // Make sure that all components in name are valid by walking through // them @@ -91,7 +91,7 @@ public final class FileURLLoader extends URLLoader * directory or a non directory component (plain file, symbolic link, ...). * An empty or null path is valid. Pathnames components are separated by * <code>File.separatorChar</code> - * + * * @param resourceFileName the name to be checked for validity. * @return the canonical file pointed by the resourceFileName or null if the * walking failed @@ -108,30 +108,30 @@ public final class FileURLLoader extends URLLoader for (int i = 0; i < tokenCount - 1; i++) { String currentToken = stringTokenizer.nextToken(); - + // If we are at the root directory and trying to go up, the walking is // finished with an error if ("..".equals(currentToken) && currentFile.equals(dir)) return null; - + currentFile = new File(currentFile, currentToken); // If the current file doesn't exist or is not a directory, the walking is // finished with an error if (! (currentFile.exists() && currentFile.isDirectory())) return null; - + } - + // Treat the last token differently, if it exists, because it does not need // to be a directory if (tokenCount > 0) { String currentToken = stringTokenizer.nextToken(); - + if ("..".equals(currentToken) && currentFile.equals(dir)) return null; - + currentFile = new File(currentFile, currentToken); // If the current file doesn't exist, the walking is @@ -139,7 +139,7 @@ public final class FileURLLoader extends URLLoader if (! currentFile.exists()) return null; } - + return currentFile.getCanonicalFile(); } -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/loader/JarURLLoader.java b/libjava/classpath/gnu/java/net/loader/JarURLLoader.java index 40194be..6f06ad3 100644 --- a/libjava/classpath/gnu/java/net/loader/JarURLLoader.java +++ b/libjava/classpath/gnu/java/net/loader/JarURLLoader.java @@ -83,7 +83,7 @@ public final class JarURLLoader extends URLLoader { jarfile = ((JarURLConnection) baseJarURL.openConnection()).getJarFile(); - + Manifest manifest; Attributes attributes; String classPathString; @@ -124,12 +124,12 @@ public final class JarURLLoader extends URLLoader else if ((manifest = jarfile.getManifest()) != null && (attributes = manifest.getMainAttributes()) != null && ((classPathString - = attributes.getValue(Attributes.Name.CLASS_PATH)) + = attributes.getValue(Attributes.Name.CLASS_PATH)) != null)) { this.classPath = new ArrayList<URLLoader>(); StringTokenizer st = new StringTokenizer(classPathString, " "); - while (st.hasMoreElements ()) + while (st.hasMoreElements ()) { String e = st.nextToken (); try diff --git a/libjava/classpath/gnu/java/net/loader/JarURLResource.java b/libjava/classpath/gnu/java/net/loader/JarURLResource.java index a9db5ce..1dec92f 100644 --- a/libjava/classpath/gnu/java/net/loader/JarURLResource.java +++ b/libjava/classpath/gnu/java/net/loader/JarURLResource.java @@ -91,4 +91,4 @@ public final class JarURLResource extends Resource throw ie; } } -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/loader/RemoteResource.java b/libjava/classpath/gnu/java/net/loader/RemoteResource.java index f180315..dc33b66 100644 --- a/libjava/classpath/gnu/java/net/loader/RemoteResource.java +++ b/libjava/classpath/gnu/java/net/loader/RemoteResource.java @@ -75,4 +75,4 @@ public final class RemoteResource extends Resource { return url; } -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java b/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java index f044740..81ef34f 100644 --- a/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java +++ b/libjava/classpath/gnu/java/net/loader/RemoteURLLoader.java @@ -98,4 +98,4 @@ public final class RemoteURLLoader extends URLLoader return null; } } -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/loader/Resource.java b/libjava/classpath/gnu/java/net/loader/Resource.java index e367a33..53720b0 100644 --- a/libjava/classpath/gnu/java/net/loader/Resource.java +++ b/libjava/classpath/gnu/java/net/loader/Resource.java @@ -107,4 +107,4 @@ public abstract class Resource * this resource can be loaded. */ public abstract InputStream getInputStream() throws IOException; -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/loader/URLLoader.java b/libjava/classpath/gnu/java/net/loader/URLLoader.java index 5b9b674..337564f 100644 --- a/libjava/classpath/gnu/java/net/loader/URLLoader.java +++ b/libjava/classpath/gnu/java/net/loader/URLLoader.java @@ -145,4 +145,4 @@ public abstract class URLLoader { return null; } -}
\ No newline at end of file +} diff --git a/libjava/classpath/gnu/java/net/protocol/file/Connection.java b/libjava/classpath/gnu/java/net/protocol/file/Connection.java index 04278d4..80155af 100644 --- a/libjava/classpath/gnu/java/net/protocol/file/Connection.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/file/Handler.java b/libjava/classpath/gnu/java/net/protocol/file/Handler.java index fc56049..58ebe4c 100644 --- a/libjava/classpath/gnu/java/net/protocol/file/Handler.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java b/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java index aa3c412..1ed31b8 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/ActiveModeDTP.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java index 63897f1..09915e7 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/BlockInputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java index 85481c9..d181f9d 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/BlockOutputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java index f2e65b7..638d780 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/CompressedInputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java index b960fb3..ec3aef9 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/CompressedOutputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java b/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java index 25580af..9ba4b7c 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/DTP.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java index 363a559..7280b01 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/DTPInputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java index 83f0be1..105c6f0 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/DTPOutputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java index 98e8a86..4e253fc 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPConnection.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java index 14ad381..1a7fcb8 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPException.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java index ec72c73..2620f0d 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPResponse.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java index cfad5a7..8cc1faf 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/FTPURLConnection.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java b/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java index 88491b3..7638b66 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/Handler.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java b/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java index 6f4fd63..a74346c 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/PassiveModeDTP.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java index 93eee4e..beee14b 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/StreamInputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java b/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java index a6e28ec..2df1a87 100644 --- a/libjava/classpath/gnu/java/net/protocol/ftp/StreamOutputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java b/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java index 0d7c988..b4ee41e 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Authenticator.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java b/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java index 35ad2bc..22a33cc 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java b/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java index 8a30e51..33df0df 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/ChunkedInputStream.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Cookie.java b/libjava/classpath/gnu/java/net/protocol/http/Cookie.java index 4482a12..122a23f 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Cookie.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java b/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java index cc1225c..da36866 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/CookieManager.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Credentials.java b/libjava/classpath/gnu/java/net/protocol/http/Credentials.java index 9e5fcd1..f95b4b5 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Credentials.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java index 44b1a60..b96bf4c 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/HTTPConnection.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java index 2f59e43..743f8e8e 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/HTTPDateFormat.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java b/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java index b31f426..9ba5c47 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/HTTPURLConnection.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Handler.java b/libjava/classpath/gnu/java/net/protocol/http/Handler.java index 6405425..3081032 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Handler.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Headers.java b/libjava/classpath/gnu/java/net/protocol/http/Headers.java index 690a0c6..faf5eb1 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Headers.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Request.java b/libjava/classpath/gnu/java/net/protocol/http/Request.java index 88e2fd0..534213e 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Request.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java b/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java index 05d98eb..aa5b78a 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/RequestBodyWriter.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/Response.java b/libjava/classpath/gnu/java/net/protocol/http/Response.java index 76fac93..084cf75 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/Response.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java b/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java index 4c5261d..ca86344 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/ResponseHeaderHandler.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java b/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java index fe05ba0..f082047 100644 --- a/libjava/classpath/gnu/java/net/protocol/http/SimpleCookieManager.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/https/Handler.java b/libjava/classpath/gnu/java/net/protocol/https/Handler.java index 2b13751..dbb6199 100644 --- a/libjava/classpath/gnu/java/net/protocol/https/Handler.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/jar/Connection.java b/libjava/classpath/gnu/java/net/protocol/jar/Connection.java index 386aace..85d27bf 100644 --- a/libjava/classpath/gnu/java/net/protocol/jar/Connection.java +++ b/libjava/classpath/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/libjava/classpath/gnu/java/net/protocol/jar/Handler.java b/libjava/classpath/gnu/java/net/protocol/jar/Handler.java index 66f0fb6..7d6103e 100644 --- a/libjava/classpath/gnu/java/net/protocol/jar/Handler.java +++ b/libjava/classpath/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); |