From 40b86e5f2cf069832e23043992dedb0bf8e0dcd6 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 12 Feb 2007 23:52:39 +0000 Subject: [PATCH] Collections.java (UnmodifiableMap.toArray): Imported changes from Classpath. libjava/classpath * java/util/Collections.java (UnmodifiableMap.toArray): Imported changes from Classpath. libjava * sources.am, Makefile.in: Rebuilt. * java/lang/Socket.java: Removed override. * java/lang/DatagramSocket.java: Removed override. * gnu/java/net/PlainSocketImpl.java (localSocketAddress): New field. (getLocalAddress): New method. * gnu/java/net/PlainDatagramSocketImpl.java (PlainDatagramSocketImpl): Throws IOException. * gnu/java/net/natPlainSocketImplPosix.cc (write): Remove 'sizeof'. (read): Likewise. From-SVN: r121866 --- libjava/ChangeLog | 14 + libjava/Makefile.in | 57 +- libjava/classpath/ChangeLog.gcj | 5 + libjava/classpath/java/util/Collections.java | 14 +- .../java/net/PlainDatagramSocketImpl.class | Bin 3097 -> 3107 bytes .../PlainSocketImpl$SocketInputStream.class | Bin 810 -> 810 bytes .../PlainSocketImpl$SocketOutputStream.class | Bin 720 -> 720 bytes .../lib/gnu/java/net/PlainSocketImpl.class | Bin 3295 -> 3586 bytes .../lib/java/net/DatagramSocket.class | Bin 9962 -> 10347 bytes libjava/classpath/lib/java/net/Socket.class | Bin 11073 -> 11289 bytes ...UnmodifiableMap$UnmodifiableEntrySet.class | Bin 2550 -> 2503 bytes .../gnu/java/net/PlainDatagramSocketImpl.java | 4 +- libjava/gnu/java/net/PlainSocketImpl.java | 23 +- .../gnu/java/net/natPlainSocketImplPosix.cc | 7 +- libjava/java/net/DatagramSocket.java | 939 ------------ libjava/java/net/Socket.java | 1269 ----------------- libjava/sources.am | 4 +- 17 files changed, 84 insertions(+), 2252 deletions(-) delete mode 100644 libjava/java/net/DatagramSocket.java delete mode 100644 libjava/java/net/Socket.java diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 39a59027108..b76d6e7c214 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,17 @@ +2007-02-12 Tom Tromey + + * sources.am, Makefile.in: Rebuilt. + * java/lang/Socket.java: Removed override. + * java/lang/DatagramSocket.java: Removed override. + * gnu/java/net/PlainSocketImpl.java (localSocketAddress): New + field. + (getLocalAddress): New method. + * gnu/java/net/PlainDatagramSocketImpl.java + (PlainDatagramSocketImpl): Throws IOException. + * gnu/java/net/natPlainSocketImplPosix.cc (write): Remove + 'sizeof'. + (read): Likewise. + 2007-02-09 Jakub Jelinek * java/util/VMTimeZone.java: Rewrite to handle both the old diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 0e73f519d7d..5411f07d6cc 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -1209,6 +1209,7 @@ classpath/gnu/classpath/jdwp/exception/InvalidClassLoaderException.java \ classpath/gnu/classpath/jdwp/exception/InvalidCountException.java \ classpath/gnu/classpath/jdwp/exception/InvalidEventTypeException.java \ classpath/gnu/classpath/jdwp/exception/InvalidFieldException.java \ +classpath/gnu/classpath/jdwp/exception/InvalidFrameException.java \ classpath/gnu/classpath/jdwp/exception/InvalidLocationException.java \ classpath/gnu/classpath/jdwp/exception/InvalidMethodException.java \ classpath/gnu/classpath/jdwp/exception/InvalidObjectException.java \ @@ -4392,7 +4393,7 @@ classpath/java/net/ConnectException.java \ classpath/java/net/ContentHandler.java \ classpath/java/net/ContentHandlerFactory.java \ classpath/java/net/DatagramPacket.java \ -java/net/DatagramSocket.java \ +classpath/java/net/DatagramSocket.java \ classpath/java/net/DatagramSocketImpl.java \ classpath/java/net/DatagramSocketImplFactory.java \ classpath/java/net/FileNameMap.java \ @@ -4415,7 +4416,7 @@ classpath/java/net/Proxy.java \ classpath/java/net/ProxySelector.java \ classpath/java/net/ResolverCache.java \ classpath/java/net/ServerSocket.java \ -java/net/Socket.java \ +classpath/java/net/Socket.java \ classpath/java/net/SocketAddress.java \ classpath/java/net/SocketException.java \ classpath/java/net/SocketImpl.java \ @@ -9973,7 +9974,7 @@ java/lang/Class.lo: classpath/lib/java/lang/Class.class gnu-CORBA.lo: $(gnu_CORBA_source_files) @find $(srcdir)/classpath/lib/gnu/CORBA -name '*.class' > gnu-CORBA.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-CORBA.lo @gnu-CORBA.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-CORBA.lo @gnu-CORBA.list @rm -f gnu-CORBA.list gnu/awt.list: $(gnu_awt_source_files) @@ -10122,7 +10123,7 @@ gnu/java/awt/dnd.list: $(gnu_java_awt_dnd_source_files) gnu-java-awt-dnd-peer-gtk.lo: $(gnu_java_awt_dnd_peer_gtk_source_files) @find $(srcdir)/classpath/lib/gnu/java/awt/dnd/peer/gtk -name '*.class' > gnu-java-awt-dnd-peer-gtk.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-dnd-peer-gtk.lo @gnu-java-awt-dnd-peer-gtk.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-dnd-peer-gtk.lo @gnu-java-awt-dnd-peer-gtk.list @rm -f gnu-java-awt-dnd-peer-gtk.list gnu/java/awt/font.list: $(gnu_java_awt_font_source_files) @@ -10169,7 +10170,7 @@ gnu/java/awt/peer.list: $(gnu_java_awt_peer_source_files) gnu-java-awt-peer-gtk.lo: $(gnu_java_awt_peer_gtk_source_files) @find $(srcdir)/classpath/lib/gnu/java/awt/peer/gtk -name '*.class' > gnu-java-awt-peer-gtk.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-gtk.lo @gnu-java-awt-peer-gtk.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-gtk.lo @gnu-java-awt-peer-gtk.list @rm -f gnu-java-awt-peer-gtk.list gnu/java/awt/peer/headless.list: $(gnu_java_awt_peer_headless_source_files) @@ -10180,17 +10181,17 @@ gnu/java/awt/peer/headless.list: $(gnu_java_awt_peer_headless_source_files) gnu-java-awt-peer-qt.lo: $(gnu_java_awt_peer_qt_source_files) @find $(srcdir)/classpath/lib/gnu/java/awt/peer/qt -name '*.class' > gnu-java-awt-peer-qt.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-qt.lo @gnu-java-awt-peer-qt.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-qt.lo @gnu-java-awt-peer-qt.list @rm -f gnu-java-awt-peer-qt.list gnu-java-awt-peer-swing.lo: $(gnu_java_awt_peer_swing_source_files) @find $(srcdir)/classpath/lib/gnu/java/awt/peer/swing -name '*.class' > gnu-java-awt-peer-swing.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-swing.lo @gnu-java-awt-peer-swing.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-swing.lo @gnu-java-awt-peer-swing.list @rm -f gnu-java-awt-peer-swing.list gnu-java-awt-peer-x.lo: $(gnu_java_awt_peer_x_source_files) @find $(srcdir)/classpath/lib/gnu/java/awt/peer/x -name '*.class' > gnu-java-awt-peer-x.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-x.lo @gnu-java-awt-peer-x.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-awt-peer-x.lo @gnu-java-awt-peer-x.list @rm -f gnu-java-awt-peer-x.list gnu/java/awt/print.list: $(gnu_java_awt_print_source_files) @@ -10201,7 +10202,7 @@ gnu/java/awt/print.list: $(gnu_java_awt_print_source_files) gnu-java-beans.lo: $(gnu_java_beans_source_files) @find $(srcdir)/classpath/lib/gnu/java/beans -name '*.class' > gnu-java-beans.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-beans.lo @gnu-java-beans.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-beans.lo @gnu-java-beans.list @rm -f gnu-java-beans.list gnu/java/io.list: $(gnu_java_io_source_files) @@ -10494,7 +10495,7 @@ gnu/java/util/prefs.list: $(gnu_java_util_prefs_source_files) gnu-java-util-prefs-gconf.lo: $(gnu_java_util_prefs_gconf_source_files) @find $(srcdir)/classpath/lib/gnu/java/util/prefs/gconf -name '*.class' > gnu-java-util-prefs-gconf.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-util-prefs-gconf.lo @gnu-java-util-prefs-gconf.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-java-util-prefs-gconf.lo @gnu-java-util-prefs-gconf.list @rm -f gnu-java-util-prefs-gconf.list gnu/java/util/regex.list: $(gnu_java_util_regex_source_files) @@ -10775,7 +10776,7 @@ gnu/javax/print/ipp/attribute/supported.list: $(gnu_javax_print_ipp_attribute_su gnu-javax-rmi.lo: $(gnu_javax_rmi_source_files) @find $(srcdir)/classpath/lib/gnu/javax/rmi -name '*.class' > gnu-javax-rmi.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-rmi.lo @gnu-javax-rmi.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-rmi.lo @gnu-javax-rmi.list @rm -f gnu-javax-rmi.list gnu/javax/security/auth.list: $(gnu_javax_security_auth_source_files) @@ -10798,7 +10799,7 @@ gnu/javax/security/auth/login.list: $(gnu_javax_security_auth_login_source_files gnu-javax-sound-midi.lo: $(gnu_javax_sound_midi_source_files) @find $(srcdir)/classpath/lib/gnu/javax/sound/midi -name '*.class' > gnu-javax-sound-midi.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-javax-sound-midi.lo @gnu-javax-sound-midi.list @rm -f gnu-javax-sound-midi.list gnu/javax/sound/sampled/AU.list: $(gnu_javax_sound_sampled_AU_source_files) @@ -10899,47 +10900,47 @@ gnu/javax/swing/tree.list: $(gnu_javax_swing_tree_source_files) gnu-xml-aelfred2.lo: $(gnu_xml_aelfred2_source_files) @find $(srcdir)/classpath/lib/gnu/xml/aelfred2 -name '*.class' > gnu-xml-aelfred2.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-aelfred2.lo @gnu-xml-aelfred2.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-aelfred2.lo @gnu-xml-aelfred2.list @rm -f gnu-xml-aelfred2.list gnu-xml-dom.lo: $(gnu_xml_dom_source_files) @find $(srcdir)/classpath/lib/gnu/xml/dom -name '*.class' > gnu-xml-dom.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-dom.lo @gnu-xml-dom.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-dom.lo @gnu-xml-dom.list @rm -f gnu-xml-dom.list gnu-xml-libxmlj.lo: $(gnu_xml_libxmlj_source_files) @find $(srcdir)/classpath/lib/gnu/xml/libxmlj -name '*.class' > gnu-xml-libxmlj.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-libxmlj.lo @gnu-xml-libxmlj.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-libxmlj.lo @gnu-xml-libxmlj.list @rm -f gnu-xml-libxmlj.list gnu-xml-pipeline.lo: $(gnu_xml_pipeline_source_files) @find $(srcdir)/classpath/lib/gnu/xml/pipeline -name '*.class' > gnu-xml-pipeline.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-pipeline.lo @gnu-xml-pipeline.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-pipeline.lo @gnu-xml-pipeline.list @rm -f gnu-xml-pipeline.list gnu-xml-stream.lo: $(gnu_xml_stream_source_files) @find $(srcdir)/classpath/lib/gnu/xml/stream -name '*.class' > gnu-xml-stream.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-stream.lo @gnu-xml-stream.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-stream.lo @gnu-xml-stream.list @rm -f gnu-xml-stream.list gnu-xml-transform.lo: $(gnu_xml_transform_source_files) @find $(srcdir)/classpath/lib/gnu/xml/transform -name '*.class' > gnu-xml-transform.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-transform.lo @gnu-xml-transform.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-transform.lo @gnu-xml-transform.list @rm -f gnu-xml-transform.list gnu-xml-util.lo: $(gnu_xml_util_source_files) @find $(srcdir)/classpath/lib/gnu/xml/util -name '*.class' > gnu-xml-util.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-util.lo @gnu-xml-util.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-util.lo @gnu-xml-util.list @rm -f gnu-xml-util.list gnu-xml-validation.lo: $(gnu_xml_validation_source_files) @find $(srcdir)/classpath/lib/gnu/xml/validation -name '*.class' > gnu-xml-validation.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-validation.lo @gnu-xml-validation.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-validation.lo @gnu-xml-validation.list @rm -f gnu-xml-validation.list gnu-xml-xpath.lo: $(gnu_xml_xpath_source_files) @find $(srcdir)/classpath/lib/gnu/xml/xpath -name '*.class' > gnu-xml-xpath.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-xpath.lo @gnu-xml-xpath.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o gnu-xml-xpath.lo @gnu-xml-xpath.list @rm -f gnu-xml-xpath.list java/applet.list: $(java_applet_source_files) @@ -11280,7 +11281,7 @@ javax/crypto/spec.list: $(javax_crypto_spec_source_files) javax-imageio.lo: $(javax_imageio_source_files) @find $(srcdir)/classpath/lib/javax/imageio -name '*.class' > javax-imageio.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o javax-imageio.lo @javax-imageio.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o javax-imageio.lo @javax-imageio.list @rm -f javax-imageio.list javax/management.list: $(javax_management_source_files) @@ -11369,7 +11370,7 @@ javax/print/event.list: $(javax_print_event_source_files) javax-rmi.lo: $(javax_rmi_source_files) @find $(srcdir)/classpath/lib/javax/rmi -name '*.class' > javax-rmi.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o javax-rmi.lo @javax-rmi.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o javax-rmi.lo @javax-rmi.list @rm -f javax-rmi.list javax/security/auth.list: $(javax_security_auth_source_files) @@ -11566,7 +11567,7 @@ javax/transaction/xa.list: $(javax_transaction_xa_source_files) javax-xml.lo: $(javax_xml_source_files) @find $(srcdir)/classpath/lib/javax/xml -name '*.class' > javax-xml.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o javax-xml.lo @javax-xml.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o javax-xml.lo @javax-xml.list @rm -f javax-xml.list org/ietf/jgss.list: $(org_ietf_jgss_source_files) @@ -11577,22 +11578,22 @@ org/ietf/jgss.list: $(org_ietf_jgss_source_files) org-omg.lo: $(org_omg_source_files) @find $(srcdir)/classpath/lib/org/omg -name '*.class' > org-omg.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o org-omg.lo @org-omg.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-omg.lo @org-omg.list @rm -f org-omg.list org-relaxng.lo: $(org_relaxng_source_files) @find $(srcdir)/classpath/lib/org/relaxng -name '*.class' > org-relaxng.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o org-relaxng.lo @org-relaxng.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-relaxng.lo @org-relaxng.list @rm -f org-relaxng.list org-w3c.lo: $(org_w3c_source_files) @find $(srcdir)/classpath/lib/org/w3c -name '*.class' > org-w3c.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o org-w3c.lo @org-w3c.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-w3c.lo @org-w3c.list @rm -f org-w3c.list org-xml.lo: $(org_xml_source_files) @find $(srcdir)/classpath/lib/org/xml -name '*.class' > org-xml.list - $(LTGCJCOMPILE) -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list + $(LTGCJCOMPILE) -fsource-filename=$(here)/classpath/lib/classes -fjni -findirect-dispatch -fno-indirect-classes -c -o org-xml.lo @org-xml.list @rm -f org-xml.list sun/misc.list: $(sun_misc_source_files) diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj index 336813b7f4c..e50d8f79747 100644 --- a/libjava/classpath/ChangeLog.gcj +++ b/libjava/classpath/ChangeLog.gcj @@ -1,3 +1,8 @@ +2007-02-12 Tom Tromey + + * java/util/Collections.java (UnmodifiableMap.toArray): Imported + changes from Classpath. + 2007-02-09 Gary Benson * javax/management/ObjectName.java diff --git a/libjava/classpath/java/util/Collections.java b/libjava/classpath/java/util/Collections.java index c15fa092bb2..77ff6ed8fa0 100644 --- a/libjava/classpath/java/util/Collections.java +++ b/libjava/classpath/java/util/Collections.java @@ -5115,7 +5115,7 @@ public class Collections // Map.Entry public Map.Entry[] toArray() { - Map.Entry[] mapEntryResult = (Map.Entry[]) super.toArray(); + Object[] mapEntryResult = super.toArray(); UnmodifiableMapEntry result[] = null; if (mapEntryResult != null) @@ -5123,21 +5123,21 @@ public class Collections result = (UnmodifiableMapEntry[]) new UnmodifiableMapEntry[mapEntryResult.length]; for (int i = 0; i < mapEntryResult.length; ++i) - result[i] = new UnmodifiableMapEntry(mapEntryResult[i]); + result[i] = new UnmodifiableMapEntry((Map.Entry)mapEntryResult[i]); } return result; } // The array returned is an array of UnmodifiableMapEntry instead of // Map.Entry - public Map.Entry[] toArray(Map.Entry[] array) + public S[] toArray(S[] array) { - super.toArray(array); + S[] result = super.toArray(array); - if (array != null) - for (int i = 0; i < array.length; i++) + if (result != null) + for (int i = 0; i < result.length; i++) array[i] = - new UnmodifiableMapEntry(array[i]); + (S) new UnmodifiableMapEntry((Map.Entry) result[i]); return array; } diff --git a/libjava/classpath/lib/gnu/java/net/PlainDatagramSocketImpl.class b/libjava/classpath/lib/gnu/java/net/PlainDatagramSocketImpl.class index 376931bdd6892cb027aa9a3102e14eae6661b5a6..7ff9c0ca8399a28505b615204091a9828ea5d8cd 100644 GIT binary patch delta 1127 zcmZ`%NmCO+6#jZni)um#g>_IR8 zB?lAASTUPZA){Y|4#NkAn1)kudoaKdSWc~_BKcHdAu^j@&Sh3r#L+K?&TBZ0PElRd zaHd`j@eOGq=D`@lVT(AwxKezRO6SRiVM4faERKEk8#VBFaI47aiOos6$-(TIXW zXs5w;beN|w+VF-emQko-#4v?vvKILxbc*~gA^n94qS3G01mD3TyXs`7;09)>+f11t zWEOJ{E;mcp+cHItP_Z(gj~HTYZn}vVn~uFP$+owX?$-4#Vrf4) zKBXS3h^4FIqFDewcF+_!VqU!3;ER49ugF$G0Y&Or!9=7H!o@@J>IPG4C^a5iOZPZD zEM(L5wsgH%38KpsE<1(!Z}q4xTo;L){hvrfV->Ie2{%XKWQx+J8$YnNgZ1wHBKG0{ lieKazoclw5+sE=iL{EKaNeCyQ_TJ9t3z{Q;yaeFXpj delta 1114 zcmZ`%OHUI~6#nj=>GU-cNTg}7&6p^PGunrOC?Z7=MJc{tRq<6SqDYCw#3(Yso$ky{ zjK+lv7j9gLSh{dwBJp?Wxih6xCbF4(<~#TM&Ueo_pW`3m-*P;m4wolO5hzIMFkywk zkkPRNS`hoi5^qmrk&&XUY}Q&*FrR0g+ewSzf$WUMN9a65~9+qNy3iMpt?R@43ye7eJBBFgiQU8uppI zinRF?*+LBms_6E@gQil&p=G+r(MR77X!Ly!755Ov6t-dp2A-1Z1stJ_?uw!xN9j++ z04!qWoS0#dO78|95yS~fnuYvt^9R!W6N2U{hOD(O(5$sz9XEV;Zu$_03EZ-qE{!pU+qkm<;kZlF@ZKY(X)UM| zDvf!P2Hhx%5}|O~mLZ00n?{Yl|JK(x#+&+PYmIR}!1N|^LxjtjM$Bz(_`A4@hu+de zWQMgO%-S5;n0vFXN*r3E$7DvuEXtJg?8^BLiseYVEtk*LNg&9QO*)~5P6$uX<>*xY zr$hSEVaT+YQp23zUl-}_*-STH7oMkG-(XNoL=D3;m%CBivg{R7;Pb;|$% diff --git a/libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketInputStream.class b/libjava/classpath/lib/gnu/java/net/PlainSocketImpl$SocketInputStream.class index c03ad3228a81cbfd0fd2a3e5e873d6ed52e3853d..5c42da8e08aa8f72436f393a06eec5dd5d010f91 100644 GIT binary patch delta 29 lcmZ3*wu)_oBNJouWG5z1#_q{IOrES$8Q2-8O}@nx004%Q2;~3( delta 29 lcmZ3*wu)_oBNJoZWG5z1#dVzI=Ars?{$wo|`tVbBw8IMkGULT{;I+ delta 23 fcmcb>dVzI=Ars@`$wo|`tm_%r88=LBULTG-*XdH6#nie*){1-6G~esWGDs2veCvM{-mWAsS1W-DOd|y4ee4|LQ|U1R=`G4 ztmRj&tDrNEI*v0PXVht(rgdaSI`V+yKj5QpzWIbNzA%3GZc;O;?|kR% z{$6uF9QgI_k3Rv3;gh+*A7V{KGS!nvcBFbv*qN5z-eEhP76`{3;alhYDaQ4OO+1JO z=ahD#YNv@EX!JwiDHEHa%cosVnWt7f<3v2`V$Ye_gGK>gPcoIZ19%?$48#RO1BsDD zG?^Iei|#){Nm(qMUkLHRP}M19?5BPP-q6{xF^Plv+JysxD?*k@ub zjYW1y>RA)_qh8i|%fyT5l)kr3yaQdpuT&XI4QHG?zNq=0iLI~-|m^lW#>2D7FAA@@pl#ylk#h_pt1~A zmMYV(!74=Y5UIp?i_!{OpEZwd->9(dJay%~f=Bplx&e3;kMXt&kK+k?Wb#geXfoPb zpTo8}K559x^nh|-gAdnLiE1}2UqY6Dl3XM*$DJ?M${5KcXf2}2(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Tj_;VuFCJrb#8j^HL^L%6+V?jllv@zrlX zYOx%as6`*KGHc2Drc{^V49@mSAXzi@U*^BoMtcSMe*wT@w@d&4 diff --git a/libjava/classpath/lib/java/net/DatagramSocket.class b/libjava/classpath/lib/java/net/DatagramSocket.class index 033684ec72fb5064f26ced7842d6841dd47dea61..d80af7d40055880d4659ead04dca8e8bbd47dfd2 100644 GIT binary patch literal 10347 zcmbtZ34B!bo&WydB$;ILNJvNmAqh-CAQv}CB_5C<5)B~|Bqkm>OkR?a$xN7oQ>oQ$ zwcTx%dPCK!Xgp9sVM2upUa+fO>vmh)+S)zc?Y7%myV^s$rQhFsZ)RSS!L40BALjp# z|NnPo=m`5a88J7q6vmq`gT7GT z+%+4oHT*FJcdySM3rDsqoYi`Uqb&o2!IjpoMun^ZZxyOOX*aj!%eLl-;fonP3aVRS zT*Md%$BgAYJrN@sRVYhSXra9Ja~}0r8{5MX%BNZsvNwj~AyUaXHxLTM&R6i(q|c62 zQ)F$dT~9Ha!##!vE|lmPk5UC!P3`(T5Fj1nP~b+n!jv=|ZSi2RJsb$djL3!C{KjA` z5Dw*{LZL+T@DBL4dqd%vccbAAai<59P$hJyD3sc=n5cHdB7smJ1rSbN9d6{x)ifRX z&=m?>10ka=KCsbX&=-vk`eOZa zJGMt-#z1={JZMB>0VAs8d|be@eMZcFNPnK0$uO3rPFv+-xdJ?B#)WRI7!f0uHFd1S zMRY!6bKDoCSww5-c$D7Q;Dl^le;<#lYuHs&%TLK>wOOo8y+c4nOzl{S0>glGqSzd0Na_LwOvU`i7UFcEvr2wLiO znB_X`a^rf138p+FN$L2kBslk=P!EPAF?>$PjglC$HU>gHZv2(wV9Odu&iO*}g$Zuz z1&K+Zo9Ta2+N(#V7L#LmaJ`SFC?4Yp%zdsvnAoPZcW~xgO&odhXyPdmxWmmfA$3AR zcDIf^cs$sQ+jZO_bt1Ox^NxBZpM1|9JM`=SzlF*Ai1mo9r{2d;* zUUY=l1qO_8JeG?$m;|C`1LqAy8NcF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+^upE=@jV}Y_BLIqE>DCHU#%Ir`NzJ^9=_UA SbaUIt&2JXnyjAp57ySvw-{JrO diff --git a/libjava/classpath/lib/java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet.class b/libjava/classpath/lib/java/util/Collections$UnmodifiableMap$UnmodifiableEntrySet.class index 4b9f103aecf138e6fa9ce719d67bc217431a4f48..70357f7569b4dc87c9a06cd7f48f900f5216972e 100644 GIT binary patch delta 451 zcmZwBO-n*S6b9gTydS1WNi!Krmm(_Exnb0`BJI0~K(RE4u#J^OArhuRt2WW5RorE( zAZQyzw1~u&{feM%f1qV{G+G2L=A0SM@Sf+Bzw-MxMM-B9SKcYRq52djqIOD6_c$@Z zzz=gLxk#maP>3XRM+3{na_Q6!%f3}F26;Bonig`!{YYx(Fuz-lG3cfIaivgZU5FIVnl3~zyOD{7n#BzTiyoMmdwAFO9GeMN!)Q|05tP*zSV?8(4&A2l3~Ngo zqcx1PCroC}6=ullP2AtsRz2 zr?C!188&nB$&qn&V3r{*-*}pPVauxHGUO`lA6JTH23DY0XP7kp=g2c2;0YrqA6>c< zY89^+9LqjfSdmF*`0m=dr(_$LO0ouKQsy(p&H4lE6i?hhSo%HeZBw6OHOy^YaHgB} zYV+N?1&E?j4#ESdpKz;9bP9%E;ecOo3{Ltt}KfQ>H)s~^J?e%T=>t)Ct&rY{ZUK_OivC4b_c>YrZ diff --git a/libjava/gnu/java/net/PlainDatagramSocketImpl.java b/libjava/gnu/java/net/PlainDatagramSocketImpl.java index f72d57331ae..08c1cb3f6ee 100644 --- a/libjava/gnu/java/net/PlainDatagramSocketImpl.java +++ b/libjava/gnu/java/net/PlainDatagramSocketImpl.java @@ -1,5 +1,5 @@ /* PlainDatagramSocketImpl.java -- Default DatagramSocket implementation - Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -119,7 +119,7 @@ public final class PlainDatagramSocketImpl extends DatagramSocketImpl /** * Default do nothing constructor */ - public PlainDatagramSocketImpl() + public PlainDatagramSocketImpl() throws IOException { } diff --git a/libjava/gnu/java/net/PlainSocketImpl.java b/libjava/gnu/java/net/PlainSocketImpl.java index eefee10ee28..dad1724d6b1 100644 --- a/libjava/gnu/java/net/PlainSocketImpl.java +++ b/libjava/gnu/java/net/PlainSocketImpl.java @@ -1,5 +1,5 @@ /* PlainSocketImpl.java -- Default socket implementation - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -110,6 +110,9 @@ public final class PlainSocketImpl extends SocketImpl // localAddress cache InetAddress localAddress; + // Local address as an InetSocketAddress. + InetSocketAddress localSocketAddress; + /** * A cached copy of the in stream for reading from the socket. */ @@ -325,6 +328,24 @@ public final class PlainSocketImpl extends SocketImpl protected native void sendUrgentData(int data) throws IOException; + public synchronized InetSocketAddress getLocalAddress() + { + if (localSocketAddress == null) + { + try + { + localSocketAddress + = new InetSocketAddress ((InetAddress) getOption(SocketOptions.SO_BINDADDR), + localport); + } + catch (SocketException _) + { + return null; + } + } + return localSocketAddress; + } + /** * Returns an InputStream object for reading from this socket. This will * be an instance of SocketInputStream. diff --git a/libjava/gnu/java/net/natPlainSocketImplPosix.cc b/libjava/gnu/java/net/natPlainSocketImplPosix.cc index e4572fa3c37..9fc619649d3 100644 --- a/libjava/gnu/java/net/natPlainSocketImplPosix.cc +++ b/libjava/gnu/java/net/natPlainSocketImplPosix.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation +/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation This file is part of libgcj. @@ -364,7 +364,7 @@ gnu::java::net::PlainSocketImpl$SocketOutputStream::write(jbyteArray b, jint off if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b)) throw new ::java::lang::ArrayIndexOutOfBoundsException; - write_helper (this$0->native_fd, elements (b) + offset * sizeof (jbyte), len); + write_helper (this$0->native_fd, elements (b) + offset, len); } static void @@ -435,8 +435,7 @@ gnu::java::net::PlainSocketImpl$SocketInputStream::read(jbyteArray buffer, if (offset < 0 || count < 0 || offset + count > bsize) throw new ::java::lang::ArrayIndexOutOfBoundsException; - return read_helper (this$0, - elements (buffer) + offset * sizeof (jbyte), count); + return read_helper (this$0, elements (buffer) + offset, count); } static jint diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java deleted file mode 100644 index d8837c006b5..00000000000 --- a/libjava/java/net/DatagramSocket.java +++ /dev/null @@ -1,939 +0,0 @@ -/* DatagramSocket.java -- A class to model UDP sockets - Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -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 -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.net; - -import gnu.classpath.SystemProperties; - -import gnu.java.net.PlainDatagramSocketImpl; -import gnu.java.nio.DatagramChannelImpl; - -import java.io.IOException; -import java.nio.channels.DatagramChannel; -import java.nio.channels.IllegalBlockingModeException; - - -/** - * Written using on-line Java Platform 1.2 API Specification, as well - * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). - * Status: Believed complete and correct. - */ -/** - * This class models a connectionless datagram socket that sends - * individual packets of data across the network. In the TCP/IP world, - * this means UDP. Datagram packets do not have guaranteed delivery, - * or any guarantee about the order the data will be received on the - * remote host. - * - * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Warren Levy (warrenl@cygnus.com) - * @date May 3, 1999. - */ -public class DatagramSocket -{ - /** - * This is the user DatagramSocketImplFactory for this class. If this - * variable is null, a default factory is used. - */ - private static DatagramSocketImplFactory factory; - - /** - * This is the implementation object used by this socket. - */ - private DatagramSocketImpl impl; - - /** - * True if socket implementation was created. - */ - private boolean implCreated; - - /** - * This is the address we are "connected" to - */ - private InetAddress remoteAddress; - - /** - * This is the port we are "connected" to - */ - private int remotePort = -1; - - /** - * True if socket is bound. - */ - private boolean bound; - - /** - * Creates a DatagramSocket from a specified - * DatagramSocketImpl instance - * - * @param impl The DatagramSocketImpl the socket will be - * created from - * - * @since 1.4 - */ - protected DatagramSocket(DatagramSocketImpl impl) - { - if (impl == null) - throw new NullPointerException("impl may not be null"); - - this.impl = impl; - this.remoteAddress = null; - this.remotePort = -1; - } - - /** - * Initializes a new instance of DatagramSocket that binds to - * a random port and every address on the local machine. - * - * @exception SocketException If an error occurs. - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation. - */ - public DatagramSocket() throws SocketException - { - this(new InetSocketAddress(0)); - } - - /** - * Initializes a new instance of DatagramSocket that binds to - * the specified port and every address on the local machine. - * - * @param port The local port number to bind to. - * - * @exception SecurityException If a security manager exists and its - * checkListen method doesn't allow the operation. - * @exception SocketException If an error occurs. - */ - public DatagramSocket(int port) throws SocketException - { - this(new InetSocketAddress(port)); - } - - /** - * Initializes a new instance of DatagramSocket that binds to - * the specified local port and address. - * - * @param port The local port number to bind to. - * @param addr The local address to bind to. - * - * @exception SecurityException If a security manager exists and its - * checkListen method doesn't allow the operation. - * @exception SocketException If an error occurs. - */ - public DatagramSocket(int port, InetAddress addr) throws SocketException - { - this(new InetSocketAddress(addr, port)); - } - - /** - * Initializes a new instance of DatagramSocket that binds to - * the specified local port and address. - * - * @param address The local address and port number to bind to. - * - * @exception SecurityException If a security manager exists and its - * checkListen method doesn't allow the operation. - * @exception SocketException If an error occurs. - * - * @since 1.4 - */ - public DatagramSocket(SocketAddress address) throws SocketException - { - String propVal = SystemProperties.getProperty("impl.prefix"); - if (propVal == null || propVal.equals("")) - { - if (factory != null) - impl = factory.createDatagramSocketImpl(); - else - impl = new PlainDatagramSocketImpl(); - } - else - try - { - impl = - (DatagramSocketImpl) Class.forName("java.net." + propVal - + "DatagramSocketImpl") - .newInstance(); - } - catch (Exception e) - { - System.err.println("Could not instantiate class: java.net." - + propVal + "DatagramSocketImpl"); - impl = new PlainDatagramSocketImpl(); - } - - if (address != null) - bind(address); - } - - // This needs to be accessible from java.net.MulticastSocket - DatagramSocketImpl getImpl() throws SocketException - { - try - { - if (! implCreated) - { - impl.create(); - implCreated = true; - } - - return impl; - } - catch (IOException e) - { - SocketException se = new SocketException(); - se.initCause(e); - throw se; - } - } - - /** - * Closes this datagram socket. - */ - public void close() - { - if (isClosed()) - return; - - try - { - getImpl().close(); - } - catch (SocketException e) - { - // Ignore this case, just close the socket in finally clause. - } - finally - { - remoteAddress = null; - remotePort = -1; - impl = null; - } - - try - { - if (getChannel() != null) - getChannel().close(); - } - catch (IOException e) - { - // Do nothing. - } - } - - /** - * This method returns the remote address to which this socket is - * connected. If this socket is not connected, then this method will - * return null. - * - * @return The remote address. - * - * @since 1.2 - */ - public InetAddress getInetAddress() - { - return remoteAddress; - } - - /** - * This method returns the remote port to which this socket is - * connected. If this socket is not connected, then this method will - * return -1. - * - * @return The remote port. - * - * @since 1.2 - */ - public int getPort() - { - return remotePort; - } - - /** - * Returns the local address this datagram socket is bound to. - * - * @return The local address is the socket is bound or null - * - * @since 1.1 - */ - public InetAddress getLocalAddress() - { - if (! isBound()) - return null; - - InetAddress localAddr; - - try - { - localAddr = - (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR); - - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkConnect(localAddr.getHostName(), -1); - } - catch (SecurityException e) - { - localAddr = InetAddress.ANY_IF; - } - catch (SocketException e) - { - // This cannot happen as we are bound. - return null; - } - - return localAddr; - } - - /** - * Returns the local port this socket is bound to. - * - * @return The local port number. - */ - public int getLocalPort() - { - if (isClosed()) - return -1; - - try - { - return getImpl().getLocalPort(); - } - catch (SocketException e) - { - // This cannot happen as we are bound. - return 0; - } - } - - /** - * Returns the value of the socket's SO_TIMEOUT setting. If this method - * returns 0 then SO_TIMEOUT is disabled. - * - * @return The current timeout in milliseconds. - * - * @exception SocketException If an error occurs. - * - * @since 1.1 - */ - public synchronized int getSoTimeout() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_TIMEOUT); - - if (buf instanceof Integer) - return ((Integer) buf).intValue(); - - throw new SocketException("unexpected type"); - } - - /** - * Sets the value of the socket's SO_TIMEOUT value. A value of 0 will - * disable SO_TIMEOUT. Any other value is the number of milliseconds - * a socket read/write will block before timing out. - * - * @param timeout The new SO_TIMEOUT value in milliseconds. - * - * @exception SocketException If an error occurs. - * - * @since 1.1 - */ - public synchronized void setSoTimeout(int timeout) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (timeout < 0) - throw new IllegalArgumentException("Invalid timeout: " + timeout); - - getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout)); - } - - /** - * This method returns the value of the system level socket option - * SO_SNDBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The send buffer size. - * - * @exception SocketException If an error occurs. - * - * @since 1.2 - */ - public int getSendBufferSize() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_SNDBUF); - - if (buf instanceof Integer) - return ((Integer) buf).intValue(); - - throw new SocketException("unexpected type"); - } - - /** - * This method sets the value for the system level socket option - * SO_SNDBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new send buffer size. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If size is 0 or negative. - * - * @since 1.2 - */ - public void setSendBufferSize(int size) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (size < 0) - throw new IllegalArgumentException("Buffer size is less than 0"); - - getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size)); - } - - /** - * This method returns the value of the system level socket option - * SO_RCVBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The receive buffer size. - * - * @exception SocketException If an error occurs. - * - * @since 1.2 - */ - public int getReceiveBufferSize() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_RCVBUF); - - if (buf instanceof Integer) - return ((Integer) buf).intValue(); - - throw new SocketException("unexpected type"); - } - - /** - * This method sets the value for the system level socket option - * SO_RCVBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new receive buffer size. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If size is 0 or negative. - * - * @since 1.2 - */ - public void setReceiveBufferSize(int size) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (size < 0) - throw new IllegalArgumentException("Buffer size is less than 0"); - - getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size)); - } - - /** - * This method connects this socket to the specified address and port. - * When a datagram socket is connected, it will only send or receive - * packets to and from the host to which it is connected. A multicast - * socket that is connected may only send and not receive packets. - * - * @param address The address to connect this socket to. - * @param port The port to connect this socket to. - * - * @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. - * - * @since 1.2 - */ - public void connect(InetAddress address, int port) - { - if (address == null) - throw new IllegalArgumentException("Connect address may not be null"); - - if ((port < 1) || (port > 65535)) - throw new IllegalArgumentException("Port number is illegal: " + port); - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkConnect(address.getHostName(), port); - - try - { - getImpl().connect(address, port); - remoteAddress = address; - remotePort = port; - } - catch (SocketException e) - { - // This means simply not connected or connect not implemented. - } - } - - /** - * This method disconnects this socket from the address/port it was - * connected to. If the socket was not connected in the first place, - * this method does nothing. - * - * @since 1.2 - */ - public void disconnect() - { - if (! isConnected()) - return; - - try - { - getImpl().disconnect(); - } - catch (SocketException e) - { - // This cannot happen as we are connected. - } - finally - { - remoteAddress = null; - remotePort = -1; - } - } - - /** - * Reads a datagram packet from the socket. Note that this method - * will block until a packet is received from the network. On return, - * the passed in DatagramPacket is populated with the data - * received and all the other information about the packet. - * - * @param p A DatagramPacket for storing the data - * - * @exception IOException If an error occurs. - * @exception SocketTimeoutException If setSoTimeout was previously called - * and the timeout has expired. - * @exception PortUnreachableException If the socket is connected to a - * currently unreachable destination. Note, there is no guarantee that the - * exception will be thrown. - * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode. - * @exception SecurityException If a security manager exists and its - * checkAccept method doesn't allow the receive. - */ - public synchronized void receive(DatagramPacket p) throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (remoteAddress != null && remoteAddress.isMulticastAddress()) - throw new IOException - ("Socket connected to a multicast address my not receive"); - - if (getChannel() != null && ! getChannel().isBlocking() - && ! ((DatagramChannelImpl) getChannel()).isInChannelOperation()) - throw new IllegalBlockingModeException(); - - getImpl().receive(p); - - SecurityManager s = System.getSecurityManager(); - if (s != null && isConnected()) - s.checkAccept(p.getAddress().getHostName(), p.getPort()); - } - - /** - * Sends the specified packet. The host and port to which the packet - * are to be sent should be set inside the packet. - * - * @param p The datagram packet to send. - * - * @exception IOException If an error occurs. - * @exception SecurityException If a security manager exists and its - * checkMulticast or checkConnect method doesn't allow the send. - * @exception PortUnreachableException If the socket is connected to a - * currently unreachable destination. Note, there is no guarantee that the - * exception will be thrown. - * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode. - */ - public void send(DatagramPacket p) throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - // JDK1.2: Don't do security checks if socket is connected; see jdk1.2 api. - SecurityManager s = System.getSecurityManager(); - if (s != null && ! isConnected()) - { - InetAddress addr = p.getAddress(); - if (addr.isMulticastAddress()) - s.checkMulticast(addr); - else - s.checkConnect(addr.getHostAddress(), p.getPort()); - } - - if (isConnected()) - { - if (p.getAddress() != null - && (remoteAddress != p.getAddress() || remotePort != p.getPort())) - throw new IllegalArgumentException - ("DatagramPacket address does not match remote address"); - } - - // FIXME: if this is a subclass of MulticastSocket, - // use getTimeToLive for TTL val. - if (getChannel() != null && ! getChannel().isBlocking() - && ! ((DatagramChannelImpl) getChannel()).isInChannelOperation()) - throw new IllegalBlockingModeException(); - - getImpl().send(p); - } - - /** - * Binds the socket to the given socket address. - * - * @param address The socket address to bind to. - * - * @exception SocketException If an error occurs. - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation. - * @exception IllegalArgumentException If address type is not supported. - * - * @since 1.4 - */ - public void bind(SocketAddress address) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (! (address instanceof InetSocketAddress)) - throw new IllegalArgumentException("unsupported address type"); - - InetAddress addr = ((InetSocketAddress) address).getAddress(); - int port = ((InetSocketAddress) address).getPort(); - - if (port < 0 || port > 65535) - throw new IllegalArgumentException("Invalid port: " + port); - - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkListen(port); - - if (addr == null) - addr = InetAddress.ANY_IF; - - try - { - getImpl().bind(port, addr); - bound = true; - } - catch (SocketException exception) - { - getImpl().close(); - throw exception; - } - catch (RuntimeException exception) - { - getImpl().close(); - throw exception; - } - catch (Error error) - { - getImpl().close(); - throw error; - } - } - - /** - * Checks if the datagram socket is closed. - * - * @return True if socket is closed, false otherwise. - * - * @since 1.4 - */ - public boolean isClosed() - { - return impl == null; - } - - /** - * Returns the datagram channel assoziated with this datagram socket. - * - * @return The associated DatagramChannel object or null - * - * @since 1.4 - */ - public DatagramChannel getChannel() - { - return null; - } - - /** - * Connects the datagram socket to a specified socket address. - * - * @param address The socket address to connect to. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If address type is not supported. - * - * @since 1.4 - */ - public void connect(SocketAddress address) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (! (address instanceof InetSocketAddress)) - throw new IllegalArgumentException("unsupported address type"); - - InetSocketAddress tmp = (InetSocketAddress) address; - connect(tmp.getAddress(), tmp.getPort()); - } - - /** - * Returns the binding state of the socket. - * - * @return True if socket bound, false otherwise. - * - * @since 1.4 - */ - public boolean isBound() - { - return bound; - } - - /** - * Returns the connection state of the socket. - * - * @return True if socket is connected, false otherwise. - * - * @since 1.4 - */ - public boolean isConnected() - { - return remoteAddress != null; - } - - /** - * Returns the SocketAddress of the host this socket is conneted to - * or null if this socket is not connected. - * - * @return The socket address of the remote host if connected or null - * - * @since 1.4 - */ - public SocketAddress getRemoteSocketAddress() - { - if (! isConnected()) - return null; - - return new InetSocketAddress(remoteAddress, remotePort); - } - - /** - * Returns the local SocketAddress this socket is bound to. - * - * @return The local SocketAddress or null if the socket is not bound. - * - * @since 1.4 - */ - public SocketAddress getLocalSocketAddress() - { - if (! isBound()) - return null; - - return new InetSocketAddress(getLocalAddress(), getLocalPort()); - } - - /** - * Enables/Disables SO_REUSEADDR. - * - * @param on Whether or not to have SO_REUSEADDR turned on. - * - * @exception SocketException If an error occurs. - * - * @since 1.4 - */ - public void setReuseAddress(boolean on) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on)); - } - - /** - * Checks if SO_REUSEADDR is enabled. - * - * @return True if SO_REUSEADDR is set on the socket, false otherwise. - * - * @exception SocketException If an error occurs. - * - * @since 1.4 - */ - public boolean getReuseAddress() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_REUSEADDR); - - if (buf instanceof Boolean) - return ((Boolean) buf).booleanValue(); - - throw new SocketException("unexpected type"); - } - - /** - * Enables/Disables SO_BROADCAST - * - * @param enable True if SO_BROADCAST should be enabled, false otherwise. - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public void setBroadcast(boolean enable) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().setOption(SocketOptions.SO_BROADCAST, Boolean.valueOf(enable)); - } - - /** - * Checks if SO_BROADCAST is enabled - * - * @return Whether SO_BROADCAST is set - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public boolean getBroadcast() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_BROADCAST); - - if (buf instanceof Boolean) - return ((Boolean) buf).booleanValue(); - - throw new SocketException("unexpected type"); - } - - /** - * Sets the traffic class value - * - * @param tc The traffic class - * - * @exception SocketException If an error occurs - * @exception IllegalArgumentException If tc value is illegal - * - * @see DatagramSocket#getTrafficClass() - * - * @since 1.4 - */ - public void setTrafficClass(int tc) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (tc < 0 || tc > 255) - throw new IllegalArgumentException(); - - getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc)); - } - - /** - * Returns the current traffic class - * - * @return The current traffic class. - * - * @see DatagramSocket#setTrafficClass(int tc) - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public int getTrafficClass() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.IP_TOS); - - if (buf instanceof Integer) - return ((Integer) buf).intValue(); - - throw new SocketException("unexpected type"); - } - - /** - * Sets the datagram socket implementation factory for the application - * - * @param fac The factory to set - * - * @exception IOException If an error occurs - * @exception SocketException If the factory is already defined - * @exception SecurityException If a security manager exists and its - * checkSetFactory method doesn't allow the operation - */ - public static void setDatagramSocketImplFactory(DatagramSocketImplFactory fac) - throws IOException - { - if (factory != null) - throw new SocketException("DatagramSocketImplFactory already defined"); - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkSetFactory(); - - factory = fac; - } -} diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java deleted file mode 100644 index b2249ffaa0d..00000000000 --- a/libjava/java/net/Socket.java +++ /dev/null @@ -1,1269 +0,0 @@ -/* Socket.java -- Client socket implementation - Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 - Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -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 -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -package java.net; - -import gnu.java.net.PlainSocketImpl; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.channels.IllegalBlockingModeException; -import java.nio.channels.SocketChannel; - - -/* Written using on-line Java Platform 1.2 API Specification. - * Status: I believe all methods are implemented. - */ - -/** - * This class models a client site socket. A socket is a TCP/IP endpoint - * for network communications conceptually similar to a file handle. - *

- * This class does not actually do any work. Instead, it redirects all of - * its calls to a socket implementation object which implements the - * SocketImpl interface. The implementation class is - * instantiated by factory class that implements the - * SocketImplFactory interface. A default - * factory is provided, however the factory may be set by a call to - * the setSocketImplFactory method. Note that this may only be - * done once per virtual machine. If a subsequent attempt is made to set the - * factory, a SocketException will be thrown. - * - * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Per Bothner (bothner@cygnus.com) - */ -public class Socket -{ - /** - * This is the user SocketImplFactory for this class. If this variable is - * null, a default factory is used. - */ - static SocketImplFactory factory; - - /** - * The implementation object to which calls are redirected - */ - // package-private because ServerSocket.implAccept() needs to access it. - SocketImpl impl; - - /** - * True if socket implementation was created by calling their - * create() method. - */ - // 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. - */ - boolean bound; - - /** - * True if input is shutdown. - */ - private boolean inputShutdown; - - /** - * True if output is shutdown. - */ - private boolean outputShutdown; - - /** - * Initializes a new instance of Socket object without - * connecting to a remote host. This useful for subclasses of socket that - * might want this behavior. - * - * @specnote This constructor is public since JDK 1.4 - * @since 1.1 - */ - public Socket() - { - if (factory != null) - impl = factory.createSocketImpl(); - else - impl = new PlainSocketImpl(); - } - - /** - * Initializes a new instance of Socket object without - * connecting to a remote host. This is useful for subclasses of socket - * that might want this behavior. - *

- * Additionally, this socket will be created using the supplied - * implementation class instead the default class or one returned by a - * factory. If this value is null, the default Socket - * implementation is used. - * - * @param impl The SocketImpl to use for this - * Socket - * - * @exception SocketException If an error occurs - * - * @since 1.1 - */ - protected Socket(SocketImpl impl) throws SocketException - { - if (impl == null) - this.impl = new PlainSocketImpl(); - else - this.impl = impl; - } - - /** - * Initializes a new instance of Socket and connects to the - * hostname and port specified as arguments. - * - * @param host The name of the host to connect to - * @param port The port number to connect to - * - * @exception UnknownHostException If the hostname cannot be resolved to a - * network address. - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - */ - public Socket(String host, int port) - throws UnknownHostException, IOException - { - this(InetAddress.getByName(host), port, null, 0, true); - } - - /** - * Initializes a new instance of Socket and connects to the - * address and port number specified as arguments. - * - * @param address The address to connect to - * @param port The port number to connect to - * - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - */ - public Socket(InetAddress address, int port) throws IOException - { - this(address, port, null, 0, true); - } - - /** - * Initializes a new instance of Socket that connects to the - * named host on the specified port and binds to the specified local address - * and port. - * - * @param host The name of the remote host to connect to. - * @param port The remote port to connect to. - * @param localAddr The local address to bind to. - * @param localPort The local port to bind to. - * - * @exception SecurityException If the SecurityManager - * exists and does not allow a connection to the specified host/port or - * binding to the specified local host/port. - * @exception IOException If a connection error occurs. - * - * @since 1.1 - */ - public Socket(String host, int port, InetAddress localAddr, int localPort) - throws IOException - { - this(InetAddress.getByName(host), port, localAddr, localPort, true); - } - - /** - * Initializes a new instance of Socket and connects to the - * address and port number specified as arguments, plus binds to the - * specified local address and port. - * - * @param address The remote address to connect to - * @param port The remote port to connect to - * @param localAddr The local address to connect to - * @param localPort The local port to connect to - * - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - * - * @since 1.1 - */ - public Socket(InetAddress address, int port, InetAddress localAddr, - int localPort) throws IOException - { - this(address, port, localAddr, localPort, true); - } - - /** - * Initializes a new instance of Socket and connects to the - * hostname and port specified as arguments. If the stream argument is set - * to true, then a stream socket is created. If it is - * false, a datagram socket is created. - * - * @param host The name of the host to connect to - * @param port The port to connect to - * @param stream true for a stream socket, false - * for a datagram socket - * - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - * - * @deprecated Use the DatagramSocket class to create - * datagram oriented sockets. - */ - public Socket(String host, int port, boolean stream) - throws IOException - { - this(InetAddress.getByName(host), port, null, 0, stream); - } - - /** - * Initializes a new instance of Socket and connects to the - * address and port number specified as arguments. If the stream param is - * true, a stream socket will be created, otherwise a datagram - * socket is created. - * - * @param host The address to connect to - * @param port The port number to connect to - * @param stream true to create a stream socket, - * false to create a datagram socket. - * - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - * - * @deprecated Use the DatagramSocket class to create - * datagram oriented sockets. - */ - public Socket(InetAddress host, int port, boolean stream) - throws IOException - { - this(host, port, null, 0, stream); - } - - /** - * This constructor is where the real work takes place. Connect to the - * specified address and port. Use default local values if not specified, - * otherwise use the local host and port passed in. Create as stream or - * datagram based on "stream" argument. - *

- * - * @param raddr The remote address to connect to - * @param rport The remote port to connect to - * @param laddr The local address to connect to - * @param lport The local port to connect to - * @param stream true for a stream socket, false for a datagram socket - * - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - */ - private Socket(InetAddress raddr, int rport, InetAddress laddr, int lport, - boolean stream) throws IOException - { - this(); - - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkConnect(raddr.getHostName(), rport); - - // bind socket - SocketAddress bindaddr = - laddr == null ? null : new InetSocketAddress(laddr, lport); - bind(bindaddr); - - // connect socket - connect(new InetSocketAddress(raddr, rport)); - - // FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port, - // i.e. '0' and if localAddr is unspecified, use getLocalAddress() as - // that default. JDK 1.2 doc infers not to do a bind. - } - - private SocketImpl getImpl() throws SocketException - { - try - { - if (! implCreated) - { - impl.create(true); - implCreated = true; - } - } - catch (IOException e) - { - SocketException se = new SocketException(e.toString()); - se.initCause(e); - throw se; - } - - return impl; - } - - /** - * Binds the socket to the givent local address/port - * - * @param bindpoint The address/port to bind to - * - * @exception IOException If an error occurs - * @exception SecurityException If a security manager exists and its - * checkConnect method doesn't allow the operation - * @exception IllegalArgumentException If the address type is not supported - * - * @since 1.4 - */ - public void bind(SocketAddress bindpoint) throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - // XXX: JDK 1.4.1 API documentation says that if bindpoint is null the - // socket will be bound to an ephemeral port and a valid local address. - if (bindpoint == null) - bindpoint = new InetSocketAddress(InetAddress.ANY_IF, 0); - - if (! (bindpoint instanceof InetSocketAddress)) - throw new IllegalArgumentException(); - - InetSocketAddress tmp = (InetSocketAddress) bindpoint; - - // bind to address/port - try - { - getImpl().bind(tmp.getAddress(), tmp.getPort()); - bound = true; - } - catch (IOException exception) - { - close(); - throw exception; - } - catch (RuntimeException exception) - { - close(); - throw exception; - } - catch (Error error) - { - close(); - throw error; - } - } - - /** - * Connects the socket with a remote address. - * - * @param endpoint The address to connect to - * - * @exception IOException If an error occurs - * @exception IllegalArgumentException If the addess type is not supported - * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode - * - * @since 1.4 - */ - public void connect(SocketAddress endpoint) throws IOException - { - connect(endpoint, 0); - } - - /** - * Connects the socket with a remote address. A timeout of zero is - * interpreted as an infinite timeout. The connection will then block - * until established or an error occurs. - * - * @param endpoint The address to connect to - * @param timeout The length of the timeout in milliseconds, or - * 0 to indicate no timeout. - * - * @exception IOException If an error occurs - * @exception IllegalArgumentException If the address type is not supported - * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode - * @exception SocketTimeoutException If the timeout is reached - * - * @since 1.4 - */ - public void connect(SocketAddress endpoint, int timeout) - throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (! (endpoint instanceof InetSocketAddress)) - throw new IllegalArgumentException("unsupported address type"); - - // The Sun spec says that if we have an associated channel and - // it is in non-blocking mode, we throw an IllegalBlockingModeException. - // However, in our implementation if the channel itself initiated this - // operation, then we must honor it regardless of its blocking mode. - if (getChannel() != null && ! getChannel().isBlocking() - && ! ((PlainSocketImpl) getImpl()).isInChannelOperation()) - throw new IllegalBlockingModeException(); - - if (! isBound()) - bind(null); - - getImpl().connect(endpoint, timeout); - } - - /** - * Returns the address of the remote end of the socket. If this socket - * is not connected, then null is returned. - * - * @return The remote address this socket is connected to - */ - public InetAddress getInetAddress() - { - if (! isConnected()) - return null; - - try - { - return getImpl().getInetAddress(); - } - catch (SocketException e) - { - // This cannot happen as we are connected. - } - - return null; - } - - /** - * Returns the local address to which this socket is bound. If this socket - * is not connected, then a wildcard address, for which - * @see InetAddress#isAnyLocalAddress() is true, is returned. - * - * @return The local address - * - * @since 1.1 - */ - public InetAddress getLocalAddress() - { - if (! isBound()) - return InetAddress.ANY_IF; - - InetAddress addr = null; - - try - { - addr = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR); - } - catch (SocketException e) - { - // (hopefully) shouldn't happen - // throw new java.lang.InternalError - // ("Error in PlainSocketImpl.getOption"); - return null; - } - - // FIXME: According to libgcj, checkConnect() is supposed to be called - // before performing this operation. Problems: 1) We don't have the - // addr until after we do it, so we do a post check. 2). The docs I - // see don't require this in the Socket case, only DatagramSocket, but - // we'll assume they mean both. - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkConnect(addr.getHostName(), getLocalPort()); - - return addr; - } - - /** - * Returns the port number of the remote end of the socket connection. If - * this socket is not connected, then 0 is returned. - * - * @return The remote port this socket is connected to - */ - public int getPort() - { - if (! isConnected()) - return 0; - - try - { - return getImpl().getPort(); - } - catch (SocketException e) - { - // This cannot happen as we are connected. - } - - return 0; - } - - /** - * Returns the local port number to which this socket is bound. If this - * socket is not connected, then -1 is returned. - * - * @return The local port - */ - public int getLocalPort() - { - if (! isBound()) - return -1; - - try - { - if (getImpl() != null) - return getImpl().getLocalPort(); - } - catch (SocketException e) - { - // This cannot happen as we are bound. - } - - return -1; - } - - /** - * Returns local socket address. - * - * @return the local socket address, null if not bound - * - * @since 1.4 - */ - public SocketAddress getLocalSocketAddress() - { - if (! isBound()) - return null; - - InetAddress addr = getLocalAddress(); - - try - { - return new InetSocketAddress(addr, getImpl().getLocalPort()); - } - catch (SocketException e) - { - // This cannot happen as we are bound. - return null; - } - } - - /** - * Returns the remote socket address. - * - * @return the remote socket address, null of not connected - * - * @since 1.4 - */ - public SocketAddress getRemoteSocketAddress() - { - if (! isConnected()) - return null; - - try - { - return new InetSocketAddress(getImpl().getInetAddress(), - getImpl().getPort()); - } - catch (SocketException e) - { - // This cannot happen as we are connected. - return null; - } - } - - /** - * Returns an InputStream for reading from this socket. - * - * @return The InputStream object - * - * @exception IOException If an error occurs or Socket is not connected - */ - public InputStream getInputStream() throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (! isConnected()) - throw new IOException("not connected"); - - return getImpl().getInputStream(); - } - - /** - * Returns an OutputStream for writing to this socket. - * - * @return The OutputStream object - * - * @exception IOException If an error occurs or Socket is not connected - */ - public OutputStream getOutputStream() throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (! isConnected()) - throw new IOException("not connected"); - - return getImpl().getOutputStream(); - } - - /** - * Sets the TCP_NODELAY option on the socket. - * - * @param on true to enable, false to disable - * - * @exception SocketException If an error occurs or Socket is not connected - * - * @since 1.1 - */ - public void setTcpNoDelay(boolean on) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().setOption(SocketOptions.TCP_NODELAY, Boolean.valueOf(on)); - } - - /** - * Tests whether or not the TCP_NODELAY option is set on the socket. - * Returns true if enabled, false if disabled. When on it disables the - * Nagle algorithm which means that packets are always send immediatly and - * never merged together to reduce network trafic. - * - * @return Whether or not TCP_NODELAY is set - * - * @exception SocketException If an error occurs or Socket not connected - * - * @since 1.1 - */ - public boolean getTcpNoDelay() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object on = getImpl().getOption(SocketOptions.TCP_NODELAY); - - if (on instanceof Boolean) - return (((Boolean) on).booleanValue()); - else - throw new SocketException("Internal Error"); - } - - /** - * Sets the value of the SO_LINGER option on the socket. If the - * SO_LINGER option is set on a socket and there is still data waiting to - * be sent when the socket is closed, then the close operation will block - * until either that data is delivered or until the timeout period - * expires. The linger interval is specified in hundreths of a second - * (platform specific?) - * - * @param on true to enable SO_LINGER, false to disable - * @param linger The SO_LINGER timeout in hundreths of a second or -1 if - * SO_LINGER not set. - * - * @exception SocketException If an error occurs or Socket not connected - * @exception IllegalArgumentException If linger is negative - * - * @since 1.1 - */ - public void setSoLinger(boolean on, int linger) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (on) - { - if (linger < 0) - throw new IllegalArgumentException("SO_LINGER must be >= 0"); - - if (linger > 65535) - linger = 65535; - - getImpl().setOption(SocketOptions.SO_LINGER, new Integer(linger)); - } - else - getImpl().setOption(SocketOptions.SO_LINGER, Boolean.valueOf(false)); - } - - /** - * Returns the value of the SO_LINGER option on the socket. If the - * SO_LINGER option is set on a socket and there is still data waiting to - * be sent when the socket is closed, then the close operation will block - * until either that data is delivered or until the timeout period - * expires. This method either returns the timeouts (in hundredths of - * of a second (platform specific?)) if SO_LINGER is set, or -1 if - * SO_LINGER is not set. - * - * @return The SO_LINGER timeout in hundreths of a second or -1 - * if SO_LINGER not set - * - * @exception SocketException If an error occurs or Socket is not connected - * - * @since 1.1 - */ - public int getSoLinger() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object linger = getImpl().getOption(SocketOptions.SO_LINGER); - - if (linger instanceof Integer) - return (((Integer) linger).intValue()); - else - return -1; - } - - /** - * Sends urgent data through the socket - * - * @param data The data to send. - * Only the lowest eight bits of data are sent - * - * @exception IOException If an error occurs - * - * @since 1.4 - */ - public void sendUrgentData(int data) throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().sendUrgentData(data); - } - - /** - * Enables/disables the SO_OOBINLINE option - * - * @param on True if SO_OOBLINE should be enabled - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public void setOOBInline(boolean on) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().setOption(SocketOptions.SO_OOBINLINE, Boolean.valueOf(on)); - } - - /** - * Returns the current setting of the SO_OOBINLINE option for this socket - * - * @return True if SO_OOBINLINE is set, false otherwise. - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public boolean getOOBInline() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_OOBINLINE); - - if (buf instanceof Boolean) - return (((Boolean) buf).booleanValue()); - else - throw new SocketException("Internal Error: Unexpected type"); - } - - /** - * Sets the value of the SO_TIMEOUT option on the socket. If this value - * is set, and an read/write is performed that does not complete within - * the timeout period, a short count is returned (or an EWOULDBLOCK signal - * would be sent in Unix if no data had been read). A value of 0 for - * this option implies that there is no timeout (ie, operations will - * block forever). On systems that have separate read and write timeout - * values, this method returns the read timeout. This - * value is in milliseconds. - * - * @param timeout The length of the timeout in milliseconds, or - * 0 to indicate no timeout. - * - * @exception SocketException If an error occurs or Socket not connected - * - * @since 1.1 - */ - public synchronized void setSoTimeout(int timeout) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (timeout < 0) - throw new IllegalArgumentException("SO_TIMEOUT value must be >= 0"); - - getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout)); - } - - /** - * Returns the value of the SO_TIMEOUT option on the socket. If this value - * is set, and an read/write is performed that does not complete within - * the timeout period, a short count is returned (or an EWOULDBLOCK signal - * would be sent in Unix if no data had been read). A value of 0 for - * this option implies that there is no timeout (ie, operations will - * block forever). On systems that have separate read and write timeout - * values, this method returns the read timeout. This - * value is in thousandths of a second (implementation specific?). - * - * @return The length of the timeout in thousandth's of a second or 0 - * if not set - * - * @exception SocketException If an error occurs or Socket not connected - * - * @since 1.1 - */ - public synchronized int getSoTimeout() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object timeout = getImpl().getOption(SocketOptions.SO_TIMEOUT); - if (timeout instanceof Integer) - return (((Integer) timeout).intValue()); - else - return 0; - } - - /** - * This method sets the value for the system level socket option - * SO_SNDBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new send buffer size. - * - * @exception SocketException If an error occurs or Socket not connected - * @exception IllegalArgumentException If size is 0 or negative - * - * @since 1.2 - */ - public void setSendBufferSize(int size) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (size <= 0) - throw new IllegalArgumentException("SO_SNDBUF value must be > 0"); - - getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size)); - } - - /** - * This method returns the value of the system level socket option - * SO_SNDBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The send buffer size. - * - * @exception SocketException If an error occurs or socket not connected - * - * @since 1.2 - */ - public int getSendBufferSize() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_SNDBUF); - - if (buf instanceof Integer) - return (((Integer) buf).intValue()); - else - throw new SocketException("Internal Error: Unexpected type"); - } - - /** - * This method sets the value for the system level socket option - * SO_RCVBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new receive buffer size. - * - * @exception SocketException If an error occurs or Socket is not connected - * @exception IllegalArgumentException If size is 0 or negative - * - * @since 1.2 - */ - public void setReceiveBufferSize(int size) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (size <= 0) - throw new IllegalArgumentException("SO_RCVBUF value must be > 0"); - - getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size)); - } - - /** - * This method returns the value of the system level socket option - * SO_RCVBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The receive buffer size. - * - * @exception SocketException If an error occurs or Socket is not connected - * - * @since 1.2 - */ - public int getReceiveBufferSize() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_RCVBUF); - - if (buf instanceof Integer) - return (((Integer) buf).intValue()); - else - throw new SocketException("Internal Error: Unexpected type"); - } - - /** - * This method sets the value for the socket level socket option - * SO_KEEPALIVE. - * - * @param on True if SO_KEEPALIVE should be enabled - * - * @exception SocketException If an error occurs or Socket is not connected - * - * @since 1.3 - */ - public void setKeepAlive(boolean on) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().setOption(SocketOptions.SO_KEEPALIVE, Boolean.valueOf(on)); - } - - /** - * This method returns the value of the socket level socket option - * SO_KEEPALIVE. - * - * @return The setting - * - * @exception SocketException If an error occurs or Socket is not connected - * - * @since 1.3 - */ - public boolean getKeepAlive() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object buf = getImpl().getOption(SocketOptions.SO_KEEPALIVE); - - if (buf instanceof Boolean) - return (((Boolean) buf).booleanValue()); - else - throw new SocketException("Internal Error: Unexpected type"); - } - - /** - * Closes the socket. - * - * @exception IOException If an error occurs - */ - public synchronized void close() throws IOException - { - if (isClosed()) - return; - - getImpl().close(); - impl = null; - bound = false; - - if (getChannel() != null) - getChannel().close(); - } - - /** - * Converts this Socket to a String. - * - * @return The String representation of this Socket - */ - public String toString() - { - try - { - if (isConnected()) - return ("Socket[addr=" + getImpl().getInetAddress() + ",port=" - + getImpl().getPort() + ",localport=" - + getImpl().getLocalPort() + "]"); - } - catch (SocketException e) - { - // This cannot happen as we are connected. - } - - return "Socket[unconnected]"; - } - - /** - * Sets the SocketImplFactory. This may be done only once per - * virtual machine. Subsequent attempts will generate a - * SocketException. Note that a SecurityManager - * check is made prior to setting the factory. If - * insufficient privileges exist to set the factory, then an - * IOException will be thrown. - * - * @param fac the factory to set - * - * @exception SecurityException If the SecurityManager does - * not allow this operation. - * @exception SocketException If the SocketImplFactory is already defined - * @exception IOException If any other error occurs - */ - public static synchronized void setSocketImplFactory(SocketImplFactory fac) - throws IOException - { - // See if already set - if (factory != null) - throw new SocketException("SocketImplFactory already defined"); - - // Check permissions - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkSetFactory(); - - if (fac == null) - throw new SocketException("SocketImplFactory cannot be null"); - - factory = fac; - } - - /** - * Closes the input side of the socket stream. - * - * @exception IOException If an error occurs. - * - * @since 1.3 - */ - public void shutdownInput() throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().shutdownInput(); - inputShutdown = true; - } - - /** - * Closes the output side of the socket stream. - * - * @exception IOException If an error occurs. - * - * @since 1.3 - */ - public void shutdownOutput() throws IOException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().shutdownOutput(); - outputShutdown = true; - } - - /** - * Returns the socket channel associated with this socket. - * - * @return the associated socket channel, - * null if no associated channel exists - * - * @since 1.4 - */ - public SocketChannel getChannel() - { - return null; - } - - /** - * Checks if the SO_REUSEADDR option is enabled - * - * @return True if SO_REUSEADDR is set, false otherwise. - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public boolean getReuseAddress() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object reuseaddr = getImpl().getOption(SocketOptions.SO_REUSEADDR); - - if (! (reuseaddr instanceof Boolean)) - throw new SocketException("Internal Error"); - - return ((Boolean) reuseaddr).booleanValue(); - } - - /** - * Enables/Disables the SO_REUSEADDR option - * - * @param reuseAddress true if SO_REUSEADDR should be enabled, - * false otherwise - * - * @exception SocketException If an error occurs - * - * @since 1.4 - */ - public void setReuseAddress(boolean reuseAddress) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - getImpl().setOption(SocketOptions.SO_REUSEADDR, - Boolean.valueOf(reuseAddress)); - } - - /** - * Returns the current traffic class - * - * @return The current traffic class. - * - * @exception SocketException If an error occurs - * - * @see Socket#setTrafficClass(int tc) - * - * @since 1.4 - */ - public int getTrafficClass() throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - Object obj = getImpl().getOption(SocketOptions.IP_TOS); - - if (obj instanceof Integer) - return ((Integer) obj).intValue(); - else - throw new SocketException("Unexpected type"); - } - - /** - * Sets the traffic class value - * - * @param tc The traffic class - * - * @exception SocketException If an error occurs - * @exception IllegalArgumentException If tc value is illegal - * - * @see Socket#getTrafficClass() - * - * @since 1.4 - */ - public void setTrafficClass(int tc) throws SocketException - { - if (isClosed()) - throw new SocketException("socket is closed"); - - if (tc < 0 || tc > 255) - throw new IllegalArgumentException(); - - getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc)); - } - - /** - * Checks if the socket is connected - * - * @return True if socket is connected, false otherwise. - * - * @since 1.4 - */ - public boolean isConnected() - { - try - { - if (getImpl() == null) - return false; - - return getImpl().getInetAddress() != null; - } - catch (SocketException e) - { - return false; - } - } - - /** - * Checks if the socket is already bound. - * - * @return True if socket is bound, false otherwise. - * - * @since 1.4 - */ - public boolean isBound() - { - return bound; - } - - /** - * Checks if the socket is closed. - * - * @return True if socket is closed, false otherwise. - * - * @since 1.4 - */ - public boolean isClosed() - { - return impl == null; - } - - /** - * Checks if the socket's input stream is shutdown - * - * @return True if input is shut down. - * - * @since 1.4 - */ - public boolean isInputShutdown() - { - return inputShutdown; - } - - /** - * Checks if the socket's output stream is shutdown - * - * @return True if output is shut down. - * - * @since 1.4 - */ - public boolean isOutputShutdown() - { - return outputShutdown; - } -} diff --git a/libjava/sources.am b/libjava/sources.am index e1b2b3776b6..0c9953f33b9 100644 --- a/libjava/sources.am +++ b/libjava/sources.am @@ -4905,7 +4905,7 @@ classpath/java/net/ConnectException.java \ classpath/java/net/ContentHandler.java \ classpath/java/net/ContentHandlerFactory.java \ classpath/java/net/DatagramPacket.java \ -java/net/DatagramSocket.java \ +classpath/java/net/DatagramSocket.java \ classpath/java/net/DatagramSocketImpl.java \ classpath/java/net/DatagramSocketImplFactory.java \ classpath/java/net/FileNameMap.java \ @@ -4928,7 +4928,7 @@ classpath/java/net/Proxy.java \ classpath/java/net/ProxySelector.java \ classpath/java/net/ResolverCache.java \ classpath/java/net/ServerSocket.java \ -java/net/Socket.java \ +classpath/java/net/Socket.java \ classpath/java/net/SocketAddress.java \ classpath/java/net/SocketException.java \ classpath/java/net/SocketImpl.java \