Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
This commit is contained in:
@@ -484,7 +484,6 @@ public class DatagramSocket
|
||||
* @param address The address to connect this socket to.
|
||||
* @param port The port to connect this socket to.
|
||||
*
|
||||
* @exception SocketException If an error occurs.
|
||||
* @exception IllegalArgumentException If address or port are invalid.
|
||||
* @exception SecurityException If the caller is not allowed to send
|
||||
* datagrams to or receive from this address and port.
|
||||
|
||||
@@ -70,7 +70,7 @@ public final class Inet4Address extends InetAddress
|
||||
* only by static methods in this class.
|
||||
*
|
||||
* @param addr The IP number of this address as an array of bytes
|
||||
* @param hostname The hostname of this IP address.
|
||||
* @param host The hostname of this IP address.
|
||||
*/
|
||||
Inet4Address(byte[] addr, String host)
|
||||
{
|
||||
|
||||
@@ -216,6 +216,6 @@ public class InetSocketAddress extends SocketAddress
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
return (addr == null ? hostname : addr.getHostName()) + ":" + port;
|
||||
return (addr == null ? hostname : addr.toString()) + ":" + port;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +316,8 @@ public class ServerSocket
|
||||
{
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
if (sm != null)
|
||||
sm.checkListen(impl.getLocalPort());
|
||||
sm.checkAccept(impl.getInetAddress().getHostAddress(),
|
||||
impl.getLocalPort());
|
||||
|
||||
Socket socket = new Socket();
|
||||
|
||||
@@ -369,6 +370,7 @@ public class ServerSocket
|
||||
|
||||
impl.accept(socket.impl);
|
||||
socket.implCreated = true;
|
||||
socket.bound = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,8 +91,9 @@ public class Socket
|
||||
|
||||
/**
|
||||
* True if the socket is bound.
|
||||
* Package private so it can be set from ServerSocket when accept is called.
|
||||
*/
|
||||
private boolean bound;
|
||||
boolean bound;
|
||||
|
||||
/**
|
||||
* True if input is shutdown.
|
||||
@@ -324,7 +325,9 @@ public class Socket
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new SocketException(e.getMessage());
|
||||
SocketException se = new SocketException(e.toString());
|
||||
se.initCause(e);
|
||||
throw se;
|
||||
}
|
||||
|
||||
return impl;
|
||||
@@ -481,7 +484,7 @@ public class Socket
|
||||
/**
|
||||
* Returns the local address to which this socket is bound. If this socket
|
||||
* is not connected, then a wildcard address, for which
|
||||
* @see isAnyLocalAddress() is <code>true</code>, is returned.
|
||||
* @see InetAddress#isAnyLocalAddress() is <code>true</code>, is returned.
|
||||
*
|
||||
* @return The local address
|
||||
*
|
||||
|
||||
@@ -235,12 +235,10 @@ public class URLClassLoader extends SecureClassLoader
|
||||
abstract static class Resource
|
||||
{
|
||||
final URLLoader loader;
|
||||
final String name;
|
||||
|
||||
Resource(URLLoader loader, String name)
|
||||
Resource(URLLoader loader)
|
||||
{
|
||||
this.loader = loader;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -391,11 +389,13 @@ public class URLClassLoader extends SecureClassLoader
|
||||
static final class JarURLResource extends Resource
|
||||
{
|
||||
private final JarEntry entry;
|
||||
private final String name;
|
||||
|
||||
JarURLResource(JarURLLoader loader, String name, JarEntry entry)
|
||||
{
|
||||
super(loader, name);
|
||||
super(loader);
|
||||
this.entry = entry;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
InputStream getInputStream() throws IOException
|
||||
@@ -496,7 +496,7 @@ public class URLClassLoader extends SecureClassLoader
|
||||
RemoteResource(RemoteURLLoader loader, String name, URL url,
|
||||
InputStream stream, int length)
|
||||
{
|
||||
super(loader, name);
|
||||
super(loader);
|
||||
this.url = url;
|
||||
this.stream = stream;
|
||||
this.length = length;
|
||||
@@ -535,9 +535,16 @@ public class URLClassLoader extends SecureClassLoader
|
||||
/** get resource with the name "name" in the file url */
|
||||
Resource getResource(String name)
|
||||
{
|
||||
File file = new File(dir, name);
|
||||
if (file.exists() && !file.isDirectory())
|
||||
return new FileResource(this, name, file);
|
||||
try
|
||||
{
|
||||
File file = new File(dir, name).getCanonicalFile();
|
||||
if (file.exists() && !file.isDirectory())
|
||||
return new FileResource(this, file);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Fall through...
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -546,9 +553,9 @@ public class URLClassLoader extends SecureClassLoader
|
||||
{
|
||||
final File file;
|
||||
|
||||
FileResource(FileURLLoader loader, String name, File file)
|
||||
FileResource(FileURLLoader loader, File file)
|
||||
{
|
||||
super(loader, name);
|
||||
super(loader);
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@@ -566,8 +573,7 @@ public class URLClassLoader extends SecureClassLoader
|
||||
{
|
||||
try
|
||||
{
|
||||
return new URL(loader.baseURL, name,
|
||||
loader.classloader.getURLStreamHandler("file"));
|
||||
return file.toURL();
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
@@ -701,7 +707,7 @@ public class URLClassLoader extends SecureClassLoader
|
||||
|
||||
private void addURLImpl(URL newUrl)
|
||||
{
|
||||
synchronized (urlloaders)
|
||||
synchronized (this)
|
||||
{
|
||||
if (newUrl == null)
|
||||
return; // Silently ignore...
|
||||
@@ -748,19 +754,42 @@ public class URLClassLoader extends SecureClassLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an array of new locations to the end of the internal URL store.
|
||||
* Adds an array of new locations to the end of the internal URL
|
||||
* store. Called from the the constructors. Should not call to the
|
||||
* protected addURL() method since that can be overridden and
|
||||
* subclasses are not yet in a good state at this point.
|
||||
* jboss 4.0.3 for example depends on this.
|
||||
*
|
||||
* @param newUrls the locations to add
|
||||
*/
|
||||
private void addURLs(URL[] newUrls)
|
||||
{
|
||||
for (int i = 0; i < newUrls.length; i++)
|
||||
addURL(newUrls[i]);
|
||||
{
|
||||
urls.add(newUrls[i]);
|
||||
addURLImpl(newUrls[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Look in both Attributes for a given value. The first Attributes
|
||||
* object, if not null, has precedence.
|
||||
*/
|
||||
private String getAttributeValue(Attributes.Name name, Attributes first,
|
||||
Attributes second)
|
||||
{
|
||||
String result = null;
|
||||
if (first != null)
|
||||
result = first.getValue(name);
|
||||
if (result == null)
|
||||
result = second.getValue(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a Package based on the given name and the supplied manifest
|
||||
* information. The manifest indicates the tile, version and
|
||||
* vendor information of the specification and implementation and wheter the
|
||||
* information. The manifest indicates the title, version and
|
||||
* vendor information of the specification and implementation and whether the
|
||||
* package is sealed. If the Manifest indicates that the package is sealed
|
||||
* then the Package will be sealed with respect to the supplied URL.
|
||||
*
|
||||
@@ -768,20 +797,43 @@ public class URLClassLoader extends SecureClassLoader
|
||||
* @param manifest The manifest describing the specification,
|
||||
* implementation and sealing details of the package
|
||||
* @param url the code source url to seal the package
|
||||
* @exception IllegalArgumentException If this package name already exists
|
||||
* in this class loader
|
||||
* @return the defined Package
|
||||
* @throws IllegalArgumentException If this package name already exists
|
||||
* in this class loader
|
||||
*/
|
||||
protected Package definePackage(String name, Manifest manifest, URL url)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
// Compute the name of the package as it may appear in the
|
||||
// Manifest.
|
||||
StringBuffer xform = new StringBuffer(name);
|
||||
for (int i = xform.length () - 1; i >= 0; --i)
|
||||
if (xform.charAt(i) == '.')
|
||||
xform.setCharAt(i, '/');
|
||||
xform.append('/');
|
||||
String xformName = xform.toString();
|
||||
|
||||
Attributes entryAttr = manifest.getAttributes(xformName);
|
||||
Attributes attr = manifest.getMainAttributes();
|
||||
String specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
|
||||
String specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
|
||||
String specVendor = attr.getValue(Attributes.Name.SPECIFICATION_VENDOR);
|
||||
String implTitle = attr.getValue(Attributes.Name.IMPLEMENTATION_TITLE);
|
||||
String implVersion = attr.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
|
||||
String implVendor = attr.getValue(Attributes.Name.IMPLEMENTATION_VENDOR);
|
||||
|
||||
String specTitle
|
||||
= getAttributeValue(Attributes.Name.SPECIFICATION_TITLE,
|
||||
entryAttr, attr);
|
||||
String specVersion
|
||||
= getAttributeValue(Attributes.Name.SPECIFICATION_VERSION,
|
||||
entryAttr, attr);
|
||||
String specVendor
|
||||
= getAttributeValue(Attributes.Name.SPECIFICATION_VENDOR,
|
||||
entryAttr, attr);
|
||||
String implTitle
|
||||
= getAttributeValue(Attributes.Name.IMPLEMENTATION_TITLE,
|
||||
entryAttr, attr);
|
||||
String implVersion
|
||||
= getAttributeValue(Attributes.Name.IMPLEMENTATION_VERSION,
|
||||
entryAttr, attr);
|
||||
String implVendor
|
||||
= getAttributeValue(Attributes.Name.IMPLEMENTATION_VENDOR,
|
||||
entryAttr, attr);
|
||||
|
||||
// Look if the Manifest indicates that this package is sealed
|
||||
// XXX - most likely not completely correct!
|
||||
@@ -793,8 +845,10 @@ public class URLClassLoader extends SecureClassLoader
|
||||
// make sure that the URL is null so the package is not sealed
|
||||
url = null;
|
||||
|
||||
return definePackage(name, specTitle, specVersion, specVendor, implTitle,
|
||||
implVersion, implVendor, url);
|
||||
return definePackage(name,
|
||||
specTitle, specVendor, specVersion,
|
||||
implTitle, implVendor, implVersion,
|
||||
url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -926,7 +980,7 @@ public class URLClassLoader extends SecureClassLoader
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
synchronized (urlloaders)
|
||||
synchronized (this)
|
||||
{
|
||||
if (thisString == null)
|
||||
{
|
||||
|
||||
@@ -530,7 +530,7 @@ public abstract class URLConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a flag indicating whether or not input is going
|
||||
* Sets the value of a flag indicating whether or not input is going
|
||||
* to be done for this connection. This default to true unless the
|
||||
* doOutput flag is set to false, in which case this defaults to false.
|
||||
*
|
||||
@@ -560,7 +560,7 @@ public abstract class URLConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a boolean flag indicating whether or not output will be done
|
||||
* Sets a boolean flag indicating whether or not output will be done
|
||||
* on this connection. The default value is false, so this method can
|
||||
* be used to override the default
|
||||
*
|
||||
@@ -851,7 +851,7 @@ public abstract class URLConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* Set's the ContentHandlerFactory for an application. This can be called
|
||||
* Sets the ContentHandlerFactory for an application. This can be called
|
||||
* once and only once. If it is called again, then an Error is thrown.
|
||||
* Unlike for other set factory methods, this one does not do a security
|
||||
* check prior to setting the factory.
|
||||
@@ -933,7 +933,7 @@ public abstract class URLConnection
|
||||
}
|
||||
|
||||
/**
|
||||
* This method set the <code>FileNameMap</code> object being used
|
||||
* This method sets the <code>FileNameMap</code> object being used
|
||||
* to decode MIME types by file extension.
|
||||
*
|
||||
* @param map The <code>FileNameMap</code>.
|
||||
|
||||
@@ -411,8 +411,6 @@ public abstract class URLStreamHandler
|
||||
* @param url2 The second URL.
|
||||
*
|
||||
* @return True if both URLs contain the same host.
|
||||
*
|
||||
* @exception UnknownHostException If an unknown host is found
|
||||
*/
|
||||
protected boolean hostsEqual(URL url1, URL url2)
|
||||
{
|
||||
@@ -511,18 +509,24 @@ public abstract class URLStreamHandler
|
||||
int size = protocol.length() + authority.length() + file.length() + 24;
|
||||
StringBuffer sb = new StringBuffer(size);
|
||||
|
||||
if (protocol != null && protocol.length() > 0)
|
||||
if (protocol.length() > 0)
|
||||
{
|
||||
sb.append(protocol);
|
||||
sb.append(":");
|
||||
}
|
||||
|
||||
if (authority.length() != 0)
|
||||
{
|
||||
sb.append("//").append(authority);
|
||||
}
|
||||
|
||||
sb.append(file);
|
||||
// If we have superfluous leading slashes (that means, at least 2)
|
||||
// we always add the authority component ("//" + host) to
|
||||
// avoid ambiguity. Otherwise we would generate an URL like
|
||||
// proto://home/foo
|
||||
// where we meant:
|
||||
// host: <empty> - file: //home/foo
|
||||
// but URL spec says it is:
|
||||
// host: home - file: /foo
|
||||
if (authority.length() != 0 || file.startsWith("//") )
|
||||
sb.append("//").append(authority).append(file);
|
||||
else
|
||||
sb.append(file);
|
||||
|
||||
if (ref != null)
|
||||
sb.append('#').append(ref);
|
||||
|
||||
Reference in New Issue
Block a user