summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/java/net
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-23 21:31:04 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-23 21:31:04 +0000
commit947b8814056ea2fba6bbcfab86591f74bffc0311 (patch)
tree3ca4b2e68dc14c3128b9c781d23f1d0b1f2bee49 /libjava/classpath/java/net
parent49792907376493f0939563eb0219b96a48f1ae3b (diff)
downloadppe42-gcc-947b8814056ea2fba6bbcfab86591f74bffc0311.tar.gz
ppe42-gcc-947b8814056ea2fba6bbcfab86591f74bffc0311.zip
Imported Classpath 0.18.
* sources.am, Makefile.in: Updated. * Makefile.am (nat_source_files): Removed natProxy.cc. * java/lang/reflect/natProxy.cc: Removed. * gnu/classpath/jdwp/VMFrame.java, gnu/classpath/jdwp/VMIdManager.java, gnu/classpath/jdwp/VMVirtualMachine.java, java/lang/reflect/VMProxy.java: New files. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC list. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/java/net/DefaultContentHandlerFactory.java (getContent): Remove ClasspathToolkit references. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * gnu/awt/xlib/XCanvasPeer.java: Add new peer methods. * gnu/awt/xlib/XFramePeer.java: Likewise. * gnu/awt/xlib/XGraphicsConfiguration.java: Likewise. 2005-09-23 Thomas Fitzsimmons <fitzsim@redhat.com> * Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add classpath/native/jawt/jawt.c. * Makefile.in: Regenerate. * jawt.c: Remove file. * include/Makefile.am (tool_include__HEADERS): Remove jawt.h and jawt_md.h. Add ../classpath/include/jawt.h and ../classpath/include/jawt_md.h. * include/Makefile.in: Regenerate. * include/jawt.h: Regenerate. * include/jawt_md.h: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104586 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/net')
-rw-r--r--libjava/classpath/java/net/DatagramSocket.java6
-rw-r--r--libjava/classpath/java/net/Inet4Address.java4
-rw-r--r--libjava/classpath/java/net/JarURLConnection.java5
-rw-r--r--libjava/classpath/java/net/NetworkInterface.java52
-rw-r--r--libjava/classpath/java/net/URLClassLoader.java32
5 files changed, 72 insertions, 27 deletions
diff --git a/libjava/classpath/java/net/DatagramSocket.java b/libjava/classpath/java/net/DatagramSocket.java
index 8596b7f807f..875ddc778e9 100644
--- a/libjava/classpath/java/net/DatagramSocket.java
+++ b/libjava/classpath/java/net/DatagramSocket.java
@@ -1,5 +1,5 @@
/* DatagramSocket.java -- A class to model UDP sockets
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,8 @@ exception statement from your version. */
package java.net;
+import gnu.classpath.SystemProperties;
+
import gnu.java.net.PlainDatagramSocketImpl;
import gnu.java.nio.DatagramChannelImpl;
@@ -172,7 +174,7 @@ public class DatagramSocket
*/
public DatagramSocket(SocketAddress address) throws SocketException
{
- String propVal = System.getProperty("impl.prefix");
+ String propVal = SystemProperties.getProperty("impl.prefix");
if (propVal == null || propVal.equals(""))
impl = new PlainDatagramSocketImpl();
else
diff --git a/libjava/classpath/java/net/Inet4Address.java b/libjava/classpath/java/net/Inet4Address.java
index 00c6501de0c..74ce6efb828 100644
--- a/libjava/classpath/java/net/Inet4Address.java
+++ b/libjava/classpath/java/net/Inet4Address.java
@@ -142,7 +142,7 @@ public final class Inet4Address extends InetAddress
*/
public boolean isMCNodeLocal()
{
- return isMCNodeLocal();
+ return super.isMCNodeLocal();
}
/**
@@ -172,7 +172,7 @@ public final class Inet4Address extends InetAddress
*/
public boolean isMCOrgLocal()
{
- return isMCOrgLocal();
+ return super.isMCOrgLocal();
}
/**
diff --git a/libjava/classpath/java/net/JarURLConnection.java b/libjava/classpath/java/net/JarURLConnection.java
index 3067ecb81e6..0ffd1afacb7 100644
--- a/libjava/classpath/java/net/JarURLConnection.java
+++ b/libjava/classpath/java/net/JarURLConnection.java
@@ -1,5 +1,5 @@
/* JarURLConnection.java -- Class for manipulating remote jar files
- Copyright (C) 1998, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -151,8 +151,9 @@ public abstract class JarURLConnection extends URLConnection
*/
public JarEntry getJarEntry() throws IOException
{
+ if (entryName == null)
+ return null;
JarFile jarFile = getJarFile();
-
return jarFile != null ? jarFile.getJarEntry(entryName) : null;
}
diff --git a/libjava/classpath/java/net/NetworkInterface.java b/libjava/classpath/java/net/NetworkInterface.java
index eccd2dac9fb..47b1c67cae7 100644
--- a/libjava/classpath/java/net/NetworkInterface.java
+++ b/libjava/classpath/java/net/NetworkInterface.java
@@ -38,7 +38,12 @@ exception statement from your version. */
package java.net;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
import java.util.Vector;
/**
@@ -143,9 +148,7 @@ public final class NetworkInterface
public static NetworkInterface getByName(String name)
throws SocketException
{
- Vector networkInterfaces = VMNetworkInterface.getInterfaces();
-
- for (Enumeration e = networkInterfaces.elements(); e.hasMoreElements();)
+ for (Enumeration e = getNetworkInterfaces(); e.hasMoreElements();)
{
NetworkInterface tmp = (NetworkInterface) e.nextElement();
@@ -170,9 +173,7 @@ public final class NetworkInterface
public static NetworkInterface getByInetAddress(InetAddress addr)
throws SocketException
{
- Vector networkInterfaces = VMNetworkInterface.getInterfaces();
-
- for (Enumeration interfaces = networkInterfaces.elements();
+ for (Enumeration interfaces = getNetworkInterfaces();
interfaces.hasMoreElements();)
{
NetworkInterface tmp = (NetworkInterface) interfaces.nextElement();
@@ -188,6 +189,41 @@ public final class NetworkInterface
throw new SocketException("no network interface is bound to such an IP address");
}
+ static private Collection condense(Collection interfaces)
+ {
+ final Map condensed = new HashMap();
+
+ final Iterator interfs = interfaces.iterator();
+ while (interfs.hasNext()) {
+
+ final NetworkInterface face = (NetworkInterface) interfs.next();
+ final String name = face.getName();
+
+ if (condensed.containsKey(name))
+ {
+ final NetworkInterface conface = (NetworkInterface) condensed.get(name);
+ if (!conface.inetAddresses.containsAll(face.inetAddresses))
+ {
+ final Iterator faceAddresses = face.inetAddresses.iterator();
+ while (faceAddresses.hasNext())
+ {
+ final InetAddress faceAddress = (InetAddress) faceAddresses.next();
+ if (!conface.inetAddresses.contains(faceAddress))
+ {
+ conface.inetAddresses.add(faceAddress);
+ }
+ }
+ }
+ }
+ else
+ {
+ condensed.put(name, face);
+ }
+ }
+
+ return condensed.values();
+ }
+
/**
* Return an <code>Enumeration</code> of all available network interfaces
*
@@ -202,7 +238,9 @@ public final class NetworkInterface
if (networkInterfaces.isEmpty())
return null;
- return networkInterfaces.elements();
+ Collection condensed = condense(networkInterfaces);
+
+ return Collections.enumeration(condensed);
}
/**
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java
index 8ebc3e05dd7..85b38578169 100644
--- a/libjava/classpath/java/net/URLClassLoader.java
+++ b/libjava/classpath/java/net/URLClassLoader.java
@@ -588,10 +588,10 @@ public class URLClassLoader extends SecureClassLoader
* in the order given to the URLClassLoader which uses these URLs to
* load classes and resources (after using the default parent ClassLoader).
*
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls) throws SecurityException
@@ -610,13 +610,13 @@ public class URLClassLoader extends SecureClassLoader
* can throw a SecurityException. Then the supplied URLs are added
* in the order given to the URLClassLoader which uses these URLs to
* load classes and resources (after using the supplied parent ClassLoader).
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
* @param parent The parent class loader used before trying this class
* loader.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
+ * @exception SecurityException
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls, ClassLoader parent)
@@ -658,14 +658,14 @@ public class URLClassLoader extends SecureClassLoader
* load classes and resources (after using the supplied parent ClassLoader).
* It will use the supplied <CODE>URLStreamHandlerFactory</CODE> to get the
* protocol handlers of the supplied URLs.
- * @exception SecurityException if the SecurityManager disallows the
- * creation of a ClassLoader.
- * @exception SecurityException
* @param urls Locations that should be searched by this ClassLoader when
* resolving Classes or Resources.
* @param parent The parent class loader used before trying this class
* loader.
* @param factory Used to get the protocol handler for the URLs.
+ * @exception SecurityException if the SecurityManager disallows the
+ * creation of a ClassLoader.
+ * @exception SecurityException
* @see SecureClassLoader
*/
public URLClassLoader(URL[] urls, ClassLoader parent,
@@ -764,12 +764,12 @@ public class URLClassLoader extends SecureClassLoader
* package is sealed. If the Manifest indicates that the package is sealed
* then the Package will be sealed with respect to the supplied URL.
*
- * @exception IllegalArgumentException If this package name already exists
- * in this class loader
* @param name The name of the package
* @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
*/
protected Package definePackage(String name, Manifest manifest, URL url)
@@ -900,7 +900,11 @@ public class URLClassLoader extends SecureClassLoader
else
result = defineClass(className, classData, 0, classData.length, source);
- super.setSigners(result, resource.getCertificates());
+ // Avoid NullPointerExceptions.
+ Certificate[] resourceCertificates = resource.getCertificates();
+ if(resourceCertificates != null)
+ super.setSigners(result, resourceCertificates);
+
return result;
}
catch (IOException ioe)
@@ -1016,11 +1020,11 @@ public class URLClassLoader extends SecureClassLoader
/**
* Finds all the resources with a particular name from all the locations.
*
- * @exception IOException when an error occurs accessing one of the
- * locations
* @param resourceName the name of the resource to lookup
* @return a (possible empty) enumeration of URLs where the resource can be
* found
+ * @exception IOException when an error occurs accessing one of the
+ * locations
*/
public Enumeration findResources(String resourceName)
throws IOException
@@ -1055,7 +1059,7 @@ public class URLClassLoader extends SecureClassLoader
*
* @param source The codesource that needs the permissions to be accessed
* @return the collection of permissions needed to access the code resource
- * @see java.security.SecureClassLoader#getPermissions()
+ * @see java.security.SecureClassLoader#getPermissions(CodeSource)
*/
protected PermissionCollection getPermissions(CodeSource source)
{
OpenPOWER on IntegriCloud