summaryrefslogtreecommitdiff
path: root/libjava/classpath/gnu
diff options
context:
space:
mode:
authordoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-28 13:29:13 +0000
committerdoko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-28 13:29:13 +0000
commit1020ce5944edde4364baef4d371cd4f9b0dae721 (patch)
tree602cd7aa7c947386134690d8e0f6b53abcdeacb9 /libjava/classpath/gnu
parent9f41ce98ce6f4f7c8ac5e2c4b6e5d27e10201015 (diff)
downloadgcc-1020ce5944edde4364baef4d371cd4f9b0dae721.tar.gz
libjava/
2008-06-28 Matthias Klose <doko@ubuntu.com> Import GNU Classpath (classpath-0_97_2-release). * Regenerate class and header files. * Regenerate auto* files. * gcj/javaprims.h: Define jobjectRefType. * jni.cc (_Jv_JNI_GetObjectRefType): New (stub only). (_Jv_JNIFunctions): Initialize GetObjectRefType. * gnu/classpath/jdwp/VMVirtualMachine.java, java/security/VMSecureRandom.java: Merge from classpath. * HACKING: Fix typo. * ChangeLog-2007: New file. * configure.ac: Set JAVAC, pass --disable-regen-headers to classpath. libjava/classpath/ 2008-06-28 Matthias Klose <doko@ubuntu.com> * m4/ac_prog_javac.m4: Disable check for JAVAC, when not configured with --enable-java-maintainer-mode. * aclocal.m4, configure: Regenerate. * native/jni/gstreamer-peer/Makefile.am: Do not link with libclasspathnative. * native/jni/gstreamer-peer/Makefile.in: Regenerate. * tools/Makefile.am, lib/Makefile.am: Use JAVAC for setting JCOMPILER, drop flags not understood by gcj. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu')
-rw-r--r--libjava/classpath/gnu/CORBA/BigDecimalHelper.java4
-rw-r--r--libjava/classpath/gnu/CORBA/ByteArrayComparator.java1
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java10
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java4
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java8
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java1
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/Vio.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java2
-rw-r--r--libjava/classpath/gnu/CORBA/CollocatedOrbs.java4
-rw-r--r--libjava/classpath/gnu/CORBA/Connected_objects.java4
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java2
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java1
-rw-r--r--libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java2
-rw-r--r--libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java2
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java6
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java2
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java4
-rw-r--r--libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java6
-rw-r--r--libjava/classpath/gnu/CORBA/IOR.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java1
-rw-r--r--libjava/classpath/gnu/CORBA/Interceptor/Registrator.java2
-rw-r--r--libjava/classpath/gnu/CORBA/IorDelegate.java6
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameParser.java1
-rw-r--r--libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java2
-rw-r--r--libjava/classpath/gnu/CORBA/ObjectCreator.java2
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFocused.java2
-rw-r--r--libjava/classpath/gnu/CORBA/OrbFunctional.java4
-rw-r--r--libjava/classpath/gnu/CORBA/OrbRestricted.java1
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/AOM.java2
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOA.java6
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java7
-rw-r--r--libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java2
-rw-r--r--libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java1
-rw-r--r--libjava/classpath/gnu/CORBA/gnuContextList.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuExceptionList.java2
-rw-r--r--libjava/classpath/gnu/CORBA/gnuRequest.java2
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java2
-rw-r--r--libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java2
-rw-r--r--libjava/classpath/gnu/classpath/ServiceFactory.java46
-rw-r--r--libjava/classpath/gnu/classpath/ServiceProviderLoadingAction.java16
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java4
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java1
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java1
-rw-r--r--libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java1
-rw-r--r--libjava/classpath/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java59
-rw-r--r--libjava/classpath/gnu/java/awt/AWTUtilities.java2
-rw-r--r--libjava/classpath/gnu/java/awt/ClasspathToolkit.java1
-rw-r--r--libjava/classpath/gnu/java/awt/EmbeddedWindow.java1
-rw-r--r--libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java40
-rw-r--r--libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java (renamed from libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java)169
-rw-r--r--libjava/classpath/gnu/java/awt/image/AsyncImage.java300
-rw-r--r--libjava/classpath/gnu/java/awt/image/ImageConverter.java528
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java165
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java132
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java29
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java2
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/ShapeWrapper.java119
-rw-r--r--libjava/classpath/gnu/java/awt/java2d/TextCacheKey.java153
-rw-r--r--libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java2
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java20
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java4
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java6
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java4
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkMainThread.java4
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java7
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java4
-rw-r--r--libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java2
-rwxr-xr-xlibjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java5
-rw-r--r--libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java2
-rw-r--r--libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java1
-rw-r--r--libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java3
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java113
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XEventPump.java17
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java768
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java4
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java234
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java38
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java9
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XToolkit.java69
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java114
-rw-r--r--libjava/classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java5
-rw-r--r--libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java1
-rw-r--r--libjava/classpath/gnu/java/awt/print/SpooledDocument.java1
-rw-r--r--libjava/classpath/gnu/java/io/PlatformHelper.java2
-rw-r--r--libjava/classpath/gnu/java/lang/MainThread.java2
-rw-r--r--libjava/classpath/gnu/java/lang/management/BeanImpl.java93
-rw-r--r--libjava/classpath/gnu/java/lang/reflect/TypeSignature.java4
-rw-r--r--libjava/classpath/gnu/java/locale/LocaleHelper.java2
-rw-r--r--libjava/classpath/gnu/java/net/protocol/http/Request.java1
-rw-r--r--libjava/classpath/gnu/java/nio/DatagramChannelImpl.java2
-rw-r--r--libjava/classpath/gnu/java/nio/FileChannelImpl.java2
-rw-r--r--libjava/classpath/gnu/java/nio/KqueueSelectionKeyImpl.java2
-rw-r--r--libjava/classpath/gnu/java/nio/NIOSocket.java1
-rw-r--r--libjava/classpath/gnu/java/nio/ServerSocketChannelImpl.java1
-rw-r--r--libjava/classpath/gnu/java/nio/SocketChannelImpl.java12
-rw-r--r--libjava/classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java2
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ByteCharset.java167
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ByteDecodeLoopHelper.java162
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ByteEncodeLoopHelper.java163
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp424.java73
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp437.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp737.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp775.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp850.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp852.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp855.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp857.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp860.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp861.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp862.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp863.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp864.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp865.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp866.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp869.java7
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Cp874.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/EncodingHelper.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_1.java63
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_13.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_15.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_2.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_3.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_4.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_5.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_6.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_7.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_8.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/ISO_8859_9.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/KOI_8.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MS874.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacCentralEurope.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacCroatian.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacCyrillic.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacDingbat.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacGreek.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacIceland.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacRoman.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacRomania.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacSymbol.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacThai.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/MacTurkish.java6
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Provider.java18
-rw-r--r--libjava/classpath/gnu/java/nio/charset/US_ASCII.java68
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1250.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1251.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1252.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1253.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1254.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1255.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1256.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1257.java5
-rw-r--r--libjava/classpath/gnu/java/nio/charset/Windows1258.java5
-rw-r--r--libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java4
-rw-r--r--libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java6
-rw-r--r--libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java1
-rw-r--r--libjava/classpath/gnu/java/security/Engine.java2
-rw-r--r--libjava/classpath/gnu/java/security/key/dss/FIPS186.java2
-rw-r--r--libjava/classpath/gnu/java/text/AttributedFormatBuffer.java2
-rw-r--r--libjava/classpath/gnu/java/util/LRUCache.java77
-rw-r--r--libjava/classpath/gnu/java/util/regex/RE.java1
-rw-r--r--libjava/classpath/gnu/java/util/regex/REException.java6
-rw-r--r--libjava/classpath/gnu/java/util/regex/REToken.java2
-rw-r--r--libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java50
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/DiffieHellmanImpl.java3
-rw-r--r--libjava/classpath/gnu/javax/crypto/key/dh/RFC2631.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/bmp/EncodeRGB32.java1
-rw-r--r--libjava/classpath/gnu/javax/imageio/gif/GIFFile.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/jpeg/JPEGComponent.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/jpeg/JPEGDecoder.java13
-rw-r--r--libjava/classpath/gnu/javax/imageio/jpeg/JPEGException.java7
-rw-r--r--libjava/classpath/gnu/javax/imageio/jpeg/JPEGFrame.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/jpeg/JPEGImageInputStream.java7
-rw-r--r--libjava/classpath/gnu/javax/imageio/png/PNGChunk.java1
-rw-r--r--libjava/classpath/gnu/javax/imageio/png/PNGDecoder.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/png/PNGEncoder.java2
-rw-r--r--libjava/classpath/gnu/javax/imageio/png/PNGFile.java1
-rw-r--r--libjava/classpath/gnu/javax/imageio/png/PNGGamma.java4
-rw-r--r--libjava/classpath/gnu/javax/management/Server.java21
-rw-r--r--libjava/classpath/gnu/javax/management/Translator.java78
-rw-r--r--libjava/classpath/gnu/javax/naming/giop/ContextContinuation.java18
-rw-r--r--libjava/classpath/gnu/javax/naming/jndi/url/rmi/ContextContinuation.java8
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/SSLRecordHandler.java1
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/StaticTrustAnchors.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/CertificateRequestBuilder.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ClientHandshake.java3
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ClientPSKParameters.java4
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ClientRSA_PSKParameters.java4
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ContentType.java4
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/EncryptedPreMasterSecret.java3
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/Handshake.java15
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/InputSecurityParameters.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/OutputSecurityParameters.java3
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ProtocolVersion.java1
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/Random.java4
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/SRPTrustManagerFactory.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ServerDHE_PSKParameters.java3
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/ServerHandshake.java6
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/SessionImpl.java6
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/Signature.java15
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/SimpleSessionContext.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/TLSHMac.java1
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/TrustedAuthorities.java1
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/UnresolvedExtensionValue.java2
-rw-r--r--libjava/classpath/gnu/javax/net/ssl/provider/X509KeyManagerFactory.java4
-rw-r--r--libjava/classpath/gnu/javax/print/PrinterDialog.java8
-rw-r--r--libjava/classpath/gnu/javax/security/auth/Password.java4
-rw-r--r--libjava/classpath/gnu/javax/sound/AudioSecurityManager.java71
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java2
-rw-r--r--libjava/classpath/gnu/javax/sound/midi/file/MidiFileWriter.java2
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/AU/AUReader.java1
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java30
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java56
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java56
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstInputStream.java119
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java42
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java31
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java366
-rw-r--r--libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java65
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/css/FontSize.java6
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/css/Selector.java2
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/models/node.java2
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java30
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java5
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java2
-rw-r--r--libjava/classpath/gnu/javax/swing/text/html/parser/support/textPreProcessor.java2
-rw-r--r--libjava/classpath/gnu/xml/aelfred2/XmlParser.java13
-rw-r--r--libjava/classpath/gnu/xml/dom/html2/DomHTMLButtonElement.java1
-rw-r--r--libjava/classpath/gnu/xml/dom/html2/DomHTMLCollection.java1
-rw-r--r--libjava/classpath/gnu/xml/dom/html2/DomHTMLParser.java2
-rw-r--r--libjava/classpath/gnu/xml/libxmlj/dom/GnomeXPathResult.java2
-rw-r--r--libjava/classpath/gnu/xml/pipeline/DomConsumer.java2
-rw-r--r--libjava/classpath/gnu/xml/pipeline/EventFilter.java4
-rw-r--r--libjava/classpath/gnu/xml/stream/AttributeImpl.java6
-rw-r--r--libjava/classpath/gnu/xml/stream/EndDocumentImpl.java1
-rw-r--r--libjava/classpath/gnu/xml/stream/SAXParser.java3
-rw-r--r--libjava/classpath/gnu/xml/stream/XIncludeFilter.java3
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java2
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLEventFactoryImpl.java6
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLEventImpl.java1
-rw-r--r--libjava/classpath/gnu/xml/stream/XMLParser.java19
-rw-r--r--libjava/classpath/gnu/xml/transform/StreamSerializer.java1
-rw-r--r--libjava/classpath/gnu/xml/transform/Stylesheet.java1
-rw-r--r--libjava/classpath/gnu/xml/util/Resolver.java2
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/Base64BinaryType.java2
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/BooleanType.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/DecimalType.java2
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/DoubleType.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/FloatType.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/HexBinaryType.java2
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/NotationType.java2
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/SimpleType.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/StringType.java4
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/Type.java2
-rw-r--r--libjava/classpath/gnu/xml/validation/datatype/TypeBuilder.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/relaxng/FullSyntaxBuilder.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java1
-rw-r--r--libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java4
-rw-r--r--libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java1
-rw-r--r--libjava/classpath/gnu/xml/xpath/XPathParser.java1
266 files changed, 4553 insertions, 1346 deletions
diff --git a/libjava/classpath/gnu/CORBA/BigDecimalHelper.java b/libjava/classpath/gnu/CORBA/BigDecimalHelper.java
index f1e1dd6b42c..119db045f0f 100644
--- a/libjava/classpath/gnu/CORBA/BigDecimalHelper.java
+++ b/libjava/classpath/gnu/CORBA/BigDecimalHelper.java
@@ -45,7 +45,6 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.math.BigInteger;
-import org.omg.CORBA.TypeCode;
import org.omg.CORBA.TypeCodePackage.BadKind;
/**
@@ -128,9 +127,6 @@ public class BigDecimalHelper
*
* @param out a stream to write into.
* @param x a big decimal to write.
- * @param digits a number of the decimal digits in the record
- * being written. For the smaller
- * numbers, zeroes are added to the left.
*
* @throws IOException if the stream write method throws one.
* @throws BadKind if this BigDecimal has more digits than
diff --git a/libjava/classpath/gnu/CORBA/ByteArrayComparator.java b/libjava/classpath/gnu/CORBA/ByteArrayComparator.java
index 8491154638d..e601399dffb 100644
--- a/libjava/classpath/gnu/CORBA/ByteArrayComparator.java
+++ b/libjava/classpath/gnu/CORBA/ByteArrayComparator.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.CORBA;
-import java.util.Arrays;
import java.util.Comparator;
/**
diff --git a/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
index 866ec2cc945..f582c31bd18 100644
--- a/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrInput.java
@@ -195,9 +195,9 @@ public abstract class AbstractCdrInput
* Set the Big Endian or Little Endian encoding. The stream reads Big Endian
* by default.
*
- * @param use_little_endian if true, the stream expect the multi-byte data in
- * the form "less significant byte first" (Little Endian). This is the
- * opposite to the java standard (Big Endian).
+ * @param use_big_endian if true, the stream expect the multi-byte data in
+ * the form "most significant byte first" (Big Endian). This is the
+ * java standard.
*/
public void setBigEndian(boolean use_big_endian)
{
@@ -208,7 +208,7 @@ public abstract class AbstractCdrInput
/**
* Get the used encoding.
*
- * @param true for Big Endian, false for Little Endian.
+ * @return true for Big Endian, false for Little Endian.
*/
public boolean isBigEndian()
{
@@ -654,7 +654,7 @@ public abstract class AbstractCdrInput
byte[] r = new byte[l];
int n = 0;
- reading: while (n < r.length)
+ while (n < r.length)
{
n += read(r, n, r.length - n);
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
index 7b4d5ec58ff..7f3e3ab0daf 100644
--- a/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/AbstractCdrOutput.java
@@ -291,7 +291,7 @@ public abstract class AbstractCdrOutput
/**
* Write a single byte.
- * @param a byte to write (low 8 bits are written).
+ * @param n byte to write (low 8 bits are written).
*/
public void write(int n)
{
@@ -497,7 +497,7 @@ public abstract class AbstractCdrOutput
* Writes the lower bytes of the passed array members.
*
* @param chars an array
- * @param offsets offset
+ * @param offset offset
* @param length length
*/
public void write_char_array(char[] chars, int offset, int length)
diff --git a/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java b/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
index 0c18dafb195..273ecea5024 100644
--- a/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
+++ b/libjava/classpath/gnu/CORBA/CDR/HeadlessInput.java
@@ -104,7 +104,7 @@ public class HeadlessInput
/**
* Create an instance, reading from the given buffer.
*
- * @param a_stram a stream from where the data will be read.
+ * @param a_stream a stream from where the data will be read.
* @param inheritSettings a stream from that endian and other settings are
* inherited.
*/
@@ -151,7 +151,7 @@ public class HeadlessInput
else
{
subsequentCalls = true;
- Serializable value = (Serializable) Vio.readValue(this, NONE, null,
+ Serializable value = Vio.readValue(this, NONE, null,
null, repository_id, null, null);
return value;
}
@@ -167,7 +167,7 @@ public class HeadlessInput
else
{
subsequentCalls = true;
- value = (Serializable) Vio.readValue(this, NONE, value, null, null,
+ value = Vio.readValue(this, NONE, value, null, null,
null, null);
return value;
}
@@ -186,7 +186,7 @@ public class HeadlessInput
{
subsequentCalls = true;
Serializable value = (Serializable) Vio.instantiateAnyWay(clz);
- value = (Serializable) Vio.readValue(this, NONE, value, null, null,
+ value = Vio.readValue(this, NONE, value, null, null,
null, null);
return value;
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java b/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
index 02cfa08ae8e..a439b658b44 100644
--- a/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
+++ b/libjava/classpath/gnu/CORBA/CDR/LittleEndianInputStream.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.CORBA.CDR;
-import java.io.DataInput;
import java.io.EOFException;
import java.io.FilterInputStream;
import java.io.IOException;
diff --git a/libjava/classpath/gnu/CORBA/CDR/Vio.java b/libjava/classpath/gnu/CORBA/CDR/Vio.java
index 28f1c5672f6..67a69b87458 100644
--- a/libjava/classpath/gnu/CORBA/CDR/Vio.java
+++ b/libjava/classpath/gnu/CORBA/CDR/Vio.java
@@ -637,7 +637,7 @@ public abstract class Vio
r = new byte[chunk_size + 256];
n = 0;
- reading: while (n < chunk_size)
+ while (n < chunk_size)
n += input.read(r, n, chunk_size - n);
output.write(r, 0, n);
}
diff --git a/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java b/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
index 774c92816ae..929dc72ec8a 100644
--- a/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
+++ b/libjava/classpath/gnu/CORBA/CDR/gnuRuntime.java
@@ -167,7 +167,7 @@ public class gnuRuntime
* @param a_id a repository Id, if only one Id was specified in the stream.
* @param a_ids a repository Ids, if the multiple Ids were specified in te
* stream.
- * @param a_codabase a codebase, if it was specified in the stream.
+ * @param a_codebase a codebase, if it was specified in the stream.
*/
public gnuRuntime(String a_codebase, Object a_target)
{
diff --git a/libjava/classpath/gnu/CORBA/CollocatedOrbs.java b/libjava/classpath/gnu/CORBA/CollocatedOrbs.java
index fc1e513efec..51ad836231c 100644
--- a/libjava/classpath/gnu/CORBA/CollocatedOrbs.java
+++ b/libjava/classpath/gnu/CORBA/CollocatedOrbs.java
@@ -44,10 +44,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
-import org.omg.CORBA.LocalObject;
-import org.omg.CORBA.portable.Delegate;
-import org.omg.CORBA.portable.ObjectImpl;
-
/**
* This class provides support for the direct method invocations without
* involving the network in the case when both ORBs run on the same java
diff --git a/libjava/classpath/gnu/CORBA/Connected_objects.java b/libjava/classpath/gnu/CORBA/Connected_objects.java
index 53ef2dd17d9..655dbe38844 100644
--- a/libjava/classpath/gnu/CORBA/Connected_objects.java
+++ b/libjava/classpath/gnu/CORBA/Connected_objects.java
@@ -109,7 +109,7 @@ public class Connected_objects
/**
* Get the record of the stored object.
*
- * @param object the stored object
+ * @param stored_object the stored object
*
* @return the record about the stored object, null if
* this object is not stored here.
@@ -141,7 +141,7 @@ public class Connected_objects
* generated automatically.
*
* @param object the object to add.
- * @param port, on that the ORB will be listening to the remote
+ * @param port on that the ORB will be listening to the remote
* invocations.
*
* @return the newly created object record.
diff --git a/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java b/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
index c96cbedc73b..63fe117f4de 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/DivideableAny.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.CORBA.DynAn;
-import gnu.CORBA.TypeKindNamer;
-
import org.omg.CORBA.Any;
import org.omg.CORBA.CompletionStatus;
import org.omg.CORBA.ORB;
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
index 825cd0a5638..dc056adff9b 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynArray.java
@@ -46,7 +46,6 @@ import org.omg.CORBA.BAD_PARAM;
import org.omg.CORBA.ORB;
import org.omg.CORBA.TCKind;
import org.omg.CORBA.TypeCode;
-import org.omg.CORBA.TypeCodePackage.BadKind;
import org.omg.CORBA.portable.Streamable;
import org.omg.DynamicAny.DynAny;
import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
diff --git a/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java b/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
index ef5aed64512..3cd8efe18f4 100644
--- a/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
+++ b/libjava/classpath/gnu/CORBA/DynAn/gnuDynUnion.java
@@ -271,7 +271,6 @@ public class gnuDynUnion
// Get the discriminator variant.
- Variants:
for (int i = 0; i < final_type.member_count(); i++)
{
if (final_type.member_label(i).equal(da))
@@ -392,7 +391,6 @@ public class gnuDynUnion
// Get the discriminator variant.
- Variants:
for (int i = 0; i < final_type.member_count(); i++)
{
if (final_type.member_label(i).equal(da))
diff --git a/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java b/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
index 8fc8697a4f3..6f84da8e5ea 100644
--- a/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
+++ b/libjava/classpath/gnu/CORBA/EmptyExceptionHolder.java
@@ -39,10 +39,8 @@ exception statement from your version. */
package gnu.CORBA;
import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.NO_IMPLEMENT;
import org.omg.CORBA.TypeCode;
import org.omg.CORBA.UNKNOWN;
-import org.omg.CORBA.UnknownUserException;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.Streamable;
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java b/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java
index 9f4de0d87d9..40f373721c7 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CancelHeader.java
@@ -55,16 +55,16 @@ public abstract class CancelHeader
public int request_id;
/**
- * Write the header.
+ * Read the header.
*
- * @param out a stream to write to.
+ * @param input a stream to read from.
*/
public abstract void read(InputStream input);
/**
* Write the header.
*
- * @param out a stream to write to.
+ * @param output a stream to write to.
*/
public abstract void write(OutputStream output);
}
diff --git a/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
index ab565db3797..81412e0298e 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/CodeSetServiceContext.java
@@ -41,8 +41,6 @@ package gnu.CORBA.GIOP;
import gnu.CORBA.CDR.AbstractCdrInput;
import gnu.CORBA.CDR.AbstractCdrOutput;
import gnu.CORBA.IOR;
-import gnu.CORBA.IOR.CodeSets_profile;
-
import java.io.IOException;
/**
diff --git a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
index 0252838581d..cac2405fc77 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/MessageHeader.java
@@ -398,7 +398,7 @@ public class MessageHeader
if (service != null)
service.setSoTimeout(to_read);
- reading: while (n < r.length)
+ while (n < r.length)
{
n += source.read(r, n, r.length - n);
}
@@ -426,7 +426,7 @@ public class MessageHeader
int dn;
n = 0;
- reading: while (n < h2.message_size)
+ while (n < h2.message_size)
{
dn = source.read(r, 0, h2.message_size - n);
diff --git a/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java b/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java
index 6e3650c4ba9..1158492235c 100644
--- a/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java
+++ b/libjava/classpath/gnu/CORBA/GIOP/v1_0/CancelHeader.java
@@ -51,9 +51,9 @@ public class CancelHeader
extends gnu.CORBA.GIOP.CancelHeader
{
/**
- * Write the header.
+ * Read the header.
*
- * @param out a stream to write to.
+ * @param input a stream to read from.
*/
public void read(InputStream input)
{
@@ -63,7 +63,7 @@ public class CancelHeader
/**
* Write the header.
*
- * @param out a stream to write to.
+ * @param output a stream to write to.
*/
public void write(OutputStream output)
{
diff --git a/libjava/classpath/gnu/CORBA/IOR.java b/libjava/classpath/gnu/CORBA/IOR.java
index 917e1983289..5e13aecabd3 100644
--- a/libjava/classpath/gnu/CORBA/IOR.java
+++ b/libjava/classpath/gnu/CORBA/IOR.java
@@ -385,7 +385,7 @@ public class IOR
/**
* Parse the provided stringifed reference.
*
- * @param stringified_reference, in the form of IOR:nnnnnn.....
+ * @param stringified_reference in the form of IOR:nnnnnn.....
*
* @return the parsed IOR
*
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java b/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
index 2b77de58e0e..d8dcabf120f 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/IORInterceptors.java
@@ -42,7 +42,6 @@ import org.omg.CORBA.OBJ_ADAPTER;
import org.omg.CORBA.OMGVMCID;
import org.omg.PortableInterceptor.IORInfo;
import org.omg.PortableInterceptor.IORInterceptor;
-import org.omg.PortableInterceptor.IORInterceptorOperations;
import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
import org.omg.PortableInterceptor.ObjectReferenceTemplate;
diff --git a/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java b/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
index 4bb895bb376..e0ce16a1496 100644
--- a/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
+++ b/libjava/classpath/gnu/CORBA/Interceptor/Registrator.java
@@ -142,7 +142,7 @@ public class Registrator extends LocalObject implements ORBInitInfo
* Create the interceptor collection from the given properties, using the
* agreed naming convention.
*
- * @param orb the ORB being initialised.
+ * @param an_orb the ORB being initialised.
* @param props the cumulated set of properties where the orb initializer
* pattern is searched.
* @param an_args the argument string array, passed to ORB.init.
diff --git a/libjava/classpath/gnu/CORBA/IorDelegate.java b/libjava/classpath/gnu/CORBA/IorDelegate.java
index 8eb43aa7d69..a2c5a0469be 100644
--- a/libjava/classpath/gnu/CORBA/IorDelegate.java
+++ b/libjava/classpath/gnu/CORBA/IorDelegate.java
@@ -58,8 +58,6 @@ import org.omg.PortableInterceptor.ForwardRequest;
import java.io.IOException;
-import java.net.Socket;
-
/**
* The Classpath implementation of the {@link Delegate} functionality in the
* case, when the object was constructed from an IOR object. The IOR can be
@@ -87,8 +85,6 @@ public class IorDelegate extends SimpleDelegate
* @param operation the method name
* @param parameters the method parameters
* @param returns the return value holder
- * @param exceptions the exceptions that can be thrown by the method
- * @param ctx_list the context list (null allowed)
*
* @return the created request.
*/
@@ -175,7 +171,7 @@ public class IorDelegate extends SimpleDelegate
throws ApplicationException, RemarshalException
{
StreamBasedRequest request = (StreamBasedRequest) output;
- Forwardings: while (true)
+ while (true)
{
try
{
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
index aa922b96a54..205ad8bec84 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameParser.java
@@ -62,7 +62,6 @@ import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
-import java.util.ArrayList;
import java.util.StringTokenizer;
/**
diff --git a/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
index d717b9d4011..7109fdb93e1 100644
--- a/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
+++ b/libjava/classpath/gnu/CORBA/NamingService/NameTransformer.java
@@ -63,7 +63,7 @@ public class NameTransformer
* representation. See {@link #toString(NameComponent)} for the
* description of this format.
*
- * @param name the string form of the name.
+ * @param a_name the string form of the name.
*
* @return the array form of the name.
*
diff --git a/libjava/classpath/gnu/CORBA/ObjectCreator.java b/libjava/classpath/gnu/CORBA/ObjectCreator.java
index 5937e76b31e..939d6923326 100644
--- a/libjava/classpath/gnu/CORBA/ObjectCreator.java
+++ b/libjava/classpath/gnu/CORBA/ObjectCreator.java
@@ -111,7 +111,7 @@ public class ObjectCreator
* mapped to the local java class. The omg.org domain must be mapped into the
* object in either org/omg or gnu/CORBA namespace.
*
- * @param IDL name
+ * @param idl name
* @return instantiated object instance or null if no such available.
*/
public static java.lang.Object createObject(String idl, String suffix)
diff --git a/libjava/classpath/gnu/CORBA/OrbFocused.java b/libjava/classpath/gnu/CORBA/OrbFocused.java
index a0f9993c1a0..572acbc1131 100644
--- a/libjava/classpath/gnu/CORBA/OrbFocused.java
+++ b/libjava/classpath/gnu/CORBA/OrbFocused.java
@@ -185,7 +185,7 @@ public class OrbFocused
p = (portServer) portServers.get(i);
if (p.s_port == port)
{
- return (portServer) p;
+ return p;
}
}
// The server is not yet instantiated. Instantiate.
diff --git a/libjava/classpath/gnu/CORBA/OrbFunctional.java b/libjava/classpath/gnu/CORBA/OrbFunctional.java
index bfb5e3d86c1..8fddc66270c 100644
--- a/libjava/classpath/gnu/CORBA/OrbFunctional.java
+++ b/libjava/classpath/gnu/CORBA/OrbFunctional.java
@@ -855,7 +855,7 @@ public class OrbFunctional extends OrbRestricted
* internet address and port. With this information, the object can be found
* by another ORB, possibly located on remote computer.
*
- * @param the CORBA object
+ * @param forObject CORBA object
* @return the object IOR representation.
*
* @throws BAD_PARAM if the object has not been previously connected to this
@@ -1040,7 +1040,7 @@ public class OrbFunctional extends OrbRestricted
* computer, possibly running a different (not necessary java) CORBA
* implementation.
*
- * @param ior the object IOR representation string.
+ * @param an_ior the object IOR representation string.
*
* @return the found CORBA object.
* @see object_to_string(org.omg.CORBA.Object)
diff --git a/libjava/classpath/gnu/CORBA/OrbRestricted.java b/libjava/classpath/gnu/CORBA/OrbRestricted.java
index c34584995a6..4ae50b1a3a1 100644
--- a/libjava/classpath/gnu/CORBA/OrbRestricted.java
+++ b/libjava/classpath/gnu/CORBA/OrbRestricted.java
@@ -65,7 +65,6 @@ import org.omg.CORBA.UnionMember;
import org.omg.CORBA.portable.OutputStream;
import org.omg.CORBA.portable.ValueFactory;
import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
-import org.omg.PortableInterceptor.IORInterceptorOperations;
import org.omg.PortableInterceptor.IORInterceptor_3_0Operations;
import org.omg.PortableInterceptor.ServerRequestInterceptorOperations;
diff --git a/libjava/classpath/gnu/CORBA/Poa/AOM.java b/libjava/classpath/gnu/CORBA/Poa/AOM.java
index 70e787af151..f8820bff83b 100644
--- a/libjava/classpath/gnu/CORBA/Poa/AOM.java
+++ b/libjava/classpath/gnu/CORBA/Poa/AOM.java
@@ -163,7 +163,7 @@ public class AOM
* Get the record of the stored object. If the object is mapped several times
* under the different keys, one of the mappings is used.
*
- * @param object the stored object
+ * @param stored_object the stored object
*
* @return the record about the stored object, null if this object is not
* stored here.
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
index 0dbca7cfbde..82e520904f1 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOA.java
@@ -421,7 +421,7 @@ public class gnuPOA
* or adding the returned instance to any possible table.
*
* @param child_name the name of the poa being created.
- * @param manager the poa manager (never null).
+ * @param a_manager the poa manager (never null).
* @param policies the array of policies.
* @param an_orb the ORB for this POA.
*
@@ -1239,7 +1239,7 @@ public class gnuPOA
* @param x the aom entry, where the object is replaced by value, returned by
* servant activator (if not null).
*
- * @param key the object key.
+ * @param object_key the object key.
*
* @param a_servant the servant that was passed as a parameter in the
* activation method.
@@ -1317,7 +1317,7 @@ public class gnuPOA
/**
* Set the adapter activator for this POA.
*
- * @param the activator being set.
+ * @param an_activator the activator being set.
*/
public void the_activator(AdapterActivator an_activator)
{
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
index 7710306b748..28f4ecd281f 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java
@@ -41,7 +41,6 @@ package gnu.CORBA.Poa;
import org.omg.CORBA.BAD_INV_ORDER;
import org.omg.CORBA.LocalObject;
import org.omg.PortableInterceptor.NON_EXISTENT;
-import org.omg.PortableInterceptor.ObjectReferenceTemplate;
import org.omg.PortableServer.POAManager;
import org.omg.PortableServer.POAManagerPackage.AdapterInactive;
import org.omg.PortableServer.POAManagerPackage.State;
@@ -89,9 +88,9 @@ public class gnuPOAManager
* Turns the associated POAs into active state, allowing them to receive
* and process requests.
*
- * @throws if the POAs are in the inactive state. If once inactivated,
- * the POA cannot be activated again. This method can only be called
- * to leave the holding or discarding state.
+ * @throws AdapterInactive if the POAs are in the inactive state.
+ * If once inactivated, the POA cannot be activated again. This
+ * method can only be called to leave the holding or discarding state.
*/
public void activate()
throws AdapterInactive
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
index 77b0ff46792..115f4f850fb 100644
--- a/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
+++ b/libjava/classpath/gnu/CORBA/Poa/gnuServantObject.java
@@ -785,7 +785,7 @@ public class gnuServantObject extends ObjectImpl
* assumed equal if they are connected to the same orb and poa under the same
* Id, regardless of they delegates.
*
- * @param another instance to check.
+ * @param other instance to check.
* @return
*/
public boolean _is_equivalent(org.omg.CORBA.Object other)
diff --git a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
index a6f7aa52b8d..c55405cedf6 100644
--- a/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
+++ b/libjava/classpath/gnu/CORBA/ServiceRequestAdapter.java
@@ -41,7 +41,6 @@ package gnu.CORBA;
import gnu.CORBA.CDR.BufferedCdrOutput;
import org.omg.CORBA.ARG_IN;
-import org.omg.CORBA.ARG_INOUT;
import org.omg.CORBA.ARG_OUT;
import org.omg.CORBA.Any;
import org.omg.CORBA.Bounds;
diff --git a/libjava/classpath/gnu/CORBA/gnuContextList.java b/libjava/classpath/gnu/CORBA/gnuContextList.java
index 68584c3891c..592eb2c2cac 100644
--- a/libjava/classpath/gnu/CORBA/gnuContextList.java
+++ b/libjava/classpath/gnu/CORBA/gnuContextList.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.CORBA;
-import java.util.ArrayList;
-
import org.omg.CORBA.Bounds;
import org.omg.CORBA.ContextList;
diff --git a/libjava/classpath/gnu/CORBA/gnuExceptionList.java b/libjava/classpath/gnu/CORBA/gnuExceptionList.java
index 5f0c0c9f50d..06ddf8d717a 100644
--- a/libjava/classpath/gnu/CORBA/gnuExceptionList.java
+++ b/libjava/classpath/gnu/CORBA/gnuExceptionList.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.CORBA;
-import java.util.ArrayList;
-
import org.omg.CORBA.Bounds;
import org.omg.CORBA.ExceptionList;
import org.omg.CORBA.TypeCode;
diff --git a/libjava/classpath/gnu/CORBA/gnuRequest.java b/libjava/classpath/gnu/CORBA/gnuRequest.java
index 0b3338d3437..3ec2a797f0f 100644
--- a/libjava/classpath/gnu/CORBA/gnuRequest.java
+++ b/libjava/classpath/gnu/CORBA/gnuRequest.java
@@ -83,12 +83,10 @@ import org.omg.PortableInterceptor.ClientRequestInterceptorOperations;
import org.omg.PortableInterceptor.ForwardRequest;
import org.omg.PortableInterceptor.InvalidSlot;
-import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.net.BindException;
import java.net.Socket;
import java.util.ArrayList;
diff --git a/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
index c5fae63bd28..af7f46ecfce 100644
--- a/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/FixedTypeCode.java
@@ -109,7 +109,7 @@ public class FixedTypeCode
/**
* Get the number of digits in thid BigDecimal
*
- * @param x a BigDecimal to check.
+ * @param number a BigDecimal to check.
*/
public static int countDigits(BigDecimal number)
{
diff --git a/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java b/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
index 0e6ac375e50..8ec2f5474d0 100644
--- a/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
+++ b/libjava/classpath/gnu/CORBA/typecodes/RecursiveTypeCode.java
@@ -63,7 +63,7 @@ public class RecursiveTypeCode
* Create a typecode that serves as a placeholder for
* the typecode with the given id.
*
- * @param id the Id of the type for that this type serves as a
+ * @param an_id the Id of the type for that this type serves as a
* placeholder.
*/
public RecursiveTypeCode(String an_id)
diff --git a/libjava/classpath/gnu/classpath/ServiceFactory.java b/libjava/classpath/gnu/classpath/ServiceFactory.java
index daf996c23ca..6c9728e0cbd 100644
--- a/libjava/classpath/gnu/classpath/ServiceFactory.java
+++ b/libjava/classpath/gnu/classpath/ServiceFactory.java
@@ -48,6 +48,7 @@ import java.security.PrivilegedActionException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
+import java.util.List;
import java.util.NoSuchElementException;
import java.util.ServiceConfigurationError;
import java.util.logging.Level;
@@ -222,8 +223,8 @@ public final class ServiceFactory
* @throws IllegalArgumentException if <code>spi</code> is
* <code>null</code>.
*/
- public static Iterator lookupProviders(Class spi,
- ClassLoader loader)
+ public static <P> Iterator<P> lookupProviders(Class<P> spi,
+ ClassLoader loader)
{
return lookupProviders(spi, loader, false);
}
@@ -266,12 +267,12 @@ public final class ServiceFactory
* @throws IllegalArgumentException if <code>spi</code> is
* <code>null</code>.
*/
- public static Iterator lookupProviders(Class spi,
- ClassLoader loader,
- boolean error)
+ public static <P> Iterator<P> lookupProviders(Class<P> spi,
+ ClassLoader loader,
+ boolean error)
{
String resourceName;
- Enumeration urls;
+ Enumeration<URL> urls;
if (spi == null)
throw new IllegalArgumentException();
@@ -295,11 +296,14 @@ public final class ServiceFactory
throw new ServiceConfigurationError("Failed to access + " +
resourceName, ioex);
else
- return Collections.EMPTY_LIST.iterator();
+ {
+ List<P> empty = Collections.emptyList();
+ return empty.iterator();
+ }
}
- return new ServiceIterator(spi, urls, loader, error,
- AccessController.getContext());
+ return new ServiceIterator<P>(spi, urls, loader, error,
+ AccessController.getContext());
}
@@ -318,7 +322,7 @@ public final class ServiceFactory
*
* @see #lookupProviders(Class, ClassLoader)
*/
- public static Iterator lookupProviders(Class spi)
+ public static <P> Iterator<P> lookupProviders(Class<P> spi)
{
ClassLoader ctxLoader;
@@ -335,14 +339,14 @@ public final class ServiceFactory
*
* @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
*/
- private static final class ServiceIterator
- implements Iterator
+ private static final class ServiceIterator<P>
+ implements Iterator<P>
{
/**
* The service provider interface (usually an interface, sometimes
* an abstract class) which the services must implement.
*/
- private final Class spi;
+ private final Class<P> spi;
/**
@@ -350,7 +354,7 @@ public final class ServiceFactory
* <code>META-INF/services/&lt;org.foo.SomeService&gt;</code>,
* as returned by {@link ClassLoader#getResources(String)}.
*/
- private final Enumeration urls;
+ private final Enumeration<URL> urls;
/**
@@ -389,7 +393,7 @@ public final class ServiceFactory
* {@link #next()}, or <code>null</code> if the iterator has
* already returned all service providers.
*/
- private Object nextProvider;
+ private P nextProvider;
/**
* True if a {@link ServiceConfigurationError} should be thrown
@@ -420,7 +424,7 @@ public final class ServiceFactory
* @param securityContext the security context to use when loading
* and initializing service providers.
*/
- ServiceIterator(Class spi, Enumeration urls, ClassLoader loader,
+ ServiceIterator(Class<P> spi, Enumeration<URL> urls, ClassLoader loader,
boolean error, AccessControlContext securityContext)
{
this.spi = spi;
@@ -436,9 +440,9 @@ public final class ServiceFactory
* @throws NoSuchElementException if {@link #hasNext} returns
* <code>false</code>.
*/
- public Object next()
+ public P next()
{
- Object result;
+ P result;
if (!hasNext())
throw new NoSuchElementException();
@@ -461,7 +465,7 @@ public final class ServiceFactory
}
- private Object loadNextServiceProvider()
+ private P loadNextServiceProvider()
{
String line;
@@ -523,7 +527,7 @@ public final class ServiceFactory
* active when calling lookupProviders.
*/
return AccessController.doPrivileged(
- new ServiceProviderLoadingAction(spi, line, loader),
+ new ServiceProviderLoadingAction<P>(spi, line, loader),
securityContext);
}
catch (Exception ex)
@@ -577,7 +581,7 @@ public final class ServiceFactory
if (!urls.hasMoreElements())
return;
- currentURL = (URL) urls.nextElement();
+ currentURL = urls.nextElement();
try
{
reader = new BufferedReader(new InputStreamReader(
diff --git a/libjava/classpath/gnu/classpath/ServiceProviderLoadingAction.java b/libjava/classpath/gnu/classpath/ServiceProviderLoadingAction.java
index 9f9dc51cb68..51f5a2fa911 100644
--- a/libjava/classpath/gnu/classpath/ServiceProviderLoadingAction.java
+++ b/libjava/classpath/gnu/classpath/ServiceProviderLoadingAction.java
@@ -54,15 +54,15 @@ import java.security.PrivilegedExceptionAction;
*
* @author <a href="mailto:brawer@dandelis.ch">Sascha Brawer</a>
*/
-final class ServiceProviderLoadingAction
- implements PrivilegedExceptionAction
+final class ServiceProviderLoadingAction<P>
+ implements PrivilegedExceptionAction<P>
{
/**
* The interface to which the loaded service provider implementation
* must conform. Usually, this is a Java interface type, but it
* might also be an abstract class or even a concrete class.
*/
- private final Class spi;
+ private final Class<P> spi;
/**
@@ -97,7 +97,7 @@ final class ServiceProviderLoadingAction
* <code>providerName</code> or <code>loader</code> is
* <code>null</code>.
*/
- ServiceProviderLoadingAction(Class spi, String providerName,
+ ServiceProviderLoadingAction(Class<P> spi, String providerName,
ClassLoader loader)
{
if (spi == null || providerName == null || loader == null)
@@ -130,13 +130,13 @@ final class ServiceProviderLoadingAction
* no-argument constructor; or if there some other problem with
* creating a new instance of the service provider.
*/
- public Object run()
+ public P run()
throws Exception
{
- Class loadedClass;
- Object serviceProvider;
+ Class<P> loadedClass;
+ P serviceProvider;
- loadedClass = loader.loadClass(providerName);
+ loadedClass = (Class<P>) loader.loadClass(providerName);
serviceProvider = loadedClass.newInstance();
// Ensure that the loaded provider is actually implementing
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java b/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java
index 1303c09be76..1bb339969ec 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/ExceptionEvent.java
@@ -117,9 +117,9 @@ public class ExceptionEvent
return _exception.getClass();
else if (type == EVENT_EXCEPTION_CAUGHT)
if (_catchLocation.getMethod() != null)
- return new Boolean(true);
+ return Boolean.TRUE;
else
- return new Boolean(false);
+ return Boolean.FALSE;
return null;
}
diff --git a/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java b/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
index d18f6975ebf..fd412716c84 100644
--- a/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
+++ b/libjava/classpath/gnu/classpath/jdwp/event/filters/StepFilter.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package gnu.classpath.jdwp.event.filters;
-import gnu.classpath.jdwp.JdwpConstants;
import gnu.classpath.jdwp.event.Event;
import gnu.classpath.jdwp.exception.InvalidThreadException;
import gnu.classpath.jdwp.id.ThreadId;
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
index 49b3f0d1b3f..1a70b9c091e 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java
@@ -56,7 +56,6 @@ import gnu.classpath.jdwp.value.ValueFactory;
import java.io.DataOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
import java.nio.ByteBuffer;
/**
diff --git a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
index c9b329869d7..cde3fc24cac 100644
--- a/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
+++ b/libjava/classpath/gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java
@@ -46,7 +46,6 @@ import gnu.classpath.jdwp.exception.InvalidFieldException;
import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.JdwpInternalErrorException;
import gnu.classpath.jdwp.exception.NotImplementedException;
-import gnu.classpath.jdwp.id.ClassReferenceTypeId;
import gnu.classpath.jdwp.id.ObjectId;
import gnu.classpath.jdwp.id.ReferenceTypeId;
import gnu.classpath.jdwp.util.JdwpString;
diff --git a/libjava/classpath/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java b/libjava/classpath/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java
new file mode 100644
index 00000000000..cb56c7641ff
--- /dev/null
+++ b/libjava/classpath/gnu/classpath/toolkit/DefaultDaemonThreadFactory.java
@@ -0,0 +1,59 @@
+/* DefaultDaemonThreadFactory.java -- Factory for Deamon Threads.
+
+ Copyright (C) 2007 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 gnu.classpath.toolkit;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;;
+
+/**
+ * Create a new thread using all the default settings as returned by
+ * <code>Executors.defaultThreadFactory()</code> plus calling
+ * <code>thread.setDaemon(true)</code> on the newly created thread.
+ *
+ * @author Mario Torre <neugens@limasoftware.net>
+ */
+public class DefaultDaemonThreadFactory implements ThreadFactory
+{
+ public Thread newThread(Runnable r)
+ {
+ Thread thread = Executors.defaultThreadFactory().newThread(r);
+ thread.setDaemon(true);
+ return thread;
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/AWTUtilities.java b/libjava/classpath/gnu/java/awt/AWTUtilities.java
index 1b68703697f..dcebc67fa25 100644
--- a/libjava/classpath/gnu/java/awt/AWTUtilities.java
+++ b/libjava/classpath/gnu/java/awt/AWTUtilities.java
@@ -126,7 +126,7 @@ public class AWTUtilities
*
* @return the next visible <code>Component</code> in the List
*
- * @throws if there is no next element
+ * @throws NoSuchElementException if there is no next element
*/
public Object next()
{
diff --git a/libjava/classpath/gnu/java/awt/ClasspathToolkit.java b/libjava/classpath/gnu/java/awt/ClasspathToolkit.java
index d78fbab4e1e..7bbc70ccb1f 100644
--- a/libjava/classpath/gnu/java/awt/ClasspathToolkit.java
+++ b/libjava/classpath/gnu/java/awt/ClasspathToolkit.java
@@ -51,7 +51,6 @@ import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
import java.awt.Toolkit;
-import java.awt.font.TextAttribute;
import java.awt.peer.DesktopPeer;
import java.awt.peer.RobotPeer;
import java.io.IOException;
diff --git a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
index 99f90c9f85d..7c04e7daf77 100644
--- a/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
+++ b/libjava/classpath/gnu/java/awt/EmbeddedWindow.java
@@ -43,7 +43,6 @@ import gnu.java.security.action.SetAccessibleAction;
import java.awt.Component;
import java.awt.Frame;
-import java.awt.Toolkit;
import java.lang.reflect.Field;
import java.security.AccessController;
diff --git a/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java b/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java
index 2f73dce77b0..22f331e15d1 100644
--- a/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java
+++ b/libjava/classpath/gnu/java/awt/font/GNUGlyphVector.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.java.awt.font;
+import gnu.java.awt.java2d.ShapeWrapper;
+
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphMetrics;
@@ -82,6 +84,10 @@ public class GNUGlyphVector
private AffineTransform[] transforms;
private int layoutFlags;
+ /**
+ * The cached non-transformed outline of this glyph vector.
+ */
+ private Shape cleanOutline;
/**
* Constructs a new GNUGlyphVector.
@@ -257,7 +263,6 @@ public class GNUGlyphVector
*/
public Shape getOutline()
{
- validate();
return getOutline(0.0f, 0.0f);
}
@@ -273,16 +278,33 @@ public class GNUGlyphVector
{
validate();
- GeneralPath outline = new GeneralPath();
- int len = glyphs.length;
- for (int i = 0; i < len; i++)
+ Shape outline;
+ if (cleanOutline == null)
{
- GeneralPath p = new GeneralPath(getGlyphOutline(i));
- outline.append(p, false);
+ GeneralPath path = new GeneralPath();
+ int len = glyphs.length;
+ for (int i = 0; i < len; i++)
+ {
+ GeneralPath p = new GeneralPath(getGlyphOutline(i));
+ path.append(p, false);
+ }
+ // Protect the cached instance from beeing modified by application
+ // code.
+ cleanOutline = new ShapeWrapper(path);
+ outline = cleanOutline;
+ }
+ else
+ {
+ outline = cleanOutline;
+ }
+ if (x != 0 || y != 0)
+ {
+ GeneralPath path = new GeneralPath(outline);
+ AffineTransform t = new AffineTransform();
+ t.translate(x, y);
+ path.transform(t);
+ outline = path;
}
- AffineTransform t = new AffineTransform();
- t.translate(x, y);
- outline.transform(t);
return outline;
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java b/libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java
index ab3861be1a9..2d898a44801 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XFontPeer2.java
+++ b/libjava/classpath/gnu/java/awt/font/OpenTypeFontPeer.java
@@ -35,7 +35,7 @@ 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 gnu.java.awt.peer.x;
+package gnu.java.awt.font;
import java.awt.Font;
import java.awt.FontMetrics;
@@ -54,15 +54,16 @@ import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
-import gnu.java.awt.font.FontDelegate;
-import gnu.java.awt.font.FontFactory;
import gnu.java.awt.peer.ClasspathFontPeer;
-public class XFontPeer2
+public class OpenTypeFontPeer
extends ClasspathFontPeer
{
@@ -70,10 +71,21 @@ public class XFontPeer2
* The font mapping as specified in the file fonts.properties.
*/
private static Properties fontProperties;
+
+ /**
+ * The available font family names.
+ */
+ private static Set<String> availableFontNames;
+
+ /**
+ * Font spec to file mapping.
+ */
+ private static Map<String,Map<String,String>> fontToFileMap;
+
static
{
fontProperties = new Properties();
- InputStream in = XFontPeer2.class.getResourceAsStream("fonts.properties");
+ InputStream in = OpenTypeFontPeer.class.getResourceAsStream("fonts.properties");
try
{
fontProperties.load(in);
@@ -234,12 +246,14 @@ public class XFontPeer2
private FontDelegate fontDelegate;
- XFontPeer2(String name, int style, int size)
+ public OpenTypeFontPeer(String name, int style, int size)
{
super(name, style, size);
try
{
- File fontfile = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
+ String fontSpec = encodeFont(name, style);
+ String filename = mapFontToFilename(fontSpec);
+ File fontfile = new File(filename);
FileInputStream in = new FileInputStream(fontfile);
FileChannel ch = in.getChannel();
ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
@@ -252,12 +266,14 @@ public class XFontPeer2
}
}
- XFontPeer2(String name, Map atts)
+ public OpenTypeFontPeer(String name, Map atts)
{
super(name, atts);
try
{
- File fontfile = new File("/usr/share/fonts/truetype/freefont/FreeSans.ttf");
+ String fontSpec = encodeFont(name, atts);
+ String filename = mapFontToFilename(fontSpec);
+ File fontfile = new File(filename);
FileInputStream in = new FileInputStream(fontfile);
FileChannel ch = in.getChannel();
ByteBuffer buffer = ch.map(FileChannel.MapMode.READ_ONLY, 0,
@@ -371,7 +387,7 @@ public class XFontPeer2
*
* @return the encoded font description
*/
- static String encodeFont(String name, Map atts)
+ public static String encodeFont(String name, Map atts)
{
String family = name;
if (family == null || family.equals(""))
@@ -379,11 +395,6 @@ public class XFontPeer2
if (family == null)
family = "SansSerif";
- int size = 12;
- Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
- if (sizeFl != null)
- size = sizeFl.intValue();
-
int style = 0;
// Detect italic attribute.
Float posture = (Float) atts.get(TextAttribute.POSTURE);
@@ -395,49 +406,43 @@ public class XFontPeer2
if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
style |= Font.BOLD;
- return encodeFont(name, style, size);
+ return encodeFont(name, style);
}
/**
- * Encodes a font name + style + size specification into a X logical font
- * description (XLFD) as described here:
- *
- * http://www.meretrx.com/e93/docs/xlfd.html
+ * Encodes a font name + style into a combined string.
*
* This is implemented to look up the font description in the
* fonts.properties of this package.
*
* @param name the font name
* @param style the font style
- * @param size the font size
*
* @return the encoded font description
*/
- static String encodeFont(String name, int style, int size)
+ static String encodeFont(String name, int style)
{
StringBuilder key = new StringBuilder();
key.append(validName(name));
- key.append('.');
+ key.append('/');
switch (style)
{
case Font.BOLD:
- key.append("bold");
+ key.append("b");
break;
case Font.ITALIC:
- key.append("italic");
+ key.append("i");
break;
case (Font.BOLD | Font.ITALIC):
- key.append("bolditalic");
+ key.append("bi");
break;
case Font.PLAIN:
default:
- key.append("plain");
+ key.append("p");
}
- String protoType = fontProperties.getProperty(key.toString());
- int s = size;
- return protoType.replaceFirst("%d", String.valueOf(s * 10));
+ return key.toString();
}
/**
@@ -451,18 +456,108 @@ public class XFontPeer2
static String validName(String name)
{
String retVal;
- if (name.equalsIgnoreCase("sansserif")
- || name.equalsIgnoreCase("serif")
- || name.equalsIgnoreCase("monospaced")
- || name.equalsIgnoreCase("dialog")
- || name.equalsIgnoreCase("dialoginput"))
+ Set<String> fontNames = getFontNames();
+ if (fontNames.contains(name))
{
- retVal = name.toLowerCase();
+ retVal = name;
}
else
{
- retVal = "sansserif";
+ retVal = "SansSerif";
}
return retVal;
}
+
+ public static String[] getAvailableFontFamilyNames(Locale l)
+ {
+ Set<String> fontNames = getFontNames();
+ int numNames = fontNames.size();
+ String[] ret = fontNames.toArray(new String[numNames]);
+ return ret;
+ }
+
+ private static synchronized Set<String> getFontNames()
+ {
+ if (availableFontNames == null)
+ {
+ HashSet<String> familyNames = new HashSet<String>();
+ for (Object o : fontProperties.keySet())
+ {
+ if (o instanceof String)
+ {
+ String key = (String) o;
+ int slashIndex = key.indexOf('/');
+ String name = key.substring(0, slashIndex);
+ familyNames.add(name);
+ }
+ }
+ availableFontNames = familyNames;
+ }
+ return availableFontNames;
+ }
+
+ /**
+ * Takes a font spec as returned by {@link #encodeFont(String, int)},
+ * and returns the corresponding font file, or <code>null</code> if no such
+ * font mapping exists.
+ *
+ * @param fontSpec font name and style as returned by
+ * {@link #encodeFont(String, int)}
+ *
+ * @return filename of the corresponding font file
+ */
+ private synchronized String mapFontToFilename(String fontSpec)
+ {
+ if (fontToFileMap == null)
+ {
+ fontToFileMap = new HashMap<String,Map<String,String>>();
+
+ // Initialize font spec to file mapping according to the
+ // font.properties.
+ for (Object o : fontProperties.keySet())
+ {
+ if (o instanceof String)
+ {
+ String key = (String) o;
+ int slashIndex = key.indexOf('/');
+ String name = key.substring(0, slashIndex);
+ String spec = key.substring(slashIndex + 1);
+ // Handle aliases in the 2nd pass below.
+ if (! spec.equals("a"))
+ {
+ Map<String,String> specToFileMap = fontToFileMap.get(name);
+ if (specToFileMap == null)
+ {
+ specToFileMap = new HashMap<String,String>();
+ fontToFileMap.put(name, specToFileMap);
+ }
+ specToFileMap.put(spec, fontProperties.getProperty(key));
+ }
+ }
+ }
+ // 2nd pass for handling aliases.
+ for (Object o : fontProperties.keySet())
+ {
+ if (o instanceof String)
+ {
+ String key = (String) o;
+ int slashIndex = key.indexOf('/');
+ String name = key.substring(0, slashIndex);
+ String spec = key.substring(slashIndex + 1);
+ // Handle aliases in the 2nd pass below.
+ if (spec.equals("a"))
+ {
+ String alias = fontProperties.getProperty(key);
+ Map<String,String> specToFileMap = fontToFileMap.get(alias);
+ fontToFileMap.put(name, specToFileMap);
+ }
+ }
+ }
+ }
+ // Look up font file.
+ int slashIndex = fontSpec.indexOf('/');
+ String name = fontSpec.substring(0, slashIndex);
+ String spec = fontSpec.substring(slashIndex + 1);
+ return fontToFileMap.get(name).get(spec);
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/image/AsyncImage.java b/libjava/classpath/gnu/java/awt/image/AsyncImage.java
new file mode 100644
index 00000000000..935601a8898
--- /dev/null
+++ b/libjava/classpath/gnu/java/awt/image/AsyncImage.java
@@ -0,0 +1,300 @@
+/* AsyncImage.java -- Loads images asynchronously
+ Copyright (C) 2008 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 gnu.java.awt.image;
+
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.awt.image.ImageConsumer;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Supports asynchronous loading of images.
+ */
+public class AsyncImage
+ extends Image
+{
+
+ /**
+ * The image source for AsyncImages.
+ */
+ private class AsyncImageSource
+ implements ImageProducer
+ {
+ /**
+ * The real image source, if already present, or <code>null</code>
+ * otherwise.
+ */
+ private ImageProducer realSource;
+
+ public void addConsumer(ImageConsumer ic)
+ {
+ startProduction(ic);
+ }
+
+ public boolean isConsumer(ImageConsumer ic)
+ {
+ return false;
+ }
+
+ public void removeConsumer(ImageConsumer ic)
+ {
+ // Nothing to do here.
+ }
+
+ public void requestTopDownLeftRightResend(ImageConsumer ic)
+ {
+ startProduction(ic);
+ }
+
+ public void startProduction(ImageConsumer ic)
+ {
+ ImageProducer ip = getRealSource();
+ if (ip == null)
+ {
+ ic.setDimensions(1, 1);
+ ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
+ }
+ else
+ {
+ ip.startProduction(ic);
+ }
+ }
+
+ /**
+ * Returns the real image source, if already present. Otherwise, this
+ * returns <code>null</code>.
+ *
+ * @return the real image source, or <code>null</code> if not present
+ */
+ private ImageProducer getRealSource()
+ {
+ synchronized (AsyncImage.this)
+ {
+ ImageProducer source = realSource;
+ if (source == null)
+ {
+ Image ri = realImage;
+ if (ri != null)
+ {
+ realSource = source = ri.getSource();
+ }
+ }
+ return source;
+ }
+ }
+ }
+
+ /**
+ * The real image. This is null as long as the image is not complete.
+ */
+ private volatile Image realImage;
+
+ /**
+ * The image observers.
+ *
+ * This is package private to avoid accessor methods.
+ */
+ HashSet<ImageObserver> observers;
+
+ private volatile boolean complete = false;
+
+ /**
+ * Creates a new AsyncImage.
+ */
+ AsyncImage()
+ {
+ observers = new HashSet<ImageObserver>();
+ }
+
+ public void flush()
+ {
+ // Nothing to do here.
+ }
+
+ public Graphics getGraphics()
+ {
+ Image r = realImage;
+ Graphics g = null;
+ if (r != null)
+ g = r.getGraphics(); // Should we return some dummy graphics instead?
+ return g;
+ }
+
+ public boolean isComplete() {
+ return complete;
+ }
+
+ public int getHeight(ImageObserver observer)
+ {
+ addObserver(observer);
+ int height = -1;
+ waitForImage(observer);
+ Image r = realImage;
+ if (r != null)
+ height = r.getHeight(observer);
+ return height;
+ }
+
+ public Object getProperty(String name, ImageObserver observer)
+ {
+ addObserver(observer);
+ Image r = realImage;
+ Object prop = null;
+ if (r != null)
+ prop = r.getProperty(name, observer);
+ return prop;
+ }
+
+ public ImageProducer getSource()
+ {
+ return new AsyncImageSource();
+ }
+
+ public int getWidth(ImageObserver observer)
+ {
+ addObserver(observer);
+ int width = -1;
+ waitForImage(observer);
+ Image r = realImage;
+ if (r != null)
+ width = r.getWidth(observer);
+ return width;
+ }
+
+ public void addObserver(ImageObserver obs)
+ {
+ if (obs != null)
+ {
+ synchronized (this)
+ {
+ // This field gets null when image loading is complete and we don't
+ // need to store any more observers.
+ HashSet<ImageObserver> observs = observers;
+ if (observs != null)
+ {
+ observs.add(obs);
+ }
+ }
+ }
+ }
+
+ public boolean prepareImage(int w, int h, ImageObserver obs)
+ {
+ addObserver(obs);
+ return realImage != null;
+ }
+
+ public int checkImage(int w, int h, ImageObserver obs)
+ {
+ addObserver(obs);
+ int flags = 0;
+ if (realImage != null)
+ flags = ImageObserver.ALLBITS | ImageObserver.WIDTH
+ | ImageObserver.HEIGHT | ImageObserver.PROPERTIES;
+ return flags;
+ }
+
+ public Image getRealImage()
+ {
+ return realImage;
+ }
+
+ public void setRealImage(Image im)
+ {
+ realImage = im;
+ int status = ImageObserver.HEIGHT | ImageObserver.WIDTH;
+ notifyObservers(status, 0, 0, im.getWidth(null), im.getHeight(null));
+ }
+
+ public void notifyObservers(int status, int x, int y, int w, int h)
+ {
+ synchronized (this)
+ {
+ HashSet observs = observers;
+ if (observs != null)
+ {
+ Iterator i = observs.iterator();
+ while (i.hasNext())
+ {
+ ImageObserver obs = (ImageObserver) i.next();
+ boolean complete = obs.imageUpdate(this, status, x, y, realImage.getWidth(obs), realImage.getHeight(obs));
+ if (complete) // Remove completed observers.
+ i.remove();
+ }
+ }
+ if ((status & ImageObserver.ALLBITS) != 0)
+ {
+ complete = true;
+ notifyAll();
+ }
+ }
+ }
+
+ /**
+ * Waits for the image to be loaded completely, if the image observer
+ * is <code>null</code>. Otherwise this is not necessary, because the
+ * image observer can be notified about later completion.
+ *
+ * @param observer the image observer
+ */
+ public void waitForImage(ImageObserver observer)
+ {
+ if (!complete && observer == null)
+ {
+ synchronized (this)
+ {
+ while (! complete)
+ {
+ try
+ {
+ wait();
+ }
+ catch (InterruptedException ex)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/image/ImageConverter.java b/libjava/classpath/gnu/java/awt/image/ImageConverter.java
new file mode 100644
index 00000000000..f607b349630
--- /dev/null
+++ b/libjava/classpath/gnu/java/awt/image/ImageConverter.java
@@ -0,0 +1,528 @@
+/* ImageConverter.java -- Loads images asynchronously
+ Copyright (C) 2008 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 gnu.java.awt.image;
+
+import gnu.java.awt.image.AsyncImage;
+
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.ImageConsumer;
+import java.awt.image.IndexColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.SinglePixelPackedSampleModel;
+import java.awt.image.WritableRaster;
+import java.util.Hashtable;
+
+/**
+ * Convert an Image to a BufferedImage.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class ImageConverter implements ImageConsumer
+{
+
+ public static final String IMAGE_TRANSPARENCY_PROPERTY =
+ "gnu.awt.image.transparency";
+
+ public static final String IMAGE_PROPERTIES_PROPERTY =
+ "gnu.awt.image.properties";
+
+ private AsyncImage image;
+ private BufferedImage bImage;
+ private Hashtable imageProperties;
+ private int width, height;
+ private ColorModel colorModel;
+ private ColorModel targetColorModel;
+
+ public ImageConverter()
+ {
+ width = 0;
+ height = 0;
+ image = new AsyncImage();
+ }
+
+ public void setDimensions(int w, int h)
+ {
+ width = w;
+ height = h;
+ }
+
+ public void setProperties(Hashtable props)
+ {
+ // Ignore for now.
+ }
+
+ public void setColorModel(ColorModel model)
+ {
+ colorModel = model;
+ }
+
+ public void setHints(int flags)
+ {
+ // Ignore for now.
+ }
+
+ public void setPixels(int x, int y, int w, int h, ColorModel model,
+ byte[] pixels, int offset, int scansize)
+ {
+ model = setupColorModel(model);
+
+ if (bImage == null)
+ {
+ createImage();
+ }
+
+ Integer t = (Integer) imageProperties.get("gnu.awt.image.transparency");
+ int transparency = t.intValue();
+
+ if(targetColorModel.equals(model))
+ {
+ transparency = transferPixels(x, y, w, h, model, pixels, offset,
+ scansize, transparency);
+ }
+ else if (model instanceof IndexColorModel
+ && targetColorModel.equals(ColorModel.getRGBdefault()))
+ {
+ transparency = convertIndexColorModelToSRGB(x, y, w, h,
+ (IndexColorModel) model,
+ pixels, offset, scansize,
+ transparency);
+ }
+ else
+ {
+ transparency = convertPixels(x, y, w, h, model, pixels, offset,
+ scansize, transparency);
+ }
+
+ imageProperties.put("gnu.awt.image.transparency",
+ Integer.valueOf(transparency));
+ }
+
+ public void setPixels(int x, int y, int w, int h, ColorModel model,
+ int[] pixels, int offset, int scansize)
+ {
+ model = setupColorModel(model);
+ if (bImage == null)
+ {
+ createImage();
+ }
+
+ Integer t = (Integer) imageProperties.get(IMAGE_TRANSPARENCY_PROPERTY);
+ int transparency= t.intValue();
+
+ if (targetColorModel.equals(model))
+ {
+ transparency = transferPixels(x, y, w, h, model, pixels, offset,
+ scansize, transparency);
+ }
+ else if (model instanceof IndexColorModel
+ && targetColorModel.equals(ColorModel.getRGBdefault()))
+ {
+ transparency = convertIndexColorModelToSRGB(x, y, w, h,
+ (IndexColorModel) model,
+ pixels, offset, scansize,
+ transparency);
+ }
+ else
+ {
+ transparency = convertPixels(x, y, w, h, model, pixels, offset,
+ scansize, transparency);
+ }
+
+ imageProperties.put(IMAGE_TRANSPARENCY_PROPERTY,
+ Integer.valueOf(transparency));
+
+ }
+
+ /**
+ * Initialize the color model for this setPixels run: <br/>
+ * 1. if no color model was given use the hinted color model <br/>
+ * 2. if no color model was given and non was hinted use the default sRGB color model. <br/>
+ * Also:<br/>
+ * If no target color model was set use the color model of the given pixels.
+ * @param model
+ * @return
+ */
+ private ColorModel setupColorModel(ColorModel model)
+ {
+ // If the given color model is null use the previously hinted color model.
+ if (model == null)
+ model = colorModel;
+
+ // If no color model was given or hinted use default sRGB.
+ if (model == null)
+ model = ColorModel.getRGBdefault();
+
+ // If no specific color model was requested for the target use the current
+ // pixels model.
+ if (targetColorModel == null)
+ targetColorModel = model;
+ targetColorModel = ColorModel.getRGBdefault();
+ return model;
+ }
+
+ /**
+ * Creates the image instance into which the pixel data is converted.
+ */
+ private void createImage()
+ {
+ if (imageProperties == null)
+ {
+ imageProperties = new Hashtable();
+ }
+
+ imageProperties.put(IMAGE_TRANSPARENCY_PROPERTY,
+ Integer.valueOf(Transparency.OPAQUE));
+ imageProperties.put(IMAGE_PROPERTIES_PROPERTY, imageProperties);
+
+ // For the sRGB case let the GraphicsEnvironment create an image for us.
+ if (ColorModel.getRGBdefault().equals(targetColorModel))
+ {
+ bImage = GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice()
+ .getDefaultConfiguration()
+ .createCompatibleImage(width, height, Transparency.TRANSLUCENT);
+ }
+ else
+ {
+ WritableRaster raster =
+ targetColorModel.createCompatibleWritableRaster(width, height);
+ bImage = new BufferedImage(targetColorModel, raster, false,
+ imageProperties);
+ }
+ image.setRealImage(bImage);
+ return;
+ }
+
+ /**
+ * Transfers pixels into a raster of the same color model.
+ *
+ * @param x the X coordinate of the source pixel rectangle
+ * @param y the Y coordinate of the source pixel rectangle
+ * @param w the width of the source pixel rectangle
+ * @param h the height of the source pixel rectangle
+ * @param model the color model of the source pixels
+ * @param pixels the pixel data
+ * @param offset the offset in the pixel array
+ * @param scansize the scanline size
+ * @param transparency the assumed transparency
+ *
+ * @return the determined transparency
+ */
+ private int transferPixels(int x, int y, int w, int h, ColorModel model,
+ byte[] pixels, int offset, int scansize,
+ int transparency)
+ {
+ // If we have the same color model, then we can simply drop
+ // the pixel value into the target raster.
+ bImage.getRaster().setDataElements(x, y, w, h, pixels);
+
+ for (int yy = 0; yy < h; yy++)
+ {
+ for (int xx = 0; xx < w; xx++)
+ {
+ int pixel = 0xFF & pixels[yy * scansize + xx + offset];
+ int alpha = model.getAlpha(pixel);
+ transparency = updateTransparency(alpha, transparency);
+ }
+ }
+ return transparency;
+ }
+
+ /**
+ * Transfers pixels into a raster of the same color model.
+ *
+ * @param x the X coordinate of the source pixel rectangle
+ * @param y the Y coordinate of the source pixel rectangle
+ * @param w the width of the source pixel rectangle
+ * @param h the height of the source pixel rectangle
+ * @param model the color model of the source pixels
+ * @param pixels the pixel data
+ * @param offset the offset in the pixel array
+ * @param scansize the scanline size
+ * @param transparency the assumed transparency
+ *
+ * @return the determined transparency
+ */
+ private int transferPixels(int x, int y, int w, int h, ColorModel model,
+ int[] pixels, int offset, int scansize,
+ int transparency)
+ {
+ // If we have the same color model, then we can simply drop
+ // the pixel value into the target raster.
+ bImage.getRaster().setDataElements(x, y, w, h, pixels);
+
+ for (int yy = 0; yy < h; yy++)
+ {
+ for (int xx = 0; xx < w; xx++)
+ {
+ int pixel = pixels[yy * scansize + xx + offset];
+ int alpha = model.getAlpha(pixel);
+ transparency = updateTransparency(alpha, transparency);
+ }
+ }
+ return transparency;
+ }
+
+ /**
+ * Converts pixel from one color model to another, and stores them in the
+ * target image.
+ *
+ * @param x the X coordinate of the source pixel rectangle
+ * @param y the Y coordinate of the source pixel rectangle
+ * @param w the width of the source pixel rectangle
+ * @param h the height of the source pixel rectangle
+ * @param model the color model of the source pixels
+ * @param pixels the pixel data
+ * @param offset the offset in the pixel array
+ * @param scansize the scanline size
+ * @param transparency the assumed transparency
+ *
+ * @return the determined transparency
+ */
+ private int convertPixels(int x, int y, int w, int h, ColorModel model,
+ byte[] pixels, int offset, int scansize,
+ int transparency)
+ {
+ // If the color models are not the same, we must convert the
+ // pixel values from one model to the other.
+ Object dataEl = null;
+ // Convert pixels to the destination color model.
+ for (int yy = 0; yy < h; yy++)
+ {
+ for (int xx = 0; xx < w; xx++)
+ {
+ int pixel = 0xFF & pixels[yy * scansize + xx + offset];
+ int rgb = model.getRGB(pixel);
+ int alpha = model.getAlpha(pixel);
+ transparency = updateTransparency(alpha, transparency);
+ dataEl = targetColorModel.getDataElements(rgb, dataEl);
+ bImage.getRaster().setDataElements(x + xx, y + yy, dataEl);
+ }
+ }
+ return transparency;
+ }
+
+ /**
+ * Converts pixel from one color model to another, and stores them in the
+ * target image.
+ *
+ * @param x the X coordinate of the source pixel rectangle
+ * @param y the Y coordinate of the source pixel rectangle
+ * @param w the width of the source pixel rectangle
+ * @param h the height of the source pixel rectangle
+ * @param model the color model of the source pixels
+ * @param pixels the pixel data
+ * @param offset the offset in the pixel array
+ * @param scansize the scanline size
+ * @param transparency the assumed transparency
+ *
+ * @return the determined transparency
+ */
+ private int convertPixels(int x, int y, int w, int h, ColorModel model,
+ int[] pixels, int offset, int scansize,
+ int transparency)
+ {
+ // If the color models are not the same, we must convert the
+ // pixel values from one model to the other.
+ Object dataEl = null;
+ // Convert pixels to the destination color model.
+ for (int yy = 0; yy < h; yy++)
+ {
+ for (int xx = 0; xx < w; xx++)
+ {
+ int pixel = pixels[yy * scansize + xx + offset];
+ int rgb = model.getRGB(pixel);
+ int alpha = model.getAlpha(pixel);
+ transparency = updateTransparency(alpha, transparency);
+ dataEl = targetColorModel.getDataElements(rgb, dataEl);
+ bImage.getRaster().setDataElements(x + xx, y + yy, dataEl);
+ }
+ }
+ return transparency;
+ }
+
+ /**
+ * Converts pixels from an index color model to the target image.
+ *
+ * @param x the X coordinate of the source pixel rectangle
+ * @param y the Y coordinate of the source pixel rectangle
+ * @param w the width of the source pixel rectangle
+ * @param h the height of the source pixel rectangle
+ * @param model the color model of the source pixels
+ * @param pixels the pixel data
+ * @param offset the offset in the pixel array
+ * @param scansize the scanline size
+ * @param transparency the assumed transparency
+ *
+ * @return the determined transparency
+ */
+ private int convertIndexColorModelToSRGB(int x, int y, int w, int h,
+ IndexColorModel model,
+ byte[] pixels, int offset,
+ int scansize, int transparency)
+ {
+
+ int mapSize = model.getMapSize();
+ int[] colorMap = new int[mapSize];
+ for(int i=0; i < mapSize; i++)
+ {
+ colorMap[i] = model.getRGB(i);
+ }
+
+ WritableRaster raster = bImage.getRaster();
+ SinglePixelPackedSampleModel sampleMode =
+ (SinglePixelPackedSampleModel) raster.getSampleModel();
+ DataBuffer dataBuffer = (DataBuffer) raster.getDataBuffer();
+
+ int rasterOffset = sampleMode.getOffset(x,y)+dataBuffer.getOffset();
+ int rasterScanline = sampleMode.getScanlineStride();
+
+ for (int yy = 0; yy < h; yy++)
+ {
+ int xoffset = offset;
+ for (int xx = 0; xx < w; xx++)
+ {
+ int argb = colorMap[(pixels[xoffset++] & 0xFF)];
+ dataBuffer.setElem(rasterOffset+xx, argb);
+ int alpha = (argb >>> 24);
+ transparency = updateTransparency(alpha, transparency);
+ }
+ offset += scansize;
+ rasterOffset += rasterScanline;
+ }
+
+ return transparency;
+ }
+
+ /**
+ * Converts pixels from an index color model to the target image.
+ *
+ * @param x the X coordinate of the source pixel rectangle
+ * @param y the Y coordinate of the source pixel rectangle
+ * @param w the width of the source pixel rectangle
+ * @param h the height of the source pixel rectangle
+ * @param model the color model of the source pixels
+ * @param pixels the pixel data
+ * @param offset the offset in the pixel array
+ * @param scansize the scanline size
+ * @param transparency the assumed transparency
+ *
+ * @return the determined transparency
+ */
+ private int convertIndexColorModelToSRGB(int x, int y, int w, int h,
+ IndexColorModel model, int[] pixels,
+ int offset, int scansize,
+ int transparency)
+ {
+ int mapSize = model.getMapSize();
+ int[] colorMap = new int[mapSize];
+ for(int i=0; i < mapSize; i++)
+ {
+ colorMap[i] = model.getRGB(i);
+ }
+
+ WritableRaster raster = bImage.getRaster();
+ SinglePixelPackedSampleModel sampleMode =
+ (SinglePixelPackedSampleModel) raster.getSampleModel();
+ DataBuffer dataBuffer = (DataBuffer)raster.getDataBuffer();
+
+ int rasterOffset = sampleMode.getOffset(x, y) + dataBuffer.getOffset();
+ int rasterScanline = sampleMode.getScanlineStride();
+
+ for (int yy = 0; yy < h; yy++)
+ {
+ int xoffset = offset;
+ for (int xx = 0; xx < w; xx++)
+ {
+ int argb = colorMap[pixels[xoffset++]];
+ dataBuffer.setElem(rasterOffset + xx, argb);
+ int alpha = (argb >>> 24);
+ transparency = updateTransparency(alpha, transparency);
+ }
+ offset += scansize;
+ rasterOffset += rasterScanline;
+ }
+
+ return transparency;
+ }
+
+ /**
+ * Updates the transparency information according to the alpha pixel value.
+ *
+ * @param alpha the alpha pixel value
+ * @param transparency the old transparency
+ *
+ * @return the updated transparency
+ */
+ private int updateTransparency(int alpha, int transparency)
+ {
+ if (alpha != 0xFF)
+ {
+ if (alpha == 0x00 && transparency <= Transparency.BITMASK)
+ {
+ transparency = Transparency.BITMASK;
+ }
+ else if (transparency < Transparency.TRANSLUCENT)
+ {
+ transparency = Transparency.TRANSLUCENT;
+ }
+ }
+ return transparency;
+ }
+
+ public void imageComplete(int status)
+ {
+ image.notifyObservers(ImageObserver.ALLBITS, 0, 0, width, height);
+ }
+
+ public void setTargetColorModel(ColorModel model)
+ {
+ targetColorModel = model;
+ }
+
+ public Image getImage()
+ {
+ return image;
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
index 15ec90da1c0..36ba0f4304c 100644
--- a/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java
@@ -37,6 +37,8 @@ exception statement from your version. */
package gnu.java.awt.java2d;
+import gnu.java.util.LRUCache;
+
import java.awt.AWTError;
import java.awt.AlphaComposite;
import java.awt.AWTPermission;
@@ -80,7 +82,9 @@ import java.awt.image.SampleModel;
import java.awt.image.WritableRaster;
import java.awt.image.renderable.RenderableImage;
import java.text.AttributedCharacterIterator;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.Map;
/**
@@ -152,22 +156,46 @@ public abstract class AbstractGraphics2D
{
/**
+ * Wether we use anti aliasing for rendering text by default or not.
+ */
+ private static final boolean DEFAULT_TEXT_AA =
+ Boolean.getBoolean("gnu.java2d.default_text_aa");
+
+ /**
* The default font to use on the graphics object.
*/
private static final Font FONT = new Font("SansSerif", Font.PLAIN, 12);
/**
+ * The size of the LRU cache used for caching GlyphVectors.
+ */
+ private static final int GV_CACHE_SIZE = 50;
+
+ /**
* Caches certain shapes to avoid massive creation of such Shapes in
* the various draw* and fill* methods.
*/
- private static final ThreadLocal<ShapeCache> shapeCache =
- new ThreadLocal<ShapeCache>();
+ private static final ShapeCache shapeCache = new ShapeCache();
+
+ /**
+ * A pool of scanline converters. It is important to reuse scanline
+ * converters because they keep their datastructures in place. We pool them
+ * for use in multiple threads.
+ */
+ private static final LinkedList<ScanlineConverter> scanlineConverters =
+ new LinkedList<ScanlineConverter>();
+
+ /**
+ * Caches glyph vectors for better drawing performance.
+ */
+ private static final Map<TextCacheKey,GlyphVector> gvCache =
+ Collections.synchronizedMap(new LRUCache<TextCacheKey,GlyphVector>(GV_CACHE_SIZE));
/**
- * The scanline converters by thread.
+ * This key is used to search in the gvCache without allocating a new
+ * key each time.
*/
- private static final ThreadLocal<ScanlineConverter> scanlineConverters =
- new ThreadLocal<ScanlineConverter>();
+ private static final TextCacheKey searchTextKey = new TextCacheKey();
/**
* The transformation for this Graphics2D instance
@@ -484,14 +512,25 @@ public abstract class AbstractGraphics2D
*/
public void drawString(String text, int x, int y)
{
- if (isOptimized)
- rawDrawString(text, x, y);
- else
+ GlyphVector gv;
+ synchronized (searchTextKey)
{
- FontRenderContext ctx = getFontRenderContext();
- GlyphVector gv = font.createGlyphVector(ctx, text.toCharArray());
- drawGlyphVector(gv, x, y);
+ TextCacheKey tck = searchTextKey;
+ FontRenderContext frc = getFontRenderContext();
+ tck.setString(text);
+ tck.setFont(font);
+ tck.setFontRenderContext(frc);
+ if (gvCache.containsKey(tck))
+ {
+ gv = gvCache.get(tck);
+ }
+ else
+ {
+ gv = font.createGlyphVector(frc, text.toCharArray());
+ gvCache.put(new TextCacheKey(text, font, frc), gv);
+ }
}
+ drawGlyphVector(gv, x, y);
}
/**
@@ -949,7 +988,10 @@ public abstract class AbstractGraphics2D
public FontRenderContext getFontRenderContext()
{
- return new FontRenderContext(transform, false, true);
+ // Protect our own transform from beeing modified.
+ AffineTransform tf = new AffineTransform(transform);
+ // TODO: Determine antialias and fractionalmetrics parameters correctly.
+ return new FontRenderContext(tf, false, true);
}
/**
@@ -992,8 +1034,10 @@ public abstract class AbstractGraphics2D
// Copy the clip. If it's a Rectangle, preserve that for optimization.
if (clip instanceof Rectangle)
copy.clip = new Rectangle((Rectangle) clip);
- else
+ else if (clip != null)
copy.clip = new GeneralPath(clip);
+ else
+ copy.clip = null;
copy.renderingHints = new RenderingHints(null);
copy.renderingHints.putAll(renderingHints);
@@ -1163,7 +1207,7 @@ public abstract class AbstractGraphics2D
}
else
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.line == null)
sc.line = new Line2D.Float();
sc.line.setLine(x1, y1, x2, y2);
@@ -1175,11 +1219,13 @@ public abstract class AbstractGraphics2D
{
if (isOptimized)
{
- rawDrawRect(x, y, w, h);
+ int tx = (int) transform.getTranslateX();
+ int ty = (int) transform.getTranslateY();
+ rawDrawRect(x + tx, y + ty, w, h);
}
else
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.rect == null)
sc.rect = new Rectangle();
sc.rect.setBounds(x, y, w, h);
@@ -1204,7 +1250,7 @@ public abstract class AbstractGraphics2D
}
else
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.rect == null)
sc.rect = new Rectangle();
sc.rect.setBounds(x, y, width, height);
@@ -1249,7 +1295,7 @@ public abstract class AbstractGraphics2D
public void drawRoundRect(int x, int y, int width, int height, int arcWidth,
int arcHeight)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.roundRect == null)
sc.roundRect = new RoundRectangle2D.Float();
sc.roundRect.setRoundRect(x, y, width, height, arcWidth, arcHeight);
@@ -1269,7 +1315,7 @@ public abstract class AbstractGraphics2D
public void fillRoundRect(int x, int y, int width, int height, int arcWidth,
int arcHeight)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.roundRect == null)
sc.roundRect = new RoundRectangle2D.Float();
sc.roundRect.setRoundRect(x, y, width, height, arcWidth, arcHeight);
@@ -1286,7 +1332,7 @@ public abstract class AbstractGraphics2D
*/
public void drawOval(int x, int y, int width, int height)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.ellipse == null)
sc.ellipse = new Ellipse2D.Float();
sc.ellipse.setFrame(x, y, width, height);
@@ -1303,7 +1349,7 @@ public abstract class AbstractGraphics2D
*/
public void fillOval(int x, int y, int width, int height)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.ellipse == null)
sc.ellipse = new Ellipse2D.Float();
sc.ellipse.setFrame(x, y, width, height);
@@ -1316,7 +1362,7 @@ public abstract class AbstractGraphics2D
public void drawArc(int x, int y, int width, int height, int arcStart,
int arcAngle)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.arc == null)
sc.arc = new Arc2D.Float();
sc.arc.setArc(x, y, width, height, arcStart, arcAngle, Arc2D.OPEN);
@@ -1329,7 +1375,7 @@ public abstract class AbstractGraphics2D
public void fillArc(int x, int y, int width, int height, int arcStart,
int arcAngle)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.arc == null)
sc.arc = new Arc2D.Float();
sc.arc.setArc(x, y, width, height, arcStart, arcAngle, Arc2D.PIE);
@@ -1338,7 +1384,7 @@ public abstract class AbstractGraphics2D
public void drawPolyline(int[] xPoints, int[] yPoints, int npoints)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.polyline == null)
sc.polyline = new GeneralPath();
GeneralPath p = sc.polyline;
@@ -1355,7 +1401,7 @@ public abstract class AbstractGraphics2D
*/
public void drawPolygon(int[] xPoints, int[] yPoints, int npoints)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.polygon == null)
sc.polygon = new Polygon();
sc.polygon.reset();
@@ -1370,7 +1416,7 @@ public abstract class AbstractGraphics2D
*/
public void fillPolygon(int[] xPoints, int[] yPoints, int npoints)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.polygon == null)
sc.polygon = new Polygon();
sc.polygon.reset();
@@ -1559,8 +1605,9 @@ public abstract class AbstractGraphics2D
{
Object v = renderingHints.get(RenderingHints.KEY_TEXT_ANTIALIASING);
// We default to antialiasing for text rendering.
- antialias = (v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON
- || v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
+ antialias = v == RenderingHints.VALUE_TEXT_ANTIALIAS_ON
+ || (v == RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT
+ && DEFAULT_TEXT_AA);
}
else
{
@@ -1569,12 +1616,15 @@ public abstract class AbstractGraphics2D
}
ScanlineConverter sc = getScanlineConverter();
int resolution = 0;
+ int yRes = 0;
if (antialias)
{
// Adjust resolution according to rendering hints.
resolution = 2;
+ yRes = 4;
}
- sc.renderShape(this, s, clip, transform, resolution, renderingHints);
+ sc.renderShape(this, s, clip, transform, resolution, yRes, renderingHints);
+ freeScanlineConverter(sc);
}
/**
@@ -1606,7 +1656,7 @@ public abstract class AbstractGraphics2D
*/
protected void rawDrawLine(int x0, int y0, int x1, int y1)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.line == null)
sc.line = new Line2D.Float();
sc.line.setLine(x0, y0, x1, y1);
@@ -1615,7 +1665,7 @@ public abstract class AbstractGraphics2D
protected void rawDrawRect(int x, int y, int w, int h)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.rect == null)
sc.rect = new Rectangle();
sc.rect.setBounds(x, y, w, h);
@@ -1623,22 +1673,6 @@ public abstract class AbstractGraphics2D
}
/**
- * Draws a string in optimization mode. The implementation should respect the
- * clip and translation. It can assume that the clip is a rectangle and that
- * the transform is only a translating transform.
- *
- * @param text the string to be drawn
- * @param x the start of the baseline, X coordinate
- * @param y the start of the baseline, Y coordinate
- */
- protected void rawDrawString(String text, int x, int y)
- {
- FontRenderContext ctx = getFontRenderContext();
- GlyphVector gv = font.createGlyphVector(ctx, text.toCharArray());
- drawGlyphVector(gv, x, y);
- }
-
- /**
* Clears a rectangle in optimization mode. The implementation should respect the
* clip and translation. It can assume that the clip is a rectangle and that
* the transform is only a translating transform.
@@ -1667,7 +1701,7 @@ public abstract class AbstractGraphics2D
*/
protected void rawFillRect(int x, int y, int w, int h)
{
- ShapeCache sc = getShapeCache();
+ ShapeCache sc = shapeCache;
if (sc.rect == null)
sc.rect = new Rectangle();
sc.rect.setBounds(x, y, w, h);
@@ -1918,35 +1952,38 @@ public abstract class AbstractGraphics2D
}
/**
- * Returns the ShapeCache for the calling thread.
+ * Returns a free scanline converter from the pool.
*
- * @return the ShapeCache for the calling thread
+ * @return a scanline converter
*/
- private ShapeCache getShapeCache()
+ private ScanlineConverter getScanlineConverter()
{
- ShapeCache sc = shapeCache.get();
- if (sc == null)
+ synchronized (scanlineConverters)
{
- sc = new ShapeCache();
- shapeCache.set(sc);
+ ScanlineConverter sc;
+ if (scanlineConverters.size() > 0)
+ {
+ sc = scanlineConverters.removeFirst();
+ }
+ else
+ {
+ sc = new ScanlineConverter();
+ }
+ return sc;
}
- return sc;
}
/**
- * Returns the scanline converter for this thread.
+ * Puts a scanline converter back in the pool.
*
- * @return the scanline converter for this thread
+ * @param sc
*/
- private ScanlineConverter getScanlineConverter()
+ private void freeScanlineConverter(ScanlineConverter sc)
{
- ScanlineConverter sc = scanlineConverters.get();
- if (sc == null)
+ synchronized (scanlineConverters)
{
- sc = new ScanlineConverter();
- scanlineConverters.set(sc);
+ scanlineConverters.addLast(sc);
}
- return sc;
}
}
diff --git a/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java b/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java
new file mode 100644
index 00000000000..c83ad1fff8f
--- /dev/null
+++ b/libjava/classpath/gnu/java/awt/java2d/PixelCoverage.java
@@ -0,0 +1,132 @@
+package gnu.java.awt.java2d;
+
+/**
+ * Stores and handles the pixel converage for a scanline. The pixel coverage
+ * is stored as sorted list of buckets, each of which holds information about
+ * the coverage for the X and Y axis. This is utilized to compute the actual
+ * coverage for each pixel on the scanline and finding chunks of pixels with
+ * equal coverage.
+ */
+final class PixelCoverage
+{
+
+ /**
+ * One bucket in the list.
+ */
+ private static final class Bucket
+ {
+ /**
+ * The X coordinate on the scanline to which this bucket belongs.
+ */
+ int xPos;
+
+ /**
+ * The X coverage.
+ */
+ int xCov;
+
+ /**
+ * The Y coverage.
+ */
+ int yCov;
+
+ /**
+ * Implements a linked list. This points to the next element of the list.
+ */
+ Bucket next;
+
+ /**
+ * Implements a linked list. This points to the previous element of the
+ * list.
+ */
+ Bucket prev;
+ }
+
+ /**
+ * The head of the sorted list of buckets.
+ */
+ private Bucket head;
+
+ /**
+ * The current bucket. We make use of the fact that the scanline converter
+ * always scans the scanline (and thus this list) from left to right to
+ * quickly find buckets or insertion points.
+ */
+ private Bucket current;
+
+ /**
+ * The bucket after the last valid bucket. Unused buckets are not thrown
+ * away and garbage collected. Instead, we keep them at the tail of the list
+ * and reuse them when necessary.
+ */
+ private Bucket last;
+
+ /**
+ * Indicates the the next scan of the scanline begins and that the next
+ * request will be at the beginning of this list. This makes searching and
+ * sorting of this list very quick.
+ */
+ void rewind()
+ {
+ current = head;
+ }
+
+ /**
+ * Clears the list. This does not throw away the old buckets but only
+ * resets the end-pointer of the list to the first element. All buckets are
+ * then unused and are reused when the list is filled again.
+ */
+ void clear()
+ {
+ last = head;
+ }
+
+ /**
+ * This adds the specified x and y coverage to the pixel at the specified
+ * X position.
+ *
+ * @param x the X position
+ * @param xc the x coverage
+ * @param yc the y coverage
+ */
+ void add(int x, int xc, int yc)
+ {
+ Bucket bucket = findOrInsert(x);
+ bucket.xCov += xc;
+ bucket.yCov += yc;
+ }
+
+ /**
+ * Finds the bucket in the list with the specified X coordinate.
+ * If no such bucket is found, then a new one is fetched (either a cached
+ * bucket from the end of the list or a newly allocated one) inserted at the
+ * correct position and returned.
+ *
+ * @param x the X coordinate
+ *
+ * @return a bucket to hold the coverage data
+ */
+ private Bucket findOrInsert(int x)
+ {
+ // First search for a matching bucket.
+ if (head == null)
+ {
+ // Special case: the list is still empty.
+ head = new Bucket();
+ current = head;
+ return head;
+ }
+
+ // This performs a linear search, starting from the current bucket.
+ // This is reasonably efficient because access to this list is always done
+ // in a linear fashion and we are not more then 1 or 2 buckets away from
+ // the one we're looking for.
+ Bucket match = current;
+ while (match != null && match.xPos != x)
+ {
+
+ }
+
+ return match;
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java b/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java
index 2693a0b70c7..cc4bbef28c0 100644
--- a/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java
+++ b/libjava/classpath/gnu/java/awt/java2d/ScanlineConverter.java
@@ -62,11 +62,6 @@ public final class ScanlineConverter
private static int ONE = Fixed.fixedValue(FIXED_DIGITS, 1);
/**
- * The number of significant bits for the Y resolution.
- */
- private static int Y_RESOLUTION = 4;
-
- /**
* The actual number of scanlines.
*/
private int numScanlines;
@@ -94,6 +89,11 @@ public final class ScanlineConverter
private int resolution;
/**
+ * The number of significant bits for the 'Y' resolution.
+ */
+ private int yResolution;
+
+ /**
* One half step according to the resolution. This is stored to avoid
* unnecessary operations during rendering.
*/
@@ -145,14 +145,15 @@ public final class ScanlineConverter
* @param trans the transform
*/
public void renderShape(Pixelizer p, Shape shape, Shape clip,
- AffineTransform trans, int res, RenderingHints hints)
+ AffineTransform trans, int res, int yRes,
+ RenderingHints hints)
{
// TODO: Do something useful with the rendering hints. Like, adjusting
// the resolution.
// Prepare resolution and upper bounds.
clear();
- setResolution(res);
+ setResolution(res, yRes);
boolean haveClip = clip != null;
@@ -278,10 +279,10 @@ public final class ScanlineConverter
int frac0 = ONE - Fixed.trunc(FIXED_DIGITS, x0);
int frac1 = ONE - Fixed.trunc(FIXED_DIGITS, x1);
// Only keep the first 4 digits after the point.
- frac0 = frac0 >> (FIXED_DIGITS - Y_RESOLUTION);
- frac1 = frac1 >> (FIXED_DIGITS - Y_RESOLUTION);
- scanlineCoverage.add(pix0, 1 * (1 << Y_RESOLUTION), frac0);
- scanlineCoverage.add(pix1, -1 * (1 << Y_RESOLUTION), -frac1);
+ frac0 = frac0 >> (FIXED_DIGITS - yResolution);
+ frac1 = frac1 >> (FIXED_DIGITS - yResolution);
+ scanlineCoverage.add(pix0, 1 * (1 << yResolution), frac0);
+ scanlineCoverage.add(pix1, -1 * (1 << yResolution), -frac1);
}
if (edge.isClip)
inClip = ! inClip;
@@ -306,14 +307,16 @@ public final class ScanlineConverter
*
* @param res the resolution
*/
- private void setResolution(int res)
+ private void setResolution(int res, int yRes)
{
int scanlinesPerPixel = 1 << res;
int one = Fixed.fixedValue(FIXED_DIGITS, 1);
resolution = one / (scanlinesPerPixel);
halfStep = resolution / 2;
- scanlineCoverage.setMaxCoverage(scanlinesPerPixel << Y_RESOLUTION);
+ scanlineCoverage.setMaxCoverage(scanlinesPerPixel << yResolution);
+
+ yResolution = yRes;
}
/**
diff --git a/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java b/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java
index 6db7fb01988..deb603bcb51 100644
--- a/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java
+++ b/libjava/classpath/gnu/java/awt/java2d/ScanlineCoverage.java
@@ -157,7 +157,7 @@ public final class ScanlineCoverage
* A data object that carries information about pixel coverage on a scanline.
* The data consists of a starting X position on the scanline, the
* length of the range in pixels and the actual coverage value.
-´ */
+ **/
public static final class Range
{
/**
diff --git a/libjava/classpath/gnu/java/awt/java2d/ShapeWrapper.java b/libjava/classpath/gnu/java/awt/java2d/ShapeWrapper.java
new file mode 100644
index 00000000000..f4e77f450d0
--- /dev/null
+++ b/libjava/classpath/gnu/java/awt/java2d/ShapeWrapper.java
@@ -0,0 +1,119 @@
+/* ShapeWrapper.java -- Protects shapes by wrapping them
+ Copyright (C) 2007 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 gnu.java.awt.java2d;
+
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/**
+ * Protects any other shape from beeing modified by wrapping it.
+ */
+public class ShapeWrapper
+ implements Shape
+{
+
+ /**
+ * The shape to be protected.
+ */
+ private Shape shape;
+
+ /**
+ * Creates a new ShapeWrapper.
+ *
+ * @param other the shape to be protected
+ */
+ public ShapeWrapper(Shape other)
+ {
+ shape = other;
+ }
+
+ public boolean contains(double x, double y)
+ {
+ return shape.contains(x, y);
+ }
+
+ public boolean contains(Point2D p)
+ {
+ return shape.contains(p);
+ }
+
+ public boolean contains(double x, double y, double w, double h)
+ {
+ return shape.contains(x, y, w, h);
+ }
+
+ public boolean contains(Rectangle2D r)
+ {
+ return shape.contains(r);
+ }
+
+ public Rectangle getBounds()
+ {
+ return shape.getBounds();
+ }
+
+ public Rectangle2D getBounds2D()
+ {
+ return shape.getBounds2D();
+ }
+
+ public PathIterator getPathIterator(AffineTransform transform)
+ {
+ return shape.getPathIterator(transform);
+ }
+
+ public PathIterator getPathIterator(AffineTransform transform, double flatness)
+ {
+ return shape.getPathIterator(transform, flatness);
+ }
+
+ public boolean intersects(double x, double y, double w, double h)
+ {
+ return shape.intersects(x, y, w, h);
+ }
+
+ public boolean intersects(Rectangle2D r)
+ {
+ return shape.intersects(r);
+ }
+
+}
diff --git a/libjava/classpath/gnu/java/awt/java2d/TextCacheKey.java b/libjava/classpath/gnu/java/awt/java2d/TextCacheKey.java
new file mode 100644
index 00000000000..0a60c622676
--- /dev/null
+++ b/libjava/classpath/gnu/java/awt/java2d/TextCacheKey.java
@@ -0,0 +1,153 @@
+/* TextCacheKey.java -- Key to use for caching texts with their rendered layout
+ Copyright (C) 2007 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 gnu.java.awt.java2d;
+
+import java.awt.Font;
+import java.awt.font.FontRenderContext;
+
+/**
+ * A key object to be used when caching pre-rendered text.
+ */
+public class TextCacheKey
+{
+
+ /**
+ * The actual string.
+ */
+ private String string;
+
+ /**
+ * The font render context.
+ */
+ private FontRenderContext fontRenderContext;
+
+ /**
+ * The font.
+ */
+ private Font font;
+
+ /**
+ * Creates a new TextCacheKey.
+ *
+ * This is intended to be used as search key. It is important to initialize
+ * the values using the setter methods before using this key, otherwise
+ * it will throw NPEs.
+ */
+ public TextCacheKey()
+ {
+ // No-arg constructor.
+ }
+
+ /**
+ * Creates a new TextCacheKey with initial values.
+ *
+ * @param s the string
+ * @param f the font
+ * @param frc the font render context
+ */
+ public TextCacheKey(String s, Font f, FontRenderContext frc)
+ {
+ string = s;
+ font = f;
+ fontRenderContext = frc;
+ }
+
+ /**
+ * Re-sets the string. This is intented to be used in search keys only.
+ *
+ * @param s the string to set
+ */
+ public void setString(String s)
+ {
+ string = s;
+ }
+
+ /**
+ * Sets the font render context.
+ * This is intented to be used in search keys only.
+ *
+ * @param frc the new font render context
+ */
+ public void setFontRenderContext(FontRenderContext frc)
+ {
+ fontRenderContext = frc;
+ }
+
+ /**
+ * Sets the font.
+ * This is intented to be used in search keys only.
+ *
+ * @param f the font to set
+ */
+ public void setFont(Font f)
+ {
+ font = f;
+ }
+
+ /**
+ * Determines if two objects are equal.
+ *
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object o)
+ {
+ boolean eq;
+ if (o instanceof TextCacheKey)
+ {
+ TextCacheKey other = (TextCacheKey) o;
+ eq = other.string.equals(string)
+ && other.font.equals(font)
+ && other.fontRenderContext.equals(fontRenderContext);
+ }
+ else
+ {
+ eq = false;
+ }
+ return eq;
+ }
+
+ /**
+ * Computes a hashcode for this key.
+ *
+ * @see Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return string.hashCode() ^ font.hashCode() ^ fontRenderContext.hashCode();
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java b/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java
index 676bd891758..30dd89ba7b2 100644
--- a/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/KDEDesktopPeer.java
@@ -37,10 +37,8 @@
package gnu.java.awt.peer;
-import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URI;
/**
* @author Mario Torre <neugens@limasoftware.net>
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
index db8acd1cda0..fcd3f6acd92 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.classpath.Configuration;
+
import gnu.java.awt.ClasspathToolkit;
import java.awt.AWTPermission;
@@ -120,7 +122,10 @@ public abstract class CairoGraphics2D extends Graphics2D
{
static
{
- System.loadLibrary("gtkpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
}
/**
@@ -222,7 +227,7 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Sets up the default values and allocates the native cairographics2d structure
- * @param cairo_t_pointer, a native pointer to a cairo_t of the context.
+ * @param cairo_t_pointer a native pointer to a cairo_t of the context.
*/
public void setup(long cairo_t_pointer)
{
@@ -341,7 +346,8 @@ public abstract class CairoGraphics2D extends Graphics2D
/**
* Draw pixels as an RGBA int matrix
- * @param w, h - width and height
+ * @param w - width
+ * @param h - height
* @param stride - stride of the array width
* @param i2u - affine transform array
*/
@@ -2113,10 +2119,10 @@ public abstract class CairoGraphics2D extends Graphics2D
private static Rectangle computeIntersection(int x, int y, int w, int h,
Rectangle rect)
{
- int x2 = (int) rect.x;
- int y2 = (int) rect.y;
- int w2 = (int) rect.width;
- int h2 = (int) rect.height;
+ int x2 = rect.x;
+ int y2 = rect.y;
+ int w2 = rect.width;
+ int h2 = rect.height;
int dx = (x > x2) ? x : x2;
int dy = (y > y2) ? y : y2;
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
index b45a79fd6e7..6c8a30d1143 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoSurface.java
@@ -43,9 +43,7 @@ import gnu.java.awt.Buffers;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
-import java.awt.Shape;
import java.awt.color.ColorSpace;
-import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
@@ -102,7 +100,8 @@ public class CairoSurface extends WritableRaster
0x000000FF);
/**
* Allocates and clears the buffer and creates the cairo surface.
- * @param width, height - the image size
+ * @param width - the image size
+ * @param height - the image size
* @param stride - the buffer row stride. (in ints)
*/
private native void create(int width, int height, int stride, int[] buf);
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
index 4ce20a30d32..bfa3bc96ac3 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/ComponentGraphics.java
@@ -153,7 +153,7 @@ public class ComponentGraphics extends CairoGraphics2D
/**
* Creates a cairo_t for a volatile image
*/
- protected native long initFromVolatile( long pixmapPtr, int width, int height);
+ protected native long initFromVolatile( long pixmapPtr);
/**
* Grab lock
@@ -938,4 +938,4 @@ public class ComponentGraphics extends CairoGraphics2D
unlock();
}
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
index 95a806ac7ee..403671cc63e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkFontPeer.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.classpath.Configuration;
import gnu.classpath.Pointer;
import gnu.java.awt.ClasspathToolkit;
@@ -166,7 +167,10 @@ public class GdkFontPeer extends ClasspathFontPeer
static
{
- System.loadLibrary("gtkpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
initStaticState ();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
index d06af84433f..980866c4b67 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.classpath.Configuration;
import gnu.java.awt.ClasspathGraphicsEnvironment;
import java.awt.Font;
@@ -72,7 +73,10 @@ public class GdkGraphicsEnvironment extends ClasspathGraphicsEnvironment
static
{
- System.loadLibrary("gtkpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
GtkToolkit.initializeGlobalIDs();
initIDs();
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
index e52bf050c09..dbf4a2018c1 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkPixbufDecoder.java
@@ -68,13 +68,17 @@ import javax.imageio.spi.ImageWriterSpi;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageOutputStream;
+import gnu.classpath.Configuration;
import gnu.classpath.Pointer;
public class GdkPixbufDecoder extends gnu.java.awt.image.ImageDecoder
{
static
{
- System.loadLibrary("gtkpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
initStaticState ();
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
index 7ef4645a257..9ce0b96dac3 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java
@@ -46,6 +46,7 @@ import java.awt.Rectangle;
import java.awt.Window;
import java.util.ArrayList;
+import gnu.classpath.Configuration;
import gnu.classpath.Pointer;
class GdkScreenGraphicsDevice extends GraphicsDevice
@@ -98,7 +99,11 @@ class GdkScreenGraphicsDevice extends GraphicsDevice
static
{
- System.loadLibrary("gtkpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
+
GtkToolkit.initializeGlobalIDs();
initIDs();
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index f658c17afbb..4b8fc128cb7 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -105,7 +105,9 @@ public class GtkComponentPeer extends GtkGenericPeer
native void gtkWidgetGetDimensions (int[] dim);
native void gtkWidgetGetPreferredDimensions (int[] dim);
native void gtkWindowGetLocationOnScreen (int[] point);
+ native void gtkWindowGetLocationOnScreenUnlocked (int[] point);
native void gtkWidgetGetLocationOnScreen (int[] point);
+ native void gtkWidgetGetLocationOnScreenUnlocked (int[] point);
native void gtkWidgetSetCursor (int type, GtkImage image, int x, int y);
native void gtkWidgetSetCursorUnlocked (int type, GtkImage image,
int x, int y);
@@ -250,7 +252,10 @@ public class GtkComponentPeer extends GtkGenericPeer
public Point getLocationOnScreen ()
{
int point[] = new int[2];
- gtkWidgetGetLocationOnScreen (point);
+ if (Thread.currentThread() == GtkMainThread.mainThread)
+ gtkWidgetGetLocationOnScreenUnlocked (point);
+ else
+ gtkWidgetGetLocationOnScreen (point);
return new Point (point[0], point[1]);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
index 4278a4579e4..87dbd5e0f56 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -87,7 +87,7 @@ public class GtkFramePeer extends GtkWindowPeer
{
// We're adding a menubar where there was no menubar before.
gtkFixedSetVisible (false);
- menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
+ menuBar = (MenuBarPeer) bar.getPeer();
setMenuBarPeer (menuBar);
int menuBarWidth =
awtComponent.getWidth () - insets.left - insets.right;
@@ -109,7 +109,7 @@ public class GtkFramePeer extends GtkWindowPeer
int oldHeight = menuBarHeight;
int menuBarWidth =
awtComponent.getWidth () - insets.left - insets.right;
- menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer ();
+ menuBar = (MenuBarPeer) bar.getPeer ();
setMenuBarPeer (menuBar);
if (menuBarWidth > 0)
setMenuBarWidth (menuBar, menuBarWidth);
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMainThread.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMainThread.java
index e40a04eed92..0ee61df84b7 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkMainThread.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkMainThread.java
@@ -134,7 +134,7 @@ public class GtkMainThread extends Thread
}
}
GtkGenericPeer.q()
- .postEvent(new NativeEventLoopRunningEvent(new Boolean(true)));
+ .postEvent(new NativeEventLoopRunningEvent(Boolean.TRUE));
}
}
}
@@ -161,7 +161,7 @@ public class GtkMainThread extends Thread
}
}
GtkGenericPeer.q()
- .postEvent(new NativeEventLoopRunningEvent(new Boolean(false)));
+ .postEvent(new NativeEventLoopRunningEvent(Boolean.FALSE));
}
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
index dc9c7155e6e..486304ef010 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkToolkit.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import gnu.classpath.Configuration;
+
import gnu.java.awt.AWTUtilities;
import gnu.java.awt.EmbeddedWindow;
import gnu.java.awt.dnd.GtkMouseDragGestureRecognizer;
@@ -170,7 +172,10 @@ public class GtkToolkit extends gnu.java.awt.ClasspathToolkit
static
{
- System.loadLibrary("gtkpeer");
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("gtkpeer");
+ }
/**
* Gotta do that first.
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
index 5dc4b2e5b37..9744c3a532e 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/GtkWindowPeer.java
@@ -396,7 +396,10 @@ public class GtkWindowPeer extends GtkContainerPeer
public Point getLocationOnScreen()
{
int point[] = new int[2];
- gtkWindowGetLocationOnScreen(point);
+ if (Thread.currentThread() == GtkMainThread.mainThread)
+ gtkWindowGetLocationOnScreenUnlocked(point);
+ else
+ gtkWindowGetLocationOnScreen(point);
return new Point(point[0], point[1]);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java b/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java
index ad5cd5ecdf2..b5858f90595 100644
--- a/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java
+++ b/libjava/classpath/gnu/java/awt/peer/gtk/VolatileImageGraphics.java
@@ -68,14 +68,14 @@ public class VolatileImageGraphics extends ComponentGraphics
public VolatileImageGraphics(GtkVolatileImage img)
{
this.owner = img;
- cairo_t = initFromVolatile( owner.nativePointer, img.width, img.height );
+ cairo_t = initFromVolatile( owner.nativePointer );
setup( cairo_t );
}
private VolatileImageGraphics(VolatileImageGraphics copy)
{
this.owner = copy.owner;
- cairo_t = initFromVolatile(owner.nativePointer, owner.width, owner.height);
+ cairo_t = initFromVolatile(owner.nativePointer);
copy( copy, cairo_t );
}
diff --git a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java
index 7457c38d2ff..87324c71043 100644
--- a/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/qt/QtMenuPeer.java
@@ -74,7 +74,7 @@ public class QtMenuPeer extends QtMenuComponentPeer implements MenuPeer
Menu o = (Menu)owner;
for( int i=0; i < o.getItemCount(); i++ )
{
- MenuItem ci = (MenuItem)o.getItem(i);
+ MenuItem ci = o.getItem(i);
if (ci instanceof Menu && ci.getPeer() != null)
((QtMenuPeer)ci.getPeer()).addItems();
addItem( ci );
diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java
index a8e3cb01bab..03d6388e9f2 100755
--- a/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingCheckboxPeer.java
@@ -37,16 +37,12 @@ exception statement from your version. */
package gnu.java.awt.peer.swing;
-import java.awt.Button;
import java.awt.Checkbox;
import java.awt.CheckboxGroup;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Image;
-import java.awt.Label;
import java.awt.Point;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
@@ -56,7 +52,6 @@ import java.awt.peer.CheckboxPeer;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
-import javax.swing.JLabel;
import javax.swing.JToggleButton;
/**
diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java
index bd9dcd77aaa..0033efb025f 100644
--- a/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingMenuBarPeer.java
@@ -174,7 +174,7 @@ public class SwingMenuBarPeer
/**
* Adds a help menu to the menu bar.
*
- * @param m the menu to add
+ * @param menu the menu to add
*/
public void addHelpMenu(Menu menu)
{
diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java
index 2c438a1ccb1..5be82f69593 100644
--- a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextAreaPeer.java
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.java.awt.peer.swing;
-import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
diff --git a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java
index 29a689da42a..28dc5f339bf 100644
--- a/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/swing/SwingTextFieldPeer.java
@@ -36,7 +36,6 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package gnu.java.awt.peer.swing;
-import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -328,7 +327,7 @@ public class SwingTextFieldPeer
* @param startPos the start index of the selection
* @param endPos the start index of the selection
*/
- public void select(int start_pos, int endPos)
+ public void select(int startPos, int endPos)
{
// TODO: Must be implemented.
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java b/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java
deleted file mode 100644
index 6d32448eece..00000000000
--- a/libjava/classpath/gnu/java/awt/peer/x/ImageConverter.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/* ImageConverter.java -- Convert arbitrary Image impl to XImage
- Copyright (C) 2006 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 gnu.java.awt.peer.x;
-
-import java.awt.Color;
-import java.awt.Graphics;
-import java.awt.image.ColorModel;
-import java.awt.image.ImageConsumer;
-import java.util.Hashtable;
-
-/**
- * Convert a non-XImage to an XImage.
- *
- * @author Roman Kennke (kennke@aicas.com)
- */
-public class ImageConverter implements ImageConsumer
-{
-
- private XImage image;
- private Graphics imageGraphics;
-
- public void setDimensions(int width, int height)
- {
- image = new XImage(width, height);
- }
-
- public void setProperties(Hashtable props)
- {
- // Ignore for now.
- }
-
- public void setColorModel(ColorModel model)
- {
- // Ignore for now.
- }
-
- public void setHints(int flags)
- {
- // Ignore for now.
- }
-
- public void setPixels(int x, int y, int w, int h, ColorModel model,
- byte[] pixels, int offset, int scansize)
- {
- // FIXME: Implement this.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- public void setPixels(int x, int y, int w, int h, ColorModel model,
- int[] pixels, int offset, int scansize)
- {
- System.err.println("transferType: " + model.getTransferType());
- System.err.println("colorModel: " + model);
- if (imageGraphics == null)
- imageGraphics = image.getGraphics();
- int xend = x + w;
- int yend = y + h;
- for (int yy = y; yy < yend; yy++)
- {
- for (int xx = x; xx < xend; xx++)
- {
- int pixel = pixels[yy * scansize + xx + offset];
- imageGraphics.setColor(new Color(model.getRGB(pixel)));
- imageGraphics.fillRect(xx, yy, 1, 1);
- }
- }
- }
-
- public void imageComplete(int status)
- {
- // Nothing to do here.
- }
-
- XImage getXImage()
- {
- return image;
- }
-}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java b/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java
index d376619c595..7f984353316 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XEventPump.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Window;
@@ -223,16 +224,21 @@ public class XEventPump
System.err.println("resize request for window id: " + key);
// Detect and report size changes.
- if (c.width() != awtWindow.getWidth()
- || c.height() != awtWindow.getHeight())
+ XWindowPeer xwindow = (XWindowPeer) awtWindow.getPeer();
+ Insets i = xwindow.insets();
+ if (c.width() != awtWindow.getWidth() - i.left - i.right
+ || c.height() != awtWindow.getHeight() - i.top - i.bottom)
{
if (XToolkit.DEBUG)
System.err.println("Setting size on AWT window: " + c.width()
+ ", " + c.height() + ", " + awtWindow.getWidth()
+ ", " + awtWindow.getHeight());
- ((XWindowPeer) awtWindow.getPeer()).callback = true;
- awtWindow.setSize(c.width(), c.height());
- ((XWindowPeer) awtWindow.getPeer()).callback = false;
+ xwindow.callback = true;
+ xwindow.xwindow.width = c.width();
+ xwindow.xwindow.height = c.height();
+ awtWindow.setSize(c.width() + i.left + i.right,
+ c.height() + i.top + i.bottom);
+ xwindow.callback = false;
}
break;
case Expose.CODE:
@@ -245,6 +251,7 @@ public class XEventPump
exp.height());
//System.err.println("expose paint: " + r);
// We need to clear the background of the exposed rectangle.
+ assert awtWindow != null : "awtWindow == null for window ID: " + key;
Graphics g = awtWindow.getGraphics();
g.clearRect(r.x, r.y, r.width, r.height);
g.dispose();
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java b/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java
new file mode 100644
index 00000000000..0a96a613b4e
--- /dev/null
+++ b/libjava/classpath/gnu/java/awt/peer/x/XFontPeer.java
@@ -0,0 +1,768 @@
+/* XFontPeer.java -- The font peer for X
+ Copyright (C) 2006 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 gnu.java.awt.peer.x;
+
+import java.awt.AWTError;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.LineMetrics;
+import java.awt.font.TextAttribute;
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.CharacterIterator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Properties;
+
+import gnu.java.awt.peer.ClasspathFontPeer;
+import gnu.x11.Display;
+import gnu.x11.Fontable;
+
+/**
+ * The bridge from AWT to X fonts.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class XFontPeer
+ extends ClasspathFontPeer
+{
+
+ /**
+ * The font mapping as specified in the file fonts.properties.
+ */
+ private static Properties fontProperties;
+ static
+ {
+ fontProperties = new Properties();
+ InputStream in = XFontPeer.class.getResourceAsStream("xfonts.properties");
+ try
+ {
+ fontProperties.load(in);
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * The FontMetrics implementation for XFontPeer.
+ */
+ private class XFontMetrics
+ extends FontMetrics
+ {
+ /**
+ * The ascent of the font.
+ */
+ int ascent;
+
+ /**
+ * The descent of the font.
+ */
+ int descent;
+
+ /**
+ * The maximum of the character advances.
+ */
+ private int maxAdvance;
+
+ /**
+ * The internal leading.
+ */
+ int leading;
+
+ /**
+ * Cached string metrics. This caches string metrics locally so that the
+ * server doesn't have to be asked each time.
+ */
+ private HashMap metricsCache;
+
+ /**
+ * The widths of the characters indexed by the characters themselves.
+ */
+ private int[] charWidths;
+
+ /**
+ * Creates a new XFontMetrics for the specified font.
+ *
+ * @param font the font
+ */
+ protected XFontMetrics(Font font)
+ {
+ super(font);
+ metricsCache = new HashMap();
+ Fontable.FontInfo info = getXFont().info();
+ ascent = info.font_ascent();
+ descent = info.font_descent();
+ maxAdvance = info.max_bounds().character_width();
+ leading = 0; // TODO: Not provided by X. Possible not needed.
+
+ if (info.min_byte1() == 0 && info.max_byte1() == 0)
+ readCharWidthsLinear(info);
+ else
+ readCharWidthsNonLinear(info);
+ }
+
+ /**
+ * Reads the character widths when specified in a linear fashion. That is
+ * when the min-byte1 and max-byte2 fields are both zero in the X protocol.
+ *
+ * @param info the font info reply
+ */
+ private void readCharWidthsLinear(Fontable.FontInfo info)
+ {
+ int startIndex = info.min_char_or_byte2();
+ int endIndex = info.max_char_or_byte2();
+ charWidths = new int[endIndex + 1];
+ // All the characters before startIndex are zero width.
+ for (int i = 0; i < startIndex; i++)
+ {
+ charWidths[i] = 0;
+ }
+ // All the other character info is fetched from the font info.
+ int index = startIndex;
+ Fontable.FontInfo.CharInfo[] charInfos = info.char_infos();
+ for (Fontable.FontInfo.CharInfo charInfo : charInfos)
+ {
+ charWidths[index] = charInfo.character_width();
+ index++;
+ }
+ }
+
+ private void readCharWidthsNonLinear(Fontable.FontInfo info)
+ {
+ // TODO: Implement.
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ /**
+ * Returns the ascent of the font.
+ *
+ * @return the ascent of the font
+ */
+ public int getAscent()
+ {
+ return ascent;
+ }
+
+ /**
+ * Returns the descent of the font.
+ *
+ * @return the descent of the font
+ */
+ public int getDescent()
+ {
+ return descent;
+ }
+
+ /**
+ * Returns the overall height of the font. This is the distance from
+ * baseline to baseline (usually ascent + descent + leading).
+ *
+ * @return the overall height of the font
+ */
+ public int getHeight()
+ {
+ return ascent + descent;
+ }
+
+ /**
+ * Returns the leading of the font.
+ *
+ * @return the leading of the font
+ */
+ public int getLeading()
+ {
+ return leading;
+ }
+
+ /**
+ * Returns the maximum advance for this font.
+ *
+ * @return the maximum advance for this font
+ */
+ public int getMaxAdvance()
+ {
+ return maxAdvance;
+ }
+
+ /**
+ * Determines the width of the specified character <code>c</code>.
+ *
+ * @param c the character
+ *
+ * @return the width of the character
+ */
+ public int charWidth(char c)
+ {
+ int width;
+ if (c > charWidths.length)
+ width = charWidths['?'];
+ else
+ width = charWidths[c];
+ return width;
+ }
+
+ /**
+ * Determines the overall width of the specified string.
+ *
+ * @param c the char buffer holding the string
+ * @param offset the starting offset of the string in the buffer
+ * @param length the number of characters in the string buffer
+ *
+ * @return the overall width of the specified string
+ */
+ public int charsWidth(char[] c, int offset, int length)
+ {
+ int width = 0;
+ if (c.length > 0 && length > 0)
+ {
+ String s = new String(c, offset, length);
+ width = stringWidth(s);
+ }
+ return width;
+ }
+
+ /**
+ * Determines the overall width of the specified string.
+ *
+ * @param s the string
+ *
+ * @return the overall width of the specified string
+ */
+ public int stringWidth(String s)
+ {
+ int width = 0;
+ if (s.length() > 0)
+ {
+ if (metricsCache.containsKey(s))
+ {
+ width = ((Integer) metricsCache.get(s)).intValue();
+ }
+ else
+ {
+ Fontable.TextExtentInfo extents = getXFont().text_extent(s);
+ /*
+ System.err.println("string: '" + s + "' : ");
+ System.err.println("ascent: " + extents.getAscent());
+ System.err.println("descent: " + extents.getDescent());
+ System.err.println("overall ascent: " + extents.getOverallAscent());
+ System.err.println("overall descent: " + extents.getOverallDescent());
+ System.err.println("overall width: " + extents.getOverallWidth());
+ System.err.println("overall left: " + extents.getOverallLeft());
+ System.err.println("overall right: " + extents.getOverallRight());
+ */
+ width = extents.overall_width(); // + extents.overall_left();
+ //System.err.println("String: " + s + ", width: " + width);
+ metricsCache.put(s, new Integer(width));
+ }
+ }
+ //System.err.print("stringWidth: '" + s + "': ");
+ //System.err.println(width);
+ return width;
+ }
+ }
+
+ /**
+ * The LineMetrics implementation for the XFontPeer.
+ */
+ private class XLineMetrics
+ extends LineMetrics
+ {
+
+ /**
+ * Returns the ascent of the font.
+ *
+ * @return the ascent of the font
+ */
+ public float getAscent()
+ {
+ return fontMetrics.ascent;
+ }
+
+ public int getBaselineIndex()
+ {
+ // FIXME: Implement this.
+ throw new UnsupportedOperationException();
+ }
+
+ public float[] getBaselineOffsets()
+ {
+ // FIXME: Implement this.
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Returns the descent of the font.
+ *
+ * @return the descent of the font
+ */
+ public float getDescent()
+ {
+ return fontMetrics.descent;
+ }
+
+ /**
+ * Returns the overall height of the font. This is the distance from
+ * baseline to baseline (usually ascent + descent + leading).
+ *
+ * @return the overall height of the font
+ */
+ public float getHeight()
+ {
+ return fontMetrics.ascent + fontMetrics.descent;
+ }
+
+ /**
+ * Returns the leading of the font.
+ *
+ * @return the leading of the font
+ */
+ public float getLeading()
+ {
+ return fontMetrics.leading;
+ }
+
+ public int getNumChars()
+ {
+ // FIXME: Implement this.
+ throw new UnsupportedOperationException();
+ }
+
+ public float getStrikethroughOffset()
+ {
+ return 0.F; // TODO: Provided by X??
+ }
+
+ public float getStrikethroughThickness()
+ {
+ return 1.F; // TODO: Provided by X??
+ }
+
+ public float getUnderlineOffset()
+ {
+ return 0.F; // TODO: Provided by X??
+ }
+
+ public float getUnderlineThickness()
+ {
+ return 1.F; // TODO: Provided by X??
+ }
+
+ }
+
+ /**
+ * The X font.
+ */
+ private gnu.x11.Font xfont;
+
+ private String name;
+
+ private int style;
+
+ private int size;
+
+ /**
+ * The font metrics for this font.
+ */
+ XFontMetrics fontMetrics;
+
+ /**
+ * Creates a new XFontPeer for the specified font name, style and size.
+ *
+ * @param name the font name
+ * @param style the font style (bold / italic / normal)
+ * @param size the size of the font
+ */
+ public XFontPeer(String name, int style, int size)
+ {
+ super(name, style, size);
+ this.name = name;
+ this.style = style;
+ this.size = size;
+ }
+
+ /**
+ * Creates a new XFontPeer for the specified font name and style
+ * attributes.
+ *
+ * @param name the font name
+ * @param atts the font attributes
+ */
+ public XFontPeer(String name, Map atts)
+ {
+ super(name, atts);
+ String family = name;
+ if (family == null || family.equals(""))
+ family = (String) atts.get(TextAttribute.FAMILY);
+ if (family == null)
+ family = "SansSerif";
+
+ int size = 12;
+ Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
+ if (sizeFl != null)
+ size = sizeFl.intValue();
+
+ int style = 0;
+ // Detect italic attribute.
+ Float posture = (Float) atts.get(TextAttribute.POSTURE);
+ if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
+ style |= Font.ITALIC;
+
+ // Detect bold attribute.
+ Float weight = (Float) atts.get(TextAttribute.WEIGHT);
+ if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
+ style |= Font.BOLD;
+
+ this.name = name;
+ this.style = style;
+ this.size = size;
+ }
+
+ /**
+ * Initializes the font peer with the specified attributes. This method is
+ * called from both constructors.
+ *
+ * @param name the font name
+ * @param style the font style
+ * @param size the font size
+ */
+ private void init(String name, int style, int size)
+ {
+ if (name == null)
+ {
+ name = "SansSerif";
+ }
+ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice dev = env.getDefaultScreenDevice();
+ if (dev instanceof XGraphicsDevice)
+ {
+ Display display = ((XGraphicsDevice) dev).getDisplay();
+ String fontDescr = encodeFont(name, style, size);
+ if (XToolkit.DEBUG)
+ System.err.println("XLFD font description: " + fontDescr);
+ xfont = new gnu.x11.Font(display, fontDescr);
+ }
+ else
+ {
+ throw new AWTError("Local GraphicsEnvironment is not XWindowGraphicsEnvironment");
+ }
+ }
+
+ public boolean canDisplay(Font font, int c)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public int canDisplayUpTo(Font font, CharacterIterator i, int start, int limit)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public String getSubFamilyName(Font font, Locale locale)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public String getPostScriptName(Font font)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public int getNumGlyphs(Font font)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public int getMissingGlyphCode(Font font)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public byte getBaselineFor(Font font, char c)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public String getGlyphName(Font font, int glyphIndex)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public GlyphVector createGlyphVector(Font font, FontRenderContext frc,
+ CharacterIterator ci)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public GlyphVector createGlyphVector(Font font, FontRenderContext ctx,
+ int[] glyphCodes)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public GlyphVector layoutGlyphVector(Font font, FontRenderContext frc,
+ char[] chars, int start, int limit,
+ int flags)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ /**
+ * Returns the font metrics for the specified font.
+ *
+ * @param font the font for which to fetch the font metrics
+ *
+ * @return the font metrics for the specified font
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ if (font.getPeer() != this)
+ throw new AWTError("The specified font has a different peer than this");
+
+ if (fontMetrics == null)
+ fontMetrics = new XFontMetrics(font);
+ return fontMetrics;
+ }
+
+ /**
+ * Frees the font in the X server.
+ */
+ protected void finalize()
+ {
+ if (xfont != null)
+ xfont.close();
+ }
+
+ public boolean hasUniformLineMetrics(Font font)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ /**
+ * Returns the line metrics for this font and the specified string and
+ * font render context.
+ */
+ public LineMetrics getLineMetrics(Font font, CharacterIterator ci, int begin,
+ int limit, FontRenderContext rc)
+ {
+ return new XLineMetrics();
+ }
+
+ public Rectangle2D getMaxCharBounds(Font font, FontRenderContext rc)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ public Rectangle2D getStringBounds(Font font, CharacterIterator ci,
+ int begin, int limit, FontRenderContext frc)
+ {
+ // TODO: Implement this.
+ throw new UnsupportedOperationException("Not yet implemented.");
+ }
+
+ /**
+ * Encodes a font name + style + size specification into a X logical font
+ * description (XLFD) as described here:
+ *
+ * http://www.meretrx.com/e93/docs/xlfd.html
+ *
+ * This is implemented to look up the font description in the
+ * fonts.properties of this package.
+ *
+ * @param name the font name
+ * @param atts the text attributes
+ *
+ * @return the encoded font description
+ */
+ static String encodeFont(String name, Map atts)
+ {
+ String family = name;
+ if (family == null || family.equals(""))
+ family = (String) atts.get(TextAttribute.FAMILY);
+ if (family == null)
+ family = "SansSerif";
+
+ int size = 12;
+ Float sizeFl = (Float) atts.get(TextAttribute.SIZE);
+ if (sizeFl != null)
+ size = sizeFl.intValue();
+
+ int style = 0;
+ // Detect italic attribute.
+ Float posture = (Float) atts.get(TextAttribute.POSTURE);
+ if (posture != null && !posture.equals(TextAttribute.POSTURE_REGULAR))
+ style |= Font.ITALIC;
+
+ // Detect bold attribute.
+ Float weight = (Float) atts.get(TextAttribute.WEIGHT);
+ if (weight != null && weight.compareTo(TextAttribute.WEIGHT_REGULAR) > 0)
+ style |= Font.BOLD;
+
+ return encodeFont(family, style, size);
+ }
+
+ /**
+ * Encodes a font name + style + size specification into a X logical font
+ * description (XLFD) as described here:
+ *
+ * http://www.meretrx.com/e93/docs/xlfd.html
+ *
+ * This is implemented to look up the font description in the
+ * fonts.properties of this package.
+ *
+ * @param name the font name
+ * @param style the font style
+ * @param size the font size
+ *
+ * @return the encoded font description
+ */
+ static String encodeFont(String name, int style, int size)
+ {
+ StringBuilder key = new StringBuilder();
+ key.append(validName(name));
+ key.append('.');
+ switch (style)
+ {
+ case Font.BOLD:
+ key.append("bold");
+ break;
+ case Font.ITALIC:
+ key.append("italic");
+ break;
+ case (Font.BOLD | Font.ITALIC):
+ key.append("bolditalic");
+ break;
+ case Font.PLAIN:
+ default:
+ key.append("plain");
+
+ }
+
+ String protoType = fontProperties.getProperty(key.toString());
+ int s = validSize(size);
+ return protoType.replaceFirst("%d", String.valueOf(s));
+ }
+
+ /**
+ * Checks the specified font name for a valid font name. If the font name
+ * is not known, then this returns 'sansserif' as fallback.
+ *
+ * @param name the font name to check
+ *
+ * @return a valid font name
+ */
+ static String validName(String name)
+ {
+ String retVal;
+ if (name.equalsIgnoreCase("sansserif")
+ || name.equalsIgnoreCase("serif")
+ || name.equalsIgnoreCase("monospaced")
+ || name.equalsIgnoreCase("dialog")
+ || name.equalsIgnoreCase("dialoginput"))
+ {
+ retVal = name.toLowerCase();
+ }
+ else
+ {
+ retVal = "sansserif";
+ }
+ return retVal;
+ }
+
+ /**
+ * Translates an arbitrary point size to a size that is typically available
+ * on an X server. These are the sizes 8, 10, 12, 14, 18 and 24.
+ *
+ * @param size the queried size
+ * @return the real available size
+ */
+ private static final int validSize(int size)
+ {
+ int val;
+ if (size <= 9)
+ val = 8;
+ else if (size <= 11)
+ val = 10;
+ else if (size <= 13)
+ val = 12;
+ else if (size <= 17)
+ val = 14;
+ else if (size <= 23)
+ val = 18;
+ else
+ val = 24;
+ return val;
+ }
+
+ /**
+ * Returns the X Font reference. This lazily loads the font when first
+ * requested.
+ *
+ * @return the X Font reference
+ */
+ gnu.x11.Font getXFont()
+ {
+ if (xfont == null)
+ {
+ init(name, style, size);
+ }
+ return xfont;
+ }
+}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java b/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java
index 74e47bc2842..7424dc671ed 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XFramePeer.java
@@ -65,6 +65,7 @@ public class XFramePeer
XFramePeer(Frame f)
{
super(f);
+ setTitle(f.getTitle());
}
public void setIconImage(Image image)
@@ -87,8 +88,7 @@ public class XFramePeer
public void setTitle(String title)
{
- // TODO: Implement this.
- throw new UnsupportedOperationException("Not yet implemented.");
+ xwindow.set_wm_name (title);
}
public int getState()
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java
index 73e780cc5a2..95129666a05 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphics2D.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
import java.awt.Color;
+import java.awt.Font;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.Image;
@@ -45,12 +46,18 @@ import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Toolkit;
+import java.awt.Transparency;
import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
+import java.awt.image.DataBuffer;
import java.awt.image.ImageObserver;
import java.awt.image.Raster;
+import java.awt.peer.FontPeer;
import java.util.HashMap;
+import java.util.WeakHashMap;
+import gnu.java.awt.image.AsyncImage;
import gnu.java.awt.java2d.AbstractGraphics2D;
import gnu.java.awt.java2d.ScanlineCoverage;
import gnu.x11.Colormap;
@@ -63,6 +70,14 @@ public class XGraphics2D
{
/**
+ * When this property is set to true, then images are always rendered as
+ * opaque images, ignoring their translucence. This is intended for
+ * debugging and demonstration purposes.
+ */
+ private static final boolean RENDER_OPAQUE =
+ Boolean.getBoolean("escherpeer.renderopaque");
+
+ /**
* The X Drawable to draw on.
*/
private Drawable xdrawable;
@@ -92,11 +107,19 @@ public class XGraphics2D
//setClip(new Rectangle(0, 0, xdrawable.width, xdrawable.height));
}
+ @Override
protected void rawDrawLine(int x0, int y0, int x1, int y1)
{
xdrawable.segment(xgc, x0, y0, x1, y1);
}
+ @Override
+ protected void rawDrawRect(int x, int y, int w, int h)
+ {
+ xdrawable.rectangle(xgc, x, y, w, h, false);
+ }
+
+ @Override
protected void rawFillRect(int x, int y, int w, int h)
{
xdrawable.rectangle(xgc, x, y, w, h, true);
@@ -217,55 +240,65 @@ public class XGraphics2D
}
}
+ @Override
public void renderScanline(int y, ScanlineCoverage c)
{
+ if (y >= xdrawable.height)
+ return;
+
+ // TODO: Handle Composite and Paint.
ScanlineCoverage.Iterator iter = c.iterate();
- float coverageAlpha = 0;
+ int coverageAlpha = 0;
int maxCoverage = c.getMaxCoverage();
- Color old = getColor();
- Color col = getColor();
- if (col == null)
- col = Color.BLACK;
while (iter.hasNext())
{
ScanlineCoverage.Range range = iter.next();
- // TODO: Dumb implementation for testing.
+
coverageAlpha = range.getCoverage();
- if (coverageAlpha > 0)
+ int x0 = range.getXPos();
+ int l = range.getLength();
+ if (coverageAlpha == c.getMaxCoverage())
+ {
+ // Simply paint the current color over the existing pixels.
+ xdrawable.fill_rectangle(xgc, x0, y, l, 1);
+ }
+ else if (coverageAlpha > 0)
{
- int red = col.getRed();
- int green = col.getGreen();
- int blue = col.getBlue();
- if (coverageAlpha < c.getMaxCoverage())
+ // Composite the current color with the existing pixels.
+ int x1 = x0 + l;
+ x0 = Math.min(Math.max(0, x0), xdrawable.width - 1);
+ x1 = Math.min(Math.max(0, x1), xdrawable.width - 1);
+ if ((x1 - x0) < 1)
+ continue;
+ l = x1 - x0;
+ gnu.x11.image.ZPixmap existing = (ZPixmap)
+ xdrawable.image(x0, y, l, 1, 0xFFFFFFFF,
+ gnu.x11.image.Image.Format.ZPIXMAP);
+ for (int x = 0; x < l; x++)
{
- float alpha = coverageAlpha / maxCoverage;
- red = 255 - (int) ((255 - red) * alpha);
- green = 255 - (int) ((255 - green) * alpha);
- blue = 255 - (int) ((255 - blue) * alpha);
+ Color col = getColor();
+ if (col == null)
+ {
+ col = Color.BLACK;
+ }
+ int red = col.getRed();
+ int green = col.getGreen();
+ int blue = col.getBlue();
+ int redOut = existing.get_red(x, 0);
+ int greenOut = existing.get_green(x, 0);
+ int blueOut = existing.get_blue(x, 0);
+ int outAlpha = maxCoverage - coverageAlpha;
+ redOut = redOut * outAlpha + red * coverageAlpha;
+ redOut = redOut / maxCoverage;
+ greenOut = greenOut * outAlpha + green * coverageAlpha;
+ greenOut = greenOut / maxCoverage;
+ blueOut = blueOut * outAlpha + blue * coverageAlpha;
+ blueOut = blueOut / maxCoverage;
+ existing.set(x, 0, redOut, greenOut, blueOut);
}
- xgc.set_foreground(red << 16 | green << 8 | blue);
- int x0 = range.getXPos();
- int l = range.getLength();
- xdrawable.fill_rectangle(xgc, x0, y, l, 1);
+ xdrawable.put_image(xgc, existing, x0, y);
}
}
- if (old != null)
- xgc.set_foreground(old.getRGB());
- }
-
- protected void fillScanline(int x0, int x1, int y)
- {
- xdrawable.segment(xgc, x0, y, x1, y);
- }
-
- protected void fillScanlineAA(int x0, int x1, int y, int alpha)
- {
- //System.err.println("fillScanlineAA: " + x0 + ", " + x1 + ", " + y + ", " + alpha);
- // FIXME: This is for testing only.
- Color c = getColor();
- setColor(new Color(255-alpha, 255-alpha, 255-alpha));
- xdrawable.segment(xgc, x0, y, x1, y);
- setColor(c);
}
protected void init()
@@ -278,6 +311,7 @@ public class XGraphics2D
super.setPaint(p);
if (p instanceof Color)
{
+ // TODO: Optimize for different standard bit-depths.
Color c = (Color) p;
XToolkit tk = (XToolkit) Toolkit.getDefaultToolkit();
HashMap colorMap = tk.colorMap;
@@ -302,8 +336,11 @@ public class XGraphics2D
}
}
+ private static WeakHashMap<Image,ZPixmap> imageCache = new WeakHashMap<Image,ZPixmap>();
+
protected boolean rawDrawImage(Image image, int x, int y, ImageObserver obs)
{
+ image = unwrap(image);
boolean ret;
if (image instanceof XImage)
{
@@ -319,6 +356,87 @@ public class XGraphics2D
pvi.getHeight(obs), x, y);
ret = true;
}
+ else if (image instanceof BufferedImage)
+ {
+ BufferedImage bi = (BufferedImage) image;
+ DataBuffer db = bi.getRaster().getDataBuffer();
+ if (db instanceof ZPixmapDataBuffer)
+ {
+ ZPixmapDataBuffer zpmdb = (ZPixmapDataBuffer) db;
+ ZPixmap zpixmap = zpmdb.getZPixmap();
+ xdrawable.put_image(xgc, zpixmap, x, y);
+ ret = true;
+ }
+ else
+ {
+ int transparency = bi.getTransparency();
+ int w = bi.getWidth();
+ int h = bi.getHeight();
+ if (imageCache.containsKey(image))
+ {
+ ZPixmap zpixmap = imageCache.get(image);
+ xdrawable.put_image(xgc, zpixmap, x, y);
+ }
+ else if (transparency == Transparency.OPAQUE || RENDER_OPAQUE)
+ {
+ XGraphicsDevice gd = XToolkit.getDefaultDevice();
+ ZPixmap zpixmap = new ZPixmap(gd.getDisplay(), w, h);
+ for (int yy = 0; yy < h; yy++)
+ {
+ for (int xx = 0; xx < w; xx++)
+ {
+ int rgb = bi.getRGB(xx, yy);
+ zpixmap.set(xx, yy, rgb);
+ }
+ }
+ xdrawable.put_image(xgc, zpixmap, x, y);
+ imageCache.put(image, zpixmap);
+ } else {
+ ZPixmap zpixmap = (ZPixmap) xdrawable.image(x, y, w, h,
+ 0xffffffff,
+ gnu.x11.image.Image.Format.ZPIXMAP);
+ for (int yy = 0; yy < h; yy++)
+ {
+ for (int xx = 0; xx < w; xx++)
+ {
+ int rgb = bi.getRGB(xx, yy);
+ int alpha = 0xff & (rgb >> 24);
+ if (alpha == 0)
+ {
+ // Completely translucent.
+ rgb = zpixmap.get_red(xx, yy) << 16
+ | zpixmap.get_green(xx, yy) << 8
+ | zpixmap.get_blue(xx, yy);
+ }
+ else if (alpha < 255)
+ {
+ // Composite pixels.
+ int red = 0xff & (rgb >> 16);
+ red = red * alpha
+ + (255 - alpha) * zpixmap.get_red(xx, yy);
+ red = red / 255;
+ int green = 0xff & (rgb >> 8);
+ green = green * alpha
+ + (255 - alpha) * zpixmap.get_green(xx, yy);
+ green = green / 255;
+ int blue = 0xff & rgb;
+ blue = blue * alpha
+ + (255 - alpha) * zpixmap.get_blue(xx, yy);
+ blue = blue / 255;
+ rgb = red << 16 | green << 8 | blue;
+ }
+ // else keep rgb value from source image.
+
+ zpixmap.set(xx, yy, rgb);
+ }
+ }
+ xdrawable.put_image(xgc, zpixmap, x, y);
+ // We can't cache prerendered translucent images, because
+ // we never know how the background changes.
+ }
+ ret = true;
+ }
+ }
else
{
ret = super.rawDrawImage(image, x, y, obs);
@@ -326,6 +444,50 @@ public class XGraphics2D
return ret;
}
+ public void setFont(Font f)
+ {
+ super.setFont(f);
+ FontPeer p = getFont().getPeer();
+ if (p instanceof XFontPeer)
+ {
+ XFontPeer xFontPeer = (XFontPeer) p;
+ xgc.set_font(xFontPeer.getXFont());
+ }
+ }
+
+ public void drawString(String s, int x, int y)
+ {
+ FontPeer p = getFont().getPeer();
+ if (p instanceof XFontPeer)
+ {
+ int tx = (int) transform.getTranslateX();
+ int ty = (int) transform.getTranslateY();
+ xdrawable.text(xgc, x + tx, y + ty, s);
+ }
+ else
+ {
+ super.drawString(s, x, y);
+ }
+ }
+
+ /**
+ * Extracts an image instance out of an AsyncImage. If the image isn't
+ * an AsyncImage, then the original instance is returned.
+ *
+ * @param im the image
+ *
+ * @return the image to render
+ */
+ private Image unwrap(Image im)
+ {
+ Image image = im;
+ if (image instanceof AsyncImage)
+ {
+ AsyncImage aIm = (AsyncImage) image;
+ image = aIm.getRealImage();
+ }
+ return image;
+ }
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java
index 11a9c9694f1..85f72a4eff4 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsConfiguration.java
@@ -37,6 +37,10 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
+import gnu.x11.Display;
+import gnu.x11.Screen;
+
+import java.awt.Dimension;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.Point;
@@ -158,4 +162,38 @@ public class XGraphicsConfiguration
throw new UnsupportedOperationException("Not yet implemented.");
}
+ /**
+ * Determines the size of the primary screen.
+ *
+ * @return the size of the primary screen
+ */
+ Dimension getSize()
+ {
+ // TODO: A GraphicsConfiguration should correspond to a Screen instance.
+ Display d = device.getDisplay();
+ Screen screen = d.default_screen;
+ int w = screen.width;
+ int h = screen.height;
+ return new Dimension(w, h);
+ }
+
+ /**
+ * Determines the resolution of the primary screen in pixel-per-inch.
+ *
+ * @returnthe resolution of the primary screen in pixel-per-inch
+ */
+ int getResolution()
+ {
+ Display d = device.getDisplay();
+ Screen screen = d.default_screen;
+ int w = screen.width * 254;
+ int h = screen.height * 254;
+ int wmm = screen.width_in_mm * 10;
+ int hmm = screen.height_in_mm * 10;
+ int xdpi = w / wmm;
+ int ydpi = h / hmm;
+ int dpi = (xdpi + ydpi) / 2;
+ return dpi;
+ }
+
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java
index 65383a6cb0f..8ec8d57bb90 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XGraphicsEnvironment.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
+import gnu.java.awt.font.OpenTypeFontPeer;
import gnu.java.awt.java2d.RasterGraphics;
import gnu.x11.Display;
@@ -189,14 +190,14 @@ public class XGraphicsEnvironment
public String[] getAvailableFontFamilyNames()
{
- // TODO: Implement this.
- throw new UnsupportedOperationException("Not yet implemented.");
+ return getAvailableFontFamilyNames(Locale.getDefault());
}
public String[] getAvailableFontFamilyNames(Locale l)
{
- // TODO: Implement this.
- throw new UnsupportedOperationException("Not yet implemented.");
+ // TODO: This doesn't work when we are using X fonts.
+ // Fix this.
+ return OpenTypeFontPeer.getAvailableFontFamilyNames(l);
}
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java b/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java
index 08186326ffa..c1724aad55d 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XToolkit.java
@@ -51,6 +51,7 @@ import java.awt.FileDialog;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
@@ -117,6 +118,8 @@ import javax.imageio.ImageIO;
import gnu.classpath.SystemProperties;
import gnu.java.awt.ClasspathToolkit;
import gnu.java.awt.EmbeddedWindow;
+import gnu.java.awt.font.OpenTypeFontPeer;
+import gnu.java.awt.image.ImageConverter;
import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.EmbeddedWindowPeer;
import gnu.java.awt.peer.swing.SwingCanvasPeer;
@@ -155,7 +158,8 @@ public class XToolkit
/**
* The cached fonts.
*/
- private WeakHashMap fontCache = new WeakHashMap();
+ private WeakHashMap<String,ClasspathFontPeer> fontCache =
+ new WeakHashMap<String,ClasspathFontPeer>();
public XToolkit()
{
@@ -179,21 +183,32 @@ public class XToolkit
*/
public ClasspathFontPeer getClasspathFontPeer(String name, Map attrs)
{
- String canonical = XFontPeer2.encodeFont(name, attrs);
ClasspathFontPeer font;
- if (!fontCache.containsKey(canonical))
+ if ("true".equals(System.getProperty("escherpeer.usexfonts")))
{
- String graphics2d =
- SystemProperties.getProperty("gnu.xawt.graphics2d");
- //if (graphics2d != null && graphics2d.equals("gl"))
- font = new XFontPeer2(name, attrs);
-// else
-// font = new XFontPeer(name, attrs);
- fontCache.put(canonical, font);
+ String canonical = XFontPeer.encodeFont(name, attrs);
+ if (!fontCache.containsKey(canonical))
+ {
+ font = new XFontPeer(name, attrs);
+ fontCache.put(canonical, font);
+ }
+ else
+ {
+ font = fontCache.get(canonical);
+ }
}
else
{
- font = (ClasspathFontPeer) fontCache.get(canonical);
+ String canonical = OpenTypeFontPeer.encodeFont(name, attrs);
+ if (!fontCache.containsKey(canonical))
+ {
+ font = new OpenTypeFontPeer(name, attrs);
+ fontCache.put(canonical, font);
+ }
+ else
+ {
+ font = fontCache.get(canonical);
+ }
}
return font;
}
@@ -338,14 +353,22 @@ public class XToolkit
public Dimension getScreenSize()
{
- // FIXME: This is only a hack to get some apps working.
- return new Dimension(1024, 768);
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice gd = ge.getDefaultScreenDevice();
+ GraphicsConfiguration gc = gd.getDefaultConfiguration();
+ XGraphicsConfiguration xgc = (XGraphicsConfiguration) gc;
+
+ return xgc.getSize();
}
public int getScreenResolution()
{
- // TODO: Implement this.
- throw new UnsupportedOperationException("Not yet implemented.");
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice gd = ge.getDefaultScreenDevice();
+ GraphicsConfiguration gc = gd.getDefaultConfiguration();
+ XGraphicsConfiguration xgc = (XGraphicsConfiguration) gc;
+
+ return xgc.getResolution();
}
/**
@@ -363,8 +386,8 @@ public class XToolkit
public String[] getFontList()
{
- // TODO: Implement this.
- throw new UnsupportedOperationException("Not yet implemented.");
+ GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ return ge.getAvailableFontFamilyNames();
}
public FontMetrics getFontMetrics(Font name)
@@ -505,7 +528,7 @@ public class XToolkit
{
ImageConverter conv = new ImageConverter();
producer.startProduction(conv);
- Image image = conv.getXImage();
+ Image image = conv.getImage();
return image;
}
@@ -602,19 +625,17 @@ public class XToolkit
}
@Override
- public boolean isModalExclusionTypeSupported
- (Dialog.ModalExclusionType modalExclusionType)
+ public boolean isModalExclusionTypeSupported(ModalExclusionType modalExclusionType)
{
- // TODO: Implement properly.
+ // TODO Auto-generated method stub
return false;
}
@Override
- public boolean isModalityTypeSupported(Dialog.ModalityType modalityType)
+ public boolean isModalityTypeSupported(ModalityType modalityType)
{
- // TODO: Implement properly.
+ // TODO Auto-generated method stub
return false;
}
-
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java b/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java
index 10d1e96858a..f9184ed1cde 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java
@@ -39,9 +39,11 @@ exception statement from your version. */
package gnu.java.awt.peer.x;
import java.awt.Component;
+import java.awt.Dialog;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.FontMetrics;
+import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -54,9 +56,12 @@ import java.awt.event.PaintEvent;
import java.awt.event.WindowEvent;
import java.awt.image.VolatileImage;
+import gnu.x11.Atom;
import gnu.x11.Window;
import gnu.x11.event.Event;
+import gnu.java.awt.font.OpenTypeFontPeer;
+import gnu.java.awt.peer.ClasspathFontPeer;
import gnu.java.awt.peer.swing.SwingWindowPeer;
public class XWindowPeer
@@ -84,7 +89,12 @@ public class XWindowPeer
/**
* The X window.
*/
- private Window xwindow;
+ protected Window xwindow;
+
+ /**
+ * The frame insets. These get updated in {@link #show()}.
+ */
+ private Insets insets;
XWindowPeer(java.awt.Window window)
{
@@ -92,15 +102,47 @@ public class XWindowPeer
XGraphicsDevice dev = XToolkit.getDefaultDevice();
// TODO: Maybe initialize lazily in show().
+ Window.Attributes atts = new Window.Attributes();
// FIXME: Howto generate a Window without decorations?
int x = Math.max(window.getX(), 0);
int y = Math.max(window.getY(), 0);
int w = Math.max(window.getWidth(), 1);
int h = Math.max(window.getHeight(), 1);
- xwindow = new Window(dev.getDisplay().default_root, x, y, w, h);
- xwindow.create();
+ xwindow = new Window(dev.getDisplay().default_root, x, y, w, h, 0, atts);
xwindow.select_input(standardSelect);
dev.getEventPump().registerWindow(xwindow, window);
+
+ boolean undecorated;
+ if (awtComponent instanceof Frame)
+ {
+ Frame f = (Frame) awtComponent;
+ undecorated = f.isUndecorated();
+ }
+ else if (awtComponent instanceof Dialog)
+ {
+ Dialog d = (Dialog) awtComponent;
+ undecorated = d.isUndecorated();
+ }
+ else
+ {
+ undecorated = true;
+ }
+ if (undecorated)
+ {
+ // First try the Motif implementation of undecorated frames. This
+ // is semantically closest and supported by all major window
+ // managers.
+ // TODO: At the time of writing this, there's no freedesktop.org
+ // standard extension that matches the required semantic. Maybe
+ // undecorated frames are added in the future, if so, then use these.
+ Atom at = Atom.intern(dev.getDisplay(), "_MOTIF_WM_HINTS");
+ if (at != null)
+ {
+ xwindow.change_property(Window.REPLACE, at, at, 32,
+ new int[]{1 << 1, 0, 0, 0, 0}, 0, 5);
+ }
+ }
+ insets = new Insets(0, 0, 0, 0);
}
public void toBack()
@@ -139,7 +181,11 @@ public class XWindowPeer
*/
public Graphics getGraphics()
{
- return new XGraphics2D(xwindow);
+ XGraphics2D xg2d = new XGraphics2D(xwindow);
+ xg2d.setColor(awtComponent.getForeground());
+ xg2d.setBackground(awtComponent.getBackground());
+ xg2d.setFont(awtComponent.getFont());
+ return xg2d;
}
public Image createImage(int w, int h)
@@ -164,16 +210,11 @@ public class XWindowPeer
*/
public void show()
{
-// // Prevent ResizeRedirect events.
-// //xwindow.select_input(noResizeRedirectSelect);
-// Window.Attributes atts = new Window.Attributes();
-// atts.set_override_redirect(true);
-// xwindow.change_attributes(atts);
-
// Prevent ResizeRedirect events.
//xwindow.select_input(Event.NO_EVENT_MASK);
//xwindow.select_input(noResizeRedirectSelect);
+ XGraphicsDevice dev = XToolkit.getDefaultDevice();
xwindow.map();
EventQueue eq = XToolkit.getDefaultToolkit().getSystemEventQueue();
java.awt.Window w = (java.awt.Window) super.awtComponent;
@@ -188,6 +229,20 @@ public class XWindowPeer
// // Reset input selection.
// atts.set_override_redirect(false);
// xwindow.change_attributes(atts);
+
+ // Determine the frame insets.
+ Atom atom = (Atom) Atom.intern(dev.getDisplay(), "_NET_FRAME_EXTENTS");
+ Window.Property p = xwindow.get_property(false, atom, Atom.CARDINAL, 0,
+ Window.MAX_WM_LENGTH);
+ if (p.format() != 0)
+ {
+ insets = new Insets(p.value(0), p.value(1), p.value(2), p.value(3));
+ Window.Changes ch = new Window.Changes();
+ ch.width(awtComponent.getWidth() - insets.left - insets.top);
+ ch.height(awtComponent.getHeight() - insets.top - insets.bottom);
+ xwindow.configure(ch);
+ }
+
}
/**
@@ -214,40 +269,19 @@ public class XWindowPeer
*/
public void reshape(int x, int y, int width, int height)
{
- // Prevent ResizeRedirect events.
-// //xwindow.select_input(noResizeRedirectSelect);
-// Window.Attributes atts = new Window.Attributes();
-// atts.set_override_redirect(true);
-// xwindow.change_attributes(atts);
-
// Need to substract insets because AWT size is including insets,
- // and X size is excuding insets.
- Insets i = insets();
- xwindow.move_resize(x - i.left, y - i.right, width - i.left - i.right,
- height - i.top - i.bottom);
-
- // Reset input selection.
-// atts = new Window.Attributes();
-// atts.set_override_redirect(false);
-// xwindow.change_attributes(atts);
+ // and X size is excluding insets.
+ if (! callback)
+ {
+ Insets i = insets;
+ xwindow.move_resize(x - i.left, y - i.right, width - i.left - i.right,
+ height - i.top - i.bottom);
+ }
}
public Insets insets()
{
- Insets i = new Insets(0, 0, 0, 0);
-// Window.GeometryReply g = xwindow.geometry();
-// int b = g.border_width();
-// Insets i = new Insets(b, b, b, b);
-// Window.WMSizeHints wmSize = xwindow.wm_normal_hints();
-// if (wmSize != null)
-// {
-// i.left = wmSize.x() - g.x();
-// i.right = wmSize.width() - g.width() - i.left ;
-// i.top = wmSize.y() - g.y();
-// i.bottom = wmSize.height() - g.height() - i.top;
-// }
-// System.err.println("insets: " + i);
- return i;
+ return (Insets) insets.clone();
}
/**
@@ -257,7 +291,7 @@ public class XWindowPeer
*/
public FontMetrics getFontMetrics(Font font)
{
- XFontPeer2 fontPeer = (XFontPeer2) font.getPeer();
+ ClasspathFontPeer fontPeer = (ClasspathFontPeer) font.getPeer();
return fontPeer.getFontMetrics(font);
}
diff --git a/libjava/classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java b/libjava/classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java
index 8043c5b8f46..cf40f4d6977 100644
--- a/libjava/classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java
+++ b/libjava/classpath/gnu/java/awt/peer/x/ZPixmapDataBuffer.java
@@ -59,4 +59,9 @@ class ZPixmapDataBuffer
zpixmap.set_data_element(i, (byte) val);
}
+ ZPixmap getZPixmap()
+ {
+ return zpixmap;
+ }
+
}
diff --git a/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java b/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java
index 4e052a1d3f4..01894e5a43e 100644
--- a/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java
+++ b/libjava/classpath/gnu/java/awt/print/PostScriptGraphics2D.java
@@ -74,7 +74,6 @@ import java.awt.print.Pageable;
import java.awt.print.Paper;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
-import java.awt.print.PrinterGraphics;
import java.awt.print.PrinterJob;
import java.io.BufferedWriter;
import java.io.File;
diff --git a/libjava/classpath/gnu/java/awt/print/SpooledDocument.java b/libjava/classpath/gnu/java/awt/print/SpooledDocument.java
index b606a2ef63e..812906b189d 100644
--- a/libjava/classpath/gnu/java/awt/print/SpooledDocument.java
+++ b/libjava/classpath/gnu/java/awt/print/SpooledDocument.java
@@ -41,7 +41,6 @@ import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.attribute.DocAttributeSet;
import java.io.File;
-import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.Reader;
diff --git a/libjava/classpath/gnu/java/io/PlatformHelper.java b/libjava/classpath/gnu/java/io/PlatformHelper.java
index e54c56da935..96231e1be5b 100644
--- a/libjava/classpath/gnu/java/io/PlatformHelper.java
+++ b/libjava/classpath/gnu/java/io/PlatformHelper.java
@@ -37,8 +37,6 @@ exception statement from your version. */
package gnu.java.io;
-import java.util.StringTokenizer;
-
/**
* We had many changes in File.java, URLStreamHandler.java etc. to handle
* path representations on different platforms (Windows/Unix-family).
diff --git a/libjava/classpath/gnu/java/lang/MainThread.java b/libjava/classpath/gnu/java/lang/MainThread.java
index ab529efd1a3..7ad70cd7c61 100644
--- a/libjava/classpath/gnu/java/lang/MainThread.java
+++ b/libjava/classpath/gnu/java/lang/MainThread.java
@@ -69,7 +69,7 @@ public class MainThread
{
try
{
- mainMethod.invoke(null,args);
+ mainMethod.invoke(null,(Object) args);
}
catch(IllegalAccessException e)
{
diff --git a/libjava/classpath/gnu/java/lang/management/BeanImpl.java b/libjava/classpath/gnu/java/lang/management/BeanImpl.java
index 59e79a550d3..a651e3548b4 100644
--- a/libjava/classpath/gnu/java/lang/management/BeanImpl.java
+++ b/libjava/classpath/gnu/java/lang/management/BeanImpl.java
@@ -44,8 +44,6 @@ import java.lang.management.ManagementPermission;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.TypeVariable;
-
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -59,13 +57,11 @@ import javax.management.MBeanException;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
-import javax.management.MBeanInfo;
import javax.management.NotCompliantMBeanException;
import javax.management.ReflectionException;
import javax.management.StandardMBean;
import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
import javax.management.openmbean.OpenDataException;
@@ -80,7 +76,6 @@ import javax.management.openmbean.OpenMBeanOperationInfoSupport;
import javax.management.openmbean.OpenMBeanParameterInfo;
import javax.management.openmbean.OpenMBeanParameterInfoSupport;
import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
@@ -277,7 +272,7 @@ public class BeanImpl
Method getter = null;
try
{
- getter = vClass.getMethod("get" + field, null);
+ getter = vClass.getMethod("get" + field);
}
catch (NoSuchMethodException e)
{
@@ -285,7 +280,7 @@ public class BeanImpl
}
try
{
- values.add(getter.invoke(value, null));
+ values.add(getter.invoke(value));
}
catch (IllegalAccessException e)
{
@@ -323,6 +318,90 @@ public class BeanImpl
return (MBeanInfo) openInfo;
}
+ /**
+ * Override this method so as to prevent the description of a constructor's
+ * parameter being @code{null}. Open MBeans can not have @code{null} descriptions,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param constructor the constructor whose parameter needs describing.
+ * @param parameter the parameter to be described.
+ * @param sequenceNo the number of the parameter to describe.
+ * @return a description of the constructor's parameter.
+ */
+ protected String getDescription(MBeanConstructorInfo constructor,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String desc = parameter.getDescription();
+ if (desc == null)
+ return "param" + sequenceNo;
+ else
+ return desc;
+ }
+
+ /**
+ * Override this method so as to prevent the description of an operation's
+ * parameter being @code{null}. Open MBeans can not have @code{null} descriptions,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param operation the operation whose parameter needs describing.
+ * @param parameter the parameter to be described.
+ * @param sequenceNo the number of the parameter to describe.
+ * @return a description of the operation's parameter.
+ */
+ protected String getDescription(MBeanOperationInfo operation,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String desc = parameter.getDescription();
+ if (desc == null)
+ return "param" + sequenceNo;
+ else
+ return desc;
+ }
+
+ /**
+ * Override this method so as to prevent the name of a constructor's
+ * parameter being @code{null}. Open MBeans can not have @code{null} names,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param constructor the constructor whose parameter needs a name.
+ * @param parameter the parameter to be named.
+ * @param sequenceNo the number of the parameter to name.
+ * @return a description of the constructor's parameter.
+ */
+ protected String getParameterName(MBeanConstructorInfo constructor,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String name = parameter.getName();
+ if (name == null)
+ return "param" + sequenceNo;
+ else
+ return name;
+ }
+
+ /**
+ * Override this method so as to prevent the name of an operation's
+ * parameter being @code{null}. Open MBeans can not have @code{null} names,
+ * but one will occur as the names of parameters aren't stored for reflection.
+ *
+ * @param operation the operation whose parameter needs a name.
+ * @param parameter the parameter to be named.
+ * @param sequenceNo the number of the parameter to name.
+ * @return a description of the operation's parameter.
+ */
+ protected String getParameterName(MBeanOperationInfo operation,
+ MBeanParameterInfo parameter,
+ int sequenceNo)
+ {
+ String name = parameter.getName();
+ if (name == null)
+ return "param" + sequenceNo;
+ else
+ return name;
+ }
+
public MBeanInfo getMBeanInfo()
{
super.getMBeanInfo();
diff --git a/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java b/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java
index 842e5bdf0f0..78c17183792 100644
--- a/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java
+++ b/libjava/classpath/gnu/java/lang/reflect/TypeSignature.java
@@ -239,7 +239,7 @@ public class TypeSignature
public static String getEncodingOfMethod(Method m)
{
Class[] paramTypes = m.getParameterTypes();
- StringBuffer buf = new StringBuffer().append('(');
+ StringBuilder buf = new StringBuilder("(");
for (int i = 0; i < paramTypes.length; i++)
buf.append(getEncodingOfClass(paramTypes[i].getName(), true));
buf.append(')').append(getEncodingOfClass(m.getReturnType().getName(),
@@ -261,7 +261,7 @@ public class TypeSignature
public static String getEncodingOfConstructor(Constructor c)
{
Class[] paramTypes = c.getParameterTypes();
- StringBuffer buf = new StringBuffer().append('(');
+ StringBuilder buf = new StringBuilder("(");
for (int i = 0; i < paramTypes.length; i++)
buf.append(getEncodingOfClass(paramTypes[i].getName(), true));
buf.append(")V");
diff --git a/libjava/classpath/gnu/java/locale/LocaleHelper.java b/libjava/classpath/gnu/java/locale/LocaleHelper.java
index 4fefd163979..f3aabbdd939 100644
--- a/libjava/classpath/gnu/java/locale/LocaleHelper.java
+++ b/libjava/classpath/gnu/java/locale/LocaleHelper.java
@@ -40,8 +40,6 @@ package gnu.java.locale;
import java.text.Collator;
import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
/**
* This class provides common helper methods
diff --git a/libjava/classpath/gnu/java/net/protocol/http/Request.java b/libjava/classpath/gnu/java/net/protocol/http/Request.java
index 06a779f3311..90e3b7a0d64 100644
--- a/libjava/classpath/gnu/java/net/protocol/http/Request.java
+++ b/libjava/classpath/gnu/java/net/protocol/http/Request.java
@@ -52,7 +52,6 @@ import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.zip.GZIPInputStream;
diff --git a/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java b/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java
index 268ee0a8aa7..ea8c863e30e 100644
--- a/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/DatagramChannelImpl.java
@@ -40,11 +40,9 @@ package gnu.java.nio;
import gnu.java.net.PlainDatagramSocketImpl;
import java.io.IOException;
-import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
-import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.DatagramChannel;
diff --git a/libjava/classpath/gnu/java/nio/FileChannelImpl.java b/libjava/classpath/gnu/java/nio/FileChannelImpl.java
index 41912405078..d4a374b4ac7 100644
--- a/libjava/classpath/gnu/java/nio/FileChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/FileChannelImpl.java
@@ -412,7 +412,7 @@ public final class FileChannelImpl extends FileChannel
if (buffer == null)
{
- buffer = ByteBuffer.allocate ((int) count);
+ buffer = ByteBuffer.allocate (count);
src.read (buffer);
buffer.flip();
}
diff --git a/libjava/classpath/gnu/java/nio/KqueueSelectionKeyImpl.java b/libjava/classpath/gnu/java/nio/KqueueSelectionKeyImpl.java
index 2f93c50cc19..11b37cadbe5 100644
--- a/libjava/classpath/gnu/java/nio/KqueueSelectionKeyImpl.java
+++ b/libjava/classpath/gnu/java/nio/KqueueSelectionKeyImpl.java
@@ -39,8 +39,6 @@ exception statement from your version. */
package gnu.java.nio;
-import java.io.IOException;
-import java.nio.ByteBuffer;
import java.nio.channels.SelectableChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
diff --git a/libjava/classpath/gnu/java/nio/NIOSocket.java b/libjava/classpath/gnu/java/nio/NIOSocket.java
index 060a3a89c1c..87574e49110 100644
--- a/libjava/classpath/gnu/java/nio/NIOSocket.java
+++ b/libjava/classpath/gnu/java/nio/NIOSocket.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.java.nio;
-import gnu.java.net.PlainSocketImpl;
import java.io.IOException;
import java.net.Socket;
import java.nio.channels.SocketChannel;
diff --git a/libjava/classpath/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/classpath/gnu/java/nio/ServerSocketChannelImpl.java
index 1e8e0901d7c..0128661e5b8 100644
--- a/libjava/classpath/gnu/java/nio/ServerSocketChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/ServerSocketChannelImpl.java
@@ -40,7 +40,6 @@ package gnu.java.nio;
import java.io.IOException;
import java.net.ServerSocket;
-import java.net.SocketTimeoutException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.NotYetBoundException;
import java.nio.channels.ServerSocketChannel;
diff --git a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
index 1c563ac097c..9564592e0cf 100644
--- a/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
+++ b/libjava/classpath/gnu/java/nio/SocketChannelImpl.java
@@ -38,28 +38,16 @@ exception statement from your version. */
package gnu.java.nio;
-import gnu.java.net.PlainSocketImpl;
-import gnu.java.net.VMPlainSocketImpl;
-
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
-import java.net.SocketException;
-import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
-import java.nio.ReadOnlyBufferException;
import java.nio.channels.AlreadyConnectedException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.ConnectionPendingException;
import java.nio.channels.NoConnectionPendingException;
import java.nio.channels.NotYetConnectedException;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.channels.UnresolvedAddressException;
import java.nio.channels.UnsupportedAddressTypeException;
diff --git a/libjava/classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java b/libjava/classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java
index 31a96ed7d88..7557e28c444 100644
--- a/libjava/classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java
+++ b/libjava/classpath/gnu/java/nio/SocketChannelSelectionKeyImpl.java
@@ -57,7 +57,7 @@ public class SocketChannelSelectionKeyImpl extends SelectionKeyImpl
public SocketChannelSelectionKeyImpl(SocketChannelImpl ch, SelectorImpl impl)
{
super(ch, impl);
- this.ch = (SocketChannelImpl) ch;
+ this.ch = ch;
}
/**
diff --git a/libjava/classpath/gnu/java/nio/charset/ByteCharset.java b/libjava/classpath/gnu/java/nio/charset/ByteCharset.java
index e2025482956..043c804b7e4 100644
--- a/libjava/classpath/gnu/java/nio/charset/ByteCharset.java
+++ b/libjava/classpath/gnu/java/nio/charset/ByteCharset.java
@@ -45,32 +45,34 @@ import java.nio.charset.CharsetEncoder;
import java.nio.charset.CoderResult;
/**
- * A generic encoding framework for single-byte encodings,
- * utilizing a look-up table.
+ * A generic encoding framework for single-byte encodings, utilizing a look-up
+ * table.
+ *
+ * This replaces the gnu.java.io.EncoderEightBitLookup class, created by Aron
+ * Renn.
*
- * This replaces the gnu.java.io.EncoderEightBitLookup class,
- * created by Aron Renn.
- *
* @author Sven de Marothy
+ * @modified Ian Rogers
*/
abstract class ByteCharset extends Charset
{
- protected char[] lookupTable;
- /**
- * Char to signify the character in the table is undefined
- */
- protected static final char NONE = (char)0xFFFD;
+ protected final char[] lookupTable;
+ /**
+ * Char to signify the character in the table is undefined
+ */
+ protected static final char NONE = (char) 0xFFFD;
- ByteCharset (String canonicalName, String[] aliases)
+ ByteCharset(String canonicalName, String[] aliases, char[] lookup)
{
- super (canonicalName, aliases);
+ super(canonicalName, aliases);
+ lookupTable = lookup;
}
/**
- * Most western charsets include ASCII, but this should
- * be overloaded for others.
+ * Most western charsets include ASCII, but this should be overloaded for
+ * others.
*/
- public boolean contains (Charset cs)
+ public boolean contains(Charset cs)
{
return cs instanceof US_ASCII || (cs.getClass() == getClass());
}
@@ -80,83 +82,91 @@ abstract class ByteCharset extends Charset
return lookupTable;
}
- public CharsetDecoder newDecoder ()
+ public CharsetDecoder newDecoder()
{
- return new Decoder (this);
+ return new Decoder(this);
}
- public CharsetEncoder newEncoder ()
+ public CharsetEncoder newEncoder()
{
- return new Encoder (this);
+ return new Encoder(this);
}
private static final class Decoder extends CharsetDecoder
{
- private char[] lookup;
-
+ /** Lookup of byte to char mappings */
+ private final char[] lookup;
+
+ /** Helper to decode loops */
+ private final ByteDecodeLoopHelper helper = new ByteDecodeLoopHelper()
+ {
+ protected boolean isMappable(byte b)
+ {
+ return lookup[(int) (b & 0xFF)] != NONE;
+ }
+ protected char mapToChar(byte b)
+ {
+ return lookup[(int) (b & 0xFF)];
+ }
+ };
+
// Package-private to avoid a trampoline constructor.
- Decoder (ByteCharset cs)
+ Decoder(ByteCharset cs)
{
- super (cs, 1.0f, 1.0f);
+ super(cs, 1.0f, 1.0f);
lookup = cs.getLookupTable();
}
- protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
+ protected CoderResult decodeLoop(ByteBuffer in, CharBuffer out)
{
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- byte b = in.get ();
- char c;
-
- if (!out.hasRemaining ())
- {
- in.position (in.position () - 1);
- return CoderResult.OVERFLOW;
- }
-
- if((c = lookup[(int) (b & 0xFF)]) == NONE)
- {
- in.position (in.position () - 1);
- return CoderResult.unmappableForLength (1);
- }
- out.put (c);
- }
-
- return CoderResult.UNDERFLOW;
+ return helper.decodeLoop(in, out);
}
}
private static final class Encoder extends CharsetEncoder
{
- private byte[] lookup;
-
+ /** Lookup of char to byte mappings */
+ private final byte[] lookup;
+
+ /** Helper to encode loops */
+ private final ByteEncodeLoopHelper helper = new ByteEncodeLoopHelper()
+ {
+ protected boolean isMappable(char c)
+ {
+ return canEncode(c);
+ }
+ protected byte mapToByte(char c)
+ {
+ return lookup[c];
+ }
+ };
+
// Package-private to avoid a trampoline constructor.
- Encoder (ByteCharset cs)
+ Encoder(ByteCharset cs)
{
- super (cs, 1.0f, 1.0f);
+ super(cs, 1.0f, 1.0f);
char[] lookup_table = cs.getLookupTable();
// Create the inverse look-up table.
- // determine required size of encoding_table:
- int max = 0;
+ // determine required size of encoding_table:
+ int max = 0;
for (int i = 0; i < lookup_table.length; i++)
- {
- int c = (int)lookup_table[i];
- max = (c > max && c < NONE) ? c : max;
- }
+ {
+ int c = (int) lookup_table[i];
+ max = (c > max && c < NONE) ? c : max;
+ }
+
+ lookup = new byte[max + 1];
- lookup = new byte[max+1];
-
for (int i = 0; i < lookup_table.length; i++)
- {
- int c = (int)lookup_table[i];
- if (c != 0 && c < NONE)
- {
- lookup[c] = (byte)i;
- }
- }
+ {
+ int c = (int) lookup_table[i];
+ if (c != 0 && c < NONE)
+ {
+ lookup[c] = (byte) i;
+ }
+ }
}
public boolean canEncode(char c)
@@ -169,38 +179,15 @@ abstract class ByteCharset extends Charset
{
for (int i = 0; i < cs.length(); ++i)
{
- if (! canEncode(cs.charAt(i)))
+ if (!canEncode(cs.charAt(i)))
return false;
}
return true;
}
- protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
+ protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out)
{
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- int c = (int)in.get ();
-
- if (!out.hasRemaining ())
- {
- in.position (in.position () - 1);
- return CoderResult.OVERFLOW;
- }
-
- // lookup byte encoding
- byte b = (c < lookup.length) ? lookup[c] : (byte)0;
-
- if ((int)b != 0 || (int)c == 0)
- {
- out.put (b);
- } else {
- in.position (in.position () - 1);
- return CoderResult.unmappableForLength (1);
- }
- }
-
- return CoderResult.UNDERFLOW;
+ return helper.encodeLoop(in, out);
}
}
}
diff --git a/libjava/classpath/gnu/java/nio/charset/ByteDecodeLoopHelper.java b/libjava/classpath/gnu/java/nio/charset/ByteDecodeLoopHelper.java
new file mode 100644
index 00000000000..33dfa0263c7
--- /dev/null
+++ b/libjava/classpath/gnu/java/nio/charset/ByteDecodeLoopHelper.java
@@ -0,0 +1,162 @@
+/* ByteCharset.java -- Abstract class for generic 1-byte encodings.
+ Copyright (C) 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 gnu.java.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CoderResult;
+
+/**
+ * Helper class to deal with decoding loops that read a byte at a time
+ *
+ * @author Ian Rogers
+ */
+public abstract class ByteDecodeLoopHelper
+{
+ /**
+ * @return can the given byte be encoded
+ */
+ protected abstract boolean isMappable(byte b);
+
+ /**
+ * Map the given byte to a char, the given byte is guaranteed to be mappable
+ */
+ protected abstract char mapToChar(byte b);
+
+ /**
+ * Encodes one or more characters into one or more bytes, mapping each
+ * character to only one byte
+ *
+ * @param in character buffer to read from
+ * @param out byte buffer to write to
+ * @return the result state of the encoder
+ */
+ CoderResult decodeLoop(ByteBuffer in, CharBuffer out)
+ {
+ if (in.hasArray() && out.hasArray())
+ {
+ return arrayDecodeLoop(in, out);
+ } else
+ {
+ return normalDecodeLoop(in, out);
+ }
+ }
+
+ /**
+ * Encode loop using get and put operations
+ */
+ private CoderResult normalDecodeLoop(ByteBuffer in, CharBuffer out)
+ {
+ int outRemaining = out.remaining();
+ int inRemaining = in.remaining();
+ while (inRemaining > 0 && outRemaining > 0)
+ {
+ byte b = in.get();
+ inRemaining--;
+
+ if (!isMappable(b))
+ {
+ in.position(in.position() - 1);
+ return CoderResult.unmappableForLength(1);
+ }
+ char c = mapToChar(b);
+ out.put(c);
+ outRemaining--;
+ }
+ if (inRemaining > 0)
+ {
+ return CoderResult.OVERFLOW;
+ } else
+ {
+ return CoderResult.UNDERFLOW;
+ }
+ }
+
+ /**
+ * Encode loop using array read and write operations
+ */
+ private CoderResult arrayDecodeLoop(ByteBuffer in, CharBuffer out)
+ {
+ byte[] inArray = in.array();
+ char[] outArray = out.array();
+ int inPos = in.arrayOffset() + in.position();
+ int outPos = out.arrayOffset() + out.position();
+ int inRemaining = in.remaining();
+ int outRemaining = out.remaining();
+ CoderResult result;
+ if (inRemaining <= outRemaining)
+ {
+ for (int i = 0; i < inRemaining; i++)
+ {
+ byte b = inArray[inPos];
+ inPos++;
+ if (!isMappable(b))
+ {
+ inPos--;
+ result = CoderResult.unmappableForLength(1);
+ break;
+ }
+ char c = mapToChar(b);
+ outArray[outPos] = c;
+ outPos++;
+ }
+ result = CoderResult.UNDERFLOW;
+ }
+ else
+ {
+ for (int i = 0; i < outRemaining; i++)
+ {
+ byte b = inArray[inPos];
+ inPos++;
+ if (!isMappable(b))
+ {
+ inPos--;
+ result = CoderResult.unmappableForLength(1);
+ break;
+ }
+ char c = mapToChar(b);
+ outArray[outPos] = c;
+ outPos++;
+ }
+ result = CoderResult.OVERFLOW;
+ }
+ in.position(inPos - in.arrayOffset());
+ out.position(outPos - out.arrayOffset());
+ return result;
+ }
+}
diff --git a/libjava/classpath/gnu/java/nio/charset/ByteEncodeLoopHelper.java b/libjava/classpath/gnu/java/nio/charset/ByteEncodeLoopHelper.java
new file mode 100644
index 00000000000..5f703b195f2
--- /dev/null
+++ b/libjava/classpath/gnu/java/nio/charset/ByteEncodeLoopHelper.java
@@ -0,0 +1,163 @@
+/* ByteCharset.java -- Abstract class for generic 1-byte encodings.
+ Copyright (C) 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 gnu.java.nio.charset;
+
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.CoderResult;
+
+/**
+ * Helper class to deal with encoding loops that write a byte at a time
+ *
+ * @author Ian Rogers
+ */
+public abstract class ByteEncodeLoopHelper
+{
+ /**
+ * @return can the given character be encoded
+ */
+ protected abstract boolean isMappable(char c);
+
+ /**
+ * Map the given character to a byte, the given character is guaranteed to be
+ * mappable
+ */
+ protected abstract byte mapToByte(char c);
+
+ /**
+ * Encodes one or more characters into one or more bytes, mapping each
+ * character to only one byte
+ *
+ * @param in character buffer to read from
+ * @param out byte buffer to write to
+ * @return the result state of the encoder
+ */
+ CoderResult encodeLoop(CharBuffer in, ByteBuffer out)
+ {
+ if (in.hasArray() && out.hasArray())
+ {
+ return arrayEncodeLoop(in, out);
+ } else
+ {
+ return normalEncodeLoop(in, out);
+ }
+ }
+
+ /**
+ * Encode loop using get and put operations
+ */
+ private CoderResult normalEncodeLoop(CharBuffer in, ByteBuffer out)
+ {
+ int outRemaining = out.remaining();
+ int inRemaining = in.remaining();
+ while (inRemaining > 0 && outRemaining > 0)
+ {
+ char c = in.get();
+ inRemaining--;
+
+ if (!isMappable(c))
+ {
+ in.position(in.position() - 1);
+ return CoderResult.unmappableForLength(1);
+ }
+ byte b = mapToByte(c);
+ out.put(b);
+ outRemaining--;
+ }
+ if (inRemaining > 0)
+ {
+ return CoderResult.OVERFLOW;
+ } else
+ {
+ return CoderResult.UNDERFLOW;
+ }
+ }
+
+ /**
+ * Encode loop using array read and write operations
+ */
+ private CoderResult arrayEncodeLoop(CharBuffer in, ByteBuffer out)
+ {
+ char[] inArray = in.array();
+ byte[] outArray = out.array();
+ int inPos = in.arrayOffset() + in.position();
+ int outPos = out.arrayOffset() + out.position();
+ int inRemaining = in.remaining();
+ int outRemaining = out.remaining();
+ CoderResult result;
+ if (inRemaining <= outRemaining)
+ {
+ for (int i = 0; i < inRemaining; i++)
+ {
+ char inChar = inArray[inPos];
+ inPos++;
+ if (!isMappable(inChar))
+ {
+ inPos--;
+ result = CoderResult.unmappableForLength(1);
+ break;
+ }
+ byte b = mapToByte(inChar);
+ outArray[outPos] = b;
+ outPos++;
+ }
+ result = CoderResult.UNDERFLOW;
+ }
+ else
+ {
+ for (int i = 0; i < outRemaining; i++)
+ {
+ char inChar = inArray[inPos];
+ inPos++;
+ if (!isMappable(inChar))
+ {
+ inPos--;
+ result = CoderResult.unmappableForLength(1);
+ break;
+ }
+ byte b = mapToByte(inChar);
+ outArray[outPos] = b;
+ outPos++;
+ }
+ result = CoderResult.OVERFLOW;
+ }
+ in.position(inPos - in.arrayOffset());
+ out.position(outPos - out.arrayOffset());
+ return result;
+ }
+}
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp424.java b/libjava/classpath/gnu/java/nio/charset/Cp424.java
index 9733a76a4c5..44e1eba4f6a 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp424.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp424.java
@@ -37,53 +37,50 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp424 extends ByteCharset
+public final class Cp424 extends ByteCharset
{
/**
* This is the lookup table for this encoding
*/
- private static final char[] lookup =
+ private static final char[] lookup =
{
- 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F,
- 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
- 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087,
- 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
- 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B,
- 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
- 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004,
- 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
- 0x0020, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6,
- 0x05D7, 0x05D8, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C,
- 0x0026, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
- 0x05E0, 0x05E1, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC,
- 0x002D, 0x002F, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
- 0x05E8, 0x05E9, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
- NONE, 0x05EA, NONE, NONE, 0x00A0, NONE, NONE, NONE,
- 0x2017, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
- NONE, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
- 0x0068, 0x0069, 0x00AB, 0x00BB, NONE, NONE, NONE, 0x00B1,
- 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070,
- 0x0071, 0x0072, NONE, NONE, NONE, 0x00B8, NONE, 0x00A4,
- 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078,
- 0x0079, 0x007A, NONE, NONE, NONE, NONE, NONE, 0x00AE,
- 0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC,
- 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
- 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
- 0x0048, 0x0049, 0x00AD, NONE, NONE, NONE, NONE, NONE,
- 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050,
- 0x0051, 0x0052, 0x00B9, NONE, NONE, NONE, NONE, NONE,
- 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
- 0x0059, 0x005A, 0x00B2, NONE, NONE, NONE, NONE, NONE,
- 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
+ 0x0000, 0x0001, 0x0002, 0x0003, 0x009C, 0x0009, 0x0086, 0x007F,
+ 0x0097, 0x008D, 0x008E, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
+ 0x0010, 0x0011, 0x0012, 0x0013, 0x009D, 0x0085, 0x0008, 0x0087,
+ 0x0018, 0x0019, 0x0092, 0x008F, 0x001C, 0x001D, 0x001E, 0x001F,
+ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x000A, 0x0017, 0x001B,
+ 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x0005, 0x0006, 0x0007,
+ 0x0090, 0x0091, 0x0016, 0x0093, 0x0094, 0x0095, 0x0096, 0x0004,
+ 0x0098, 0x0099, 0x009A, 0x009B, 0x0014, 0x0015, 0x009E, 0x001A,
+ 0x0020, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6,
+ 0x05D7, 0x05D8, 0x00A2, 0x002E, 0x003C, 0x0028, 0x002B, 0x007C,
+ 0x0026, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
+ 0x05E0, 0x05E1, 0x0021, 0x0024, 0x002A, 0x0029, 0x003B, 0x00AC,
+ 0x002D, 0x002F, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
+ 0x05E8, 0x05E9, 0x00A6, 0x002C, 0x0025, 0x005F, 0x003E, 0x003F,
+ NONE, 0x05EA, NONE, NONE, 0x00A0, NONE, NONE, NONE,
+ 0x2017, 0x0060, 0x003A, 0x0023, 0x0040, 0x0027, 0x003D, 0x0022,
+ NONE, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
+ 0x0068, 0x0069, 0x00AB, 0x00BB, NONE, NONE, NONE, 0x00B1,
+ 0x00B0, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070,
+ 0x0071, 0x0072, NONE, NONE, NONE, 0x00B8, NONE, 0x00A4,
+ 0x00B5, 0x007E, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078,
+ 0x0079, 0x007A, NONE, NONE, NONE, NONE, NONE, 0x00AE,
+ 0x005E, 0x00A3, 0x00A5, 0x00B7, 0x00A9, 0x00A7, 0x00B6, 0x00BC,
+ 0x00BD, 0x00BE, 0x005B, 0x005D, 0x00AF, 0x00A8, 0x00B4, 0x00D7,
+ 0x007B, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
+ 0x0048, 0x0049, 0x00AD, NONE, NONE, NONE, NONE, NONE,
+ 0x007D, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F, 0x0050,
+ 0x0051, 0x0052, 0x00B9, NONE, NONE, NONE, NONE, NONE,
+ 0x005C, 0x00F7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
+ 0x0059, 0x005A, 0x00B2, NONE, NONE, NONE, NONE, NONE,
+ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x00B3, NONE, NONE, NONE, NONE, 0x009F
};
- public Cp424()
- {
- super("Cp424", new String[] {
- });
- lookupTable = lookup;
+ public Cp424() {
+ super("Cp424", new String[] {}, lookup);
}
} // class Cp424
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp437.java b/libjava/classpath/gnu/java/nio/charset/Cp437.java
index d6083579d11..e38a482573a 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp437.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp437.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp437 extends ByteCharset
+public final class Cp437 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class Cp437 extends ByteCharset
public Cp437()
{
- super("Cp437", new String[] {
- });
- lookupTable = lookup;
+ super("Cp437", new String[]{}, lookup);
}
} // class Cp437
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp737.java b/libjava/classpath/gnu/java/nio/charset/Cp737.java
index 548da21912b..2187987ead7 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp737.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp737.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp737 extends ByteCharset
+public final class Cp737 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class Cp737 extends ByteCharset
public Cp737()
{
- super("Cp737", new String[] {
- });
- lookupTable = lookup;
+ super("Cp737", new String[] {}, lookup);
}
} // class Cp737
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp775.java b/libjava/classpath/gnu/java/nio/charset/Cp775.java
index 4d3f1c36c8d..f2fba4356e3 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp775.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp775.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp775 extends ByteCharset
+public final class Cp775 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class Cp775 extends ByteCharset
public Cp775()
{
- super("Cp775", new String[] {
- });
- lookupTable = lookup;
+ super("Cp775", new String[] {}, lookup);
}
} // class Cp775
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp850.java b/libjava/classpath/gnu/java/nio/charset/Cp850.java
index 9122105ad08..48d4fb3448a 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp850.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp850.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp850 extends ByteCharset
+public final class Cp850 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class Cp850 extends ByteCharset
public Cp850()
{
- super("Cp850", new String[] {
- });
- lookupTable = lookup;
+ super("Cp850", new String[] {}, lookup);
}
} // class Cp850
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp852.java b/libjava/classpath/gnu/java/nio/charset/Cp852.java
index a859530a8ef..c550944b526 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp852.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp852.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp852 extends ByteCharset
+public final class Cp852 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class Cp852 extends ByteCharset
public Cp852()
{
- super("Cp852", new String[] {
- });
- lookupTable = lookup;
+ super("Cp852", new String[] {}, lookup);
}
} // class Cp852
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp855.java b/libjava/classpath/gnu/java/nio/charset/Cp855.java
index fbec999c794..141e891b67c 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp855.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp855.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp855 extends ByteCharset
+public final class Cp855 extends ByteCharset
{
/**
@@ -81,10 +81,7 @@ public class Cp855 extends ByteCharset
public Cp855()
{
- super("Cp855", new String[] {
- "cp-855",
- });
- lookupTable = lookup;
+ super("Cp855", new String[] {"cp-855",}, lookup);
}
} // class Cp855
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp857.java b/libjava/classpath/gnu/java/nio/charset/Cp857.java
index 78f8dbd2d15..b517b0393c6 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp857.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp857.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp857 extends ByteCharset
+public final class Cp857 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp857 extends ByteCharset
public Cp857()
{
- super("Cp857", new String[] {
- "cp-857"
- });
- lookupTable = lookup;
+ super("Cp857", new String[] {"cp-857"}, lookup);
}
} // class Cp857
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp860.java b/libjava/classpath/gnu/java/nio/charset/Cp860.java
index e3c7f46b8f5..58a396446ad 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp860.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp860.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp860 extends ByteCharset
+public final class Cp860 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp860 extends ByteCharset
public Cp860()
{
- super("Cp860", new String[] {
- "cp-860"
- });
- lookupTable = lookup;
+ super("Cp860", new String[] {"cp-860"}, lookup);
}
} // class Cp860
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp861.java b/libjava/classpath/gnu/java/nio/charset/Cp861.java
index 6e17ea2e842..cf5210d0a2a 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp861.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp861.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp861 extends ByteCharset
+public final class Cp861 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp861 extends ByteCharset
public Cp861()
{
- super("Cp861", new String[] {
- "cp-861"
- });
- lookupTable = lookup;
+ super("Cp861", new String[] {"cp-861"}, lookup);
}
} // class Cp861
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp862.java b/libjava/classpath/gnu/java/nio/charset/Cp862.java
index ccd74fa9ddb..f66118021a3 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp862.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp862.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp862 extends ByteCharset
+public final class Cp862 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp862 extends ByteCharset
public Cp862()
{
- super("Cp862", new String[] {
- "Cp-862"
- });
- lookupTable = lookup;
+ super("Cp862", new String[] {"Cp-862"}, lookup);
}
} // class Cp862
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp863.java b/libjava/classpath/gnu/java/nio/charset/Cp863.java
index 97812a6f66c..03850234ef6 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp863.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp863.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp863 extends ByteCharset
+public final class Cp863 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp863 extends ByteCharset
public Cp863()
{
- super("Cp863", new String[] {
- "Cp-863"
- });
- lookupTable = lookup;
+ super("Cp863", new String[] {"Cp-863"}, lookup);
}
} // class Cp863
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp864.java b/libjava/classpath/gnu/java/nio/charset/Cp864.java
index f136f43eccc..028235dd30c 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp864.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp864.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp864 extends ByteCharset
+public final class Cp864 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp864 extends ByteCharset
public Cp864()
{
- super("Cp864", new String[] {
- "Cp-864"
- });
- lookupTable = lookup;
+ super("Cp864", new String[] {"Cp-864"}, lookup);
}
} // class Cp864
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp865.java b/libjava/classpath/gnu/java/nio/charset/Cp865.java
index a1332a74f95..c723e80c995 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp865.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp865.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp865 extends ByteCharset
+public final class Cp865 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp865 extends ByteCharset
public Cp865()
{
- super("Cp865", new String[] {
- "Cp-865"
- });
- lookupTable = lookup;
+ super("Cp865", new String[] {"Cp-865"}, lookup);
}
} // class Cp865
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp866.java b/libjava/classpath/gnu/java/nio/charset/Cp866.java
index ca6958949f6..103bca7c30a 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp866.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp866.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp866 extends ByteCharset
+public final class Cp866 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp866 extends ByteCharset
public Cp866()
{
- super("Cp866", new String[] {
- "cp-866"
- });
- lookupTable = lookup;
+ super("Cp866", new String[] {"cp-866"}, lookup);
}
} // class Cp866
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp869.java b/libjava/classpath/gnu/java/nio/charset/Cp869.java
index f5e05298473..0632b37418c 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp869.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp869.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp869 extends ByteCharset
+public final class Cp869 extends ByteCharset
{
/**
@@ -82,10 +82,7 @@ public class Cp869 extends ByteCharset
public Cp869()
{
- super("Cp869", new String[] {
- "Cp-869"
- });
- lookupTable = lookup;
+ super("Cp869", new String[] {"Cp-869"}, lookup);
}
} // class Cp869
diff --git a/libjava/classpath/gnu/java/nio/charset/Cp874.java b/libjava/classpath/gnu/java/nio/charset/Cp874.java
index d81755c1e0e..f6e52c485ea 100644
--- a/libjava/classpath/gnu/java/nio/charset/Cp874.java
+++ b/libjava/classpath/gnu/java/nio/charset/Cp874.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class Cp874 extends ByteCharset
+public final class Cp874 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class Cp874 extends ByteCharset
public Cp874()
{
- super("Cp874", new String[] {
- });
- lookupTable = lookup;
+ super("Cp874", new String[] {}, lookup);
}
} // class Cp874
diff --git a/libjava/classpath/gnu/java/nio/charset/EncodingHelper.java b/libjava/classpath/gnu/java/nio/charset/EncodingHelper.java
index be7b4afe05d..479b6e53434 100644
--- a/libjava/classpath/gnu/java/nio/charset/EncodingHelper.java
+++ b/libjava/classpath/gnu/java/nio/charset/EncodingHelper.java
@@ -57,10 +57,10 @@ public class EncodingHelper
* Contains the mapping from java.io canonical names
* to java.nio canonical names.
*/
- private static HashMap canonicalNames;
+ private static final HashMap<String,String> canonicalNames;
static {
- canonicalNames = new HashMap();
+ canonicalNames = new HashMap<String,String>();
canonicalNames.put("US-ASCII", "ASCII");
canonicalNames.put("windows-1250", "Cp1250");
canonicalNames.put("windows-1251", "Cp1251");
@@ -94,7 +94,6 @@ public class EncodingHelper
*/
public static String getDefaultEncoding()
{
- String encoding;
try
{
return System.getProperty("file.encoding");
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_1.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_1.java
index 558289583dd..19a538d9fe4 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_1.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_1.java
@@ -48,6 +48,7 @@ import java.nio.charset.CoderResult;
* ISO-8859-1 charset.
*
* @author Jesse Rosenstock
+ * @modified Ian Rogers
*/
final class ISO_8859_1 extends Charset
{
@@ -98,6 +99,19 @@ final class ISO_8859_1 extends Charset
private static final class Decoder extends CharsetDecoder
{
+ /** Helper to decode loops */
+ private static final ByteDecodeLoopHelper helper = new ByteDecodeLoopHelper()
+ {
+ protected boolean isMappable(byte b)
+ {
+ return true;
+ }
+ protected char mapToChar(byte b)
+ {
+ return (char)(b & 0xFF);
+ }
+ };
+
// Package-private to avoid a trampoline constructor.
Decoder (Charset cs)
{
@@ -106,26 +120,24 @@ final class ISO_8859_1 extends Charset
protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
{
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- byte b = in.get ();
-
- if (!out.hasRemaining ())
- {
- in.position (in.position () - 1);
- return CoderResult.OVERFLOW;
- }
-
- out.put ((char) (b & 0xFF));
- }
-
- return CoderResult.UNDERFLOW;
+ return helper.decodeLoop(in, out);
}
}
private static final class Encoder extends CharsetEncoder
{
+ /** Helper to encode loops */
+ private static final ByteEncodeLoopHelper helper = new ByteEncodeLoopHelper()
+ {
+ protected boolean isMappable(char c)
+ {
+ return c <= 0xff;
+ }
+ protected byte mapToByte(char c)
+ {
+ return (byte)c;
+ }
+ };
// Package-private to avoid a trampoline constructor.
Encoder (Charset cs)
{
@@ -147,26 +159,7 @@ final class ISO_8859_1 extends Charset
protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
{
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- char c = in.get ();
-
- if (c > 0xFF)
- {
- in.position (in.position () - 1);
- return CoderResult.unmappableForLength (1);
- }
- if (!out.hasRemaining ())
- {
- in.position (in.position () - 1);
- return CoderResult.OVERFLOW;
- }
-
- out.put ((byte) c);
- }
-
- return CoderResult.UNDERFLOW;
+ return helper.encodeLoop(in, out);
}
}
}
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_13.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_13.java
index c10eef305c3..3bbd42f3b49 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_13.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_13.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-13, ISO Latin-7 char set.
*/
-public class ISO_8859_13 extends ByteCharset
+public final class ISO_8859_13 extends ByteCharset
{
/**
@@ -96,8 +96,7 @@ public class ISO_8859_13 extends ByteCharset
"8859_13",
"cp921",
"921"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_13
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_15.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_15.java
index 973fe1c947d..df2265ac549 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_15.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_15.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-15, ISO Latin-9 char set.
*/
-public class ISO_8859_15 extends ByteCharset
+public final class ISO_8859_15 extends ByteCharset
{
/**
@@ -103,8 +103,7 @@ public class ISO_8859_15 extends ByteCharset
"cp923",
"923",
"windows-28605"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_15
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_2.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_2.java
index 2de96df9b68..dbe2b4dbf96 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_2.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_2.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-2, ISO Latin-2 char set.
*/
-public class ISO_8859_2 extends ByteCharset
+public final class ISO_8859_2 extends ByteCharset
{
/**
@@ -102,8 +102,7 @@ public class ISO_8859_2 extends ByteCharset
"cp912",
"912",
"windows-28592"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_2
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_3.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_3.java
index 6e718719a2d..567379e7de4 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_3.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_3.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-3, ISO Latin-3 char set.
*/
-public class ISO_8859_3 extends ByteCharset
+public final class ISO_8859_3 extends ByteCharset
{
/**
@@ -101,8 +101,7 @@ public class ISO_8859_3 extends ByteCharset
"cp913",
"913",
"windows-28593"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_3
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_4.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_4.java
index 96dc4675476..ca062278a7a 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_4.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_4.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-4, ISO Latin-4 char set.
*/
-public class ISO_8859_4 extends ByteCharset
+public final class ISO_8859_4 extends ByteCharset
{
/**
@@ -102,8 +102,7 @@ public class ISO_8859_4 extends ByteCharset
"cp914",
"914",
"windows-28594"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_4
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_5.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_5.java
index ad208729c85..70496ce4931 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_5.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_5.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-5, ISO cyrillic char set.
*/
-public class ISO_8859_5 extends ByteCharset
+public final class ISO_8859_5 extends ByteCharset
{
/**
@@ -100,8 +100,7 @@ public class ISO_8859_5 extends ByteCharset
"cp915",
"915",
"windows-28595"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_5
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_6.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_6.java
index 5600e792386..dc7a9bef8ca 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_6.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_6.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-6, ISO Arabic char set.
*/
-public class ISO_8859_6 extends ByteCharset
+public final class ISO_8859_6 extends ByteCharset
{
/**
@@ -104,8 +104,7 @@ public class ISO_8859_6 extends ByteCharset
"windows-28596",
"ISO-8859-6-I",
"ISO-8859-6-E"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_6
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_7.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_7.java
index 9262a607723..195f1609458 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_7.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_7.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-7, ISO Latin/Greek char set.
*/
-public class ISO_8859_7 extends ByteCharset
+public final class ISO_8859_7 extends ByteCharset
{
/**
@@ -103,8 +103,7 @@ public class ISO_8859_7 extends ByteCharset
"cp813",
"813",
"windows-28597"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_7
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_8.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_8.java
index 96fb0f48b82..b58030f174b 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_8.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_8.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-8, ISO Latin/Hebrew char set.
*/
-public class ISO_8859_8 extends ByteCharset
+public final class ISO_8859_8 extends ByteCharset
{
/**
@@ -102,8 +102,7 @@ public class ISO_8859_8 extends ByteCharset
"cp916",
"916",
"windows-28598"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_8
diff --git a/libjava/classpath/gnu/java/nio/charset/ISO_8859_9.java b/libjava/classpath/gnu/java/nio/charset/ISO_8859_9.java
index 28be34cf877..83fb5a222d7 100644
--- a/libjava/classpath/gnu/java/nio/charset/ISO_8859_9.java
+++ b/libjava/classpath/gnu/java/nio/charset/ISO_8859_9.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for ISO-8859-9, ISO Latin-5 char set.
*/
-public class ISO_8859_9 extends ByteCharset
+public final class ISO_8859_9 extends ByteCharset
{
/**
@@ -102,8 +102,7 @@ public class ISO_8859_9 extends ByteCharset
"920",
"windows-28599",
"ECMA-128"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class ISO_8859_9
diff --git a/libjava/classpath/gnu/java/nio/charset/KOI_8.java b/libjava/classpath/gnu/java/nio/charset/KOI_8.java
index c6706560702..20eb8b198ad 100644
--- a/libjava/classpath/gnu/java/nio/charset/KOI_8.java
+++ b/libjava/classpath/gnu/java/nio/charset/KOI_8.java
@@ -41,7 +41,7 @@ package gnu.java.nio.charset;
/**
* Encoding table for the KOI8 cyrillic char set.
*/
-public class KOI_8 extends ByteCharset
+public final class KOI_8 extends ByteCharset
{
/**
@@ -94,8 +94,7 @@ public class KOI_8 extends ByteCharset
"koi8r",
"koi-8-r",
"koi"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class KOI_8
diff --git a/libjava/classpath/gnu/java/nio/charset/MS874.java b/libjava/classpath/gnu/java/nio/charset/MS874.java
index b16e53f4243..f7cf81a2509 100644
--- a/libjava/classpath/gnu/java/nio/charset/MS874.java
+++ b/libjava/classpath/gnu/java/nio/charset/MS874.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MS874 extends ByteCharset
+public final class MS874 extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MS874 extends ByteCharset
public MS874()
{
- super("MS874", new String[] {
- });
- lookupTable = lookup;
+ super("MS874", new String[] {}, lookup);
}
} // class MS874
diff --git a/libjava/classpath/gnu/java/nio/charset/MacCentralEurope.java b/libjava/classpath/gnu/java/nio/charset/MacCentralEurope.java
index 5496db2b5ea..ce085436530 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacCentralEurope.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacCentralEurope.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacCentralEurope extends ByteCharset
+public final class MacCentralEurope extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacCentralEurope extends ByteCharset
public MacCentralEurope()
{
- super("MacCentralEurope", new String[] {
- });
- lookupTable = lookup;
+ super("MacCentralEurope", new String[] {}, lookup);
}
} // class MacCentralEurope
diff --git a/libjava/classpath/gnu/java/nio/charset/MacCroatian.java b/libjava/classpath/gnu/java/nio/charset/MacCroatian.java
index f71ac5199b7..3bb19f5e2ed 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacCroatian.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacCroatian.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacCroatian extends ByteCharset
+public final class MacCroatian extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacCroatian extends ByteCharset
public MacCroatian()
{
- super("MacCroatian", new String[] {
- });
- lookupTable = lookup;
+ super("MacCroatian", new String[] {}, lookup);
}
} // class MacCroatian
diff --git a/libjava/classpath/gnu/java/nio/charset/MacCyrillic.java b/libjava/classpath/gnu/java/nio/charset/MacCyrillic.java
index f152f6b1c1b..b1984e57ab1 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacCyrillic.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacCyrillic.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacCyrillic extends ByteCharset
+public final class MacCyrillic extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacCyrillic extends ByteCharset
public MacCyrillic()
{
- super("MacCyrillic", new String[] {
- });
- lookupTable = lookup;
+ super("MacCyrillic", new String[] {}, lookup);
}
} // class MacCyrillic
diff --git a/libjava/classpath/gnu/java/nio/charset/MacDingbat.java b/libjava/classpath/gnu/java/nio/charset/MacDingbat.java
index 84102d56f67..ad2f1c851c4 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacDingbat.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacDingbat.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacDingbat extends ByteCharset
+public final class MacDingbat extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacDingbat extends ByteCharset
public MacDingbat()
{
- super("MacDingbat", new String[] {
- });
- lookupTable = lookup;
+ super("MacDingbat", new String[] {}, lookup);
}
} // class MacDingbat
diff --git a/libjava/classpath/gnu/java/nio/charset/MacGreek.java b/libjava/classpath/gnu/java/nio/charset/MacGreek.java
index 07624d59eff..6d152287408 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacGreek.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacGreek.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacGreek extends ByteCharset
+public final class MacGreek extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacGreek extends ByteCharset
public MacGreek()
{
- super("MacGreek", new String[] {
- });
- lookupTable = lookup;
+ super("MacGreek", new String[] {}, lookup);
}
} // class MacGreek
diff --git a/libjava/classpath/gnu/java/nio/charset/MacIceland.java b/libjava/classpath/gnu/java/nio/charset/MacIceland.java
index 7918e026622..a8eb7036c17 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacIceland.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacIceland.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacIceland extends ByteCharset
+public final class MacIceland extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacIceland extends ByteCharset
public MacIceland()
{
- super("MacIceland", new String[] {
- });
- lookupTable = lookup;
+ super("MacIceland", new String[] {}, lookup);
}
} // class MacIceland
diff --git a/libjava/classpath/gnu/java/nio/charset/MacRoman.java b/libjava/classpath/gnu/java/nio/charset/MacRoman.java
index b413caf2be7..72738a2aa23 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacRoman.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacRoman.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacRoman extends ByteCharset
+public final class MacRoman extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacRoman extends ByteCharset
public MacRoman()
{
- super("MacRoman", new String[] {
- });
- lookupTable = lookup;
+ super("MacRoman", new String[] {}, lookup);
}
} // class MacRoman
diff --git a/libjava/classpath/gnu/java/nio/charset/MacRomania.java b/libjava/classpath/gnu/java/nio/charset/MacRomania.java
index d1779a40eb8..e05e94025e6 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacRomania.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacRomania.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacRomania extends ByteCharset
+public final class MacRomania extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacRomania extends ByteCharset
public MacRomania()
{
- super("MacRomania", new String[] {
- });
- lookupTable = lookup;
+ super("MacRomania", new String[] {}, lookup);
}
} // class MacRomania
diff --git a/libjava/classpath/gnu/java/nio/charset/MacSymbol.java b/libjava/classpath/gnu/java/nio/charset/MacSymbol.java
index 869de194736..9878efd89d3 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacSymbol.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacSymbol.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacSymbol extends ByteCharset
+public final class MacSymbol extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacSymbol extends ByteCharset
public MacSymbol()
{
- super("MacSymbol", new String[] {
- });
- lookupTable = lookup;
+ super("MacSymbol", new String[] {}, lookup);
}
} // class MacSymbol
diff --git a/libjava/classpath/gnu/java/nio/charset/MacThai.java b/libjava/classpath/gnu/java/nio/charset/MacThai.java
index 498b9e6bb4c..daed7563033 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacThai.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacThai.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacThai extends ByteCharset
+public final class MacThai extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacThai extends ByteCharset
public MacThai()
{
- super("MacThai", new String[] {
- });
- lookupTable = lookup;
+ super("MacThai", new String[] {}, lookup);
}
} // class MacThai
diff --git a/libjava/classpath/gnu/java/nio/charset/MacTurkish.java b/libjava/classpath/gnu/java/nio/charset/MacTurkish.java
index 68ea27b8cee..b623ee39a82 100644
--- a/libjava/classpath/gnu/java/nio/charset/MacTurkish.java
+++ b/libjava/classpath/gnu/java/nio/charset/MacTurkish.java
@@ -37,7 +37,7 @@ exception statement from your version. */
package gnu.java.nio.charset;
-public class MacTurkish extends ByteCharset
+public final class MacTurkish extends ByteCharset
{
/**
@@ -81,9 +81,7 @@ public class MacTurkish extends ByteCharset
public MacTurkish()
{
- super("MacTurkish", new String[] {
- });
- lookupTable = lookup;
+ super("MacTurkish", new String[] {}, lookup);
}
} // class MacTurkish
diff --git a/libjava/classpath/gnu/java/nio/charset/Provider.java b/libjava/classpath/gnu/java/nio/charset/Provider.java
index b56e5a90e72..d3b71a61265 100644
--- a/libjava/classpath/gnu/java/nio/charset/Provider.java
+++ b/libjava/classpath/gnu/java/nio/charset/Provider.java
@@ -67,14 +67,14 @@ public final class Provider extends CharsetProvider
* are all lower-case to allow case-insensitive retrieval of
* Charset instances.
*/
- private final HashMap canonicalNames;
+ private final HashMap<String, String> canonicalNames;
/**
* Map from lower-case canonical name to Charset.
* TODO: We may want to use soft references. We would then need to keep
* track of the class name to regenerate the object.
*/
- private final HashMap charsets;
+ private final HashMap<String, Charset> charsets;
/**
* We don't load all available charsets at the start
@@ -85,8 +85,8 @@ public final class Provider extends CharsetProvider
Provider ()
{
extendedLoaded = false;
- canonicalNames = new HashMap ();
- charsets = new HashMap ();
+ canonicalNames = new HashMap<String,String> ();
+ charsets = new HashMap<String,Charset> ();
// US-ASCII aka ISO646-US
addCharset (new US_ASCII ());
@@ -203,7 +203,7 @@ public final class Provider extends CharsetProvider
extendedLoaded = true;
}
- public Iterator charsets ()
+ public Iterator<Charset> charsets ()
{
loadExtended();
return Collections.unmodifiableCollection (charsets.values ())
@@ -250,7 +250,7 @@ public final class Provider extends CharsetProvider
*/
canonicalNames.put(canonicalName, canonicalName);
- for (Iterator i = cs.aliases ().iterator (); i.hasNext (); )
+ for (Iterator<String> i = cs.aliases ().iterator (); i.hasNext (); )
canonicalNames.put (((String) i.next()).toLowerCase(), canonicalName);
}
@@ -258,10 +258,10 @@ public final class Provider extends CharsetProvider
{
// The default provider is safe to instantiate.
if (singleton == null)
- singleton = (Provider) AccessController.doPrivileged
- (new PrivilegedAction()
+ singleton = AccessController.doPrivileged
+ (new PrivilegedAction<Provider>()
{
- public Object run()
+ public Provider run()
{
return new Provider();
}
diff --git a/libjava/classpath/gnu/java/nio/charset/US_ASCII.java b/libjava/classpath/gnu/java/nio/charset/US_ASCII.java
index 8888416bebf..b09c43e61c1 100644
--- a/libjava/classpath/gnu/java/nio/charset/US_ASCII.java
+++ b/libjava/classpath/gnu/java/nio/charset/US_ASCII.java
@@ -48,6 +48,7 @@ import java.nio.charset.CoderResult;
* US-ASCII charset.
*
* @author Jesse Rosenstock
+ * @modified Ian Rogers
*/
final class US_ASCII extends Charset
{
@@ -95,6 +96,19 @@ final class US_ASCII extends Charset
private static final class Decoder extends CharsetDecoder
{
+ /** Helper to decode loops */
+ private static final ByteDecodeLoopHelper helper = new ByteDecodeLoopHelper()
+ {
+ protected boolean isMappable(byte b)
+ {
+ return b >= 0;
+ }
+ protected char mapToChar(byte b)
+ {
+ return (char)b;
+ }
+ };
+
// Package-private to avoid a trampoline constructor.
Decoder (Charset cs)
{
@@ -103,31 +117,24 @@ final class US_ASCII extends Charset
protected CoderResult decodeLoop (ByteBuffer in, CharBuffer out)
{
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- byte b = in.get ();
-
- if (b < 0)
- {
- in.position (in.position () - 1);
- return CoderResult.malformedForLength (1);
- }
- if (!out.hasRemaining ())
- {
- in.position (in.position () - 1);
- return CoderResult.OVERFLOW;
- }
-
- out.put ((char) b);
- }
-
- return CoderResult.UNDERFLOW;
+ return helper.decodeLoop(in, out);
}
}
private static final class Encoder extends CharsetEncoder
{
+ /** Helper to encode loops */
+ private static final ByteEncodeLoopHelper helper = new ByteEncodeLoopHelper()
+ {
+ protected boolean isMappable(char c)
+ {
+ return c <= 0x7f;
+ }
+ protected byte mapToByte(char c)
+ {
+ return (byte)c;
+ }
+ };
// Package-private to avoid a trampoline constructor.
Encoder (Charset cs)
{
@@ -149,26 +156,7 @@ final class US_ASCII extends Charset
protected CoderResult encodeLoop (CharBuffer in, ByteBuffer out)
{
- // TODO: Optimize this in the case in.hasArray() / out.hasArray()
- while (in.hasRemaining ())
- {
- char c = in.get ();
-
- if (c > 0x7f)
- {
- in.position (in.position () - 1);
- return CoderResult.unmappableForLength (1);
- }
- if (!out.hasRemaining ())
- {
- in.position (in.position () - 1);
- return CoderResult.OVERFLOW;
- }
-
- out.put ((byte) c);
- }
-
- return CoderResult.UNDERFLOW;
+ return helper.encodeLoop(in, out);
}
}
}
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1250.java b/libjava/classpath/gnu/java/nio/charset/Windows1250.java
index 9d7ab8edd8c..f8fc90ae281 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1250.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1250.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1250-Latin-1,
* aka cp1250 or Windows-1250 or whatever.
*/
-public class Windows1250 extends ByteCharset
+public final class Windows1250 extends ByteCharset
{
/**
@@ -95,8 +95,7 @@ public class Windows1250 extends ByteCharset
"cp_1250",
"windows1250",
"windows_1250"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1250
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1251.java b/libjava/classpath/gnu/java/nio/charset/Windows1251.java
index bf3227e87f2..51f289e2aa9 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1251.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1251.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1251 Cyrillic char set.
* aka cp1251 or Windows-1251 or whatever.
*/
-public class Windows1251 extends ByteCharset
+public final class Windows1251 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1251 extends ByteCharset
"cp_1251",
"windows1251",
"windows_1251"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1251
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1252.java b/libjava/classpath/gnu/java/nio/charset/Windows1252.java
index 9391c87d48a..03d15802c8a 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1252.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1252.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1252-Latin-1,
* aka cp1252 or Windows-1252 or whatever.
*/
-public class Windows1252 extends ByteCharset
+public final class Windows1252 extends ByteCharset
{
/**
@@ -92,8 +92,7 @@ public class Windows1252 extends ByteCharset
"windows-1252",
"cp1252",
"cp-1252"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1252
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1253.java b/libjava/classpath/gnu/java/nio/charset/Windows1253.java
index 02150b4afb9..9e5b1f769dc 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1253.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1253.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1253 Greek char set.
* aka cp1253 or Windows-1253 or whatever.
*/
-public class Windows1253 extends ByteCharset
+public final class Windows1253 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1253 extends ByteCharset
"cp_1253",
"windows1253",
"windows_1253"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1253
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1254.java b/libjava/classpath/gnu/java/nio/charset/Windows1254.java
index 7cdad3c4693..9025421b33e 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1254.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1254.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1254 Turkish char set.
* aka cp1254 or Windows-1254 or whatever.
*/
-public class Windows1254 extends ByteCharset
+public final class Windows1254 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1254 extends ByteCharset
"cp_1254",
"windows1254",
"windows_1254"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1254
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1255.java b/libjava/classpath/gnu/java/nio/charset/Windows1255.java
index b706d193006..61787d184d0 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1255.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1255.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1255 Hebrew char set.
* aka cp1255 or Windows-1255 or whatever.
*/
-public class Windows1255 extends ByteCharset
+public final class Windows1255 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1255 extends ByteCharset
"cp_1255",
"windows1255",
"windows_1255"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1255
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1256.java b/libjava/classpath/gnu/java/nio/charset/Windows1256.java
index 6924420e1bc..cf88c21b47d 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1256.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1256.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1256 Arabic char set.
* aka cp1256 or Windows-1256 or whatever.
*/
-public class Windows1256 extends ByteCharset
+public final class Windows1256 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1256 extends ByteCharset
"cp_1256",
"windows1256",
"windows_1256"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1256
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1257.java b/libjava/classpath/gnu/java/nio/charset/Windows1257.java
index 2f95d64ac74..2d281d9cd26 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1257.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1257.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1257 Baltic char set.
* aka cp1257 or Windows-1257 or whatever.
*/
-public class Windows1257 extends ByteCharset
+public final class Windows1257 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1257 extends ByteCharset
"cp_1257",
"windows1257",
"windows_1257"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1257
diff --git a/libjava/classpath/gnu/java/nio/charset/Windows1258.java b/libjava/classpath/gnu/java/nio/charset/Windows1258.java
index 7d653b49780..63ef37f1a31 100644
--- a/libjava/classpath/gnu/java/nio/charset/Windows1258.java
+++ b/libjava/classpath/gnu/java/nio/charset/Windows1258.java
@@ -42,7 +42,7 @@ package gnu.java.nio.charset;
* Encoding table for Windows-1258 Arabic char set.
* aka cp1258 or Windows-1258 or whatever.
*/
-public class Windows1258 extends ByteCharset
+public final class Windows1258 extends ByteCharset
{
/**
@@ -93,8 +93,7 @@ public class Windows1258 extends ByteCharset
"cp_1258",
"windows1258",
"windows_1258"
- });
- lookupTable = lookup;
+ }, lookup);
}
} // class Windows1258
diff --git a/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java b/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java
index 9cc57b2289f..9f2b3706e86 100644
--- a/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java
+++ b/libjava/classpath/gnu/java/rmi/server/ConnectionRunnerPool.java
@@ -103,7 +103,7 @@ class ConnectionRunnerPool
static {
ConnectionRunner[] pools = new ConnectionRunner[size];
for(int i = 0; i < pools.length; i++){
- pools[i] = new ConnectionRunner(group, new Integer(i).toString());
+ pools[i] = new ConnectionRunner(group, Integer.toString(i));
pools[i].setContextClassLoader(Thread.currentThread().getContextClassLoader());
pools[i].start();
}
@@ -123,7 +123,7 @@ class ConnectionRunnerPool
if(freelist.size() == 0){
if(size < max_size){
++size;
- ConnectionRunner a = new ConnectionRunner(group, new Integer(size).toString());
+ ConnectionRunner a = new ConnectionRunner(group, Integer.toString(size));
a.start();
freelist.add(a);
}else
diff --git a/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
index 82f0ff69e4e..4d5e1b0269e 100644
--- a/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
+++ b/libjava/classpath/gnu/java/rmi/server/RMIClassLoaderImpl.java
@@ -64,12 +64,6 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi
this.annotation = annotation;
}
- private MyClassLoader (URL[] urls, ClassLoader parent)
- {
- super (urls, parent);
- this.annotation = urlToAnnotation (urls);
- }
-
public static String urlToAnnotation (URL[] urls)
{
if (urls.length == 0)
diff --git a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
index 75f4f120236..65a13f991b3 100644
--- a/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
+++ b/libjava/classpath/gnu/java/rmi/server/RMIObjectInputStream.java
@@ -46,7 +46,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
import java.net.MalformedURLException;
import java.rmi.server.RMIClassLoader;
-import java.util.ArrayList;
public class RMIObjectInputStream
extends ObjectInputStream {
diff --git a/libjava/classpath/gnu/java/security/Engine.java b/libjava/classpath/gnu/java/security/Engine.java
index 85491922f30..2cb21832152 100644
--- a/libjava/classpath/gnu/java/security/Engine.java
+++ b/libjava/classpath/gnu/java/security/Engine.java
@@ -163,7 +163,7 @@ public final class Engine
}
else if (key.equalsIgnoreCase(ALG_ALIAS + service + "." + algorithm))
{
- alias = (String) provider.getProperty(key);
+ alias = provider.getProperty(key);
if (! algorithm.equalsIgnoreCase(alias)) // does not refer to itself
{
algorithm = alias;
diff --git a/libjava/classpath/gnu/java/security/key/dss/FIPS186.java b/libjava/classpath/gnu/java/security/key/dss/FIPS186.java
index 7277599bd54..65dc5800c77 100644
--- a/libjava/classpath/gnu/java/security/key/dss/FIPS186.java
+++ b/libjava/classpath/gnu/java/security/key/dss/FIPS186.java
@@ -173,7 +173,7 @@ public class FIPS186
// 6. Let counter = 0 and offset = 2.
counter = 0;
offset = 2;
- step7: while (true)
+ while (true)
{
OFFSET = BigInteger.valueOf(offset & 0xFFFFFFFFL);
SEED_PLUS_OFFSET = SEED.add(OFFSET);
diff --git a/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java b/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java
index 8cfc8f56ddb..ae3e6ef706c 100644
--- a/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java
+++ b/libjava/classpath/gnu/java/text/AttributedFormatBuffer.java
@@ -91,7 +91,7 @@ public class AttributedFormatBuffer implements FormatBuffer
* comprised between the last entry in 'ranges' and the specified new range.
*
* @param new_range A new range to insert in the list.
- * @param new_attribute A new attribute to insert in the list.
+ * @param attr A new attribute to insert in the list.
*/
private final void addAttribute(int new_range, AttributedCharacterIterator.Attribute attr)
{
diff --git a/libjava/classpath/gnu/java/util/LRUCache.java b/libjava/classpath/gnu/java/util/LRUCache.java
new file mode 100644
index 00000000000..784a442ab2d
--- /dev/null
+++ b/libjava/classpath/gnu/java/util/LRUCache.java
@@ -0,0 +1,77 @@
+/* LRUCache.java -- A LRU Cache implementation
+ Copyright (C) 2007 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 gnu.java.util;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * A least recently used cache, based on LinkedHashMap.
+ */
+public class LRUCache<K,V>
+ extends LinkedHashMap<K,V>
+{
+
+ /**
+ * The capacity of the cache.
+ */
+ private int capacity;
+
+ /**
+ * Creates a new LRUCache instance with the specified capacity.
+ *
+ * @param cap the capacity of the new cache
+ */
+ public LRUCache(int cap)
+ {
+ super();
+ capacity = cap;
+ }
+
+ /**
+ * Returns <code>true</code> when the oldest entry should be removed.
+ *
+ * @param eldest the entry about to be removed
+ *
+ * @return <code>true</code> when the oldest entry should be removed
+ */
+ protected boolean removeEldestEntry(Map.Entry<K, V> eldest)
+ {
+ return size() > capacity;
+ }
+}
diff --git a/libjava/classpath/gnu/java/util/regex/RE.java b/libjava/classpath/gnu/java/util/regex/RE.java
index 09ff74b908f..421640ff293 100644
--- a/libjava/classpath/gnu/java/util/regex/RE.java
+++ b/libjava/classpath/gnu/java/util/regex/RE.java
@@ -41,7 +41,6 @@ import java.io.Serializable;
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
-import java.util.Stack;
import java.util.Vector;
/**
diff --git a/libjava/classpath/gnu/java/util/regex/REException.java b/libjava/classpath/gnu/java/util/regex/REException.java
index 4104fbcd8a7..7a277ca3ae3 100644
--- a/libjava/classpath/gnu/java/util/regex/REException.java
+++ b/libjava/classpath/gnu/java/util/regex/REException.java
@@ -147,6 +147,12 @@ public class REException extends Exception {
this.pos = position;
}
+ REException(String msg, Throwable cause, int type, int position) {
+ super(msg, cause);
+ this.type = type;
+ this.pos = position;
+ }
+
/**
* Returns the type of the exception, one of the constants listed above.
*/
diff --git a/libjava/classpath/gnu/java/util/regex/REToken.java b/libjava/classpath/gnu/java/util/regex/REToken.java
index 9affd4ee3c9..addc62225eb 100644
--- a/libjava/classpath/gnu/java/util/regex/REToken.java
+++ b/libjava/classpath/gnu/java/util/regex/REToken.java
@@ -128,7 +128,7 @@ abstract class REToken implements Serializable, Cloneable {
* of the REmatch found this time so that another possible match
* may be found when backtrack is called.
* By default, nothing is added to the backtrackStack.
- * @param CharIndexed input Input character sequence.
+ * @param input Input character sequence.
* @param mymatch Position at which a match should be found
* @return REMatch object if a match was found, null otherwise.
*/
diff --git a/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java b/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java
index aec27583a58..0051f164364 100644
--- a/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java
+++ b/libjava/classpath/gnu/java/util/regex/RETokenNamedProperty.java
@@ -38,6 +38,9 @@ exception statement from your version. */
package gnu.java.util.regex;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
final class RETokenNamedProperty extends REToken {
String name;
boolean insens;
@@ -268,6 +271,20 @@ final class RETokenNamedProperty extends REToken {
return true;
}
};
+ if (name.startsWith("java"))
+ {
+ try
+ {
+ Method m = Character.class.getMethod("is" + name.substring(4),
+ Character.TYPE);
+ return new JavaCategoryHandler(m);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new REException("Unsupported Java handler: " + name, e,
+ REException.REG_ESCAPE, 0);
+ }
+ }
throw new REException("unsupported name " + name, REException.REG_ESCAPE, 0);
}
@@ -320,4 +337,37 @@ final class RETokenNamedProperty extends REToken {
}
}
+ /**
+ * Handle the Java-specific extensions \p{javaX} where X
+ * is a method from Character of the form isX
+ *
+ * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
+ */
+ private static class JavaCategoryHandler
+ extends Handler
+ {
+ private Method method;
+
+ public JavaCategoryHandler(Method m)
+ {
+ this.method = m;
+ }
+
+ public boolean includes(char c)
+ {
+ try
+ {
+ return (Boolean) method.invoke(null, c);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new InternalError("Unable to access method " + method);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new InternalError("Error invoking " + method);
+ }
+ }
+ }
+
}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/DiffieHellmanImpl.java b/libjava/classpath/gnu/javax/crypto/jce/DiffieHellmanImpl.java
index 4f4d5e47908..6a65437d644 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/DiffieHellmanImpl.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/DiffieHellmanImpl.java
@@ -94,8 +94,7 @@ public final class DiffieHellmanImpl
DHPublicKey pub = (DHPublicKey) incoming;
DHParameterSpec s1 = key.getParams();
DHParameterSpec s2 = pub.getParams();
- if (! s1.getG().equals(s2.getG()) || ! s1.getP().equals(s2.getP())
- || s1.getL() != s2.getL())
+ if (! s1.getG().equals(s2.getG()) || ! s1.getP().equals(s2.getP()))
throw new InvalidKeyException("Incompatible key");
if (! lastPhase)
throw new IllegalArgumentException(
diff --git a/libjava/classpath/gnu/javax/crypto/key/dh/RFC2631.java b/libjava/classpath/gnu/javax/crypto/key/dh/RFC2631.java
index 673e44864b5..a814d2c0bbf 100644
--- a/libjava/classpath/gnu/javax/crypto/key/dh/RFC2631.java
+++ b/libjava/classpath/gnu/javax/crypto/key/dh/RFC2631.java
@@ -136,7 +136,7 @@ public class RFC2631
}
// 8. Let counter = 0
counter = 0;
- step9: while (true)
+ while (true)
{
// 9. Set R = seed + 2*m' + (L' * counter)
R = SEED
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
index 702c93ab3ca..397b857aa37 100644
--- a/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
+++ b/libjava/classpath/gnu/javax/imageio/bmp/DecodeBF16.java
@@ -39,8 +39,6 @@ package gnu.javax.imageio.bmp;
import java.io.IOException;
import javax.imageio.stream.ImageInputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DirectColorModel;
diff --git a/libjava/classpath/gnu/javax/imageio/bmp/EncodeRGB32.java b/libjava/classpath/gnu/javax/imageio/bmp/EncodeRGB32.java
index d653bbf9ffd..4aa1cd5d2fb 100644
--- a/libjava/classpath/gnu/javax/imageio/bmp/EncodeRGB32.java
+++ b/libjava/classpath/gnu/javax/imageio/bmp/EncodeRGB32.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.javax.imageio.bmp;
-import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.awt.image.PixelGrabber;
import java.io.IOException;
diff --git a/libjava/classpath/gnu/javax/imageio/gif/GIFFile.java b/libjava/classpath/gnu/javax/imageio/gif/GIFFile.java
index a11a8c0c6f5..ec0a3103d30 100644
--- a/libjava/classpath/gnu/javax/imageio/gif/GIFFile.java
+++ b/libjava/classpath/gnu/javax/imageio/gif/GIFFile.java
@@ -276,7 +276,7 @@ public class GIFFile
*
* @param in - the stream (reads 6 bytes, does not close or reset).
* @return true if the signature is a valid GIF signature.
- * @throws an IOException if the signature could not be read.
+ * @throws IOException if the signature could not be read.
*/
public static boolean readSignature( InputStream in ) throws IOException
{
diff --git a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGComponent.java b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGComponent.java
index d5799fd412b..d07bb34e939 100644
--- a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGComponent.java
+++ b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGComponent.java
@@ -336,7 +336,7 @@ public class JPEGComponent
{
k += r;
r = (int) JPEGStream.readBits(s);
- s = (int) HuffmanTable.extend(r, s);
+ s = HuffmanTable.extend(r, s);
zz[k] = s;
}
else
diff --git a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGDecoder.java b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGDecoder.java
index 3610ebe874f..0f2a3f2b949 100644
--- a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGDecoder.java
+++ b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGDecoder.java
@@ -40,16 +40,12 @@ package gnu.javax.imageio.jpeg;
import java.io.IOException;
import java.nio.ByteOrder;
-import javax.imageio.*;
import javax.imageio.plugins.jpeg.JPEGHuffmanTable;
import javax.imageio.plugins.jpeg.JPEGQTable;
-import javax.imageio.spi.*;
-import javax.imageio.metadata.*;
import javax.imageio.stream.ImageInputStream;
import java.util.ArrayList;
import java.util.Hashtable;
-import java.util.Iterator;
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
@@ -391,7 +387,7 @@ public class JPEGDecoder
// read in how much they need
for (int compIndex = 0; compIndex < numberOfComponents; compIndex++)
{
- JPEGComponent comp = (JPEGComponent) frame.components.getComponentByID(componentSelector[compIndex]);
+ JPEGComponent comp = frame.components.getComponentByID(componentSelector[compIndex]);
comp.readComponentMCU(jpegStream);
}
mcuIndex++;
@@ -420,7 +416,7 @@ public class JPEGDecoder
{
for (int compIndex = 0; compIndex < numberOfComponents; compIndex++)
{
- JPEGComponent comp = (JPEGComponent) frame.components.getComponentByID(componentSelector[compIndex]);
+ JPEGComponent comp = frame.components.getComponentByID(componentSelector[compIndex]);
if (compIndex > 1)
comp.padMCU(mcuTotalIndex, resetInterval - mcuIndex);
comp.resetInterval();
@@ -485,8 +481,7 @@ public class JPEGDecoder
// Unencode the data.
for (int i = 0; i < frame.getComponentCount(); i++)
{
- JPEGComponent comp =
- (JPEGComponent) frame.components.get(i);
+ JPEGComponent comp = frame.components.get(i);
comp.setQuantizationTable(qTables[comp.quant_id].getTable());
comp.quantitizeData();
comp.idctData(myDCT);
@@ -494,7 +489,7 @@ public class JPEGDecoder
// Scale the image and write the data to the raster.
for (int i = 0; i < frame.getComponentCount(); i++)
{
- JPEGComponent comp = (JPEGComponent) frame.components.get(i);
+ JPEGComponent comp = frame.components.get(i);
comp.scaleByFactors();
comp.writeData(raster, i);
// Ensure garbage collection.
diff --git a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGException.java b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGException.java
index b684069ccb6..a2c06e27e04 100644
--- a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGException.java
+++ b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGException.java
@@ -37,14 +37,7 @@ exception statement from your version. */
package gnu.javax.imageio.jpeg;
-// FIXME: change to IIOException
-import java.io.IOException;
import javax.imageio.*;
-import javax.imageio.spi.*;
-import javax.imageio.metadata.*;
-import javax.imageio.stream.ImageInputStream;
-import java.util.Iterator;
-import java.awt.image.BufferedImage;
public class JPEGException extends IIOException
{
diff --git a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGFrame.java b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGFrame.java
index 9b958f98f2c..35aed728a4d 100644
--- a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGFrame.java
+++ b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGFrame.java
@@ -101,7 +101,7 @@ public class JPEGFrame
public void setHuffmanTables(byte componentID, JPEGHuffmanTable ACTable,
JPEGHuffmanTable DCTable)
{
- JPEGComponent comp = (JPEGComponent)components.getComponentByID(componentID);
+ JPEGComponent comp = components.getComponentByID(componentID);
comp.setACTable(ACTable);
comp.setDCTable(DCTable);
}
diff --git a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGImageInputStream.java b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGImageInputStream.java
index 4ae909baf15..29a12f346cf 100644
--- a/libjava/classpath/gnu/javax/imageio/jpeg/JPEGImageInputStream.java
+++ b/libjava/classpath/gnu/javax/imageio/jpeg/JPEGImageInputStream.java
@@ -37,17 +37,10 @@ exception statement from your version. */
package gnu.javax.imageio.jpeg;
-import java.io.EOFException;
import java.io.IOException;
-import javax.imageio.*;
-import javax.imageio.spi.*;
-import javax.imageio.metadata.*;
import javax.imageio.stream.ImageInputStream;
import javax.imageio.stream.ImageInputStreamImpl;
-import java.util.Iterator;
-import java.awt.image.BufferedImage;
-
public class JPEGImageInputStream
extends ImageInputStreamImpl
{
diff --git a/libjava/classpath/gnu/javax/imageio/png/PNGChunk.java b/libjava/classpath/gnu/javax/imageio/png/PNGChunk.java
index 6b53810c89d..8efbeea7259 100644
--- a/libjava/classpath/gnu/javax/imageio/png/PNGChunk.java
+++ b/libjava/classpath/gnu/javax/imageio/png/PNGChunk.java
@@ -40,7 +40,6 @@ package gnu.javax.imageio.png;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
/**
* Class to load and validate a generic PNG chunk.
diff --git a/libjava/classpath/gnu/javax/imageio/png/PNGDecoder.java b/libjava/classpath/gnu/javax/imageio/png/PNGDecoder.java
index 20fc32ce371..652f59d35b5 100644
--- a/libjava/classpath/gnu/javax/imageio/png/PNGDecoder.java
+++ b/libjava/classpath/gnu/javax/imageio/png/PNGDecoder.java
@@ -140,7 +140,7 @@ public class PNGDecoder
/**
* Parse the appropriate color type and create an AWT raster for it.
- * @param raster - the file header.
+ * @param header - the file header.
*/
public WritableRaster getRaster( PNGHeader header )
{
diff --git a/libjava/classpath/gnu/javax/imageio/png/PNGEncoder.java b/libjava/classpath/gnu/javax/imageio/png/PNGEncoder.java
index c0a30a7baef..b8441c4e3f0 100644
--- a/libjava/classpath/gnu/javax/imageio/png/PNGEncoder.java
+++ b/libjava/classpath/gnu/javax/imageio/png/PNGEncoder.java
@@ -40,7 +40,6 @@ package gnu.javax.imageio.png;
import java.util.Vector;
import java.util.zip.Deflater;
import java.awt.color.ColorSpace;
-import java.awt.color.ICC_Profile;
import java.awt.color.ICC_ColorSpace;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
@@ -48,7 +47,6 @@ import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferUShort;
import java.awt.image.IndexColorModel;
-import java.awt.image.Raster;
import java.awt.image.WritableRaster;
public class PNGEncoder
diff --git a/libjava/classpath/gnu/javax/imageio/png/PNGFile.java b/libjava/classpath/gnu/javax/imageio/png/PNGFile.java
index cc0ca297fcb..96e8f9ce78f 100644
--- a/libjava/classpath/gnu/javax/imageio/png/PNGFile.java
+++ b/libjava/classpath/gnu/javax/imageio/png/PNGFile.java
@@ -44,7 +44,6 @@ import java.util.Vector;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.awt.image.ColorModel;
-import java.awt.image.IndexColorModel;
import java.awt.color.ColorSpace;
public class PNGFile
diff --git a/libjava/classpath/gnu/javax/imageio/png/PNGGamma.java b/libjava/classpath/gnu/javax/imageio/png/PNGGamma.java
index af777d9b4f6..d9cacea4609 100644
--- a/libjava/classpath/gnu/javax/imageio/png/PNGGamma.java
+++ b/libjava/classpath/gnu/javax/imageio/png/PNGGamma.java
@@ -37,10 +37,6 @@ exception statement from your version. */
package gnu.javax.imageio.png;
-import java.awt.color.ICC_ProfileGray;
-import java.awt.color.ICC_ProfileRGB;
-import java.awt.color.ICC_Profile;
-import java.awt.color.ICC_ColorSpace;
import java.awt.color.ColorSpace;
/**
diff --git a/libjava/classpath/gnu/javax/management/Server.java b/libjava/classpath/gnu/javax/management/Server.java
index 616854e95bd..8e8d826c00f 100644
--- a/libjava/classpath/gnu/javax/management/Server.java
+++ b/libjava/classpath/gnu/javax/management/Server.java
@@ -169,7 +169,7 @@ public class Server
* Constructs a new management server using the specified
* default domain, delegate bean and outer server.
*
- * @param domain the default domain to use for beans constructed
+ * @param defaultDomain the default domain to use for beans constructed
* with no specified domain.
* @param outer an {@link javax.management.MBeanServer} to pass
* to beans implementing the {@link MBeanRegistration}
@@ -229,8 +229,8 @@ public class Server
if (name != null)
{
Object bean = getBean(name);
- Method method = bean.getClass().getMethod("getMBeanInfo", null);
- info = (MBeanInfo) method.invoke(bean, null);
+ Method method = bean.getClass().getMethod("getMBeanInfo");
+ info = (MBeanInfo) method.invoke(bean);
}
sm.checkPermission(new MBeanPermission((info == null) ?
null : info.getClassName(),
@@ -1031,13 +1031,20 @@ public class Server
checkSecurity(name, null, "getMBeanInfo");
try
{
- Method method = bean.getClass().getMethod("getMBeanInfo", null);
- return (MBeanInfo) method.invoke(bean, null);
+ Method method = bean.getClass().getMethod("getMBeanInfo");
+ return (MBeanInfo) method.invoke(bean);
}
catch (NoSuchMethodException e)
{
- throw new IntrospectionException("The getMBeanInfo method " +
- "could not be found.");
+ try
+ {
+ return new StandardMBean(bean, null).getMBeanInfo();
+ }
+ catch (NotCompliantMBeanException ex)
+ {
+ throw new IntrospectionException("An error occurred in executing " +
+ "getMBeanInfo on the bean: " + ex + ".");
+ }
}
catch (IllegalAccessException e)
{
diff --git a/libjava/classpath/gnu/javax/management/Translator.java b/libjava/classpath/gnu/javax/management/Translator.java
index 69191d43f86..4ede3743088 100644
--- a/libjava/classpath/gnu/javax/management/Translator.java
+++ b/libjava/classpath/gnu/javax/management/Translator.java
@@ -39,11 +39,15 @@ package gnu.javax.management;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -92,7 +96,7 @@ public final class Translator
Type[] gtypes = method.getGenericParameterTypes();
Object[] otypes = new Object[jtypes.length];
for (int a = 0; a < jtypes.length; ++a)
- otypes[a] = fromJava(jtypes[a], (Class<?>) gtypes[a]);
+ otypes[a] = fromJava(jtypes[a], gtypes[a]);
return otypes;
}
@@ -131,11 +135,10 @@ public final class Translator
if (jtype instanceof List || jtype instanceof Set ||
jtype instanceof SortedSet)
{
- String elemType = tName.substring(tName.indexOf("<") + 1,
- tName.indexOf(">")).trim();
if (jtype instanceof SortedSet)
{
- Class<?> elemClass = Class.forName(elemType);
+ ParameterizedType ptype = (ParameterizedType) type;
+ Class<?> elemClass = (Class<?>) ptype.getActualTypeArguments()[0];
if (!Comparable.class.isAssignableFrom(elemClass))
throw new IllegalArgumentException(jtype + " has a " +
"non-comparable element " +
@@ -144,11 +147,13 @@ public final class Translator
throw new IllegalArgumentException(jtype + " does not " +
"use natural ordering.");
}
- List elems = (List) jtype;
- Object[] celems = new Object[elems.size()];
- for (int a = 0; a < elems.size(); ++a)
+ Collection<Object> elems = (Collection<Object>) jtype;
+ int numElems = elems.size();
+ Object[] celems = new Object[numElems];
+ Iterator<Object> i = elems.iterator();
+ for (int a = 0; a < numElems; ++a)
{
- Object elem = elems.get(a);
+ Object elem = i.next();
celems[a] = fromJava(elem, elem.getClass());
}
return makeArraySpecific(celems);
@@ -440,33 +445,6 @@ public final class Translator
SimpleType.STRING,
null, names);
}
- try
- {
- c.getMethod("from", new Class[] { CompositeData.class });
- Method[] methods = c.getDeclaredMethods();
- List<String> names = new ArrayList<String>();
- List<OpenType> types = new ArrayList<OpenType>();
- for (int a = 0; a < methods.length; ++a)
- {
- String name = methods[a].getName();
- if (name.startsWith("get"))
- {
- names.add(name.substring(3));
- types.add(getTypeFromClass(methods[a].getReturnType()));
- }
- }
- String[] fields = names.toArray(new String[names.size()]);
- CompositeType ctype = new CompositeType(c.getName(), c.getName(),
- fields, fields,
- types.toArray(new OpenType[types.size()]));
- return new OpenMBeanParameterInfoSupport("TransParam",
- "Translated parameter",
- ctype);
- }
- catch (NoSuchMethodException e)
- {
- /* Ignored; we expect this if this isn't a from(CompositeData) class */
- }
if (c.isArray())
{
int depth;
@@ -478,7 +456,35 @@ public final class Translator
new ArrayType(depth, ot)
);
}
- throw new InternalError("The type used does not have an open type translation.");
+ Method[] methods = c.getDeclaredMethods();
+ List<String> names = new ArrayList<String>();
+ List<OpenType> types = new ArrayList<OpenType>();
+ for (int a = 0; a < methods.length; ++a)
+ {
+ String name = methods[a].getName();
+ if (Modifier.isPublic(methods[a].getModifiers()))
+ {
+ if (name.startsWith("get"))
+ {
+ names.add(name.substring(3));
+ types.add(getTypeFromClass(methods[a].getReturnType()));
+ }
+ else if (name.startsWith("is"))
+ {
+ names.add(name.substring(2));
+ types.add(getTypeFromClass(methods[a].getReturnType()));
+ }
+ }
+ }
+ if (names.isEmpty())
+ throw new OpenDataException("The type used does not have an open type translation.");
+ String[] fields = names.toArray(new String[names.size()]);
+ CompositeType ctype = new CompositeType(c.getName(), c.getName(),
+ fields, fields,
+ types.toArray(new OpenType[types.size()]));
+ return new OpenMBeanParameterInfoSupport("TransParam",
+ "Translated parameter",
+ ctype);
}
/**
diff --git a/libjava/classpath/gnu/javax/naming/giop/ContextContinuation.java b/libjava/classpath/gnu/javax/naming/giop/ContextContinuation.java
index 7d7a785fd2f..05023840ba3 100644
--- a/libjava/classpath/gnu/javax/naming/giop/ContextContinuation.java
+++ b/libjava/classpath/gnu/javax/naming/giop/ContextContinuation.java
@@ -129,14 +129,14 @@ public class ContextContinuation implements Context
* Creates a new naming context that uses naming service, represented by the
* given CORBA object.
*
- * @param namingService
+ * @param nsObject
* the naming service object. It must be possible to narrow it into
* the NamingContextExt.
* @param props
* the environment table.
- * @param orb
+ * @param anOrb
* the associated ORB. This reference is used during cleanup.
- * @param the
+ * @param aFactory
* parent factory. This reference is used during cleanup.
*/
public ContextContinuation(org.omg.CORBA.Object nsObject,
@@ -293,7 +293,7 @@ public class ContextContinuation implements Context
* context. The returned object will wrap around the newly created CORBA
* subcontext
*
- * @param name
+ * @param subContext
* the name of the new context being created
* @return the newly created context, bound to the instance of the context on
* that the method has been called
@@ -336,7 +336,7 @@ public class ContextContinuation implements Context
* context. The returned object will wrap around the newly created CORBA
* subcontext
*
- * @param name
+ * @param subContext
* the name of the new context being created
* @return the newly created context, bound to the instance of the context on
* that the method has been called
@@ -380,7 +380,7 @@ public class ContextContinuation implements Context
* action if such subcontext does not exist. The context being destroyed must
* be empty.
*
- * @param name
+ * @param subContext
* the name of the subcontext beig removed.
* @throws ContextNotEmptyException
* if the named context is not empty.
@@ -396,7 +396,7 @@ public class ContextContinuation implements Context
* action if such subcontext does not exist. The context being destroyed must
* be empty.
*
- * @param name
+ * @param subContext
* the name of the subcontext beig removed.
* @throws ContextNotEmptyException
* if the named context is not empty.
@@ -868,9 +868,9 @@ public class ContextContinuation implements Context
* and value of the new property must not be null. If the property is already
* defined, is current value is replaced by the propVal.
*
- * @param propName
+ * @param key
* the name of the new property
- * @param propVal
+ * @param value
* the value of the new property
* @return the previous value of this property or null if the property has not
* been previously defined
diff --git a/libjava/classpath/gnu/javax/naming/jndi/url/rmi/ContextContinuation.java b/libjava/classpath/gnu/javax/naming/jndi/url/rmi/ContextContinuation.java
index de79b93c3dc..ee8c7791419 100644
--- a/libjava/classpath/gnu/javax/naming/jndi/url/rmi/ContextContinuation.java
+++ b/libjava/classpath/gnu/javax/naming/jndi/url/rmi/ContextContinuation.java
@@ -97,9 +97,9 @@ public class ContextContinuation implements Context
* the registry. The new registry will be lazily instantiated on the first
* call.
*
- * @param propName
+ * @param key
* the name of the new property
- * @param propVal
+ * @param value
* the value of the new property
* @return the previous value of this property or null if the property has not
* been previously defined
@@ -426,7 +426,7 @@ public class ContextContinuation implements Context
* @param name
* the object name (.toString()) is used to convert into string
* representation.
- * @param the
+ * @param obj
* object (must be an instance of Remote).
*/
public void rebind(Name name, Object obj) throws NamingException
@@ -439,7 +439,7 @@ public class ContextContinuation implements Context
*
* @param name
* the object name.
- * @param the
+ * @param obj
* object (must be an instance of Remote).
*/
public void rebind(String name, Object obj) throws NamingException
diff --git a/libjava/classpath/gnu/javax/net/ssl/SSLRecordHandler.java b/libjava/classpath/gnu/javax/net/ssl/SSLRecordHandler.java
index 3147415fe36..3ce56eab5fe 100644
--- a/libjava/classpath/gnu/javax/net/ssl/SSLRecordHandler.java
+++ b/libjava/classpath/gnu/javax/net/ssl/SSLRecordHandler.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package gnu.javax.net.ssl;
import java.nio.ByteBuffer;
-import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
public abstract class SSLRecordHandler
diff --git a/libjava/classpath/gnu/javax/net/ssl/StaticTrustAnchors.java b/libjava/classpath/gnu/javax/net/ssl/StaticTrustAnchors.java
index 0c2c3cca8a8..480f1c754b1 100644
--- a/libjava/classpath/gnu/javax/net/ssl/StaticTrustAnchors.java
+++ b/libjava/classpath/gnu/javax/net/ssl/StaticTrustAnchors.java
@@ -39,8 +39,6 @@ exception statement from your version. */
package gnu.javax.net.ssl;
import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/CertificateRequestBuilder.java b/libjava/classpath/gnu/javax/net/ssl/provider/CertificateRequestBuilder.java
index 9beab473ca6..8c059854e4a 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/CertificateRequestBuilder.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/CertificateRequestBuilder.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import static gnu.javax.net.ssl.provider.CertificateRequest.ClientCertificateType;
-
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ClientHandshake.java b/libjava/classpath/gnu/javax/net/ssl/provider/ClientHandshake.java
index a8780084508..fdbf262122b 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ClientHandshake.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ClientHandshake.java
@@ -56,7 +56,6 @@ import java.nio.ByteBuffer;
import java.security.AccessController;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
-import java.security.KeyManagementException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
@@ -65,7 +64,6 @@ import java.security.PrivateKey;
import java.security.SignatureException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import java.security.interfaces.RSAPublicKey;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
@@ -77,7 +75,6 @@ import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
-import javax.crypto.SecretKey;
import javax.crypto.interfaces.DHPrivateKey;
import javax.crypto.interfaces.DHPublicKey;
import javax.crypto.spec.DHParameterSpec;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ClientPSKParameters.java b/libjava/classpath/gnu/javax/net/ssl/provider/ClientPSKParameters.java
index 676a872f925..f08ec7f9062 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ClientPSKParameters.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ClientPSKParameters.java
@@ -38,13 +38,9 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import gnu.classpath.debug.Component;
-import gnu.classpath.debug.SystemLogger;
-
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ClientRSA_PSKParameters.java b/libjava/classpath/gnu/javax/net/ssl/provider/ClientRSA_PSKParameters.java
index f7483a94c30..860cc731f7a 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ClientRSA_PSKParameters.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ClientRSA_PSKParameters.java
@@ -38,13 +38,9 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import gnu.classpath.debug.Component;
-import gnu.classpath.debug.SystemLogger;
-
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.nio.charset.Charset;
/**
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ContentType.java b/libjava/classpath/gnu/javax/net/ssl/provider/ContentType.java
index f7165a2d769..eaebebf4b67 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ContentType.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ContentType.java
@@ -38,10 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import java.io.EOFException;
-import java.io.InputStream;
-import java.io.IOException;
-
/**
* The content type enumeration, which marks packets in the record layer.
*
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/EncryptedPreMasterSecret.java b/libjava/classpath/gnu/javax/net/ssl/provider/EncryptedPreMasterSecret.java
index ea7439bd2c6..85769cffcf2 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/EncryptedPreMasterSecret.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/EncryptedPreMasterSecret.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import gnu.classpath.debug.Component;
-import gnu.classpath.debug.SystemLogger;
-
import java.io.PrintWriter;
import java.io.StringWriter;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/Handshake.java b/libjava/classpath/gnu/javax/net/ssl/provider/Handshake.java
index 52f61424e4c..dd36f2b3fc5 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/Handshake.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/Handshake.java
@@ -38,26 +38,11 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
import java.io.PrintWriter;
-import java.io.StringReader;
import java.io.StringWriter;
import java.nio.ByteBuffer;
-import java.security.PublicKey;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-import javax.net.ssl.SSLProtocolException;
-
/**
* An SSL handshake message. SSL handshake messages have the following
* form:
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/InputSecurityParameters.java b/libjava/classpath/gnu/javax/net/ssl/provider/InputSecurityParameters.java
index 13a3ef814de..cf5ca6099ff 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/InputSecurityParameters.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/InputSecurityParameters.java
@@ -47,11 +47,9 @@ import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
import java.util.Arrays;
-import java.util.logging.Level;
import java.util.zip.DataFormatException;
import java.util.zip.Inflater;
-import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.Mac;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/OutputSecurityParameters.java b/libjava/classpath/gnu/javax/net/ssl/provider/OutputSecurityParameters.java
index 6da0d066741..228071a393d 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/OutputSecurityParameters.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/OutputSecurityParameters.java
@@ -40,16 +40,13 @@ package gnu.javax.net.ssl.provider;
import gnu.classpath.debug.Component;
import gnu.classpath.debug.SystemLogger;
-import gnu.java.security.util.ByteArray;
import gnu.java.security.util.ByteBufferOutputStream;
import java.nio.ByteBuffer;
-import java.util.logging.Level;
import java.util.zip.DataFormatException;
import java.util.zip.Deflater;
-import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.Mac;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ProtocolVersion.java b/libjava/classpath/gnu/javax/net/ssl/provider/ProtocolVersion.java
index ca62054a89c..3c3f29a21e6 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ProtocolVersion.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ProtocolVersion.java
@@ -40,7 +40,6 @@ package gnu.javax.net.ssl.provider;
import java.io.InputStream;
import java.io.IOException;
-import java.io.OutputStream;
public final class ProtocolVersion
implements Comparable<ProtocolVersion>, Constructed
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/Random.java b/libjava/classpath/gnu/javax/net/ssl/provider/Random.java
index e6815930934..f89acc1f8f5 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/Random.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/Random.java
@@ -38,10 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/SRPTrustManagerFactory.java b/libjava/classpath/gnu/javax/net/ssl/provider/SRPTrustManagerFactory.java
index 5822afe0596..c5422871df5 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/SRPTrustManagerFactory.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/SRPTrustManagerFactory.java
@@ -44,8 +44,6 @@ import java.math.BigInteger;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyPair;
import java.security.KeyStore;
-import java.security.Security;
-
import java.util.HashMap;
import javax.net.ssl.ManagerFactoryParameters;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ServerDHE_PSKParameters.java b/libjava/classpath/gnu/javax/net/ssl/provider/ServerDHE_PSKParameters.java
index edc3ac259cb..2d21d9d4554 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ServerDHE_PSKParameters.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ServerDHE_PSKParameters.java
@@ -38,9 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import gnu.classpath.debug.Component;
-import gnu.classpath.debug.SystemLogger;
-
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.ByteBuffer;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/ServerHandshake.java b/libjava/classpath/gnu/javax/net/ssl/provider/ServerHandshake.java
index 300012a4b30..e30f04241a0 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/ServerHandshake.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/ServerHandshake.java
@@ -775,7 +775,7 @@ class ServerHandshake extends AbstractHandshake
// outgoing buffer. This isn't that great because we'd need to
// store and copy things unnecessarily.
//
- // 2. Build outgoing handshake objects “virtually,” that is, store them
+ // 2. Build outgoing handshake objects 'virtually', that is, store them
// as collections of objects, then compute the length, and then write
// them to a buffer, instead of making the objects views on
// ByteBuffers for both input and output. This would complicate the
@@ -784,7 +784,7 @@ class ServerHandshake extends AbstractHandshake
// pretty OK), and we still need to figure out how exactly to chunk
// those objects across record boundaries.
//
- // 3. Try to build these objects on the buffer we’re given, but detect
+ // 3. Try to build these objects on the buffer we're given, but detect
// when we run out of space in the output buffer, and split the
// overflow message. This sounds like the best, but also probably
// the hardest to code.
@@ -1374,4 +1374,4 @@ output_loop:
setupSecurityParameters(keys, false, engine, compression);
}
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/SessionImpl.java b/libjava/classpath/gnu/javax/net/ssl/provider/SessionImpl.java
index 86dcb4915cd..6a4020117ec 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/SessionImpl.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/SessionImpl.java
@@ -40,22 +40,16 @@ package gnu.javax.net.ssl.provider;
import gnu.javax.crypto.key.GnuPBEKey;
import gnu.javax.net.ssl.Session;
-import gnu.javax.net.ssl.Session.ID;
-
import java.io.IOException;
import java.io.Serializable;
-import java.security.Certificate;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
-import java.security.cert.X509Certificate;
-
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SealedObject;
-import javax.crypto.spec.PBEKeySpec;
import javax.net.ssl.SSLException;
public class SessionImpl extends Session
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/Signature.java b/libjava/classpath/gnu/javax/net/ssl/provider/Signature.java
index 8c6cfadc734..d95e181370e 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/Signature.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/Signature.java
@@ -38,26 +38,11 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.math.BigInteger;
-
import java.nio.ByteBuffer;
-import java.security.PublicKey;
-import java.security.interfaces.RSAKey;
-
-import java.util.Arrays;
-
-import gnu.java.security.der.*;
-
/**
* The signature structure.
*
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/SimpleSessionContext.java b/libjava/classpath/gnu/javax/net/ssl/provider/SimpleSessionContext.java
index b9d0f95519d..20503d3cabe 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/SimpleSessionContext.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/SimpleSessionContext.java
@@ -41,8 +41,6 @@ package gnu.javax.net.ssl.provider;
import gnu.javax.net.ssl.AbstractSessionContext;
import gnu.javax.net.ssl.Session;
import gnu.javax.net.ssl.SessionStoreException;
-import gnu.javax.net.ssl.Session.ID;
-
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/TLSHMac.java b/libjava/classpath/gnu/javax/net/ssl/provider/TLSHMac.java
index 18aa8f5f4c7..8bdda930b3c 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/TLSHMac.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/TLSHMac.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
import java.security.InvalidKeyException;
-import java.util.HashMap;
import java.util.Map;
import gnu.java.security.hash.IMessageDigest;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/TrustedAuthorities.java b/libjava/classpath/gnu/javax/net/ssl/provider/TrustedAuthorities.java
index 1e4b173595d..85e359675a7 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/TrustedAuthorities.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/TrustedAuthorities.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.javax.net.ssl.provider;
-import gnu.java.security.x509.X500DistinguishedName;
import gnu.javax.net.ssl.provider.Extension.Value;
import java.io.PrintWriter;
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/UnresolvedExtensionValue.java b/libjava/classpath/gnu/javax/net/ssl/provider/UnresolvedExtensionValue.java
index 2094daf9098..f54dda5bc6d 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/UnresolvedExtensionValue.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/UnresolvedExtensionValue.java
@@ -40,8 +40,6 @@ package gnu.javax.net.ssl.provider;
import gnu.javax.net.ssl.provider.Extension.Value;
-import java.io.PrintWriter;
-import java.io.StringWriter;
import java.nio.ByteBuffer;
public class UnresolvedExtensionValue extends Value
diff --git a/libjava/classpath/gnu/javax/net/ssl/provider/X509KeyManagerFactory.java b/libjava/classpath/gnu/javax/net/ssl/provider/X509KeyManagerFactory.java
index dc772886697..c3b7e5f4b8f 100644
--- a/libjava/classpath/gnu/javax/net/ssl/provider/X509KeyManagerFactory.java
+++ b/libjava/classpath/gnu/javax/net/ssl/provider/X509KeyManagerFactory.java
@@ -64,8 +64,6 @@ import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import java.util.List;
@@ -77,8 +75,6 @@ import javax.net.ssl.KeyManagerFactorySpi;
import javax.net.ssl.ManagerFactoryParameters;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.X509ExtendedKeyManager;
-import javax.net.ssl.X509KeyManager;
-
import gnu.javax.net.ssl.NullManagerParameters;
import gnu.javax.net.ssl.PrivateCredentials;
diff --git a/libjava/classpath/gnu/javax/print/PrinterDialog.java b/libjava/classpath/gnu/javax/print/PrinterDialog.java
index d7598be3e5b..54d6b87b47c 100644
--- a/libjava/classpath/gnu/javax/print/PrinterDialog.java
+++ b/libjava/classpath/gnu/javax/print/PrinterDialog.java
@@ -479,17 +479,17 @@ public final class PrinterDialog extends JDialog implements ActionListener
*/
void updateForSelectedService()
{
- PrinterMakeAndModel att1 = (PrinterMakeAndModel)
+ PrinterMakeAndModel att1 =
getSelectedPrintService().getAttribute(PrinterMakeAndModel.class);
typValue.setText(att1 == null ? "" : att1.getValue());
- PrinterInfo att2 = (PrinterInfo)
+ PrinterInfo att2 =
getSelectedPrintService().getAttribute(PrinterInfo.class);
infoValue.setText(att2 == null ? "" : att2.getValue());
- PrinterIsAcceptingJobs att3 = (PrinterIsAcceptingJobs)
+ PrinterIsAcceptingJobs att3 =
getSelectedPrintService().getAttribute(PrinterIsAcceptingJobs.class);
- PrinterState att4 = (PrinterState)
+ PrinterState att4 =
getSelectedPrintService().getAttribute(PrinterState.class);
String status = att4.toString();
diff --git a/libjava/classpath/gnu/javax/security/auth/Password.java b/libjava/classpath/gnu/javax/security/auth/Password.java
index 7284b7d6823..8fb07ee6b86 100644
--- a/libjava/classpath/gnu/javax/security/auth/Password.java
+++ b/libjava/classpath/gnu/javax/security/auth/Password.java
@@ -40,8 +40,6 @@ package gnu.javax.security.auth;
import gnu.java.security.util.ExpirableObject;
-import javax.security.auth.DestroyFailedException;
-
/**
* Immutible, though destroyable, password class.
*
@@ -145,7 +143,7 @@ public final class Password extends ExpirableObject
for(i = 0, j = offset; i < length; i++, j++)
{
- this.password[i] = (char) password[j];
+ this.password[i] = password[j];
// XXX this should use character encodings, other than ASCII.
bPassword[i] = (byte) (password[j] & 0x7F);
}
diff --git a/libjava/classpath/gnu/javax/sound/AudioSecurityManager.java b/libjava/classpath/gnu/javax/sound/AudioSecurityManager.java
index cd10e510665..a6dce60b394 100644
--- a/libjava/classpath/gnu/javax/sound/AudioSecurityManager.java
+++ b/libjava/classpath/gnu/javax/sound/AudioSecurityManager.java
@@ -1,19 +1,90 @@
+/* AudioSecurityManager.java -- Manages Security requests for Sound classes.
+
+ Copyright (C) 2007 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 gnu.javax.sound;
import javax.sound.sampled.AudioPermission;
+/**
+ * This class handles security requests for classes in the Sound API.
+ *
+ * A class that needs to check against a particular permission type may use this
+ * class to query the <code>SecurityManager</code>.
+ *
+ * For example, to check for a read permission, a class can simply pass the
+ * <code>Permission.READ</code> constant to
+ * {@link #checkPermissions(gnu.javax.sound.AudioSecurityManager.Permission))},
+ * like the following code demonstrates:
+ *
+ * <pre>
+ * AudioSecurityManager.checkPermissions(Permission.PLAY);
+ * </pre>
+ *
+ * If there is need to query for all the defined permissions type, the constant
+ * <code>Permission.ALL</code> can be used. In alternative, the
+ * {@link #checkPermissions()} is presented as a shorthand.
+ *
+ * @author Mario Torre <neugens@limasoftware.net>
+ */
public class AudioSecurityManager
{
+ /**
+ * Defines a common set of permission allowed by the specification.
+ */
public static enum Permission
{
PLAY, RECORD, ALL
}
+ /**
+ * Shorthand to <code>checkPermissions(Permission.ALL)</code>.
+ */
public static final void checkPermissions()
{
checkPermissions(Permission.ALL);
}
+ /**
+ * Query the <code>SecurityManager</code> agains the given
+ * <code>Permission</code>.
+ *
+ * @param permission
+ */
public static final void checkPermissions(Permission permission)
{
SecurityManager sm = System.getSecurityManager();
diff --git a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
index baf61732d18..740b124eb65 100644
--- a/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
+++ b/libjava/classpath/gnu/javax/sound/midi/dssi/DSSIMidiDeviceProvider.java
@@ -44,8 +44,6 @@ import java.io.File;
import java.io.FilenameFilter;
import gnu.classpath.Configuration;
-import gnu.javax.sound.midi.alsa.AlsaMidiSequencerDevice;
-
import javax.sound.midi.MidiDevice;
import javax.sound.midi.MidiDevice.Info;
import javax.sound.midi.spi.MidiDeviceProvider;
diff --git a/libjava/classpath/gnu/javax/sound/midi/file/MidiFileWriter.java b/libjava/classpath/gnu/javax/sound/midi/file/MidiFileWriter.java
index 71970d5ba6e..b9b6fe87a10 100644
--- a/libjava/classpath/gnu/javax/sound/midi/file/MidiFileWriter.java
+++ b/libjava/classpath/gnu/javax/sound/midi/file/MidiFileWriter.java
@@ -38,10 +38,8 @@ exception statement from your version. */
package gnu.javax.sound.midi.file;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStream;
import javax.sound.midi.MetaMessage;
diff --git a/libjava/classpath/gnu/javax/sound/sampled/AU/AUReader.java b/libjava/classpath/gnu/javax/sound/sampled/AU/AUReader.java
index c9035df7338..ed5852e6c9a 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/AU/AUReader.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/AU/AUReader.java
@@ -47,7 +47,6 @@ import java.io.File;
import java.io.IOException;
import java.io.BufferedInputStream;
import java.io.InputStream;
-import java.io.DataInputStream;
import java.io.FileInputStream;
import java.net.URL;
import java.nio.ByteBuffer;
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java
index b32db0f353c..aa42a4c3da8 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/GStreamerMixer.java
@@ -37,13 +37,9 @@ exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer;
-import java.awt.AWTPermission;
-
import gnu.javax.sound.sampled.gstreamer.lines.GstSourceDataLine;
import javax.sound.sampled.AudioFormat;
-import javax.sound.sampled.AudioPermission;
-import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Control;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.Line;
@@ -52,7 +48,6 @@ import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.Control.Type;
-import javax.sound.sampled.Line.Info;
/**
* @author Mario Torre <neugens@limasoftware.net>
@@ -81,32 +76,15 @@ public class GStreamerMixer
super(name, vendor, desc, vers);
}
}
-
+
public static final String GST_BACKEND = GstInfo.name;
public static final String GST_DECODER = "decoder";
-
- private static AudioFormat[] BASIC_FORMATS =
- {
- new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- true),
-
- new AudioFormat(AudioFormat.Encoding.PCM_UNSIGNED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- AudioSystem.NOT_SPECIFIED,
- false),
- };
+ public static final String GST_TYPE_NAME = "type";
+ public static final String GST_FILE_EXTENSION = "ext";
/** Mixer Info */
private static final Mixer.Info INFO = new GStreamerMixer.GstInfo();
-
+
public Line getLine(Line.Info info)
throws LineUnavailableException
{
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java
index 53b2155d8ec..b90caef24b5 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReader.java
@@ -37,13 +37,14 @@ exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.io;
+import gnu.javax.sound.sampled.gstreamer.GStreamerMixer;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-
import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
@@ -59,21 +60,61 @@ import javax.sound.sampled.spi.AudioFileReader;
*/
public class GstAudioFileReader
extends AudioFileReader
-{
+{
@Override
public AudioFileFormat getAudioFileFormat(File file)
throws UnsupportedAudioFileException, IOException
{
- throw new UnsupportedAudioFileException("Unsupported encoding.");
+ StringBuffer name = new StringBuffer(file.getName());
+ String _name = name.substring(name.lastIndexOf(".") + 1);
+
+ return getAudioFileFormat(
+ new BufferedInputStream(new FileInputStream(file)), _name);
}
@Override
public AudioFileFormat getAudioFileFormat(InputStream is)
throws UnsupportedAudioFileException, IOException
{
- throw new UnsupportedAudioFileException("Unsupported encoding.");
+ return getAudioFileFormat(is, null);
}
+ private AudioFileFormat getAudioFileFormat(InputStream is, String extension)
+ throws UnsupportedAudioFileException
+ {
+ AudioFormat format = null;
+ try
+ {
+ format = GstAudioFileReaderNativePeer.getAudioFormat(is);
+ }
+ catch (Exception e)
+ {
+ UnsupportedAudioFileException ex =
+ new UnsupportedAudioFileException("Unsupported encoding.");
+
+ ex.initCause(ex.getCause());
+ throw ex;
+ }
+
+ if (format == null)
+ throw new UnsupportedAudioFileException("Unsupported encoding.");
+
+ String name = format.getProperty(GStreamerMixer.GST_DECODER).toString();
+
+ if (extension == null)
+ {
+ extension =
+ format.getProperty(GStreamerMixer.GST_FILE_EXTENSION).toString();
+ }
+
+ AudioFileFormat.Type type =
+ new AudioFileFormat.Type(name, extension);
+
+ // TODO: we should calculate this in some way. We don't need it, but
+ // application may want to use this data.
+ return new AudioFileFormat(type, format, AudioSystem.NOT_SPECIFIED);
+ }
+
@Override
public AudioFileFormat getAudioFileFormat(URL url)
throws UnsupportedAudioFileException, IOException
@@ -96,8 +137,11 @@ public class GstAudioFileReader
}
catch (Exception e)
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ UnsupportedAudioFileException ex =
+ new UnsupportedAudioFileException("Unsupported encoding.");
+
+ ex.initCause(ex.getCause());
+ throw ex;
}
// get the header size
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java
index 45ae4ff8588..761720fee5d 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstAudioFileReaderNativePeer.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.io;
+import gnu.classpath.Pointer;
import gnu.javax.sound.sampled.gstreamer.GStreamerMixer;
import java.io.BufferedInputStream;
@@ -90,8 +91,11 @@ final class GstAudioFileReaderNativePeer
public String isSigned = null;
public String layer = null;
+
public String bitrate = null;
+
public String framed = null;
+
public String type = null;
}
@@ -108,18 +112,7 @@ final class GstAudioFileReaderNativePeer
public static AudioFormat getAudioFormat(InputStream is) throws Exception
{
- GstHeader header = new GstHeader();
-
- BufferedInputStream stream = new BufferedInputStream(is);
- if(!stream.markSupported())
- throw new IOException("Stream must support marking.");
-
- stream.mark(0);
-
- if (!gstreamer_get_audio_format_stream(header, stream))
- return null;
-
- return getAudioFormat(header);
+ return getAudioFormat(is, new GstHeader());
}
public static AudioFormat getAudioFormat(URL url) throws Exception
@@ -127,13 +120,20 @@ final class GstAudioFileReaderNativePeer
GstHeader header = new GstHeader();
header.file = url.toExternalForm();
- BufferedInputStream stream = new BufferedInputStream(url.openStream());
+ return getAudioFormat(url.openStream(), header);
+ }
+
+ private static AudioFormat getAudioFormat(InputStream is, GstHeader header)
+ throws Exception
+ {
+ BufferedInputStream stream = new BufferedInputStream(is);
if(!stream.markSupported())
throw new IOException("Stream must support marking.");
stream.mark(0);
- if (!gstreamer_get_audio_format_stream(header, stream))
+ if (!gstreamer_get_audio_format_stream(header, new GstInputStream(stream).
+ getNativeClass()))
return null;
return getAudioFormat(header);
@@ -200,27 +200,31 @@ final class GstAudioFileReaderNativePeer
bigEndian = true;
}
+ String ext = null;
+
int frameSize = na;
float frameRate = na;
String lowerCase = header.name.toLowerCase();
// FIXME: frameRate = sampleRate in these cases under all the tests so far
// but I'm not sure if this is always correct...
- if (lowerCase.contains("law") || lowerCase.contains("au") ||
- lowerCase.contains("x-au"))
+ if (lowerCase.contains("law") || lowerCase.contains("au"))
{
frameSize = (sampleSizeInBits >> 3) * channels;
frameRate = sampleRate;
+ ext = "au";
}
else if (lowerCase.contains("wav"))
{
frameSize = ((sampleSizeInBits + 7) / 8) * channels;
frameRate = sampleRate;
+ ext = "wav";
}
else if (lowerCase.contains("iff"))
{
frameSize = (sampleSizeInBits * channels) / 8;
frameRate = sampleRate;
+ ext = "aiff";
}
// write all the additional properties we got to identify
@@ -228,6 +232,9 @@ final class GstAudioFileReaderNativePeer
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(GStreamerMixer.GST_BACKEND, true);
properties.put(GStreamerMixer.GST_DECODER, header.name);
+ properties.put(GStreamerMixer.GST_TYPE_NAME, encoding.toString());
+ if (ext != null)
+ properties.put(GStreamerMixer.GST_FILE_EXTENSION, ext);
/* now we put in some of the additional properties if we have them */
if (header.type != null) properties.put("type", header.type);
@@ -251,26 +258,27 @@ final class GstAudioFileReaderNativePeer
/* ***** native methods ***** */
/**
- * Retrieve header information about the file being played.
- *
- * @param info
- * @return
+ * Retrieve header information about the stream being played.
*/
native static final
protected boolean gstreamer_get_audio_format_stream(GstHeader info,
- BufferedInputStream istream);
+ Pointer pointer);
/**
* Retrieve header information about the file being played.
- *
- * @param info
- * @return
*/
native static final
protected boolean gstreamer_get_audio_format_file(GstHeader info);
+ /**
+ * Initialize the native peer and enables the object cache.
+ * It is meant to be used by the static initializer.
+ */
+ native private static final void init_id_cache();
+
static
{
System.loadLibrary("gstreamerpeer"); //$NON-NLS-1$
+ init_id_cache();
}
}
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstInputStream.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstInputStream.java
new file mode 100644
index 00000000000..0702eded7e8
--- /dev/null
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/io/GstInputStream.java
@@ -0,0 +1,119 @@
+/* GstInputStream.java -- Trampoline class for an InputStream, mean to be used
+ by native code.
+ Copyright (C) 2007 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 gnu.javax.sound.sampled.gstreamer.io;
+
+import gnu.classpath.Pointer;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Encapsulates the functionality of an InputStream Object.
+ *
+ * This class is only meant to be used by the native code, to allow reading
+ * of the given InputStream as part of a the GStreamer InputStream Source
+ * Plugin.
+ *
+ * <strong>Note:</strong> this class will be not garbage collected as the
+ * native code contains strong references to internal fields.
+ * The native layer provides a method that can be called by the C code to
+ * free the resources and to let the garbage collected to handle this class
+ * when not needed anymore.
+ *
+ * @author Mario Torre <neugens@limasoftware.net>
+ */
+public class GstInputStream
+{
+ /** The real InputStream on which to perform reading operations. */
+ private InputStream istream;
+
+ /**
+ * Initialized in the native code, don't change without changes
+ * in the native layer.
+ */
+ private Pointer gstInputStream = null;
+
+ public GstInputStream(InputStream istream)
+ {
+ this.istream = istream;
+ init_instance();
+ }
+
+ public int read(byte[] buf, int off, int len) throws IOException
+ {
+ return this.istream.read(buf, off, len);
+ }
+
+ public int available() throws IOException
+ {
+ return this.istream.available();
+ }
+
+ /**
+ * Return a reference to the GstInputStream native class as a Pointer object.
+ * This method is intended as an helper accessor and the returned pointer
+ * needs to be casted and used in the native code only.
+ *
+ * @return Pointer to the native GstInputStream class.
+ */
+ public Pointer getNativeClass()
+ {
+ return this.gstInputStream;
+ }
+
+ /* native methods */
+
+ /**
+ * Initialize the native peer and enables the object cache.
+ * It is meant to be used by the class constructor.
+ */
+ native private final void init_instance();
+
+ /**
+ * Initialize the native peer and enables the object cache.
+ * It is meant to be used by the static initializer.
+ */
+ native private static final void init_id_cache();
+
+ static
+ {
+ System.loadLibrary("gstreamerpeer"); //$NON-NLS-1$
+ init_id_cache();
+ }
+}
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java
index 0467c955905..33be15c58b8 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstDataLine.java
@@ -41,22 +41,13 @@ import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.Control;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineListener;
-import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Control.Type;
public abstract class GstDataLine
implements DataLine
{
- public static enum State
- {
- PLAY, PAUSE, STOP
- }
-
public static final int DEFAULT_BUFFER_SIZE = 1024;
- /** Represents the playing state of this Line. */
- protected State state = State.STOP;
-
/** Represents if this Line is opened or not. */
protected Boolean open = false;
@@ -90,12 +81,7 @@ public abstract class GstDataLine
// TODO Auto-generated method stub
return 0;
}
-
- public boolean isRunning()
- {
- return (state == State.PLAY || state == State.PAUSE);
- }
-
+
public void addLineListener(LineListener listener)
{
// TODO Auto-generated method stub
@@ -131,15 +117,35 @@ public abstract class GstDataLine
return false;
}
- public void open() throws LineUnavailableException
+ public void removeLineListener(LineListener listener)
{
// TODO Auto-generated method stub
}
- public void removeLineListener(LineListener listener)
+ /* protected methods for subclasses */
+
+ /**
+ * @param open the open to set
+ */
+ protected void setOpen(Boolean open)
{
- // TODO Auto-generated method stub
+ this.open = open;
+ }
+
+ /**
+ * @param bufferSize the bufferSize to set
+ */
+ protected void setBufferSize(int bufferSize)
+ {
+ this.bufferSize = bufferSize;
+ }
+ /**
+ * @param format the format to set
+ */
+ protected void setFormat(AudioFormat format)
+ {
+ this.format = format;
}
}
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java
index 2b41a118672..84007ac97e7 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstNativeDataLine.java
@@ -37,12 +37,41 @@ exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.lines;
+import gnu.classpath.Pointer;
+
+import javax.sound.sampled.LineUnavailableException;
+
public class GstNativeDataLine
-{
+{
+ public static final GstPipeline createSourcePipeline(int bufferSize)
+ throws LineUnavailableException
+ {
+ GstPipeline pipeline = new GstPipeline(bufferSize);
+
+ pipeline.createForWrite();
+
+ if (!setup_sink_pipeline(pipeline.getNativeClass()))
+ throw new LineUnavailableException("Line unavailable");
+
+ return pipeline;
+ }
+ /* native methods */
+ /**
+ * Initialize the native peer and enables the object cache.
+ * It is meant to be used by the static initializer.
+ */
+ native static final private void init_id_cache();
+
+ /**
+ * Setup a new GStreamer Pipeline
+ */
+ native static final private boolean setup_sink_pipeline(Pointer pipeline);
+
static
{
System.loadLibrary("gstreamerpeer"); //$NON-NLS-1$
+ init_id_cache();
}
}
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java
index d1460e5090f..f561f71c2fa 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstPipeline.java
@@ -34,24 +34,382 @@ 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 gnu.javax.sound.sampled.gstreamer.lines;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.prefs.Preferences;
+
+import javax.sound.sampled.LineUnavailableException;
+
import gnu.classpath.Pointer;
/**
+ * This class represent a GStreamer pipeline and is resposible to handle the
+ * flow of data to and from the GStreamer native backend.
*
* @author Mario Torre <neugens@limasoftware.net>
*/
public class GstPipeline
{
+ /*
+ * Implementation note:
+ * This class is at first a bit confusing as it serves as a gateway
+ * to a real filesystem named pipe.
+ * The pipelines is shared by the gstreamer backend and by the java code.
+ * If the operation we are performing is to play a given stream of bytes,
+ * we need to open the java side of the pipeline for writing, which is done
+ * in the prepareWrite method. At the same time, the native side of the code
+ * need to open the pipeline in read mode, to get access to the data,
+ * and hence, act as a source element. This is why you will see terms
+ * like "read" or "source" in methods that are used to write in the pipeline,
+ * in other words, each the native operation is the opposite of the java
+ * side operation.
+ * Opening the pipe to record audio data from the sound card works the same
+ * except that all the operation are inverted.
+ */
+
+ // These enums are used in the native code also, changes here must reflect
+ // changes in the native code.
+ public static enum State
+ {
+ PLAY, PAUSE, STOP, CLOSE
+ }
+
+ private static final int READ = 0;
+ private static final int WRITE = 1;
+ private static final int QUEUED = 1;
+
+ private static final String CAPACITY_KEY = "Capacity";
+
+ private static final Object [] lock = new Object[0];
+
+ /*
+ * Preference subsystem. We use this to store some system specific settings.
+ */
+ protected Preferences prefs =
+ Preferences.userNodeForPackage(GstPipeline.class).node("GStreamer");
+
+ // used by the native code, stores the size of the named pipeline
+ // created by the operating system.
+ private long capacity = -1;
+
+ /** Represents the playing state of this Line. */
+ private State state = State.STOP;
+
+ /** The name of the named pipe. */
+ // Will be setup and filled in the native code. See the native library
+ // for details.
+ private String name = null;
+
+ /** This is the named pipe that will be read by the gstreamer backend. */
+ private FileOutputStream output = null;
+
+ /**
+ * Defines if we are getting data from a sink pipe
+ * or writing to a source pipe.
+ */
+ private boolean source = true;
+
+ /** Indicate that we are ready to process audio data to/from the pipe. */
+ private boolean ready = false;
+
/**
* This is the native GStreamer Pipeline.
+ */
+ // This field is used by the native code, so any change to it must be
+ // followed by similar changes in the native peer.
+ private Pointer pipeline = null;
+
+ /**
+ * Creates a new GstPipeline with a capacity of
+ * {@link GstDataLine#DEFAULT_BUFFER_SIZE}.
*
- * This field is used by the native code, so any change to it must be
- * followed by similar changes in the native peer.
+ * @see GstDataLine#DEFAULT_BUFFER_SIZE
+ */
+ public GstPipeline()
+ {
+ this(GstDataLine.DEFAULT_BUFFER_SIZE);
+ }
+
+ /**
+ * Creates a new GstPipeline with a capacity of bufferSize.
+ * @see GstDataLine#DEFAULT_BUFFER_SIZE
+ */
+ public GstPipeline(int bufferSize)
+ {
+ // see if we need to detect the size of the named pipe or we can use
+ // an already computet default for this system.
+ // Note that this is very different from the bufferSize parameter,
+ // see below.
+ capacity = prefs.getLong(CAPACITY_KEY, -1);
+ if (capacity == -1)
+ {
+ synchronized (lock)
+ {
+ capacity = detect_pipe_size();
+ }
+
+ prefs.putLong(CAPACITY_KEY, capacity);
+ }
+
+ // FIXME: bufferSize actually not used nor needed by the backend.
+ // Applications that expects a buffer of different size will be a
+ // bit disappointed by that..
+ init_instance();
+
+ // need to remove the named pipe in case of abnormal termination
+ Runtime.getRuntime().addShutdownHook(new CleanPipeline());
+ }
+
+ /**
+ * Creates a source pipeline. A source pipeline is a pipe you send data for
+ * processing using the write method.
+ */
+ public void createForWrite() throws LineUnavailableException
+ {
+ // create the named pipe
+ if (!create_named_pipe(this.pipeline))
+ throw new LineUnavailableException("Unable to create filesystem pipe");
+
+ open_native_pipe(this.pipeline, READ);
+ prepareWrite();
+
+ this.source = true;
+ }
+
+ /**
+ * @return the state
+ */
+ public State getState()
+ {
+ return this.state;
+ }
+
+ /**
+ * Closes this pipeline.
+ * Short hand for #setState(State.STOP).
+ */
+ public void close()
+ {
+ setState(State.STOP);
+ }
+
+ /**
+ * @param state the state to set
*/
- private Pointer pipeline;
+ public void setState(final State state)
+ {
+ int _state = -1;
+ switch (state)
+ {
+ case PLAY:
+ _state = 0;
+ break;
+
+ case PAUSE:
+ _state = 1;
+ break;
+
+ case STOP: case CLOSE:
+ _state = 2;
+ closePipe();
+ break;
+ }
- native private void setState();
+ if (set_state(pipeline, _state))
+ GstPipeline.this.state = state;
+ }
+
+ /**
+ * Return a reference to the GstPipeline native class as a Pointer object.
+ * This method is intended as an helper accessor and the returned pointer
+ * needs to be casted and used in the native code only.
+ *
+ * @return Pointer to the native GstPipeline class.
+ */
+ public Pointer getNativeClass()
+ {
+ return this.pipeline;
+ }
+
+ /**
+ * Write length bytes from the given buffer into this pipeline,
+ * starting at offset.
+ * This method block if the pipeline can't accept more data.
+ *
+ * @param buffer
+ * @param offset
+ * @param length
+ * @return
+ */
+ public int write(byte[] buffer, int offset, int length)
+ {
+ if (this.state == State.STOP)
+ return -1;
+ else if (this.state == State.PAUSE)
+ return 0;
+ else if (!ready)
+ return -1;
+
+ try
+ {
+ if (output != null)
+ {
+ output.write(buffer, offset, length);
+ return length;
+ }
+ return 0;
+ }
+ catch (Exception e)
+ {
+ /* nothing to do */
+ }
+
+ return -1;
+ }
+
+ public int read(byte[] buffer, int offset, int length)
+ {
+ return 0;
+ }
+
+ public int available()
+ {
+ if (this.source)
+ return available(this.pipeline, READ);
+ else
+ return available(this.pipeline, WRITE);
+ }
+
+ /**
+ * Wait for remaining data to be enqueued in the pipeline.
+ */
+ public void drain()
+ {
+ if (this.state == State.STOP)
+ return;
+
+ try
+ {
+ // wait untill there is anymore data in the pipe
+ while (available(this.pipeline, QUEUED) > 0)
+ Thread.sleep(3000);
+
+ // plus a bit to allow data to be processed
+ Thread.sleep(1000);
+ }
+ catch (InterruptedException e)
+ {
+ /* nothing to do*/
+ }
+ }
+
+ /**
+ * Flush all the data currently waiting to be processed.
+ */
+ public void flush()
+ {
+ try
+ {
+ if (source)
+ this.output.flush();
+ }
+ catch (IOException e)
+ {
+ /* nothing */
+ }
+ }
+
+ private void closePipe()
+ {
+ try
+ {
+ GstPipeline.this.flush();
+ if (source)
+ GstPipeline.this.output.close();
+ }
+ catch (IOException e)
+ {
+ /* nothing to do */
+ }
+ }
+
+ private void prepareWrite()
+ {
+ try
+ {
+ // if this is not completed for some reason, we will catch
+ // in the write method. As this call can block, we assume we will
+ // succeed and that the dataline can get data.
+ GstPipeline.this.ready = true;
+ GstPipeline.this.output = new FileOutputStream(name);
+ }
+ catch (Exception e)
+ {
+ GstPipeline.this.ready = false;
+ }
+ }
+
+ /* ***** native ***** */
+
+ /**
+ * Initialize the native peer and enables the object cache.
+ * It is meant to be used by the static initializer.
+ */
+ native private static final void init_id_cache();
+
+ /**
+ * Set the playing state of this pipeline.
+ */
+ native private static final boolean set_state(Pointer pipeline, int state);
+
+ /**
+ * Get the number of bytes currently available for reading or writing
+ * from the pipeline.
+ */
+ native private static final int available(Pointer pipeline, int mode);
+
+ /**
+ * Open the native pipeline with the given mode.
+ */
+ native private static final void open_native_pipe(Pointer jpipeline,
+ int mode);
+
+ /**
+ * Close the native pipeline.
+ */
+ native private static final void close_native_pipe(Pointer jpipeline);
+
+ /**
+ * Initialize the native peer and enables the object cache.
+ * It is meant to be used by the class constructor.
+ */
+ native private final void init_instance();
+
+ /**
+ * Crates the named pipe used to pass data between the application code
+ * and gstreamer.
+ */
+ native private final boolean create_named_pipe(Pointer jpipeline);
+
+ /**
+ * Detect and return the size of the filesystem named pipe.
+ */
+ native private final long detect_pipe_size();
+
+ private class CleanPipeline extends Thread
+ {
+ public void run()
+ {
+ GstPipeline.close_native_pipe(GstPipeline.this.pipeline);
+ }
+ }
+ static
+ {
+ System.loadLibrary("gstreamerpeer"); //$NON-NLS-1$
+ init_id_cache();
+ }
}
diff --git a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java
index d1a0262e5b5..f149ab39df2 100644
--- a/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java
+++ b/libjava/classpath/gnu/javax/sound/sampled/gstreamer/lines/GstSourceDataLine.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package gnu.javax.sound.sampled.gstreamer.lines;
import gnu.javax.sound.AudioSecurityManager;
+import gnu.javax.sound.sampled.gstreamer.lines.GstPipeline.State;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.LineUnavailableException;
@@ -48,87 +49,105 @@ import static gnu.javax.sound.AudioSecurityManager.Permission;
public class GstSourceDataLine
extends GstDataLine implements SourceDataLine
{
+ private GstPipeline pipeline = null;
+ private boolean open = false;
+
public GstSourceDataLine(AudioFormat format)
{
super(format);
}
+ public void open() throws LineUnavailableException
+ {
+ AudioSecurityManager.checkPermissions(Permission.PLAY);
+
+ if (open)
+ throw new IllegalStateException("Line already opened");
+
+ // create the pipeline
+ pipeline = GstNativeDataLine.createSourcePipeline(getBufferSize());
+
+ this.open = true;
+ }
+
public void open(AudioFormat fmt) throws LineUnavailableException
{
AudioSecurityManager.checkPermissions(Permission.PLAY);
- throw new LineUnavailableException("Line unavailable");
+
+ setFormat(fmt);
+ this.open();
}
public void open(AudioFormat fmt, int size) throws LineUnavailableException
{
AudioSecurityManager.checkPermissions(Permission.PLAY);
- throw new LineUnavailableException("Line unavailable");
+
+ setBufferSize(size);
+ this.open(fmt);
}
public int write(byte[] buf, int offset, int length)
- {
- // TODO Auto-generated method stub
- return 0;
+ {
+ return this.pipeline.write(buf, offset, length);
}
public int available()
{
- // TODO Auto-generated method stub
- return 0;
+ return this.pipeline.available();
}
public void drain()
{
- // TODO Auto-generated method stub
-
+ this.pipeline.drain();
}
public void flush()
{
- // TODO Auto-generated method stub
-
+ this.pipeline.flush();
}
public int getFramePosition()
{
- // TODO Auto-generated method stub
+ System.out.println("getFramePosition -: IMPLEMENT ME!!");
return 0;
}
public long getLongFramePosition()
{
- // TODO Auto-generated method stub
+ System.out.println("getLongFramePosition -: IMPLEMENT ME!!");
return 0;
}
public long getMicrosecondPosition()
{
- // TODO Auto-generated method stub
+ System.out.println("getMicrosecondPosition -: IMPLEMENT ME!!");
return 0;
}
public boolean isActive()
{
- // TODO Auto-generated method stub
- return false;
+ State state = pipeline.getState();
+ return (state == State.PLAY || state == State.PAUSE);
}
public void start()
{
- // TODO Auto-generated method stub
-
+ pipeline.setState(State.PLAY);
}
public void stop()
{
- // TODO Auto-generated method stub
-
+ pipeline.setState(State.PAUSE);
}
public void close()
{
- // TODO Auto-generated method stub
-
+ pipeline.close();
+ this.open = false;
+ }
+
+ public boolean isRunning()
+ {
+ return (pipeline.getState() == State.PLAY);
}
-
}
diff --git a/libjava/classpath/gnu/javax/swing/text/html/css/FontSize.java b/libjava/classpath/gnu/javax/swing/text/html/css/FontSize.java
index 2795b678401..203eadc4073 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/css/FontSize.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/css/FontSize.java
@@ -143,7 +143,7 @@ public class FontSize
{
int end = value.indexOf("pt");
String number = value.substring(0, end);
- int intVal = Integer.parseInt(number);
+ int intVal = (int) Double.parseDouble(number);
return intVal;
}
@@ -160,7 +160,7 @@ public class FontSize
String number = value.substring(0, end);
try
{
- int intVal = Integer.parseInt(number);
+ int intVal = (int) Double.parseDouble(number);
return intVal;
}
catch (NumberFormatException ex)
@@ -177,7 +177,7 @@ public class FontSize
String number = value.substring(0, end);
try
{
- int intVal = Integer.parseInt(number);
+ int intVal = (int) Double.parseDouble(number);
return intVal * par / 100;
}
catch (NumberFormatException ex)
diff --git a/libjava/classpath/gnu/javax/swing/text/html/css/Selector.java b/libjava/classpath/gnu/javax/swing/text/html/css/Selector.java
index 210df3a7b65..6e182a53623 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/css/Selector.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/css/Selector.java
@@ -93,8 +93,6 @@ public class Selector
* instance, the html tag).
*
* @param tags
- * @param classes
- * @param ids
*
* @return <code>true</code> when this selector matches the element path,
* <code>false</code> otherwise
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/models/node.java b/libjava/classpath/gnu/javax/swing/text/html/parser/models/node.java
index c615ddff350..54469b34995 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/models/node.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/models/node.java
@@ -177,7 +177,7 @@ public class node
/**
* Do the match operation with the given token. This sets various
* flags.
- * @param token The token to match.
+ * @param a_token The token to match.
* @return true if the the token matches node, false if it does not match
* or if the node is closed.
*/
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java b/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java
index c0d1e636e92..e99be3238e9 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/support/Parser.java
@@ -216,7 +216,7 @@ public class Parser
* The tag validator closes all unclosed elements that are required
* to have the end (closing) tag.
*
- * @param element The tag being fictionally (forcibly) closed.
+ * @param tElement The tag being fictionally (forcibly) closed.
*/
protected void handleSupposedEndTag(Element tElement)
{
@@ -234,7 +234,7 @@ public class Parser
* assigned to the empty one, the previous value is
* restored before return.
*
- * @param element The tag being fictionally (forcibly) closed.
+ * @param tElement The tag being fictionally (forcibly) closed.
*/
protected void handleSupposedStartTag(Element tElement)
{
@@ -523,8 +523,7 @@ public class Parser
restOfTag(false, name, start);
buffer.setLength(0);
-
- script:
+
while (!SCRIPT_CLOSE.matches(this))
{
append(getNextToken());
@@ -606,8 +605,7 @@ public class Parser
restOfTag(false, name, start);
buffer.setLength(0);
-
- style:
+
while (!STYLE_CLOSE.matches(this))
{
append(getNextToken());
@@ -742,7 +740,7 @@ public class Parser
* Handle the tag with no content, like &lt;br&gt;. The method is
* called for the elements that, in accordance with the current DTD,
* has an empty content.
- * @param The tag being handled.
+ * @param tag The tag being handled.
* @throws javax.swing.text.ChangedCharSetException
*/
protected void handleEmptyTag(TagElement tag)
@@ -754,7 +752,7 @@ public class Parser
* The method is called when the HTML closing tag ((like &lt;/table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag
+ * @param tag The tag
*/
protected void handleEndTag(TagElement tag)
{
@@ -769,7 +767,7 @@ public class Parser
* The method is called when the HTML opening tag ((like &lt;table&gt;)
* is found or if the parser concludes that the one should be present
* in the current position.
- * @param The tag
+ * @param tag The tag
*/
protected void handleStartTag(TagElement tag)
{
@@ -798,7 +796,7 @@ public class Parser
* both title starting and closing tags are already behind.
* The passed argument contains the concatenation of all
* title text sections.
- * @param The title text.
+ * @param title The title text.
*/
protected void handleTitle(char[] title)
{
@@ -868,7 +866,7 @@ public class Parser
{
Object value = HTML.NULL_ATTRIBUTE_VALUE;
- Element e = (Element) dtd.elementHash.get(element.toLowerCase());
+ Element e = dtd.elementHash.get(element.toLowerCase());
if (e != null)
{
AttributeList attr = e.getAttribute(attribute);
@@ -1146,7 +1144,7 @@ public class Parser
* is found or if the parser concludes that the one should be present
* in the current position. The method is called immediately before
* calling the handleStartTag.
- * @param The tag
+ * @param tag The tag
*/
protected void startTag(TagElement tag)
throws ChangedCharSetException
@@ -1182,7 +1180,7 @@ public class Parser
* A hooks for operations, preceeding call to handleEmptyTag().
* Handle the tag with no content, like &lt;br&gt;. As no any
* nested tags are expected, the tag validator is not involved.
- * @param The tag being handled.
+ * @param tag The tag being handled.
*/
private void _handleEmptyTag(TagElement tag)
{
@@ -1208,7 +1206,7 @@ public class Parser
* A hooks for operations, preceeding call to handleEndTag().
* The method is called when the HTML closing tag
* is found. Calls handleTitle after closing the 'title' tag.
- * @param The tag
+ * @param tag The tag
*/
private void _handleEndTag(TagElement tag)
{
@@ -1254,7 +1252,7 @@ public class Parser
* The method is called when the HTML opening tag ((like &lt;table&gt;)
* is found.
* Package-private to avoid an accessor method.
- * @param The tag
+ * @param tag The tag
*/
void _handleStartTag(TagElement tag)
{
@@ -1328,7 +1326,7 @@ public class Parser
private TagElement makeTagElement(String name, boolean isSupposed)
{
- Element e = (Element) dtd.elementHash.get(name.toLowerCase());
+ Element e = dtd.elementHash.get(name.toLowerCase());
if (e == null)
{
error("Unknown tag <" + name + ">");
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java b/libjava/classpath/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java
index 0ffc6c8b754..80bb333a528 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java
@@ -240,15 +240,14 @@ public class ReaderTokenizer
/**
* Read the given number of the tokens. Add the needed number of EOF
* tokens if there are no more data in the stream.
- * @param amount The number of additional tokens to read.
+ * @param numberOfTokens The number of additional tokens to read.
*/
void read(int numberOfTokens)
throws IOException
{
if (numberOfTokens <= 0)
return;
-
- reading:
+
for (int i = 0; i < numberOfTokens; i++)
readToken();
}
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java b/libjava/classpath/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java
index 654acbbb58c..43c07572a14 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java
@@ -80,7 +80,7 @@ public class parameterDefaulter
if (atts == null)
{
htmlAttributeSet set = new htmlAttributeSet();
- Element e = (Element) dtd.elementHash.get(element.toLowerCase());
+ Element e = dtd.elementHash.get(element.toLowerCase());
if (e != null)
{
diff --git a/libjava/classpath/gnu/javax/swing/text/html/parser/support/textPreProcessor.java b/libjava/classpath/gnu/javax/swing/text/html/parser/support/textPreProcessor.java
index 6fd79e2589e..0cb6d7a59f3 100644
--- a/libjava/classpath/gnu/javax/swing/text/html/parser/support/textPreProcessor.java
+++ b/libjava/classpath/gnu/javax/swing/text/html/parser/support/textPreProcessor.java
@@ -109,7 +109,7 @@ public class textPreProcessor
* \r or \r\n mutate into \n. Tabs are
* preserved.
* The content of the passed buffer is destroyed.
- * @param text
+ * @param a_text
* @return
*/
public char[] preprocessPreformatted(StringBuffer a_text)
diff --git a/libjava/classpath/gnu/xml/aelfred2/XmlParser.java b/libjava/classpath/gnu/xml/aelfred2/XmlParser.java
index 37466ca1c05..c0fd8027c21 100644
--- a/libjava/classpath/gnu/xml/aelfred2/XmlParser.java
+++ b/libjava/classpath/gnu/xml/aelfred2/XmlParser.java
@@ -542,7 +542,7 @@ final class XmlParser
private void error(String message, char textFound, String textExpected)
throws SAXException
{
- error(message, new Character(textFound).toString(), textExpected);
+ error(message, Character.toString(textFound), textExpected);
}
/**
@@ -2281,7 +2281,7 @@ loop2:
{
// too big for surrogate
error("character reference " + value + " is too large for UTF-16",
- new Integer(value).toString(), null);
+ Integer.toString(value), null);
}
}
@@ -2375,7 +2375,7 @@ loop2:
{
// too big for surrogate
error("character reference " + value + " is too large for UTF-16",
- new Integer(value).toString(), null);
+ Integer.toString(value), null);
}
if (doFlush)
{
@@ -3095,7 +3095,6 @@ loop:
nameBufferPos = 0;
// Read the first character.
-loop:
while (true)
{
c = readCh();
@@ -3295,7 +3294,7 @@ loop:
catch (EOFException e)
{
error("end of input while looking for delimiter (started on line "
- + startLine + ')', null, new Character(delim).toString());
+ + startLine + ')', null, Character.toString(delim));
}
inLiteral = false;
expandPE = saved;
@@ -3599,7 +3598,7 @@ loop:
if (c != delim)
{
- error("required character", c, new Character(delim).toString());
+ error("required character", c, Character.toString(delim));
}
}
@@ -4299,7 +4298,7 @@ loop:
}
else
{
- pushString(null, new Character(c).toString());
+ pushString(null, Character.toString(c));
}
}
diff --git a/libjava/classpath/gnu/xml/dom/html2/DomHTMLButtonElement.java b/libjava/classpath/gnu/xml/dom/html2/DomHTMLButtonElement.java
index 5aff5f8c1a9..3bca44c0992 100644
--- a/libjava/classpath/gnu/xml/dom/html2/DomHTMLButtonElement.java
+++ b/libjava/classpath/gnu/xml/dom/html2/DomHTMLButtonElement.java
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.xml.dom.html2;
-import org.w3c.dom.Node;
import org.w3c.dom.html2.HTMLButtonElement;
import org.w3c.dom.html2.HTMLFormElement;
diff --git a/libjava/classpath/gnu/xml/dom/html2/DomHTMLCollection.java b/libjava/classpath/gnu/xml/dom/html2/DomHTMLCollection.java
index 577337a3c3a..c63620087e3 100644
--- a/libjava/classpath/gnu/xml/dom/html2/DomHTMLCollection.java
+++ b/libjava/classpath/gnu/xml/dom/html2/DomHTMLCollection.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.xml.dom.html2;
import gnu.xml.dom.DomDOMException;
-import gnu.xml.dom.DomElement;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
diff --git a/libjava/classpath/gnu/xml/dom/html2/DomHTMLParser.java b/libjava/classpath/gnu/xml/dom/html2/DomHTMLParser.java
index 2d329fd4cdb..c6d8c4c5ca6 100644
--- a/libjava/classpath/gnu/xml/dom/html2/DomHTMLParser.java
+++ b/libjava/classpath/gnu/xml/dom/html2/DomHTMLParser.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.xml.dom.html2;
-import gnu.javax.swing.text.html.parser.support.Parser;
-
import java.io.IOException;
import java.io.Reader;
diff --git a/libjava/classpath/gnu/xml/libxmlj/dom/GnomeXPathResult.java b/libjava/classpath/gnu/xml/libxmlj/dom/GnomeXPathResult.java
index b384e4ac87b..d0e1a4f20de 100644
--- a/libjava/classpath/gnu/xml/libxmlj/dom/GnomeXPathResult.java
+++ b/libjava/classpath/gnu/xml/libxmlj/dom/GnomeXPathResult.java
@@ -101,7 +101,7 @@ implements XPathResult
case STRING_TYPE:
return getStringValue ();
case NUMBER_TYPE:
- return new Double (getNumberValue ()).toString ();
+ return Double.toString (getNumberValue ());
case BOOLEAN_TYPE:
return Boolean.valueOf (getBooleanValue ()).toString ();
case UNORDERED_NODE_SNAPSHOT_TYPE:
diff --git a/libjava/classpath/gnu/xml/pipeline/DomConsumer.java b/libjava/classpath/gnu/xml/pipeline/DomConsumer.java
index da527b96587..53f7f24a29f 100644
--- a/libjava/classpath/gnu/xml/pipeline/DomConsumer.java
+++ b/libjava/classpath/gnu/xml/pipeline/DomConsumer.java
@@ -743,7 +743,7 @@ public class DomConsumer implements EventConsumer
// ELSE ... search up the tree we've been building
for (Node n = top;
n != null && n.getNodeType () != Node.DOCUMENT_NODE;
- n = (Node) n.getParentNode ()) {
+ n = n.getParentNode ()) {
if (n.getNodeType () == Node.ENTITY_REFERENCE_NODE)
continue;
Element e = (Element) n;
diff --git a/libjava/classpath/gnu/xml/pipeline/EventFilter.java b/libjava/classpath/gnu/xml/pipeline/EventFilter.java
index a14fb340f12..af2113f97ce 100644
--- a/libjava/classpath/gnu/xml/pipeline/EventFilter.java
+++ b/libjava/classpath/gnu/xml/pipeline/EventFilter.java
@@ -187,14 +187,14 @@ public class EventFilter
Method m = null;
try {
- m = Thread.class.getMethod("getContextClassLoader", null);
+ m = Thread.class.getMethod("getContextClassLoader");
} catch (NoSuchMethodException e) {
// Assume that we are running JDK 1.1, use the current ClassLoader
return EventFilter.class.getClassLoader();
}
try {
- return (ClassLoader) m.invoke(Thread.currentThread(), null);
+ return (ClassLoader) m.invoke(Thread.currentThread());
} catch (IllegalAccessException e) {
// assert(false)
throw new UnknownError(e.getMessage());
diff --git a/libjava/classpath/gnu/xml/stream/AttributeImpl.java b/libjava/classpath/gnu/xml/stream/AttributeImpl.java
index 501575e56d8..f74aebd3526 100644
--- a/libjava/classpath/gnu/xml/stream/AttributeImpl.java
+++ b/libjava/classpath/gnu/xml/stream/AttributeImpl.java
@@ -56,11 +56,11 @@ public class AttributeImpl
protected final QName name;
protected final String value;
- protected final QName type;
+ protected final String type;
protected final boolean specified;
protected AttributeImpl(Location location,
- QName name, String value, QName type,
+ QName name, String value, String type,
boolean specified)
{
super(location);
@@ -85,7 +85,7 @@ public class AttributeImpl
return value;
}
- public QName getDTDType()
+ public String getDTDType()
{
return type;
}
diff --git a/libjava/classpath/gnu/xml/stream/EndDocumentImpl.java b/libjava/classpath/gnu/xml/stream/EndDocumentImpl.java
index 7a5e2049e10..0e3ed9630ad 100644
--- a/libjava/classpath/gnu/xml/stream/EndDocumentImpl.java
+++ b/libjava/classpath/gnu/xml/stream/EndDocumentImpl.java
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.xml.stream;
-import java.io.IOException;
import java.io.Writer;
import javax.xml.stream.Location;
import javax.xml.stream.XMLStreamException;
diff --git a/libjava/classpath/gnu/xml/stream/SAXParser.java b/libjava/classpath/gnu/xml/stream/SAXParser.java
index af4a6af4217..ab1f86e49ed 100644
--- a/libjava/classpath/gnu/xml/stream/SAXParser.java
+++ b/libjava/classpath/gnu/xml/stream/SAXParser.java
@@ -66,7 +66,6 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.ext.Attributes2;
import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.EntityResolver2;
import org.xml.sax.ext.LexicalHandler;
import org.xml.sax.ext.Locator2;
@@ -234,7 +233,7 @@ public class SAXParser
return baseAware ? Boolean.TRUE : Boolean.FALSE;
if ((GNU_PROPERTIES + "document-xml-encoding").equals(name))
return xmlEncoding;
- throw new SAXNotSupportedException(name);
+ throw new SAXNotRecognizedException(name);
}
public boolean isXIncludeAware()
diff --git a/libjava/classpath/gnu/xml/stream/XIncludeFilter.java b/libjava/classpath/gnu/xml/stream/XIncludeFilter.java
index 86961faea91..d5c4af12c5e 100644
--- a/libjava/classpath/gnu/xml/stream/XIncludeFilter.java
+++ b/libjava/classpath/gnu/xml/stream/XIncludeFilter.java
@@ -51,7 +51,6 @@ import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
@@ -500,7 +499,7 @@ class XIncludeFilter
return event;
case XPathResult.NUMBER_TYPE:
double nval = result.getNumberValue();
- String ntext = new Double(nval).toString();
+ String ntext = Double.toString(nval);
buf = ntext.toCharArray();
len = buf.length;
result = null;
diff --git a/libjava/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java b/libjava/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java
index 666bffabe23..fb1e4c28c58 100644
--- a/libjava/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLEventAllocatorImpl.java
@@ -165,7 +165,7 @@ public class XMLEventAllocatorImpl
attributes.add(new AttributeImpl(location,
reader.getAttributeName(i),
reader.getAttributeValue(i),
- QName.valueOf(reader.getAttributeType(i)),
+ reader.getAttributeType(i),
reader.isAttributeSpecified(i)));
return new StartElementImpl(location,
reader.getName(),
diff --git a/libjava/classpath/gnu/xml/stream/XMLEventFactoryImpl.java b/libjava/classpath/gnu/xml/stream/XMLEventFactoryImpl.java
index e1d7d6ab82f..f694753c4b4 100644
--- a/libjava/classpath/gnu/xml/stream/XMLEventFactoryImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLEventFactoryImpl.java
@@ -79,20 +79,20 @@ public class XMLEventFactoryImpl
{
return new AttributeImpl(location,
new QName(namespaceURI, localName, prefix),
- value, QName.valueOf("CDATA"), true);
+ value, "CDATA", true);
}
public Attribute createAttribute(String localName, String value)
{
return new AttributeImpl(location,
new QName(localName),
- value, QName.valueOf("CDATA"), true);
+ value, "CDATA", true);
}
public Attribute createAttribute(QName name, String value)
{
return new AttributeImpl(location, name, value,
- QName.valueOf("CDATA"), true);
+ "CDATA", true);
}
public Namespace createNamespace(String namespaceURI)
diff --git a/libjava/classpath/gnu/xml/stream/XMLEventImpl.java b/libjava/classpath/gnu/xml/stream/XMLEventImpl.java
index 9f57d89d828..de2fccb7a1e 100644
--- a/libjava/classpath/gnu/xml/stream/XMLEventImpl.java
+++ b/libjava/classpath/gnu/xml/stream/XMLEventImpl.java
@@ -40,7 +40,6 @@ package gnu.xml.stream;
import java.io.Writer;
import javax.xml.namespace.QName;
import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.EndElement;
diff --git a/libjava/classpath/gnu/xml/stream/XMLParser.java b/libjava/classpath/gnu/xml/stream/XMLParser.java
index c1eee946e69..049575ac707 100644
--- a/libjava/classpath/gnu/xml/stream/XMLParser.java
+++ b/libjava/classpath/gnu/xml/stream/XMLParser.java
@@ -178,11 +178,6 @@ public class XMLParser
private int event;
/**
- * Whether we are looking ahead. Used by hasNext.
- */
- private boolean lookahead;
-
- /**
* The element name stack. The first element in this stack will be the
* root element.
*/
@@ -1013,24 +1008,12 @@ public class XMLParser
public boolean hasNext()
throws XMLStreamException
{
- if (event == XMLStreamConstants.END_DOCUMENT)
- return false;
- if (!lookahead)
- {
- next();
- lookahead = true;
- }
- return event != -1;
+ return (event != XMLStreamConstants.END_DOCUMENT && event != -1);
}
public int next()
throws XMLStreamException
{
- if (lookahead)
- {
- lookahead = false;
- return event;
- }
if (event == XMLStreamConstants.END_ELEMENT)
{
// Pop namespace context
diff --git a/libjava/classpath/gnu/xml/transform/StreamSerializer.java b/libjava/classpath/gnu/xml/transform/StreamSerializer.java
index 26bdda8b325..35323e7353d 100644
--- a/libjava/classpath/gnu/xml/transform/StreamSerializer.java
+++ b/libjava/classpath/gnu/xml/transform/StreamSerializer.java
@@ -40,7 +40,6 @@ package gnu.xml.transform;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
diff --git a/libjava/classpath/gnu/xml/transform/Stylesheet.java b/libjava/classpath/gnu/xml/transform/Stylesheet.java
index 73b22969114..41562c3c60a 100644
--- a/libjava/classpath/gnu/xml/transform/Stylesheet.java
+++ b/libjava/classpath/gnu/xml/transform/Stylesheet.java
@@ -51,7 +51,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
-import java.util.TreeSet;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
diff --git a/libjava/classpath/gnu/xml/util/Resolver.java b/libjava/classpath/gnu/xml/util/Resolver.java
index e84b5ade106..02c4693ae2f 100644
--- a/libjava/classpath/gnu/xml/util/Resolver.java
+++ b/libjava/classpath/gnu/xml/util/Resolver.java
@@ -170,7 +170,7 @@ public class Resolver implements EntityResolver, Cloneable
* Constructs a resolver which understands how to map PUBLIC identifiers
* to other URIs, typically for local copies of standard DTD components.
*
- * @param dictionary maps PUBLIC identifiers to URIs. This is not
+ * @param dict maps PUBLIC identifiers to URIs. This is not
* copied; subsequent modifications will be reported through the
* resolution operations.
*/
diff --git a/libjava/classpath/gnu/xml/validation/datatype/Base64BinaryType.java b/libjava/classpath/gnu/xml/validation/datatype/Base64BinaryType.java
index 5a72a280d7b..2fc4c33b91e 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/Base64BinaryType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/Base64BinaryType.java
@@ -37,8 +37,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
-import java.util.Collections;
-import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.relaxng.datatype.DatatypeException;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/BooleanType.java b/libjava/classpath/gnu/xml/validation/datatype/BooleanType.java
index 5a2d9ecfa2d..25e488a05fd 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/BooleanType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/BooleanType.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import javax.xml.XMLConstants;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/DecimalType.java b/libjava/classpath/gnu/xml/validation/datatype/DecimalType.java
index 08fe3304c5f..b895c44b213 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/DecimalType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/DecimalType.java
@@ -38,8 +38,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
import java.math.BigDecimal;
-import java.util.Collections;
-import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.relaxng.datatype.DatatypeException;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/DoubleType.java b/libjava/classpath/gnu/xml/validation/datatype/DoubleType.java
index e25d060fa5f..5d2d8662d56 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/DoubleType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/DoubleType.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import javax.xml.XMLConstants;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/FloatType.java b/libjava/classpath/gnu/xml/validation/datatype/FloatType.java
index a81a56c1a68..372e38871ae 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/FloatType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/FloatType.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import javax.xml.XMLConstants;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/HexBinaryType.java b/libjava/classpath/gnu/xml/validation/datatype/HexBinaryType.java
index 686e09d9801..8a92b15f634 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/HexBinaryType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/HexBinaryType.java
@@ -37,8 +37,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
-import java.util.Collections;
-import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.relaxng.datatype.DatatypeException;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/NotationType.java b/libjava/classpath/gnu/xml/validation/datatype/NotationType.java
index 59c7f25e538..e9d7c9fda20 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/NotationType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/NotationType.java
@@ -37,8 +37,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
-import java.util.Collections;
-import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.relaxng.datatype.DatatypeException;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/SimpleType.java b/libjava/classpath/gnu/xml/validation/datatype/SimpleType.java
index 6554f2fe066..1b8479922b8 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/SimpleType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/SimpleType.java
@@ -40,7 +40,6 @@ package gnu.xml.validation.datatype;
import java.util.Iterator;
import java.util.Set;
import java.util.regex.Matcher;
-import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
import org.relaxng.datatype.Datatype;
import org.relaxng.datatype.DatatypeException;
diff --git a/libjava/classpath/gnu/xml/validation/datatype/StringType.java b/libjava/classpath/gnu/xml/validation/datatype/StringType.java
index a2235f2df66..593c265dc59 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/StringType.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/StringType.java
@@ -37,12 +37,8 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
-import java.util.Collections;
-import java.util.Set;
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;
-import org.relaxng.datatype.DatatypeException;
-import org.relaxng.datatype.ValidationContext;
/**
* The XML Schema string type.
diff --git a/libjava/classpath/gnu/xml/validation/datatype/Type.java b/libjava/classpath/gnu/xml/validation/datatype/Type.java
index e0662761f37..be6f0a0b447 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/Type.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/Type.java
@@ -37,8 +37,6 @@ exception statement from your version. */
package gnu.xml.validation.datatype;
-import java.util.HashMap;
-import java.util.Map;
import javax.xml.namespace.QName;
/**
* Abstract base class for XML Schema datatypes.
diff --git a/libjava/classpath/gnu/xml/validation/datatype/TypeBuilder.java b/libjava/classpath/gnu/xml/validation/datatype/TypeBuilder.java
index 606fd0e62fb..054eb8a55de 100644
--- a/libjava/classpath/gnu/xml/validation/datatype/TypeBuilder.java
+++ b/libjava/classpath/gnu/xml/validation/datatype/TypeBuilder.java
@@ -39,7 +39,6 @@ package gnu.xml.validation.datatype;
import java.util.LinkedHashSet;
import java.util.regex.Pattern;
-import javax.xml.namespace.QName;
import org.relaxng.datatype.Datatype;
import org.relaxng.datatype.DatatypeBuilder;
import org.relaxng.datatype.DatatypeException;
diff --git a/libjava/classpath/gnu/xml/validation/relaxng/FullSyntaxBuilder.java b/libjava/classpath/gnu/xml/validation/relaxng/FullSyntaxBuilder.java
index 2a6833737bb..78e9f853327 100644
--- a/libjava/classpath/gnu/xml/validation/relaxng/FullSyntaxBuilder.java
+++ b/libjava/classpath/gnu/xml/validation/relaxng/FullSyntaxBuilder.java
@@ -51,7 +51,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
diff --git a/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java b/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java
index 758bc94cd95..45064075a96 100644
--- a/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java
+++ b/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaAttributeTypeInfo.java
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.xml.validation.xmlschema;
-import org.w3c.dom.TypeInfo;
import gnu.xml.validation.datatype.SimpleType;
/**
diff --git a/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java b/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java
index ddf91409d2b..ecf3ad3b89f 100644
--- a/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java
+++ b/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaBuilder.java
@@ -38,7 +38,6 @@ exception statement from your version. */
package gnu.xml.validation.xmlschema;
import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import javax.xml.XMLConstants;
@@ -49,11 +48,8 @@ import org.relaxng.datatype.helpers.DatatypeLibraryLoader;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import gnu.xml.validation.datatype.Annotation;
-import gnu.xml.validation.datatype.AtomicSimpleType;
-import gnu.xml.validation.datatype.ListSimpleType;
import gnu.xml.validation.datatype.SimpleType;
import gnu.xml.validation.datatype.Type;
-import gnu.xml.validation.datatype.UnionSimpleType;
/**
* Parses an XML Schema DOM tree, constructing a compiled internal
diff --git a/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java b/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java
index 98a5fb75983..a65133c20e4 100644
--- a/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java
+++ b/libjava/classpath/gnu/xml/validation/xmlschema/XMLSchemaElementTypeInfo.java
@@ -37,7 +37,6 @@ exception statement from your version. */
package gnu.xml.validation.xmlschema;
-import org.w3c.dom.TypeInfo;
import gnu.xml.validation.datatype.SimpleType;
import gnu.xml.validation.datatype.Type;
diff --git a/libjava/classpath/gnu/xml/xpath/XPathParser.java b/libjava/classpath/gnu/xml/xpath/XPathParser.java
index 03066fbfc36..9b7540a4a40 100644
--- a/libjava/classpath/gnu/xml/xpath/XPathParser.java
+++ b/libjava/classpath/gnu/xml/xpath/XPathParser.java
@@ -44,7 +44,6 @@ package gnu.xml.xpath;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.xpath.XPathFunctionResolver;