aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/java/net
diff options
context:
space:
mode:
authorMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
committerMatthias Klose <doko@gcc.gnu.org>2007-06-03 23:18:43 +0000
commite1bea0c0687c5f4551b3a6058ec37ce3705fa6cc (patch)
treea9c9e7d91c484d53fe154f9285fc57325572ce50 /libjava/classpath/java/net
parentaf333b9a7f9e1cc1029bec56d48f2de63acdf686 (diff)
downloadgcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.zip
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.gz
gcc-e1bea0c0687c5f4551b3a6058ec37ce3705fa6cc.tar.bz2
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com> * javax/management/NotificationBroadcasterSupport.java (getNotificationInfo): Add cast. * native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include directories. * native/jni/qt-peer/Makefile.in: Regenerate. libjava/ChangeLog: 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/natFileWin32.cc (setFilePermissions): New (stub only). _access: Handle EXEC query, stub only. 2007-06-03 Matthias Klose <doko@ubuntu.com> Merged from classpath: * gnu/java/nio/SelectorProviderImpl.java: Whitespace merge. * java/lang/System.java(inheritedChannel): New. * java/lang/Character.java: Remove stray`;'. * java/net/MulticastSocket.java: Merged. * java/text/DateFormatSymbols.java(getInstance): New, comment updates. * java/text/Collator.java(getInstance): Merged. * java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG. getDisplayName, getDisplayNames: New. * java/util/logging/Logger.java: Merged. * Regenerate .class and .h files. 2007-06-03 Matthias Klose <doko@ubuntu.com> * java/io/File.java: Merge with classpath-0.95, new method setFilePermissions, new attribute EXEC. * java/io/natFilePosix.cc (setFilePermissions): New. _access: Handle EXEC query. * classpath/lib/java/io/File.class, java/io/File.h: Regenerate. 2007-06-03 Matthias Klose <doko@ubuntu.com> Imported GNU Classpath 0.95. * classpath/Makefile.in, classpath/native/jni/midi-dssi/Makefile.in, classpath/native/jni/classpath/Makefile.in, classpath/native/jni/Makefile.in, classpath/native/jni/gconf-peer/Makefile.in, classpath/native/jni/java-io/Makefile.in, classpath/native/jni/native-lib/Makefile.in, classpath/native/jni/java-util/Makefile.in, classpath/native/jni/midi-alsa/Makefile.in, classpath/native/jni/java-lang/Makefile.in, classpath/native/jni/java-nio/Makefile.in, classpath/native/jni/java-net/Makefile.in, classpath/native/jni/xmlj/Makefile.in, classpath/native/jni/qt-peer/Makefile.in, classpath/native/jni/gtk-peer/Makefile.in, classpath/native/Makefile.in, classpath/native/jawt/Makefile.in, classpath/native/fdlibm/Makefile.in, classpath/native/plugin/Makefile.in, classpath/resource/Makefile.in, classpath/scripts/Makefile.in, classpath/tools/Makefile.in, classpath/doc/Makefile.in, classpath/doc/api/Makefile.in, classpath/lib/Makefile.in, classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in, classpath/external/sax/Makefile.in, classpath/external/w3c_dom/Makefile.in, classpath/external/relaxngDatatype/Makefile.in, classpath/include/Makefile.in, classpath/examples/Makefile.in: Regenerate. * classpath/config.guess, classpath/config.sub, classpath/ltmain.sh : Update. * classpath/configure, classpath/depcomp, classpath/missing, classpath/aclocal.m4, classpath/install-sh: Regenerate. * gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95. * sources.am: Regenerate. * Makefile.in: Regenerate. * Update the .class files and generated CNI header files, add new .class and generated CNI header files. * Remove generated files for removed java source files: classpath/gnu/java/net/BASE64.java, classpath/gnu/java/security/util/Base64.java, classpath/gnu/java/awt/peer/gtk/GThreadMutex.java, classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java, classpath/gnu/java/awt/font/autofit/Scaler.java, classpath/gnu/classpath/jdwp/util/Value.java, classpath/gnu/javax/net/ssl/Base64.java. * Remove empty directories. * Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc. * java/lang/Class.java(setAccessible): Merge from classpath. * java/util/Locale.java: Remove. * gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java, gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New. * gcj/javaprims.h: Update class declarations. * scripts/classes.pl: Update usage. * HACKING: Mention to build all peers. From-SVN: r125302
Diffstat (limited to 'libjava/classpath/java/net')
-rw-r--r--libjava/classpath/java/net/MimeTypeMapper.java13
-rw-r--r--libjava/classpath/java/net/MulticastSocket.java6
-rw-r--r--libjava/classpath/java/net/NetworkInterface.java7
-rw-r--r--libjava/classpath/java/net/Proxy.java2
-rw-r--r--libjava/classpath/java/net/ResolverCache.java4
-rw-r--r--libjava/classpath/java/net/ServerSocket.java7
-rw-r--r--libjava/classpath/java/net/Socket.java23
-rw-r--r--libjava/classpath/java/net/URI.java2
-rw-r--r--libjava/classpath/java/net/URL.java11
-rw-r--r--libjava/classpath/java/net/URLClassLoader.java29
-rw-r--r--libjava/classpath/java/net/class-dependencies.conf122
11 files changed, 58 insertions, 168 deletions
diff --git a/libjava/classpath/java/net/MimeTypeMapper.java b/libjava/classpath/java/net/MimeTypeMapper.java
index 8153694..b0d400c 100644
--- a/libjava/classpath/java/net/MimeTypeMapper.java
+++ b/libjava/classpath/java/net/MimeTypeMapper.java
@@ -232,7 +232,8 @@ class MimeTypeMapper implements FileNameMap
/**
* The MIME types above are put into this Hashtable for faster lookup.
*/
- private Hashtable mime_types = new Hashtable(150);
+ private Hashtable<String, String> mime_types
+ = new Hashtable<String, String>(150);
/**
* Create a new <code>MimeTypeMapper</code> object.
@@ -257,7 +258,7 @@ class MimeTypeMapper implements FileNameMap
}
}
- public static void fillFromFile (Map table, String fname)
+ public static void fillFromFile (Map<String, String> table, String fname)
throws IOException
{
LineNumberReader reader =
@@ -325,17 +326,17 @@ class MimeTypeMapper implements FileNameMap
*/
public static void main(String[] args) throws IOException
{
- TreeMap map = new TreeMap();
+ TreeMap<String, String> map = new TreeMap<String, String>();
// It is fine to hard-code the name here. This is only ever
// used by maintainers, who can hack it if they need to re-run
// it.
fillFromFile(map, "/etc/mime.types");
- Iterator it = map.keySet().iterator();
+ Iterator<String> it = map.keySet().iterator();
boolean first = true;
while (it.hasNext())
{
- String key = (String) it.next();
- String value = (String) map.get(key);
+ String key = it.next();
+ String value = map.get(key);
// Put the "," first since it is easier to make correct syntax this way.
System.out.println(" " + (first ? " " : ", ")
+ "{ \"" + key + "\", \"" + value + "\" }");
diff --git a/libjava/classpath/java/net/MulticastSocket.java b/libjava/classpath/java/net/MulticastSocket.java
index 2841192..114d11f 100644
--- a/libjava/classpath/java/net/MulticastSocket.java
+++ b/libjava/classpath/java/net/MulticastSocket.java
@@ -1,5 +1,5 @@
/* MulticastSocket.java -- Class for using multicast sockets
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2007
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -337,7 +337,7 @@ public class MulticastSocket extends DatagramSocket
/**
* Sets the "Time to Live" value for a socket. The value must be between
- * 1 and 255.
+ * 0 and 255, inclusive.
*
* @param ttl The new TTL value
*
@@ -350,7 +350,7 @@ public class MulticastSocket extends DatagramSocket
if (isClosed())
throw new SocketException("socket is closed");
- if (ttl <= 0 || ttl > 255)
+ if (ttl < 0 || ttl > 255)
throw new IllegalArgumentException("Invalid ttl: " + ttl);
getImpl().setTimeToLive(ttl);
diff --git a/libjava/classpath/java/net/NetworkInterface.java b/libjava/classpath/java/net/NetworkInterface.java
index 6c78ead..a3a6058 100644
--- a/libjava/classpath/java/net/NetworkInterface.java
+++ b/libjava/classpath/java/net/NetworkInterface.java
@@ -40,12 +40,8 @@ package java.net;
import gnu.classpath.SystemProperties;
-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;
/**
@@ -100,7 +96,8 @@ public final class NetworkInterface
public Enumeration<InetAddress> getInetAddresses()
{
SecurityManager s = System.getSecurityManager();
- Vector inetAddresses = new Vector(netif.addresses);
+ Vector<InetAddress> inetAddresses
+ = new Vector<InetAddress>(netif.addresses);
if (s == null)
return inetAddresses.elements();
diff --git a/libjava/classpath/java/net/Proxy.java b/libjava/classpath/java/net/Proxy.java
index 6f9f1b6..3151774 100644
--- a/libjava/classpath/java/net/Proxy.java
+++ b/libjava/classpath/java/net/Proxy.java
@@ -57,7 +57,7 @@ public class Proxy
* For compatability with Sun's JDK
*/
private static final long serialVersionUID = -2231209257930100533L;
- };
+ }
public static final Proxy NO_PROXY = new Proxy(Type.DIRECT, null);
diff --git a/libjava/classpath/java/net/ResolverCache.java b/libjava/classpath/java/net/ResolverCache.java
index f879066..d57df49 100644
--- a/libjava/classpath/java/net/ResolverCache.java
+++ b/libjava/classpath/java/net/ResolverCache.java
@@ -97,12 +97,12 @@ class ResolverCache
/**
* The cache itself.
*/
- private static HashMap cache = new HashMap();
+ private static HashMap<Object, Entry> cache = new HashMap<Object, Entry>();
/**
* List of entries which may expire.
*/
- private static LinkedList killqueue = new LinkedList();
+ private static LinkedList<Entry> killqueue = new LinkedList<Entry>();
/**
* Return the hostname for the specified IP address.
diff --git a/libjava/classpath/java/net/ServerSocket.java b/libjava/classpath/java/net/ServerSocket.java
index d5f2a17..9cefd29 100644
--- a/libjava/classpath/java/net/ServerSocket.java
+++ b/libjava/classpath/java/net/ServerSocket.java
@@ -85,9 +85,7 @@ public class ServerSocket
* This constructor is only used by java.nio.
*/
- // FIXME: Workaround a bug in gcj.
- //ServerSocket (PlainSocketImpl impl) throws IOException
- ServerSocket(SocketImpl impl) throws IOException
+ ServerSocket(PlainSocketImpl impl) throws IOException
{
if (impl == null)
throw new NullPointerException("impl may not be null");
@@ -101,8 +99,6 @@ public class ServerSocket
* This method is only used by java.nio.
*/
- // FIXME: Workaround a bug in gcj.
- //PlainSocketImpl getImpl()
SocketImpl getImpl()
{
return impl;
@@ -390,6 +386,7 @@ public class ServerSocket
impl.accept(socket.impl);
socket.bound = true;
+ socket.implCreated = true;
SecurityManager sm = System.getSecurityManager();
if (sm != null)
diff --git a/libjava/classpath/java/net/Socket.java b/libjava/classpath/java/net/Socket.java
index f4f25fe..6480527 100644
--- a/libjava/classpath/java/net/Socket.java
+++ b/libjava/classpath/java/net/Socket.java
@@ -1,5 +1,5 @@
/* Socket.java -- Client socket implementation
- Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2006
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -83,6 +83,12 @@ public class Socket
SocketImpl impl;
/**
+ * True if impl.create() has been called.
+ */
+ // package-private because ServerSocket.implAccept() needs to access it.
+ boolean implCreated;
+
+ /**
* True if the socket is bound.
* Package private so it can be set from ServerSocket when accept is called.
*/
@@ -326,11 +332,23 @@ public class Socket
private SocketImpl getImpl() throws SocketException
{
+ if (! implCreated)
+ {
+ try
+ {
+ impl.create(true);
+ }
+ catch (IOException x)
+ {
+ throw (SocketException) new SocketException().initCause(x);
+ }
+ implCreated = true;
+ }
return impl;
}
/**
- * Binds the socket to the givent local address/port
+ * Binds the socket to the given local address/port
*
* @param bindpoint The address/port to bind to
*
@@ -359,7 +377,6 @@ public class Socket
// bind to address/port
try
{
- getImpl().create(true);
getImpl().bind(tmp.getAddress(), tmp.getPort());
bound = true;
}
diff --git a/libjava/classpath/java/net/URI.java b/libjava/classpath/java/net/URI.java
index 689843c..43b10fc 100644
--- a/libjava/classpath/java/net/URI.java
+++ b/libjava/classpath/java/net/URI.java
@@ -693,7 +693,7 @@ public final class URI
String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP);
- if (portStr != null)
+ if (portStr != null && ! portStr.isEmpty())
try
{
port = Integer.parseInt(portStr);
diff --git a/libjava/classpath/java/net/URL.java b/libjava/classpath/java/net/URL.java
index 8f72d06..16a606f 100644
--- a/libjava/classpath/java/net/URL.java
+++ b/libjava/classpath/java/net/URL.java
@@ -190,7 +190,8 @@ public final class URL implements Serializable
* This a table where we cache protocol handlers to avoid the overhead
* of looking them up each time.
*/
- private static HashMap ph_cache = new HashMap();
+ private static HashMap<String, URLStreamHandler> ph_cache
+ = new HashMap<String, URLStreamHandler>();
/**
* Whether or not to cache protocol handlers.
@@ -901,7 +902,7 @@ public final class URL implements Serializable
// First, see if a protocol handler is in our cache.
if (cache_handlers)
{
- if ((ph = (URLStreamHandler) ph_cache.get(protocol)) != null)
+ if ((ph = ph_cache.get(protocol)) != null)
return ph;
}
@@ -934,9 +935,9 @@ public final class URL implements Serializable
// Cache the systemClassLoader
if (systemClassLoader == null)
{
- systemClassLoader = (ClassLoader) AccessController.doPrivileged
- (new PrivilegedAction() {
- public Object run()
+ systemClassLoader = AccessController.doPrivileged
+ (new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
{
return ClassLoader.getSystemClassLoader();
}
diff --git a/libjava/classpath/java/net/URLClassLoader.java b/libjava/classpath/java/net/URLClassLoader.java
index 7e2353a..6df2818 100644
--- a/libjava/classpath/java/net/URLClassLoader.java
+++ b/libjava/classpath/java/net/URLClassLoader.java
@@ -145,7 +145,7 @@ public class URLClassLoader extends SecureClassLoader
// Instance variables
/** Locations to load classes from */
- private final Vector urls = new Vector();
+ private final Vector<URL> urls = new Vector<URL>();
/**
* Store pre-parsed information for each url into this vector: each
@@ -153,7 +153,7 @@ public class URLClassLoader extends SecureClassLoader
* attribute which adds to the URLs that will be searched, but this
* does not add to the list of urls.
*/
- private final Vector urlinfos = new Vector();
+ private final Vector<URLLoader> urlinfos = new Vector<URLLoader>();
/** Factory used to get the protocol handlers of the URLs */
private final URLStreamHandlerFactory factory;
@@ -301,7 +301,6 @@ public class URLClassLoader extends SecureClassLoader
if ("file".equals (protocol))
{
File dir = new File(file);
- URL absUrl;
try
{
absoluteURL = dir.getCanonicalFile().toURL();
@@ -329,12 +328,12 @@ public class URLClassLoader extends SecureClassLoader
// First see if we can find a handler with the correct name.
try
{
- Class handler = Class.forName(URL_LOADER_PREFIX + protocol);
- Class[] argTypes = new Class[] { URLClassLoader.class,
- URLStreamHandlerCache.class,
- URLStreamHandlerFactory.class,
- URL.class,
- URL.class };
+ Class<?> handler = Class.forName(URL_LOADER_PREFIX + protocol);
+ Class<?>[] argTypes = new Class<?>[] { URLClassLoader.class,
+ URLStreamHandlerCache.class,
+ URLStreamHandlerFactory.class,
+ URL.class,
+ URL.class };
Constructor k = handler.getDeclaredConstructor(argTypes);
loader
= (URLLoader) k.newInstance(new Object[] { this,
@@ -395,7 +394,7 @@ public class URLClassLoader extends SecureClassLoader
}
urlinfos.add(loader);
- ArrayList extra = loader.getClassPath();
+ ArrayList<URLLoader> extra = loader.getClassPath();
if (extra != null)
urlinfos.addAll(extra);
}
@@ -602,10 +601,10 @@ public class URLClassLoader extends SecureClassLoader
Class result = null;
if (sm != null && securityContext != null)
{
- result = (Class)AccessController.doPrivileged
- (new PrivilegedAction()
+ result = AccessController.doPrivileged
+ (new PrivilegedAction<Class>()
{
- public Object run()
+ public Class run()
{
return defineClass(className, classData,
0, classData.length,
@@ -848,9 +847,9 @@ public class URLClassLoader extends SecureClassLoader
+ securityContext);
URLClassLoader loader =
- (URLClassLoader) AccessController.doPrivileged(new PrivilegedAction()
+ AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>()
{
- public Object run()
+ public URLClassLoader run()
{
return new URLClassLoader(parent,
(AccessControlContext) securityContext);
diff --git a/libjava/classpath/java/net/class-dependencies.conf b/libjava/classpath/java/net/class-dependencies.conf
deleted file mode 100644
index 8b130f5..0000000
--- a/libjava/classpath/java/net/class-dependencies.conf
+++ /dev/null
@@ -1,122 +0,0 @@
-# This property file contains dependencies of classes, methods, and
-# field on other methods or classes.
-#
-# Syntax:
-#
-# <used>: <needed 1> [... <needed N>]
-#
-# means that when <used> is included, <needed 1> (... <needed N>) must
-# be included as well.
-#
-# <needed X> and <used> are of the form
-#
-# <class.methodOrField(signature)>
-#
-# or just
-#
-# <class>
-#
-# Within dependencies, variables can be used. A variable is defined as
-# follows:
-#
-# {variable}: value1 value2 ... value<n>
-#
-# variables can be used on the right side of dependencies as follows:
-#
-# <used>: com.bla.blu.{variable}.Class.m()V
-#
-# The use of the variable will expand to <n> dependencies of the form
-#
-# <used>: com.bla.blu.value1.Class.m()V
-# <used>: com.bla.blu.value2.Class.m()V
-# ...
-# <used>: com.bla.blu.value<n>.Class.m()V
-#
-# Variables can be redefined when building a system to select the
-# required support for features like encodings, protocols, etc.
-#
-# Hints:
-#
-# - For methods and fields, the signature is mandatory. For
-# specification, please see the Java Virtual Machine Specification by
-# SUN. Unlike in the spec, field signatures (types) are in brackets.
-#
-# - Package names must be separated by '/' (and not '.'). E.g.,
-# java/lang/Class (this is necessary, because the '.' is used to
-# separate method or field names from classes)
-#
-# - In case <needed> refers to a class, only the class itself will be
-# included in the resulting binary, NOT necessarily all its methods
-# and fields. If you want to refer to all methods and fields, you can
-# write class.* as an abbreviation.
-#
-# - Abbreviations for packages are also possible: my/package/* means all
-# methods and fields of all classes in my/package.
-#
-# - A line with a trailing '\' continues in the next line.
-
-java/net/InetAddress: \
- java/lang/ClassNotFoundException.<init>(Ljava/lang/String;)V \
- java/lang/InternalError.<init>(Ljava/lang/String;)V \
- java/net/UnknownHostException.<init>(Ljava/lang/String;)V
-
-java/net/DatagramSocketImpl: \
- java/net/DatagramSocketImpl.fd(Ljava/io/FileDescriptor;) \
- java/net/DatagramSocketImpl.localPort(I)
-
-java/net/PlainDatagramSocketImpl: \
- java/lang/ClassNotFoundException.<init>(Ljava/lang/String;)V \
- java/lang/InternalError.<init>(Ljava/lang/String;)V \
- java/io/IOException.<init>(Ljava/lang/String;)V \
- java/io/FileDescriptor.<init>()V \
- java/lang/Boolean.<init>(Z)V \
- java/lang/Integer.<init>(I)V \
- java/net/InetAddress.getByName(Ljava/lang/String;)Ljava/net/InetAddress; \
- java/net/InetAddress.getAddress()[B \
- java/lang/Boolean.booleanValue()Z \
- java/lang/Integer.intValue()I \
- java/net/SocketException.<init>(Ljava/lang/String;)V \
- java/net/DatagramPacket.getData()[B \
- java/net/SocketImpl.address(Ljava/net/InetAddress;) \
- java/net/PlainSocketImpl.native_fd(I) \
- java/net/SocketImpl.fd(Ljava/io/FileDescriptor;) \
- java/net/SocketImpl.address(Ljava/net/InetAddress;) \
- java/net/PlainDatagramSocketImpl.native_fd(I) \
- java/net/SocketImpl.localport(I) \
- java/net/SocketImpl.port(I)
-
-java/net/PlainSocketImpl: \
- java/lang/ClassNotFoundException.<init>(Ljava/lang/String;)V \
- java/lang/InternalError.<init>(Ljava/lang/String;)V \
- java/io/IOException.<init>(Ljava/lang/String;)V \
- java/io/FileDescriptor.<init>()V \
- java/lang/Boolean.<init>(Z)V \
- java/lang/Integer.<init>(I)V \
- java/net/InetAddress.getByName(Ljava/lang/String;)Ljava/net/InetAddress; \
- java/net/InetAddress.getAddress()[B \
- java/lang/Boolean.booleanValue()Z \
- java/lang/Integer.intValue()I \
- java/net/SocketException.<init>(Ljava/lang/String;)V \
- java/net/DatagramPacket.getData()[B \
- java/net/SocketImpl.address(Ljava/net/InetAddress;) \
- java/net/PlainSocketImpl.native_fd(I) \
- java/net/SocketImpl.fd(Ljava/io/FileDescriptor;) \
- java/net/SocketImpl.address(Ljava/net/InetAddress;) \
- java/net/PlainDatagramSocketImpl.native_fd(I) \
- java/net/SocketImpl.localport(I) \
- java/net/SocketImpl.port(I)
-
-# All protocols supported are loaded via URL.getURLStreamHandler from
-# class gnu.java.net.protocol.<protocol>.Handler.
-#
-# This introduces a dependency for all protocols. To allow an easy selection
-# and addition of protocols, the library variable {protocols} can be set to
-# the set of supported protocols.
-#
-{protocols}: http file jar
-
-java/net/URL.getURLStreamHandler(Ljava/lang/String;)Ljava/net/URLStreamHandler;: \
- gnu/java/net/protocol/{protocols}/Handler.* \
- com/aicas/java/net/protocol/rom/Handler.*
-
-# end of file