diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-06-03 19:11:10 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2010-06-03 19:11:10 +0000 |
commit | a17284098845d59d84bbf76b33190a5a91c12a82 (patch) | |
tree | c634c40062604cd1cdefa535b838926c9ede1a38 /java/net | |
parent | 43b6a8d2580b5c9549a58db41a0239f3929e4b91 (diff) | |
download | classpath-a17284098845d59d84bbf76b33190a5a91c12a82.tar.gz |
Normalise whitespace.
2010-06-03 Andrew John Hughes <ahughes@redhat.com>
* examples/gnu/classpath/examples/CORBA/NamingService/Demo.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/Demo.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToPass.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/StructureToReturn.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/TreeNode.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisException.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/WeThrowThisExceptionHelper.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterImplBase.java,
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/communication/_DemoTesterStub.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/CanvasWorld.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/ChatConstants.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/ClientFrame.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/Demo.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/GameManager.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/GameManagerImpl.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/IorReader.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/OrbStarter.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/Player.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/PlayerImpl.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/PlayingDesk.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/State.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/X5Server.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/_GameManagerImpl_Tie.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/_GameManager_Stub.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/_PlayerImpl_Tie.java,
* examples/gnu/classpath/examples/CORBA/swing/x5/_Player_Stub.java,
* examples/gnu/classpath/examples/awt/AicasGraphicsBenchmark.java,
* examples/gnu/classpath/examples/awt/Demo.java,
* examples/gnu/classpath/examples/awt/HintingDemo.java,
* examples/gnu/classpath/examples/datatransfer/Demo.java,
* examples/gnu/classpath/examples/html/Demo.java,
* examples/gnu/classpath/examples/java2d/J2dBenchmark.java,
* examples/gnu/classpath/examples/java2d/J2dBenchmarkGUI.java,
* examples/gnu/classpath/examples/java2d/JNIOverhead.java,
* examples/gnu/classpath/examples/jawt/DemoJAWT.java,
* examples/gnu/classpath/examples/management/TestClassLoading.java,
* examples/gnu/classpath/examples/management/TestCompilation.java,
* examples/gnu/classpath/examples/management/TestGarbageCollector.java,
* examples/gnu/classpath/examples/management/TestMemory.java,
* examples/gnu/classpath/examples/management/TestMemoryManager.java,
* examples/gnu/classpath/examples/management/TestMemoryPool.java,
* examples/gnu/classpath/examples/management/TestThread.java,
* examples/gnu/classpath/examples/midi/Demo.java,
* examples/gnu/classpath/examples/print/Demo.java,
* examples/gnu/classpath/examples/sound/AudioPlayerSample.java,
* examples/gnu/classpath/examples/swing/BrowserEditorKit.java,
* examples/gnu/classpath/examples/swing/ButtonDemo.java,
* examples/gnu/classpath/examples/swing/ComboBoxDemo.java,
* examples/gnu/classpath/examples/swing/Demo.java,
* examples/gnu/classpath/examples/swing/DemoFactory.java,
* examples/gnu/classpath/examples/swing/DocumentFilterDemo.java,
* examples/gnu/classpath/examples/swing/FileChooserDemo.java,
* examples/gnu/classpath/examples/swing/HtmlDemo.java,
* examples/gnu/classpath/examples/swing/ListDemo.java,
* examples/gnu/classpath/examples/swing/MetalThemeEditor.java,
* examples/gnu/classpath/examples/swing/NavigationFilterDemo.java,
* examples/gnu/classpath/examples/swing/ScrollBarDemo.java,
* examples/gnu/classpath/examples/swing/SliderDemo.java,
* examples/gnu/classpath/examples/swing/SpinnerDemo.java,
* examples/gnu/classpath/examples/swing/TabbedPaneDemo.java,
* examples/gnu/classpath/examples/swing/TableDemo.java,
* examples/gnu/classpath/examples/swing/TextAreaDemo.java,
* examples/gnu/classpath/examples/swing/TextFieldDemo.java,
* examples/gnu/classpath/examples/swing/TreeDemo.java,
* gnu/CORBA/BigDecimalHelper.java,
* gnu/CORBA/CDR/AbstractCdrInput.java,
* gnu/CORBA/CDR/AbstractCdrOutput.java,
* gnu/CORBA/CDR/AbstractDataInput.java,
* gnu/CORBA/CDR/AbstractDataOutput.java,
* gnu/CORBA/CDR/AligningInput.java,
* gnu/CORBA/CDR/AligningOutput.java,
* gnu/CORBA/CDR/ArrayValueHelper.java,
* gnu/CORBA/CDR/BigEndianInputStream.java,
* gnu/CORBA/CDR/BigEndianOutputStream.java,
* gnu/CORBA/CDR/BufferedCdrOutput.java,
* gnu/CORBA/CDR/BufferredCdrInput.java,
* gnu/CORBA/CDR/HeadlessInput.java,
* gnu/CORBA/CDR/IDLTypeHelper.java,
* gnu/CORBA/CDR/LittleEndianOutputStream.java,
* gnu/CORBA/CDR/UnknownExceptionCtxHandler.java,
* gnu/CORBA/CDR/VMVio.java,
* gnu/CORBA/CDR/Vio.java,
* gnu/CORBA/CDR/gnuRuntime.java,
* gnu/CORBA/CDR/gnuValueStream.java,
* gnu/CORBA/CdrEncapsCodecImpl.java,
* gnu/CORBA/CollocatedOrbs.java,
* gnu/CORBA/Connected_objects.java,
* gnu/CORBA/DefaultSocketFactory.java,
* gnu/CORBA/DuplicateNameHolder.java,
* gnu/CORBA/DynAn/AbstractAny.java,
* gnu/CORBA/DynAn/DivideableAny.java,
* gnu/CORBA/DynAn/NameValuePairHolder.java,
* gnu/CORBA/DynAn/RecordAny.java,
* gnu/CORBA/DynAn/ValueChangeListener.java,
* gnu/CORBA/DynAn/gnuDynAny.java,
* gnu/CORBA/DynAn/gnuDynAnyFactory.java,
* gnu/CORBA/DynAn/gnuDynArray.java,
* gnu/CORBA/DynAn/gnuDynEnum.java,
* gnu/CORBA/DynAn/gnuDynFixed.java,
* gnu/CORBA/DynAn/gnuDynSequence.java,
* gnu/CORBA/DynAn/gnuDynUnion.java,
* gnu/CORBA/DynAn/gnuDynValue.java,
* gnu/CORBA/DynAn/gnuDynValueBox.java,
* gnu/CORBA/DynAnySeqHolder.java,
* gnu/CORBA/EmptyExceptionHolder.java,
* gnu/CORBA/ForwardRequestHelper.java,
* gnu/CORBA/GIOP/CharSets_OSF.java,
* gnu/CORBA/GIOP/CloseMessage.java,
* gnu/CORBA/GIOP/ErrorMessage.java,
* gnu/CORBA/GIOP/MessageHeader.java,
* gnu/CORBA/GIOP/ServiceContext.java,
* gnu/CORBA/GIOP/v1_2/RequestHeader.java,
* gnu/CORBA/GeneralHolder.java,
* gnu/CORBA/IOR.java,
* gnu/CORBA/Interceptor/ClientRequestInterceptors.java,
* gnu/CORBA/Interceptor/ForwardRequestHolder.java,
* gnu/CORBA/Interceptor/IORInterceptors.java,
* gnu/CORBA/Interceptor/Registrator.java,
* gnu/CORBA/Interceptor/ServerRequestInterceptors.java,
* gnu/CORBA/Interceptor/gnuClientRequestInfo.java,
* gnu/CORBA/Interceptor/gnuIcCurrent.java,
* gnu/CORBA/Interceptor/gnuIorInfo.java,
* gnu/CORBA/Interceptor/gnuServerRequestInfo.java,
* gnu/CORBA/IorDelegate.java,
* gnu/CORBA/IorObject.java,
* gnu/CORBA/Minor.java,
* gnu/CORBA/NameDynAnyPairHolder.java,
* gnu/CORBA/NameDynAnyPairSeqHolder.java,
* gnu/CORBA/NameValuePairHolder.java,
* gnu/CORBA/NameValuePairSeqHolder.java,
* gnu/CORBA/NamingService/NameParser.java,
* gnu/CORBA/NamingService/NamingMap.java,
* gnu/CORBA/NamingService/NamingServiceTransient.java,
* gnu/CORBA/NamingService/TransientContext.java,
* gnu/CORBA/ObjectCreator.java,
* gnu/CORBA/OrbFocused.java,
* gnu/CORBA/OrbFunctional.java,
* gnu/CORBA/OrbRestricted.java,
* gnu/CORBA/Poa/AOM.java,
* gnu/CORBA/Poa/AccessiblePolicy.java,
* gnu/CORBA/Poa/DynamicImpHandler.java,
* gnu/CORBA/Poa/ForwardRequestHolder.java,
* gnu/CORBA/Poa/ForwardedServant.java,
* gnu/CORBA/Poa/InvalidPolicyHolder.java,
* gnu/CORBA/Poa/LocalDelegate.java,
* gnu/CORBA/Poa/LocalRequest.java,
* gnu/CORBA/Poa/LocalServerRequest.java,
* gnu/CORBA/Poa/ORB_1_4.java,
* gnu/CORBA/Poa/ServantDelegateImpl.java,
* gnu/CORBA/Poa/StandardPolicies.java,
* gnu/CORBA/Poa/gnuAdapterActivator.java,
* gnu/CORBA/Poa/gnuForwardRequest.java,
* gnu/CORBA/Poa/gnuIdAssignmentPolicy.java,
* gnu/CORBA/Poa/gnuIdUniquenessPolicy.java,
* gnu/CORBA/Poa/gnuImplicitActivationPolicy.java,
* gnu/CORBA/Poa/gnuLifespanPolicy.java,
* gnu/CORBA/Poa/gnuPOA.java,
* gnu/CORBA/Poa/gnuPOAManager.java,
* gnu/CORBA/Poa/gnuPoaCurrent.java,
* gnu/CORBA/Poa/gnuRequestProcessingPolicy.java,
* gnu/CORBA/Poa/gnuServantObject.java,
* gnu/CORBA/Poa/gnuServantRetentionPolicy.java,
* gnu/CORBA/Poa/gnuThreadPolicy.java,
* gnu/CORBA/ServiceRequestAdapter.java,
* gnu/CORBA/SetOverrideTypeHolder.java,
* gnu/CORBA/SimpleDelegate.java,
* gnu/CORBA/SocketRepository.java,
* gnu/CORBA/StreamHolder.java,
* gnu/CORBA/TypeCodeHelper.java,
* gnu/CORBA/TypeKindNamer.java,
* gnu/CORBA/Version.java,
* gnu/CORBA/_PolicyImplBase.java,
* gnu/CORBA/gnuAny.java,
* gnu/CORBA/gnuCodecFactory.java,
* gnu/CORBA/gnuEnvironment.java,
* gnu/CORBA/gnuRequest.java,
* gnu/CORBA/gnuValueHolder.java,
* gnu/CORBA/interfaces/SocketFactory.java,
* gnu/CORBA/typecodes/AliasTypeCode.java,
* gnu/CORBA/typecodes/ArrayTypeCode.java,
* gnu/CORBA/typecodes/FixedTypeCode.java,
* gnu/CORBA/typecodes/GeneralTypeCode.java,
* gnu/CORBA/typecodes/PrimitiveTypeCode.java,
* gnu/CORBA/typecodes/RecordTypeCode.java,
* gnu/CORBA/typecodes/RecursiveTypeCode.java,
* gnu/CORBA/typecodes/StringTypeCode.java,
* gnu/classpath/Pair.java,
* gnu/classpath/Pointer.java,
* gnu/classpath/Pointer32.java,
* gnu/classpath/Pointer64.java,
* gnu/classpath/ServiceFactory.java,
* gnu/classpath/ServiceProviderLoadingAction.java,
* gnu/classpath/SystemProperties.java,
* gnu/classpath/debug/Component.java,
* gnu/classpath/debug/PreciseFilter.java,
* gnu/classpath/debug/SystemLogger.java,
* gnu/classpath/debug/TeeInputStream.java,
* gnu/classpath/debug/TeeReader.java,
* gnu/classpath/jdwp/Jdwp.java,
* gnu/classpath/jdwp/JdwpConstants.java,
* gnu/classpath/jdwp/event/BreakpointEvent.java,
* gnu/classpath/jdwp/event/ClassPrepareEvent.java,
* gnu/classpath/jdwp/event/ClassUnloadEvent.java,
* gnu/classpath/jdwp/event/Event.java,
* gnu/classpath/jdwp/event/EventManager.java,
* gnu/classpath/jdwp/event/EventRequest.java,
* gnu/classpath/jdwp/event/ExceptionEvent.java,
* gnu/classpath/jdwp/event/MethodEntryEvent.java,
* gnu/classpath/jdwp/event/MethodExitEvent.java,
* gnu/classpath/jdwp/event/SingleStepEvent.java,
* gnu/classpath/jdwp/event/ThreadEndEvent.java,
* gnu/classpath/jdwp/event/VmDeathEvent.java,
* gnu/classpath/jdwp/event/VmInitEvent.java,
* gnu/classpath/jdwp/event/filters/ClassExcludeFilter.java,
* gnu/classpath/jdwp/event/filters/ClassMatchFilter.java,
* gnu/classpath/jdwp/event/filters/ClassOnlyFilter.java,
* gnu/classpath/jdwp/event/filters/ExceptionOnlyFilter.java,
* gnu/classpath/jdwp/event/filters/FieldOnlyFilter.java,
* gnu/classpath/jdwp/event/filters/InstanceOnlyFilter.java,
* gnu/classpath/jdwp/event/filters/StepFilter.java,
* gnu/classpath/jdwp/event/filters/ThreadOnlyFilter.java,
* gnu/classpath/jdwp/exception/InvalidClassException.java,
* gnu/classpath/jdwp/exception/InvalidClassLoaderException.java,
* gnu/classpath/jdwp/exception/InvalidEventTypeException.java,
* gnu/classpath/jdwp/exception/InvalidFieldException.java,
* gnu/classpath/jdwp/exception/InvalidFrameException.java,
* gnu/classpath/jdwp/exception/InvalidLocationException.java,
* gnu/classpath/jdwp/exception/InvalidMethodException.java,
* gnu/classpath/jdwp/exception/InvalidObjectException.java,
* gnu/classpath/jdwp/exception/InvalidSlotException.java,
* gnu/classpath/jdwp/exception/InvalidStringException.java,
* gnu/classpath/jdwp/exception/InvalidThreadException.java,
* gnu/classpath/jdwp/exception/InvalidThreadGroupException.java,
* gnu/classpath/jdwp/exception/NativeMethodException.java,
* gnu/classpath/jdwp/exception/NotImplementedException.java,
* gnu/classpath/jdwp/id/JdwpId.java,
* gnu/classpath/jdwp/id/NullObjectId.java,
* gnu/classpath/jdwp/processor/ArrayReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/ArrayTypeCommandSet.java,
* gnu/classpath/jdwp/processor/ClassLoaderReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/ClassObjectReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/ClassTypeCommandSet.java,
* gnu/classpath/jdwp/processor/CommandSet.java,
* gnu/classpath/jdwp/processor/EventRequestCommandSet.java,
* gnu/classpath/jdwp/processor/FieldCommandSet.java,
* gnu/classpath/jdwp/processor/InterfaceTypeCommandSet.java,
* gnu/classpath/jdwp/processor/MethodCommandSet.java,
* gnu/classpath/jdwp/processor/ObjectReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/PacketProcessor.java,
* gnu/classpath/jdwp/processor/ReferenceTypeCommandSet.java,
* gnu/classpath/jdwp/processor/StackFrameCommandSet.java,
* gnu/classpath/jdwp/processor/StringReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/ThreadGroupReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/ThreadReferenceCommandSet.java,
* gnu/classpath/jdwp/processor/VirtualMachineCommandSet.java,
* gnu/classpath/jdwp/transport/JdwpCommandPacket.java,
* gnu/classpath/jdwp/transport/JdwpConnection.java,
* gnu/classpath/jdwp/transport/JdwpPacket.java,
* gnu/classpath/jdwp/transport/JdwpReplyPacket.java,
* gnu/classpath/jdwp/transport/SocketTransport.java,
* gnu/classpath/jdwp/transport/TransportFactory.java,
* gnu/classpath/jdwp/util/JdwpString.java,
* gnu/classpath/jdwp/util/LineTable.java,
* gnu/classpath/jdwp/util/Location.java,
* gnu/classpath/jdwp/util/MethodResult.java,
* gnu/classpath/jdwp/util/MonitorInfo.java,
* gnu/classpath/jdwp/util/Signature.java,
* gnu/classpath/jdwp/util/VariableTable.java,
* gnu/classpath/jdwp/value/ArrayValue.java,
* gnu/classpath/jdwp/value/BooleanValue.java,
* gnu/classpath/jdwp/value/ByteValue.java,
* gnu/classpath/jdwp/value/CharValue.java,
* gnu/classpath/jdwp/value/DoubleValue.java,
* gnu/classpath/jdwp/value/FloatValue.java,
* gnu/classpath/jdwp/value/IntValue.java,
* gnu/classpath/jdwp/value/LongValue.java,
* gnu/classpath/jdwp/value/ObjectValue.java,
* gnu/classpath/jdwp/value/ShortValue.java,
* gnu/classpath/jdwp/value/StringValue.java,
* gnu/classpath/jdwp/value/Value.java,
* gnu/classpath/jdwp/value/ValueFactory.java,
* gnu/classpath/jdwp/value/VoidValue.java,
* gnu/classpath/toolkit/DefaultDaemonThreadFactory.java,
* gnu/java/awt/AWTUtilities.java,
* gnu/java/awt/BitMaskExtent.java,
* gnu/java/awt/BitwiseXORComposite.java,
* gnu/java/awt/Buffers.java,
* gnu/java/awt/ClasspathGraphicsEnvironment.java,
* gnu/java/awt/ClasspathToolkit.java,
* gnu/java/awt/ComponentDataBlitOp.java,
* gnu/java/awt/EmbeddedWindow.java,
* gnu/java/awt/GradientPaintContext.java,
* gnu/java/awt/color/CieXyzConverter.java,
* gnu/java/awt/color/ClutProfileConverter.java,
* gnu/java/awt/color/ColorLookUpTable.java,
* gnu/java/awt/color/GrayProfileConverter.java,
* gnu/java/awt/color/GrayScaleConverter.java,
* gnu/java/awt/color/LinearRGBConverter.java,
* gnu/java/awt/color/ProfileHeader.java,
* gnu/java/awt/color/RgbProfileConverter.java,
* gnu/java/awt/color/SrgbConverter.java,
* gnu/java/awt/color/ToneReproductionCurve.java,
* gnu/java/awt/dnd/GtkMouseDragGestureRecognizer.java,
* gnu/java/awt/dnd/peer/gtk/GtkDragSourceContextPeer.java,
* gnu/java/awt/dnd/peer/gtk/GtkDropTargetContextPeer.java,
* gnu/java/awt/dnd/peer/gtk/GtkDropTargetPeer.java,
* gnu/java/awt/font/FontDelegate.java,
* gnu/java/awt/font/FontFactory.java,
* gnu/java/awt/font/GNUGlyphVector.java,
* gnu/java/awt/font/OpenTypeFontPeer.java,
* gnu/java/awt/font/autofit/GlyphHints.java,
* gnu/java/awt/font/autofit/Latin.java,
* gnu/java/awt/font/autofit/Utils.java,
* gnu/java/awt/font/opentype/CharGlyphMap.java,
* gnu/java/awt/font/opentype/GlyphNamer.java,
* gnu/java/awt/font/opentype/MacResourceFork.java,
* gnu/java/awt/font/opentype/NameDecoder.java,
* gnu/java/awt/font/opentype/OpenTypeFont.java,
* gnu/java/awt/font/opentype/OpenTypeFontFactory.java,
* gnu/java/awt/font/opentype/truetype/GlyphLoader.java,
* gnu/java/awt/font/opentype/truetype/GlyphLocator.java,
* gnu/java/awt/font/opentype/truetype/GlyphMeasurer.java,
* gnu/java/awt/font/opentype/truetype/Point.java,
* gnu/java/awt/font/opentype/truetype/TrueTypeScaler.java,
* gnu/java/awt/font/opentype/truetype/VirtualMachine.java,
* gnu/java/awt/font/opentype/truetype/Zone.java,
* gnu/java/awt/font/opentype/truetype/ZonePathIterator.java,
* gnu/java/awt/image/AsyncImage.java,
* gnu/java/awt/image/ImageConverter.java,
* gnu/java/awt/image/ImageDecoder.java,
* gnu/java/awt/image/XBMDecoder.java,
* gnu/java/awt/java2d/AbstractGraphics2D.java,
* gnu/java/awt/java2d/AlphaCompositeContext.java,
* gnu/java/awt/java2d/CubicSegment.java,
* gnu/java/awt/java2d/LineSegment.java,
* gnu/java/awt/java2d/PixelCoverage.java,
* gnu/java/awt/java2d/QuadSegment.java,
* gnu/java/awt/java2d/RasterGraphics.java,
* gnu/java/awt/java2d/ScanlineConverter.java,
* gnu/java/awt/java2d/ScanlineCoverage.java,
* gnu/java/awt/java2d/Segment.java,
* gnu/java/awt/java2d/TexturePaintContext.java,
* gnu/java/awt/peer/ClasspathDesktopPeer.java,
* gnu/java/awt/peer/ClasspathFontPeer.java,
* gnu/java/awt/peer/GLightweightPeer.java,
* gnu/java/awt/peer/GnomeDesktopPeer.java,
* gnu/java/awt/peer/KDEDesktopPeer.java,
* gnu/java/awt/peer/gtk/AsyncImage.java,
* gnu/java/awt/peer/gtk/BufferedImageGraphics.java,
* gnu/java/awt/peer/gtk/CairoGraphics2D.java,
* gnu/java/awt/peer/gtk/CairoSurface.java,
* gnu/java/awt/peer/gtk/CairoSurfaceGraphics.java,
* gnu/java/awt/peer/gtk/ComponentGraphics.java,
* gnu/java/awt/peer/gtk/ComponentGraphicsCopy.java,
* gnu/java/awt/peer/gtk/FreetypeGlyphVector.java,
* gnu/java/awt/peer/gtk/GdkFontPeer.java,
* gnu/java/awt/peer/gtk/GdkGraphicsConfiguration.java,
* gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
* gnu/java/awt/peer/gtk/GdkPixbufDecoder.java,
* gnu/java/awt/peer/gtk/GdkRobotPeer.java,
* gnu/java/awt/peer/gtk/GdkScreenGraphicsDevice.java,
* gnu/java/awt/peer/gtk/GtkButtonPeer.java,
* gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
* gnu/java/awt/peer/gtk/GtkChoicePeer.java,
* gnu/java/awt/peer/gtk/GtkClipboard.java,
* gnu/java/awt/peer/gtk/GtkComponentPeer.java,
* gnu/java/awt/peer/gtk/GtkContainerPeer.java,
* gnu/java/awt/peer/gtk/GtkCursor.java,
* gnu/java/awt/peer/gtk/GtkDialogPeer.java,
* gnu/java/awt/peer/gtk/GtkFileDialogPeer.java,
* gnu/java/awt/peer/gtk/GtkFramePeer.java,
* gnu/java/awt/peer/gtk/GtkGenericPeer.java,
* gnu/java/awt/peer/gtk/GtkImage.java,
* gnu/java/awt/peer/gtk/GtkImageConsumer.java,
* gnu/java/awt/peer/gtk/GtkLabelPeer.java,
* gnu/java/awt/peer/gtk/GtkListPeer.java,
* gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java,
* gnu/java/awt/peer/gtk/GtkMenuPeer.java,
* gnu/java/awt/peer/gtk/GtkMouseInfoPeer.java,
* gnu/java/awt/peer/gtk/GtkPanelPeer.java,
* gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java,
* gnu/java/awt/peer/gtk/GtkScrollbarPeer.java,
* gnu/java/awt/peer/gtk/GtkSelection.java,
* gnu/java/awt/peer/gtk/GtkToolkit.java,
* gnu/java/awt/peer/gtk/GtkVolatileImage.java,
* gnu/java/awt/peer/gtk/GtkWindowPeer.java,
* gnu/java/awt/peer/gtk/VolatileImageGraphics.java,
* gnu/java/awt/peer/headless/HeadlessGraphicsEnvironment.java,
* gnu/java/awt/peer/qt/MainQtThread.java,
* gnu/java/awt/peer/qt/QMatrix.java,
* gnu/java/awt/peer/qt/QPainterPath.java,
* gnu/java/awt/peer/qt/QPen.java,
* gnu/java/awt/peer/qt/QtAudioClip.java,
* gnu/java/awt/peer/qt/QtButtonPeer.java,
* gnu/java/awt/peer/qt/QtCheckboxPeer.java,
* gnu/java/awt/peer/qt/QtChoicePeer.java,
* gnu/java/awt/peer/qt/QtComponentGraphics.java,
* gnu/java/awt/peer/qt/QtComponentPeer.java,
* gnu/java/awt/peer/qt/QtContainerPeer.java,
* gnu/java/awt/peer/qt/QtDialogPeer.java,
* gnu/java/awt/peer/qt/QtEmbeddedWindowPeer.java,
* gnu/java/awt/peer/qt/QtFileDialogPeer.java,
* gnu/java/awt/peer/qt/QtFontMetrics.java,
* gnu/java/awt/peer/qt/QtFontPeer.java,
* gnu/java/awt/peer/qt/QtFramePeer.java,
* gnu/java/awt/peer/qt/QtGraphics.java,
* gnu/java/awt/peer/qt/QtGraphicsEnvironment.java,
* gnu/java/awt/peer/qt/QtImage.java,
* gnu/java/awt/peer/qt/QtImageConsumer.java,
* gnu/java/awt/peer/qt/QtImageDirectGraphics.java,
* gnu/java/awt/peer/qt/QtImageGraphics.java,
* gnu/java/awt/peer/qt/QtLabelPeer.java,
* gnu/java/awt/peer/qt/QtListPeer.java,
* gnu/java/awt/peer/qt/QtMenuBarPeer.java,
* gnu/java/awt/peer/qt/QtMenuComponentPeer.java,
* gnu/java/awt/peer/qt/QtMenuItemPeer.java,
* gnu/java/awt/peer/qt/QtMenuPeer.java,
* gnu/java/awt/peer/qt/QtPanelPeer.java,
* gnu/java/awt/peer/qt/QtPopupMenuPeer.java,
* gnu/java/awt/peer/qt/QtRepaintThread.java,
* gnu/java/awt/peer/qt/QtScreenDevice.java,
* gnu/java/awt/peer/qt/QtScreenDeviceConfiguration.java,
* gnu/java/awt/peer/qt/QtScrollPanePeer.java,
* gnu/java/awt/peer/qt/QtScrollbarPeer.java,
* gnu/java/awt/peer/qt/QtTextAreaPeer.java,
* gnu/java/awt/peer/qt/QtTextFieldPeer.java,
* gnu/java/awt/peer/qt/QtToolkit.java,
* gnu/java/awt/peer/qt/QtVolatileImage.java,
* gnu/java/awt/peer/qt/QtWindowPeer.java,
* gnu/java/awt/peer/swing/SwingButtonPeer.java,
* gnu/java/awt/peer/swing/SwingCheckboxPeer.java,
* gnu/java/awt/peer/swing/SwingComponent.java,
* gnu/java/awt/peer/swing/SwingComponentPeer.java,
* gnu/java/awt/peer/swing/SwingContainerPeer.java,
* gnu/java/awt/peer/swing/SwingLabelPeer.java,
* gnu/java/awt/peer/swing/SwingListPeer.java,
* gnu/java/awt/peer/swing/SwingMenuItemPeer.java,
* gnu/java/awt/peer/swing/SwingMenuPeer.java,
* gnu/java/awt/peer/swing/SwingTextAreaPeer.java,
* gnu/java/awt/peer/swing/SwingTextFieldPeer.java,
* gnu/java/awt/peer/x/GLGraphics.java,
* gnu/java/awt/peer/x/KeyboardMapping.java,
* gnu/java/awt/peer/x/XEventPump.java,
* gnu/java/awt/peer/x/XFontPeer.java,
* gnu/java/awt/peer/x/XFramePeer.java,
* gnu/java/awt/peer/x/XGraphics2D.java,
* gnu/java/awt/peer/x/XGraphicsConfiguration.java,
* gnu/java/awt/peer/x/XGraphicsDevice.java,
* gnu/java/awt/peer/x/XGraphicsEnvironment.java,
* gnu/java/awt/peer/x/XImage.java,
* gnu/java/awt/peer/x/XToolkit.java,
* gnu/java/awt/peer/x/XWindowPeer.java,
* gnu/java/awt/print/JavaPrinterGraphics.java,
* gnu/java/awt/print/JavaPrinterJob.java,
* gnu/java/awt/print/PostScriptGraphics2D.java,
* gnu/java/awt/print/SpooledDocument.java,
* gnu/java/beans/BeanInfoEmbryo.java,
* gnu/java/beans/DefaultExceptionListener.java,
* gnu/java/beans/ExplicitBeanInfo.java,
* gnu/java/beans/IntrospectionIncubator.java,
* gnu/java/beans/decoder/AbstractContext.java,
* gnu/java/beans/decoder/AbstractCreatableObjectContext.java,
* gnu/java/beans/decoder/AbstractElementHandler.java,
* gnu/java/beans/decoder/AbstractObjectContext.java,
* gnu/java/beans/decoder/ArrayContext.java,
* gnu/java/beans/decoder/ArrayHandler.java,
* gnu/java/beans/decoder/AssemblyException.java,
* gnu/java/beans/decoder/BooleanHandler.java,
* gnu/java/beans/decoder/ByteHandler.java,
* gnu/java/beans/decoder/CharHandler.java,
* gnu/java/beans/decoder/ClassHandler.java,
* gnu/java/beans/decoder/ConstructorContext.java,
* gnu/java/beans/decoder/Context.java,
* gnu/java/beans/decoder/DecoderContext.java,
* gnu/java/beans/decoder/DoubleHandler.java,
* gnu/java/beans/decoder/DummyContext.java,
* gnu/java/beans/decoder/DummyHandler.java,
* gnu/java/beans/decoder/ElementHandler.java,
* gnu/java/beans/decoder/FloatHandler.java,
* gnu/java/beans/decoder/GrowableArrayContext.java,
* gnu/java/beans/decoder/IndexContext.java,
* gnu/java/beans/decoder/IntHandler.java,
* gnu/java/beans/decoder/JavaHandler.java,
* gnu/java/beans/decoder/LongHandler.java,
* gnu/java/beans/decoder/MethodContext.java,
* gnu/java/beans/decoder/MethodFinder.java,
* gnu/java/beans/decoder/NullHandler.java,
* gnu/java/beans/decoder/ObjectContext.java,
* gnu/java/beans/decoder/ObjectHandler.java,
* gnu/java/beans/decoder/PersistenceParser.java,
* gnu/java/beans/decoder/PropertyContext.java,
* gnu/java/beans/decoder/ShortHandler.java,
* gnu/java/beans/decoder/SimpleHandler.java,
* gnu/java/beans/decoder/StaticMethodContext.java,
* gnu/java/beans/decoder/StringHandler.java,
* gnu/java/beans/decoder/VoidHandler.java,
* gnu/java/beans/editors/ColorEditor.java,
* gnu/java/beans/editors/FontEditor.java,
* gnu/java/beans/editors/NativeBooleanEditor.java,
* gnu/java/beans/editors/NativeByteEditor.java,
* gnu/java/beans/editors/NativeDoubleEditor.java,
* gnu/java/beans/editors/NativeFloatEditor.java,
* gnu/java/beans/editors/NativeIntEditor.java,
* gnu/java/beans/editors/NativeLongEditor.java,
* gnu/java/beans/editors/NativeShortEditor.java,
* gnu/java/beans/editors/StringEditor.java,
* gnu/java/beans/encoder/ArrayPersistenceDelegate.java,
* gnu/java/beans/encoder/ClassPersistenceDelegate.java,
* gnu/java/beans/encoder/CollectionPersistenceDelegate.java,
* gnu/java/beans/encoder/Context.java,
* gnu/java/beans/encoder/GenericScannerState.java,
* gnu/java/beans/encoder/IgnoringScannerState.java,
* gnu/java/beans/encoder/MapPersistenceDelegate.java,
* gnu/java/beans/encoder/ObjectId.java,
* gnu/java/beans/encoder/PrimitivePersistenceDelegate.java,
* gnu/java/beans/encoder/ReportingScannerState.java,
* gnu/java/beans/encoder/Root.java,
* gnu/java/beans/encoder/ScanEngine.java,
* gnu/java/beans/encoder/ScannerState.java,
* gnu/java/beans/encoder/StAXWriter.java,
* gnu/java/beans/encoder/Writer.java,
* gnu/java/beans/encoder/elements/ArrayInstantiation.java,
* gnu/java/beans/encoder/elements/Array_Get.java,
* gnu/java/beans/encoder/elements/ClassResolution.java,
* gnu/java/beans/encoder/elements/Element.java,
* gnu/java/beans/encoder/elements/List_Get.java,
* gnu/java/beans/encoder/elements/List_Set.java,
* gnu/java/beans/encoder/elements/MethodInvocation.java,
* gnu/java/beans/encoder/elements/NullObject.java,
* gnu/java/beans/encoder/elements/ObjectInstantiation.java,
* gnu/java/beans/encoder/elements/ObjectReference.java,
* gnu/java/beans/encoder/elements/PrimitiveInstantiation.java,
* gnu/java/beans/encoder/elements/StaticFieldAccess.java,
* gnu/java/beans/encoder/elements/StaticMethodInvocation.java,
* gnu/java/beans/encoder/elements/StringReference.java,
* gnu/java/io/ASN1ParsingException.java,
* gnu/java/io/Base64InputStream.java,
* gnu/java/io/ClassLoaderObjectInputStream.java,
* gnu/java/io/NullOutputStream.java,
* gnu/java/io/ObjectIdentityMap2Int.java,
* gnu/java/io/ObjectIdentityWrapper.java,
* gnu/java/io/PlatformHelper.java,
* gnu/java/lang/CPStringBuilder.java,
* gnu/java/lang/CharData.java,
* gnu/java/lang/InstrumentationImpl.java,
* gnu/java/lang/MainThread.java,
* gnu/java/lang/management/BeanImpl.java,
* gnu/java/lang/management/ClassLoadingMXBeanImpl.java,
* gnu/java/lang/management/CompilationMXBeanImpl.java,
* gnu/java/lang/management/GarbageCollectorMXBeanImpl.java,
* gnu/java/lang/management/MemoryMXBeanImpl.java,
* gnu/java/lang/management/MemoryManagerMXBeanImpl.java,
* gnu/java/lang/management/MemoryPoolMXBeanImpl.java,
* gnu/java/lang/management/OperatingSystemMXBeanImpl.java,
* gnu/java/lang/management/RuntimeMXBeanImpl.java,
* gnu/java/lang/management/ThreadMXBeanImpl.java,
* gnu/java/lang/reflect/TypeSignature.java,
* gnu/java/locale/LocaleHelper.java,
* gnu/java/math/Fixed.java,
* gnu/java/math/GMP.java,
* gnu/java/math/MPN.java,
* gnu/java/net/CRLFInputStream.java,
* gnu/java/net/CRLFOutputStream.java,
* gnu/java/net/DefaultContentHandlerFactory.java,
* gnu/java/net/DefaultProxySelector.java,
* gnu/java/net/EmptyX509TrustManager.java,
* gnu/java/net/GetLocalHostAction.java,
* gnu/java/net/HeaderFieldHelper.java,
* gnu/java/net/IndexListParser.java,
* gnu/java/net/LineInputStream.java,
* gnu/java/net/PlainDatagramSocketImpl.java,
* gnu/java/net/PlainSocketImpl.java,
* gnu/java/net/loader/FileResource.java,
* gnu/java/net/loader/FileURLLoader.java,
* gnu/java/net/loader/JarURLLoader.java,
* gnu/java/net/loader/JarURLResource.java,
* gnu/java/net/loader/RemoteResource.java,
* gnu/java/net/loader/RemoteURLLoader.java,
* gnu/java/net/loader/Resource.java,
* gnu/java/net/loader/URLLoader.java,
* gnu/java/net/protocol/file/Connection.java,
* gnu/java/net/protocol/file/Handler.java,
* gnu/java/net/protocol/ftp/ActiveModeDTP.java,
* gnu/java/net/protocol/ftp/BlockInputStream.java,
* gnu/java/net/protocol/ftp/BlockOutputStream.java,
* gnu/java/net/protocol/ftp/CompressedInputStream.java,
* gnu/java/net/protocol/ftp/CompressedOutputStream.java,
* gnu/java/net/protocol/ftp/DTP.java,
* gnu/java/net/protocol/ftp/DTPInputStream.java,
* gnu/java/net/protocol/ftp/DTPOutputStream.java,
* gnu/java/net/protocol/ftp/FTPConnection.java,
* gnu/java/net/protocol/ftp/FTPException.java,
* gnu/java/net/protocol/ftp/FTPResponse.java,
* gnu/java/net/protocol/ftp/FTPURLConnection.java,
* gnu/java/net/protocol/ftp/Handler.java,
* gnu/java/net/protocol/ftp/PassiveModeDTP.java,
* gnu/java/net/protocol/ftp/StreamInputStream.java,
* gnu/java/net/protocol/ftp/StreamOutputStream.java,
* gnu/java/net/protocol/http/Authenticator.java,
* gnu/java/net/protocol/http/ByteArrayRequestBodyWriter.java,
* gnu/java/net/protocol/http/ChunkedInputStream.java,
* gnu/java/net/protocol/http/Cookie.java,
* gnu/java/net/protocol/http/CookieManager.java,
* gnu/java/net/protocol/http/Credentials.java,
* gnu/java/net/protocol/http/HTTPConnection.java,
* gnu/java/net/protocol/http/HTTPDateFormat.java,
* gnu/java/net/protocol/http/HTTPURLConnection.java,
* gnu/java/net/protocol/http/Handler.java,
* gnu/java/net/protocol/http/Headers.java,
* gnu/java/net/protocol/http/Request.java,
* gnu/java/net/protocol/http/RequestBodyWriter.java,
* gnu/java/net/protocol/http/Response.java,
* gnu/java/net/protocol/http/ResponseHeaderHandler.java,
* gnu/java/net/protocol/http/SimpleCookieManager.java,
* gnu/java/net/protocol/https/Handler.java,
* gnu/java/net/protocol/jar/Connection.java,
* gnu/java/net/protocol/jar/Handler.java,
* gnu/java/nio/ChannelInputStream.java,
* gnu/java/nio/ChannelOutputStream.java,
* gnu/java/nio/ChannelReader.java,
* gnu/java/nio/ChannelWriter.java,
* gnu/java/nio/DatagramChannelImpl.java,
* gnu/java/nio/DatagramChannelSelectionKey.java,
* gnu/java/nio/EpollSelectionKeyImpl.java,
* gnu/java/nio/EpollSelectorImpl.java,
* gnu/java/nio/FileChannelImpl.java,
* gnu/java/nio/FileLockImpl.java,
* gnu/java/nio/InputStreamChannel.java,
* gnu/java/nio/KqueueSelectionKeyImpl.java,
* gnu/java/nio/KqueueSelectorImpl.java,
* gnu/java/nio/NIODatagramSocket.java,
* gnu/java/nio/NIOServerSocket.java,
* gnu/java/nio/NIOSocket.java,
* gnu/java/nio/NIOSocketImpl.java,
* gnu/java/nio/OutputStreamChannel.java,
* gnu/java/nio/PipeImpl.java,
* gnu/java/nio/SelectionKeyImpl.java,
* gnu/java/nio/SelectorImpl.java,
* gnu/java/nio/SelectorProviderImpl.java,
* gnu/java/nio/ServerSocketChannelImpl.java,
* gnu/java/nio/ServerSocketChannelSelectionKey.java,
* gnu/java/nio/SocketChannelImpl.java,
* gnu/java/nio/SocketChannelSelectionKey.java,
* gnu/java/nio/SocketChannelSelectionKeyImpl.java,
* gnu/java/nio/VMChannelOwner.java,
* gnu/java/nio/charset/ByteCharset.java,
* gnu/java/nio/charset/ByteDecodeLoopHelper.java,
* gnu/java/nio/charset/ByteEncodeLoopHelper.java,
* gnu/java/nio/charset/Cp424.java,
* gnu/java/nio/charset/Cp437.java,
* gnu/java/nio/charset/Cp737.java,
* gnu/java/nio/charset/Cp775.java,
* gnu/java/nio/charset/Cp850.java,
* gnu/java/nio/charset/Cp852.java,
* gnu/java/nio/charset/Cp855.java,
* gnu/java/nio/charset/Cp857.java,
* gnu/java/nio/charset/Cp860.java,
* gnu/java/nio/charset/Cp861.java,
* gnu/java/nio/charset/Cp862.java,
* gnu/java/nio/charset/Cp863.java,
* gnu/java/nio/charset/Cp864.java,
* gnu/java/nio/charset/Cp865.java,
* gnu/java/nio/charset/Cp866.java,
* gnu/java/nio/charset/Cp869.java,
* gnu/java/nio/charset/Cp874.java,
* gnu/java/nio/charset/EncodingHelper.java,
* gnu/java/nio/charset/ISO_8859_1.java,
* gnu/java/nio/charset/ISO_8859_13.java,
* gnu/java/nio/charset/ISO_8859_15.java,
* gnu/java/nio/charset/ISO_8859_2.java,
* gnu/java/nio/charset/ISO_8859_3.java,
* gnu/java/nio/charset/ISO_8859_4.java,
* gnu/java/nio/charset/ISO_8859_5.java,
* gnu/java/nio/charset/ISO_8859_6.java,
* gnu/java/nio/charset/ISO_8859_7.java,
* gnu/java/nio/charset/ISO_8859_8.java,
* gnu/java/nio/charset/ISO_8859_9.java,
* gnu/java/nio/charset/KOI_8.java,
* gnu/java/nio/charset/MS874.java,
* gnu/java/nio/charset/MacCentralEurope.java,
* gnu/java/nio/charset/MacCroatian.java,
* gnu/java/nio/charset/MacCyrillic.java,
* gnu/java/nio/charset/MacDingbat.java,
* gnu/java/nio/charset/MacGreek.java,
* gnu/java/nio/charset/MacIceland.java,
* gnu/java/nio/charset/MacRoman.java,
* gnu/java/nio/charset/MacRomania.java,
* gnu/java/nio/charset/MacSymbol.java,
* gnu/java/nio/charset/MacThai.java,
* gnu/java/nio/charset/MacTurkish.java,
* gnu/java/
Diffstat (limited to 'java/net')
-rw-r--r-- | java/net/ContentHandler.java | 4 | ||||
-rw-r--r-- | java/net/DatagramSocket.java | 122 | ||||
-rw-r--r-- | java/net/DatagramSocketImpl.java | 8 | ||||
-rw-r--r-- | java/net/HttpURLConnection.java | 74 | ||||
-rw-r--r-- | java/net/Inet4Address.java | 14 | ||||
-rw-r--r-- | java/net/Inet6Address.java | 60 | ||||
-rw-r--r-- | java/net/InetAddress.java | 96 | ||||
-rw-r--r-- | java/net/InetSocketAddress.java | 16 | ||||
-rw-r--r-- | java/net/MimeTypeMapper.java | 16 | ||||
-rw-r--r-- | java/net/MulticastSocket.java | 26 | ||||
-rw-r--r-- | java/net/NetworkInterface.java | 44 | ||||
-rw-r--r-- | java/net/Proxy.java | 12 | ||||
-rw-r--r-- | java/net/ProxySelector.java | 8 | ||||
-rw-r--r-- | java/net/ResolverCache.java | 66 | ||||
-rw-r--r-- | java/net/ServerSocket.java | 60 | ||||
-rw-r--r-- | java/net/Socket.java | 72 | ||||
-rw-r--r-- | java/net/SocketPermission.java | 314 | ||||
-rw-r--r-- | java/net/URI.java | 526 | ||||
-rw-r--r-- | java/net/URL.java | 168 | ||||
-rw-r--r-- | java/net/URLClassLoader.java | 162 | ||||
-rw-r--r-- | java/net/URLConnection.java | 56 | ||||
-rw-r--r-- | java/net/URLDecoder.java | 84 | ||||
-rw-r--r-- | java/net/URLEncoder.java | 78 | ||||
-rw-r--r-- | java/net/URLStreamHandler.java | 198 |
24 files changed, 1142 insertions, 1142 deletions
diff --git a/java/net/ContentHandler.java b/java/net/ContentHandler.java index 7f63e7402..fed8f3de4 100644 --- a/java/net/ContentHandler.java +++ b/java/net/ContentHandler.java @@ -117,8 +117,8 @@ public abstract class ContentHandler for (int i = 0; i < classes.length; i++) { - if (classes[i].isInstance(obj)) - return obj; + if (classes[i].isInstance(obj)) + return obj; } return null; diff --git a/java/net/DatagramSocket.java b/java/net/DatagramSocket.java index ea681a1ab..6ca9c42fe 100644 --- a/java/net/DatagramSocket.java +++ b/java/net/DatagramSocket.java @@ -196,15 +196,15 @@ public class DatagramSocket else try { - impl = - (DatagramSocketImpl) Class.forName("java.net." + propVal - + "DatagramSocketImpl") - .newInstance(); + impl = + (DatagramSocketImpl) Class.forName("java.net." + propVal + + "DatagramSocketImpl") + .newInstance(); } catch (Exception e) { - System.err.println("Could not instantiate class: java.net." - + propVal + "DatagramSocketImpl"); + System.err.println("Could not instantiate class: java.net." + + propVal + "DatagramSocketImpl"); try { impl = new PlainDatagramSocketImpl(); @@ -226,19 +226,19 @@ public class DatagramSocket { try { - if (! implCreated) - { - impl.create(); - implCreated = true; - } + if (! implCreated) + { + impl.create(); + implCreated = true; + } - return impl; + return impl; } catch (IOException e) { - SocketException se = new SocketException(); - se.initCause(e); - throw se; + SocketException se = new SocketException(); + se.initCause(e); + throw se; } } @@ -252,27 +252,27 @@ public class DatagramSocket try { - getImpl().close(); + getImpl().close(); } catch (SocketException e) { - // Ignore this case, just close the socket in finally clause. + // Ignore this case, just close the socket in finally clause. } finally { - remoteAddress = null; - remotePort = -1; - impl = null; + remoteAddress = null; + remotePort = -1; + impl = null; } try { - if (getChannel() != null) - getChannel().close(); + if (getChannel() != null) + getChannel().close(); } catch (IOException e) { - // Do nothing. + // Do nothing. } } @@ -320,21 +320,21 @@ public class DatagramSocket try { - localAddr = - (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR); + localAddr = + (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR); - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkConnect(localAddr.getHostAddress(), -1); + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkConnect(localAddr.getHostAddress(), -1); } catch (SecurityException e) { - localAddr = InetAddress.ANY_IF; + localAddr = InetAddress.ANY_IF; } catch (SocketException e) { - // This cannot happen as we are bound. - return null; + // This cannot happen as we are bound. + return null; } return localAddr; @@ -352,12 +352,12 @@ public class DatagramSocket try { - return getImpl().getLocalPort(); + return getImpl().getLocalPort(); } catch (SocketException e) { - // This cannot happen as we are bound. - return 0; + // This cannot happen as we are bound. + return 0; } } @@ -529,13 +529,13 @@ public class DatagramSocket try { - getImpl().connect(address, port); - remoteAddress = address; - remotePort = port; + getImpl().connect(address, port); + remoteAddress = address; + remotePort = port; } catch (SocketException e) { - // This means simply not connected or connect not implemented. + // This means simply not connected or connect not implemented. } } @@ -553,16 +553,16 @@ public class DatagramSocket try { - getImpl().disconnect(); + getImpl().disconnect(); } catch (SocketException e) { - // This cannot happen as we are connected. + // This cannot happen as we are connected. } finally { - remoteAddress = null; - remotePort = -1; + remoteAddress = null; + remotePort = -1; } } @@ -592,7 +592,7 @@ public class DatagramSocket if (remoteAddress != null && remoteAddress.isMulticastAddress()) throw new IOException - ("Socket connected to a multicast address my not receive"); + ("Socket connected to a multicast address my not receive"); if (getChannel() != null && ! getChannel().isBlocking() && ! ((DatagramChannelImpl) getChannel()).isInChannelOperation()) @@ -635,19 +635,19 @@ public class DatagramSocket SecurityManager s = System.getSecurityManager(); if (s != null && ! isConnected()) { - InetAddress addr = p.getAddress(); - if (addr.isMulticastAddress()) - s.checkMulticast(addr); - else - s.checkConnect(addr.getHostAddress(), p.getPort()); + InetAddress addr = p.getAddress(); + if (addr.isMulticastAddress()) + s.checkMulticast(addr); + else + s.checkConnect(addr.getHostAddress(), p.getPort()); } if (isConnected()) { - if (p.getAddress() != null - && (remoteAddress != p.getAddress() || remotePort != p.getPort())) - throw new IllegalArgumentException - ("DatagramPacket address does not match remote address"); + if (p.getAddress() != null + && (remoteAddress != p.getAddress() || remotePort != p.getPort())) + throw new IllegalArgumentException + ("DatagramPacket address does not match remote address"); } // FIXME: if this is a subclass of MulticastSocket, @@ -675,7 +675,7 @@ public class DatagramSocket { if (isClosed()) throw new SocketException("socket is closed"); - + if (address == null) address = new InetSocketAddress(InetAddress.ANY_IF, 0); @@ -697,23 +697,23 @@ public class DatagramSocket try { - getImpl().bind(port, addr); - bound = true; + getImpl().bind(port, addr); + bound = true; } catch (SocketException exception) { - getImpl().close(); - throw exception; + getImpl().close(); + throw exception; } catch (RuntimeException exception) { - getImpl().close(); - throw exception; + getImpl().close(); + throw exception; } catch (Error error) { - getImpl().close(); - throw error; + getImpl().close(); + throw error; } } diff --git a/java/net/DatagramSocketImpl.java b/java/net/DatagramSocketImpl.java index cfcde92e5..4f51f9f93 100644 --- a/java/net/DatagramSocketImpl.java +++ b/java/net/DatagramSocketImpl.java @@ -200,9 +200,9 @@ public abstract class DatagramSocketImpl implements SocketOptions * socket. <b>Use <code>getTimeToLive()</code></b> instead. * * @return the current time-to-live - * + * * @exception IOException If an error occurs - * + * * @deprecated // FIXME: when ? */ protected abstract byte getTTL() throws IOException; @@ -222,7 +222,7 @@ public abstract class DatagramSocketImpl implements SocketOptions * socket. * * @return the current time-to-live - * + * * @exception IOException If an error occurs */ protected abstract int getTimeToLive() throws IOException; @@ -276,7 +276,7 @@ public abstract class DatagramSocketImpl implements SocketOptions /** * Returns the FileDescriptor for this socket - * + * * @return the file descriptor associated with this socket */ protected FileDescriptor getFileDescriptor() diff --git a/java/net/HttpURLConnection.java b/java/net/HttpURLConnection.java index 07eae48e7..72dd67d91 100644 --- a/java/net/HttpURLConnection.java +++ b/java/net/HttpURLConnection.java @@ -380,7 +380,7 @@ public abstract class HttpURLConnection extends URLConnection /** * Returns the value of this HttpURLConnection's instanceFollowRedirects * field - * + * * @return true if following redirects is enabled, false otherwise */ public boolean getInstanceFollowRedirects() @@ -474,33 +474,33 @@ public abstract class HttpURLConnection extends URLConnection // If responseCode not yet explicitly set by subclass if (responseCode == -1) { - // Response is the first header received from the connection. - String respField = getHeaderField(0); - - if (respField == null || ! respField.startsWith("HTTP/")) - { - // Set to default values on failure. - responseCode = -1; - responseMessage = null; - return; - } - - int firstSpc; - int nextSpc; - firstSpc = respField.indexOf(' '); - nextSpc = respField.indexOf(' ', firstSpc + 1); - responseMessage = respField.substring(nextSpc + 1); - String codeStr = respField.substring(firstSpc + 1, nextSpc); - try - { - responseCode = Integer.parseInt(codeStr); - } - catch (NumberFormatException e) - { - // Set to default values on failure. - responseCode = -1; - responseMessage = null; - } + // Response is the first header received from the connection. + String respField = getHeaderField(0); + + if (respField == null || ! respField.startsWith("HTTP/")) + { + // Set to default values on failure. + responseCode = -1; + responseMessage = null; + return; + } + + int firstSpc; + int nextSpc; + firstSpc = respField.indexOf(' '); + nextSpc = respField.indexOf(' ', firstSpc + 1); + responseMessage = respField.substring(nextSpc + 1); + String codeStr = respField.substring(firstSpc + 1, nextSpc); + try + { + responseCode = Integer.parseInt(codeStr); + } + catch (NumberFormatException e) + { + // Set to default values on failure. + responseCode = -1; + responseMessage = null; + } } } @@ -542,11 +542,11 @@ public abstract class HttpURLConnection extends URLConnection int code; try { - code = getResponseCode(); + code = getResponseCode(); } catch (IOException e) { - code = -1; + code = -1; } if (code == -1) @@ -557,18 +557,18 @@ public abstract class HttpURLConnection extends URLConnection try { - PushbackInputStream pbis = new PushbackInputStream(getInputStream()); + PushbackInputStream pbis = new PushbackInputStream(getInputStream()); - int i = pbis.read(); - if (i == -1) - return null; + int i = pbis.read(); + if (i == -1) + return null; - pbis.unread(i); - return pbis; + pbis.unread(i); + return pbis; } catch (IOException e) { - return null; + return null; } } diff --git a/java/net/Inet4Address.java b/java/net/Inet4Address.java index 1a50a4729..e3cff7b13 100644 --- a/java/net/Inet4Address.java +++ b/java/net/Inet4Address.java @@ -70,7 +70,7 @@ public final class Inet4Address extends InetAddress { return new InetAddress(addr, hostName, AF_INET); } - + /** * Initializes this object's addr instance variable from the passed in * byte array. Note that this constructor is protected and is called @@ -175,8 +175,8 @@ public final class Inet4Address extends InetAddress return false; return ((addr[0] & 0xff) == 0xe0 - && (addr[1] & 0xff) == 0x00 - && (addr[2] & 0xff) == 0x00); + && (addr[1] & 0xff) == 0x00 + && (addr[2] & 0xff) == 0x00); } /** @@ -218,15 +218,15 @@ public final class Inet4Address extends InetAddress int len = addr.length; int i = 0; - + for ( ; ; ) { sb.append(addr[i] & 0xff); i++; - + if (i == len) break; - + sb.append('.'); } @@ -266,7 +266,7 @@ public final class Inet4Address extends InetAddress for (int i = addr1.length; --i >= 0;) if (addr1[i] != addr2[i]) - return false; + return false; return true; } diff --git a/java/net/Inet6Address.java b/java/net/Inet6Address.java index 9a1c4ea96..60c406587 100644 --- a/java/net/Inet6Address.java +++ b/java/net/Inet6Address.java @@ -48,7 +48,7 @@ import java.io.IOException; /* * Written using on-line Java Platform 1.4 API Specification and * RFC 1884 (http://www.ietf.org/rfc/rfc1884.txt) - * + * * @author Michael Koch * @status Updated to 1.5. Serialization compatibility is tested. */ @@ -62,37 +62,37 @@ public final class Inet6Address extends InetAddress byte[] ipaddress; /** - * The scope ID, if any. + * The scope ID, if any. * @since 1.5 - * @serial + * @serial */ private int scope_id; /** - * The scope ID, if any. + * The scope ID, if any. * @since 1.5 - * @serial + * @serial */ private boolean scope_id_set; /** * Whether ifname is set or not. * @since 1.5 - * @serial + * @serial */ private boolean scope_ifname_set; /** * Name of the network interface, used only by the serialization methods * @since 1.5 - * @serial + * @serial */ private String ifname; /** * Scope network interface, or <code>null</code>. */ - private transient NetworkInterface nif; + private transient NetworkInterface nif; /** * The address family of these addresses (used for serialization). @@ -250,14 +250,14 @@ public final class Inet6Address extends InetAddress * * @throws UnkownHostException if the address is an invalid number of bytes. * @since 1.5 - */ - public static Inet6Address getByAddress(String host, byte[] addr, - int scopeId) + */ + public static Inet6Address getByAddress(String host, byte[] addr, + int scopeId) throws UnknownHostException { if( addr.length != 16 ) throw new UnknownHostException("Illegal address length: " + addr.length - + " bytes."); + + " bytes."); Inet6Address ip = new Inet6Address( addr, host ); ip.scope_id = scopeId; ip.scope_id_set = true; @@ -270,14 +270,14 @@ public final class Inet6Address extends InetAddress * * @throws UnkownHostException if the address is an invalid number of bytes. * @since 1.5 - */ - public static Inet6Address getByAddress(String host, byte[] addr, - NetworkInterface nif) + */ + public static Inet6Address getByAddress(String host, byte[] addr, + NetworkInterface nif) throws UnknownHostException { if( addr.length != 16 ) throw new UnknownHostException("Illegal address length: " + addr.length - + " bytes."); + + " bytes."); Inet6Address ip = new Inet6Address( addr, host ); ip.nif = nif; @@ -287,8 +287,8 @@ public final class Inet6Address extends InetAddress /** * Returns the <code>NetworkInterface</code> of the address scope * if it is a scoped address and the scope is given in the form of a - * NetworkInterface. - * (I.e. the address was created using the + * NetworkInterface. + * (I.e. the address was created using the * getByAddress(String, byte[], NetworkInterface) method) * Otherwise this method returns <code>null</code>. * @since 1.5 @@ -310,7 +310,7 @@ public final class Inet6Address extends InetAddress // check scope_id_set because some JDK-serialized objects seem to have // scope_id set to a nonzero value even when scope_id_set == false if( scope_id_set ) - return scope_id; + return scope_id; return 0; } @@ -323,12 +323,12 @@ public final class Inet6Address extends InetAddress for (int i = 0; i < 16; i += 2) { - int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); + int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF); - if (i > 0) - sbuf.append(':'); + if (i > 0) + sbuf.append(':'); - sbuf.append(Integer.toHexString(x)); + sbuf.append(Integer.toHexString(x)); } if( nif != null ) sbuf.append( "%" + nif.getName() ); @@ -361,7 +361,7 @@ public final class Inet6Address extends InetAddress for (int i = 0; i < ip.ipaddress.length; i++) if (ipaddress[i] != ip.ipaddress[i]) - return false; + return false; if( ip.nif != null && nif != null ) return nif.equals( ip.nif ); @@ -399,16 +399,16 @@ public final class Inet6Address extends InetAddress */ private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException - { + { s.defaultReadObject(); try { - if( scope_ifname_set ) - nif = NetworkInterface.getByName( ifname ); + if( scope_ifname_set ) + nif = NetworkInterface.getByName( ifname ); } catch( SocketException se ) { - // FIXME: Ignore this? or throw an IOException? + // FIXME: Ignore this? or throw an IOException? } } @@ -421,8 +421,8 @@ public final class Inet6Address extends InetAddress { if( nif != null ) { - ifname = nif.getName(); - scope_ifname_set = true; + ifname = nif.getName(); + scope_ifname_set = true; } s.defaultWriteObject(); } diff --git a/java/net/InetAddress.java b/java/net/InetAddress.java index 1f2667980..1a9dc6202 100644 --- a/java/net/InetAddress.java +++ b/java/net/InetAddress.java @@ -74,24 +74,24 @@ public class InetAddress implements Serializable byte[] addr; try { - addr = VMInetAddress.lookupInaddrAny(); + addr = VMInetAddress.lookupInaddrAny(); } catch (UnknownHostException e) { - // Make one up and hope it works. - addr = new byte[] {0, 0, 0, 0}; + // Make one up and hope it works. + addr = new byte[] {0, 0, 0, 0}; } try { - ANY_IF = getByAddress(addr); + ANY_IF = getByAddress(addr); } catch (UnknownHostException e) { - throw (InternalError) new InternalError().initCause(e); + throw (InternalError) new InternalError().initCause(e); } ANY_IF.hostName = ANY_IF.getHostName(); } - + /** * Stores static localhost address object. */ @@ -100,13 +100,13 @@ public class InetAddress implements Serializable { try { - LOCALHOST = getByAddress("localhost", new byte[] {127, 0, 0, 1}); + LOCALHOST = getByAddress("localhost", new byte[] {127, 0, 0, 1}); } catch (UnknownHostException e) { - throw (InternalError) new InternalError().initCause(e); + throw (InternalError) new InternalError().initCause(e); } - } + } /** * The Serialized Form specifies that an int 'address' is saved/restored. @@ -158,7 +158,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @return true if mulitcast, false if not * * @since 1.1 @@ -174,7 +174,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isAnyLocalAddress() @@ -188,7 +188,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isLoopbackAddress() @@ -202,7 +202,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isLinkLocalAddress() @@ -216,7 +216,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isSiteLocalAddress() @@ -230,7 +230,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isMCGlobal() @@ -244,7 +244,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isMCNodeLocal() @@ -258,7 +258,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isMCLinkLocal() @@ -272,7 +272,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isMCSiteLocal() @@ -287,7 +287,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @since 1.4 */ public boolean isMCOrgLocal() @@ -316,17 +316,17 @@ public class InetAddress implements Serializable { try { - return ResolverCache.getHostByAddr(addr); + return ResolverCache.getHostByAddr(addr); } catch (UnknownHostException e) { - return getHostAddress(); + return getHostAddress(); } } /** * Returns the canonical hostname represented by this InetAddress - * + * * @since 1.4 */ public String getCanonicalHostName() @@ -337,13 +337,13 @@ public class InetAddress implements Serializable if (sm != null) { try - { + { sm.checkConnect(hostname, -1); - } - catch (SecurityException e) - { - return getHostAddress(); - } + } + catch (SecurityException e) + { + return getHostAddress(); + } } return hostname; @@ -367,7 +367,7 @@ public class InetAddress implements Serializable * <p>This method cannot be abstract for backward compatibility reasons. By * default it always throws {@link UnsupportedOperationException} unless * overridden.</p> - * + * * @return The IP address of this object in String form * * @since 1.0.2 @@ -425,7 +425,7 @@ public class InetAddress implements Serializable for (int i = 0; i < addr.length; i++) if (addr[i] != addr2[i]) - return false; + return false; return true; } @@ -481,18 +481,18 @@ public class InetAddress implements Serializable if (addr.length == 16) { - for (int i = 0; i < 12; i++) - { - if (addr[i] != (i < 10 ? 0 : (byte) 0xFF)) - return new Inet6Address(addr, host); - } - - byte[] ip4addr = new byte[4]; - ip4addr[0] = addr[12]; - ip4addr[1] = addr[13]; - ip4addr[2] = addr[14]; - ip4addr[3] = addr[15]; - return new Inet4Address(ip4addr, host); + for (int i = 0; i < 12; i++) + { + if (addr[i] != (i < 10 ? 0 : (byte) 0xFF)) + return new Inet6Address(addr, host); + } + + byte[] ip4addr = new byte[4]; + ip4addr[0] = addr[12]; + ip4addr[1] = addr[13]; + ip4addr[2] = addr[14]; + ip4addr[3] = addr[15]; + return new Inet4Address(ip4addr, host); } throw new UnknownHostException("IP address has illegal length"); @@ -515,14 +515,14 @@ public class InetAddress implements Serializable byte[] address = VMInetAddress.aton(literal); if (address == null) return null; - + try { - return getByAddress(address); + return getByAddress(address); } catch (UnknownHostException e) { - throw (InternalError) new InternalError().initCause(e); + throw (InternalError) new InternalError().initCause(e); } } @@ -534,7 +534,7 @@ public class InetAddress implements Serializable * default. This method is equivalent to returning the first element in * the InetAddress array returned from GetAllByName. * - * @param hostname The name of the desired host, or null for the local + * @param hostname The name of the desired host, or null for the local * loopback address. * * @return The address of the host as an InetAddress object. @@ -612,11 +612,11 @@ public class InetAddress implements Serializable String hostname = VMInetAddress.getLocalHostname(); try { - return getByName(hostname); + return getByName(hostname); } catch (SecurityException e) { - return LOCALHOST; + return LOCALHOST; } } diff --git a/java/net/InetSocketAddress.java b/java/net/InetSocketAddress.java index 5267cc11a..2126f7703 100644 --- a/java/net/InetSocketAddress.java +++ b/java/net/InetSocketAddress.java @@ -181,14 +181,14 @@ public class InetSocketAddress extends SocketAddress // The hostname may differ. if (obj instanceof InetSocketAddress) { - InetSocketAddress sa = (InetSocketAddress) obj; - - if (addr == null && sa.addr != null) - return false; - else if (addr == null && sa.addr == null) // we know hostname != null - return hostname.equals(sa.hostname) && sa.port == port; - else - return addr.equals(sa.addr) && sa.port == port; + InetSocketAddress sa = (InetSocketAddress) obj; + + if (addr == null && sa.addr != null) + return false; + else if (addr == null && sa.addr == null) // we know hostname != null + return hostname.equals(sa.hostname) && sa.port == port; + else + return addr.equals(sa.addr) && sa.port == port; } return false; diff --git a/java/net/MimeTypeMapper.java b/java/net/MimeTypeMapper.java index b0d400ced..3e4379291 100644 --- a/java/net/MimeTypeMapper.java +++ b/java/net/MimeTypeMapper.java @@ -258,15 +258,15 @@ class MimeTypeMapper implements FileNameMap } } - public static void fillFromFile (Map<String, String> table, String fname) + public static void fillFromFile (Map<String, String> table, String fname) throws IOException { - LineNumberReader reader = + LineNumberReader reader = new LineNumberReader (new FileReader (fname)); while (reader.ready ()) { - StringTokenizer tokenizer = + StringTokenizer tokenizer = new StringTokenizer (reader.readLine ()); try @@ -308,10 +308,10 @@ class MimeTypeMapper implements FileNameMap int index = filename.lastIndexOf("."); if (index != -1) { - if (index == filename.length()) - return "application/octet-stream"; - else - filename = filename.substring(index + 1); + if (index == filename.length()) + return "application/octet-stream"; + else + filename = filename.substring(index + 1); } String type = (String) mime_types.get(filename); @@ -338,7 +338,7 @@ class MimeTypeMapper implements FileNameMap String key = it.next(); String value = map.get(key); // Put the "," first since it is easier to make correct syntax this way. - System.out.println(" " + (first ? " " : ", ") + System.out.println(" " + (first ? " " : ", ") + "{ \"" + key + "\", \"" + value + "\" }"); first = false; } diff --git a/java/net/MulticastSocket.java b/java/net/MulticastSocket.java index 114d11f2d..5014b6a8e 100644 --- a/java/net/MulticastSocket.java +++ b/java/net/MulticastSocket.java @@ -202,7 +202,7 @@ public class MulticastSocket extends DatagramSocket { if (isClosed()) throw new SocketException("socket is closed"); - + InetAddress address; if (netIf != null) out: @@ -235,8 +235,8 @@ public class MulticastSocket extends DatagramSocket } else address = InetAddress.ANY_IF; - - + + getImpl().setOption(SocketOptions.IP_MULTICAST_IF, address); } @@ -258,10 +258,10 @@ public class MulticastSocket extends DatagramSocket InetAddress address = (InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF); - + if (address.isAnyLocalAddress()) return NetworkInterface.createAnyInterface(); - + NetworkInterface netIf = NetworkInterface.getByInetAddress(address); return netIf; @@ -294,7 +294,7 @@ public class MulticastSocket extends DatagramSocket * Checks if local loopback mode is enabled * * @return true if loopback mode is enabled, false otherwise - * + * * @exception SocketException If an error occurs * * @since 1.4 @@ -501,13 +501,13 @@ public class MulticastSocket extends DatagramSocket SecurityManager s = System.getSecurityManager(); if (s != null) { - InetAddress addr = packet.getAddress(); - if (addr.isMulticastAddress()) - s.checkPermission(new SocketPermission(addr.getHostName() - + packet.getPort(), - "accept,connect")); - else - s.checkConnect(addr.getHostAddress(), packet.getPort()); + InetAddress addr = packet.getAddress(); + if (addr.isMulticastAddress()) + s.checkPermission(new SocketPermission(addr.getHostName() + + packet.getPort(), + "accept,connect")); + else + s.checkConnect(addr.getHostAddress(), packet.getPort()); } int oldttl = getImpl().getTimeToLive(); diff --git a/java/net/NetworkInterface.java b/java/net/NetworkInterface.java index 5ec64ff16..127dfba78 100644 --- a/java/net/NetworkInterface.java +++ b/java/net/NetworkInterface.java @@ -59,12 +59,12 @@ import java.util.Vector; public final class NetworkInterface { private final VMNetworkInterface netif; - + private NetworkInterface(VMNetworkInterface netif) { this.netif = netif; } - + /** Creates an NetworkInterface instance which * represents any interface in the system. Its only * address is <code>0.0.0.0/0.0.0.0</code>. This @@ -74,7 +74,7 @@ public final class NetworkInterface { return new NetworkInterface(new VMNetworkInterface()); } - + /** * Returns the name of the network interface * @@ -109,16 +109,16 @@ public final class NetworkInterface for (Enumeration<InetAddress> addresses = inetAddresses.elements(); addresses.hasMoreElements();) { - InetAddress addr = addresses.nextElement(); - try - { - s.checkConnect(addr.getHostAddress(), -1); - tmpInetAddresses.add(addr); - } - catch (SecurityException e) - { - // Ignore. - } + InetAddress addr = addresses.nextElement(); + try + { + s.checkConnect(addr.getHostAddress(), -1); + tmpInetAddresses.add(addr); + } + catch (SecurityException e) + { + // Ignore. + } } return tmpInetAddresses.elements(); @@ -138,7 +138,7 @@ public final class NetworkInterface * Returns an network interface by name * * @param name The name of the interface to return - * + * * @return a <code>NetworkInterface</code> object representing the interface, * or null if there is no interface with that name. * @@ -187,14 +187,14 @@ public final class NetworkInterface * Return an <code>Enumeration</code> of all available network interfaces * * @return all interfaces - * + * * @exception SocketException If an error occurs */ public static Enumeration<NetworkInterface> getNetworkInterfaces() throws SocketException { VMNetworkInterface[] netifs = VMNetworkInterface.getVMInterfaces(); - Vector<NetworkInterface> networkInterfaces = + Vector<NetworkInterface> networkInterfaces = new Vector<NetworkInterface>(netifs.length); for (int i = 0; i < netifs.length; i++) { @@ -217,7 +217,7 @@ public final class NetworkInterface return false; NetworkInterface tmp = (NetworkInterface) obj; - + if (netif.name == null) return tmp.netif.name == null; @@ -234,10 +234,10 @@ public final class NetworkInterface { // FIXME: hash correctly int hc = netif.addresses.hashCode(); - + if (netif.name != null) hc += netif.name.hashCode(); - + return hc; } @@ -253,7 +253,7 @@ public final class NetworkInterface String separator = SystemProperties.getProperty("line.separator"); result = new CPStringBuilder(); - + result.append("name: "); result.append(getDisplayName()); result.append(" (").append(getName()).append(") addresses:"); @@ -261,8 +261,8 @@ public final class NetworkInterface for (Iterator it = netif.addresses.iterator(); it.hasNext(); ) { - InetAddress address = (InetAddress) it.next(); - result.append(address.toString()).append(";").append(separator); + InetAddress address = (InetAddress) it.next(); + result.append(address.toString()).append(";").append(separator); } return result.toString(); diff --git a/java/net/Proxy.java b/java/net/Proxy.java index 315177413..36a25fa80 100644 --- a/java/net/Proxy.java +++ b/java/net/Proxy.java @@ -41,7 +41,7 @@ package java.net; /** * Defines a proxy setting. This setting contains a type (https, socks, * direct) and a socket address. - * + * * @since 1.5 */ public class Proxy @@ -49,8 +49,8 @@ public class Proxy /** * Represents the proxy type. */ - public enum Type - { + public enum Type + { DIRECT, HTTP, SOCKS; /** @@ -112,8 +112,8 @@ public class Proxy Proxy tmp = (Proxy) obj; return (type.equals(tmp.type) - && (address == null ? tmp.address == null - : address.equals(tmp.address))); + && (address == null ? tmp.address == null + : address.equals(tmp.address))); } /** @@ -134,6 +134,6 @@ public class Proxy public String toString() { return type.toString() + (address == null ? "" - : (":" + address.toString())); + : (":" + address.toString())); } } diff --git a/java/net/ProxySelector.java b/java/net/ProxySelector.java index 78592a244..6c85f99c7 100644 --- a/java/net/ProxySelector.java +++ b/java/net/ProxySelector.java @@ -44,7 +44,7 @@ import java.util.List; /** * Class for handling proxies for different connections. - * + * * @since 1.5 */ public abstract class ProxySelector @@ -100,17 +100,17 @@ public abstract class ProxySelector /** * Signals to the selector that a proxy was no available. - * + * * @throws IllegalArgumentException If one argument is null */ public abstract void connectFailed(URI uri, SocketAddress address, - IOException exception); + IOException exception); /** * Returns the list of proxy settings for a given URI. * * @return list of proxy settings - * + * * @throws IllegalArgumentException If uri is null */ public abstract List<Proxy> select(URI uri); diff --git a/java/net/ResolverCache.java b/java/net/ResolverCache.java index ad329b607..d7e5ed407 100644 --- a/java/net/ResolverCache.java +++ b/java/net/ResolverCache.java @@ -119,21 +119,21 @@ class ResolverCache Entry entry = get(key); if (entry != null) { - if (entry.value == null) - throw new UnknownHostException(); - return (String) entry.value; + if (entry.value == null) + throw new UnknownHostException(); + return (String) entry.value; } try { - String hostname = VMInetAddress.getHostByAddr(addr); - put(new Entry(key, hostname)); - return hostname; + String hostname = VMInetAddress.getHostByAddr(addr); + put(new Entry(key, hostname)); + return hostname; } catch (UnknownHostException e) { - put(new Entry(key, null)); - throw e; + put(new Entry(key, null)); + throw e; } } @@ -152,21 +152,21 @@ class ResolverCache Entry entry = get(hostname); if (entry != null) { - if (entry.value == null) - throw new UnknownHostException(); - return (byte[][]) entry.value; + if (entry.value == null) + throw new UnknownHostException(); + return (byte[][]) entry.value; } try { - byte[][] addrs = VMInetAddress.getHostByName(hostname); - put(new Entry(hostname, addrs)); - return addrs; + byte[][] addrs = VMInetAddress.getHostByName(hostname); + put(new Entry(hostname, addrs)); + return addrs; } catch (UnknownHostException e) { - put(new Entry(hostname, null)); - throw e; + put(new Entry(hostname, null)); + throw e; } } @@ -201,9 +201,9 @@ class ResolverCache reap(); if (entry.expires != 0) { - if (entry.expires != -1) - killqueue.add(entry); - cache.put(entry.key, entry); + if (entry.expires != -1) + killqueue.add(entry); + cache.put(entry.key, entry); } } @@ -215,20 +215,20 @@ class ResolverCache { if (!killqueue.isEmpty()) { - long now = System.currentTimeMillis(); + long now = System.currentTimeMillis(); - Iterator iter = killqueue.iterator(); - while (iter.hasNext()) - { - Entry entry = (Entry) iter.next(); - if (entry.expires > now) - break; - cache.remove(entry.key); - iter.remove(); - } + Iterator iter = killqueue.iterator(); + while (iter.hasNext()) + { + Entry entry = (Entry) iter.next(); + if (entry.expires > now) + break; + cache.remove(entry.key); + iter.remove(); + } } } - + /** * An entry in the cache. */ @@ -243,7 +243,7 @@ class ResolverCache * The entry itself. A null value indicates a failed lookup. */ public final Object value; - + /** * The time when this cache entry expires. If set to -1 then * this entry will never expire. If set to 0 then this entry @@ -261,9 +261,9 @@ class ResolverCache int ttl = value != null ? POSITIVE_TTL : NEGATIVE_TTL; if (ttl < 1) - expires = ttl; + expires = ttl; else - expires = System.currentTimeMillis() + ttl * 1000; + expires = System.currentTimeMillis() + ttl * 1000; } } } diff --git a/java/net/ServerSocket.java b/java/net/ServerSocket.java index fa1c51e75..1dbd7636c 100644 --- a/java/net/ServerSocket.java +++ b/java/net/ServerSocket.java @@ -247,8 +247,8 @@ public class ServerSocket try { - impl.bind(addr, port); - impl.listen(backlog); + impl.bind(addr, port); + impl.listen(backlog); this.port = port; local = new InetSocketAddress( (InetAddress) impl.getOption(SocketOptions.SO_BINDADDR), @@ -259,7 +259,7 @@ public class ServerSocket try { if (local == null) - close(); + close(); } catch (IOException _) { @@ -297,7 +297,7 @@ public class ServerSocket * Returns the local socket address * * @return the local socket address, null if not bound - * + * * @since 1.4 */ public SocketAddress getLocalSocketAddress() @@ -326,33 +326,33 @@ public class ServerSocket try { - implAccept(socket); + implAccept(socket); } catch (IOException e) { - try - { - socket.close(); - } - catch (IOException e2) - { - // Ignore. - } - - throw e; + try + { + socket.close(); + } + catch (IOException e2) + { + // Ignore. + } + + throw e; } catch (SecurityException e) { - try - { - socket.close(); - } - catch (IOException e2) - { - // Ignore. - } - - throw e; + try + { + socket.close(); + } + catch (IOException e2) + { + // Ignore. + } + + throw e; } return socket; @@ -391,7 +391,7 @@ public class ServerSocket SecurityManager sm = System.getSecurityManager(); if (sm != null) sm.checkAccept(socket.getInetAddress().getHostAddress(), - socket.getPort()); + socket.getPort()); } /** @@ -416,7 +416,7 @@ public class ServerSocket * by <code>ServerSocketChannel.open()</code>.</p> * * @return the associated socket channel, null if none exists - * + * * @since 1.4 */ public ServerSocketChannel getChannel() @@ -428,7 +428,7 @@ public class ServerSocket * Returns true when the socket is bound, otherwise false * * @return true if socket is bound, false otherwise - * + * * @since 1.4 */ public boolean isBound() @@ -440,7 +440,7 @@ public class ServerSocket * Returns true if the socket is closed, otherwise false * * @return true if socket is closed, false otherwise - * + * * @since 1.4 */ public boolean isClosed() @@ -501,7 +501,7 @@ public class ServerSocket * Enables/Disables the SO_REUSEADDR option * * @param on true if SO_REUSEADDR should be enabled, false otherwise - * + * * @exception SocketException If an error occurs * * @since 1.4 diff --git a/java/net/Socket.java b/java/net/Socket.java index 7541bdf78..d61e81f5e 100644 --- a/java/net/Socket.java +++ b/java/net/Socket.java @@ -377,23 +377,23 @@ public class Socket // bind to address/port try { - getImpl().bind(tmp.getAddress(), tmp.getPort()); - bound = true; + getImpl().bind(tmp.getAddress(), tmp.getPort()); + bound = true; } catch (IOException exception) { - close(); - throw exception; + close(); + throw exception; } catch (RuntimeException exception) { - close(); - throw exception; + close(); + throw exception; } catch (Error error) { - close(); - throw error; + close(); + throw error; } } @@ -467,11 +467,11 @@ public class Socket try { - return getImpl().getInetAddress(); + return getImpl().getInetAddress(); } catch (SocketException e) { - // This cannot happen as we are connected. + // This cannot happen as we are connected. } return null; @@ -495,7 +495,7 @@ public class Socket if (impl instanceof PlainSocketImpl) addr = ((PlainSocketImpl) impl).getLocalAddress().getAddress(); - + if (addr == null) { try @@ -536,11 +536,11 @@ public class Socket try { - return getImpl().getPort(); + return getImpl().getPort(); } catch (SocketException e) { - // This cannot happen as we are connected. + // This cannot happen as we are connected. } return 0; @@ -559,12 +559,12 @@ public class Socket try { - if (getImpl() != null) - return getImpl().getLocalPort(); + if (getImpl() != null) + return getImpl().getLocalPort(); } catch (SocketException e) { - // This cannot happen as we are bound. + // This cannot happen as we are bound. } return -1; @@ -586,12 +586,12 @@ public class Socket try { - return new InetSocketAddress(addr, getImpl().getLocalPort()); + return new InetSocketAddress(addr, getImpl().getLocalPort()); } catch (SocketException e) { - // This cannot happen as we are bound. - return null; + // This cannot happen as we are bound. + return null; } } @@ -609,13 +609,13 @@ public class Socket try { - return new InetSocketAddress(getImpl().getInetAddress(), - getImpl().getPort()); + return new InetSocketAddress(getImpl().getInetAddress(), + getImpl().getPort()); } catch (SocketException e) { - // This cannot happen as we are connected. - return null; + // This cannot happen as we are connected. + return null; } } @@ -721,13 +721,13 @@ public class Socket if (on) { - if (linger < 0) - throw new IllegalArgumentException("SO_LINGER must be >= 0"); + if (linger < 0) + throw new IllegalArgumentException("SO_LINGER must be >= 0"); - if (linger > 65535) - linger = 65535; + if (linger > 65535) + linger = 65535; - getImpl().setOption(SocketOptions.SO_LINGER, Integer.valueOf(linger)); + getImpl().setOption(SocketOptions.SO_LINGER, Integer.valueOf(linger)); } else getImpl().setOption(SocketOptions.SO_LINGER, Integer.valueOf(-1)); @@ -1034,15 +1034,15 @@ public class Socket { try { - if (isConnected()) - return (super.toString() + if (isConnected()) + return (super.toString() + " [addr=" + getImpl().getInetAddress() + ",port=" - + getImpl().getPort() + ",localport=" - + getImpl().getLocalPort() + "]"); + + getImpl().getPort() + ",localport=" + + getImpl().getLocalPort() + "]"); } catch (SocketException e) { - // This cannot happen as we are connected. + // This cannot happen as we are connected. } return super.toString() + " [unconnected]"; @@ -1225,7 +1225,7 @@ public class Socket { if (impl == null) return false; - + return impl.getInetAddress() != null; } @@ -1242,7 +1242,7 @@ public class Socket return false; if (impl instanceof PlainSocketImpl) { - InetSocketAddress addr = ((PlainSocketImpl) impl).getLocalAddress(); + InetSocketAddress addr = ((PlainSocketImpl) impl).getLocalAddress(); return addr != null && addr.getAddress() != null; } return bound; @@ -1258,7 +1258,7 @@ public class Socket public boolean isClosed() { SocketChannel channel = getChannel(); - + return impl == null || (channel != null && ! channel.isOpen()); } diff --git a/java/net/SocketPermission.java b/java/net/SocketPermission.java index a5a848eee..ce16a79a0 100644 --- a/java/net/SocketPermission.java +++ b/java/net/SocketPermission.java @@ -127,9 +127,9 @@ public final class SocketPermission extends Permission implements Serializable /** * An IP address (IPv4 or IPv6). Will be set if and only if this * object was initialized with a single literal IP address. - */ + */ private transient InetAddress address = null; - + /** * A range of ports. */ @@ -199,39 +199,39 @@ public final class SocketPermission extends Permission implements Serializable boolean colon_allowed = true; for (int i = 0; i < hostport.length(); i++) { - if (hostport.charAt(i) == ':') - { - if (!colon_allowed) - throw new IllegalArgumentException("Ambiguous hostport part"); - colons++; - colon_allowed = false; - } - else - colon_allowed = true; + if (hostport.charAt(i) == ':') + { + if (!colon_allowed) + throw new IllegalArgumentException("Ambiguous hostport part"); + colons++; + colon_allowed = false; + } + else + colon_allowed = true; } switch (colons) { case 0: case 1: - // a hostname or IPv4 address - return hostport; - + // a hostname or IPv4 address + return hostport; + case 7: - // an IPv6 address with no ports - return "[" + hostport + "]"; + // an IPv6 address with no ports + return "[" + hostport + "]"; case 8: - // an IPv6 address with ports - int last_colon = hostport.lastIndexOf(':'); - return "[" + hostport.substring(0, last_colon) + "]" - + hostport.substring(last_colon); + // an IPv6 address with ports + int last_colon = hostport.lastIndexOf(':'); + return "[" + hostport.substring(0, last_colon) + "]" + + hostport.substring(last_colon); default: - throw new IllegalArgumentException("Ambiguous hostport part"); + throw new IllegalArgumentException("Ambiguous hostport part"); } } - + /** * Parse the hostport argument to the constructor. */ @@ -241,90 +241,90 @@ public final class SocketPermission extends Permission implements Serializable String host, ports; if (hostport.charAt(0) == '[') { - // host is a bracketed IPv6 address - int end = hostport.indexOf("]"); - if (end == -1) - throw new IllegalArgumentException("Unmatched '['"); - host = hostport.substring(1, end); - - address = InetAddress.getByLiteral(host); - if (address == null) - throw new IllegalArgumentException("Bad IPv6 address"); - - if (end == hostport.length() - 1) - ports = ""; - else if (hostport.charAt(end + 1) == ':') - ports = hostport.substring(end + 2); - else - throw new IllegalArgumentException("Bad character after ']'"); + // host is a bracketed IPv6 address + int end = hostport.indexOf("]"); + if (end == -1) + throw new IllegalArgumentException("Unmatched '['"); + host = hostport.substring(1, end); + + address = InetAddress.getByLiteral(host); + if (address == null) + throw new IllegalArgumentException("Bad IPv6 address"); + + if (end == hostport.length() - 1) + ports = ""; + else if (hostport.charAt(end + 1) == ':') + ports = hostport.substring(end + 2); + else + throw new IllegalArgumentException("Bad character after ']'"); } else { - // host is a hostname or IPv4 address - int sep = hostport.indexOf(":"); - if (sep == -1) - { - host = hostport; - ports = ""; - } - else - { - host = hostport.substring(0, sep); - ports = hostport.substring(sep + 1); - } - - address = InetAddress.getByLiteral(host); - if (address == null) - { - if (host.lastIndexOf('*') > 0) - throw new IllegalArgumentException("Bad hostname"); - - hostname = host; - } + // host is a hostname or IPv4 address + int sep = hostport.indexOf(":"); + if (sep == -1) + { + host = hostport; + ports = ""; + } + else + { + host = hostport.substring(0, sep); + ports = hostport.substring(sep + 1); + } + + address = InetAddress.getByLiteral(host); + if (address == null) + { + if (host.lastIndexOf('*') > 0) + throw new IllegalArgumentException("Bad hostname"); + + hostname = host; + } } // Parse and validate the ports if (ports.length() == 0) { - minport = MIN_PORT; - maxport = MAX_PORT; + minport = MIN_PORT; + maxport = MAX_PORT; } else { - int sep = ports.indexOf("-"); - if (sep == -1) - { - // a single port - minport = maxport = Integer.parseInt(ports); - } - else - { - if (ports.indexOf("-", sep + 1) != -1) - throw new IllegalArgumentException("Unexpected '-'"); - - if (sep == 0) - { - // an upper bound - minport = MIN_PORT; - maxport = Integer.parseInt(ports.substring(1)); - } - else if (sep == ports.length() - 1) - { - // a lower bound - minport = - Integer.parseInt(ports.substring(0, ports.length() - 1)); - maxport = MAX_PORT; - } - else - { - // a range with two bounds - minport = Integer.parseInt(ports.substring(0, sep)); - maxport = Integer.parseInt(ports.substring(sep + 1)); - } - } + int sep = ports.indexOf("-"); + if (sep == -1) + { + // a single port + minport = maxport = Integer.parseInt(ports); + } + else + { + if (ports.indexOf("-", sep + 1) != -1) + throw new IllegalArgumentException("Unexpected '-'"); + + if (sep == 0) + { + // an upper bound + minport = MIN_PORT; + maxport = Integer.parseInt(ports.substring(1)); + } + else if (sep == ports.length() - 1) + { + // a lower bound + minport = + Integer.parseInt(ports.substring(0, ports.length() - 1)); + maxport = MAX_PORT; + } + else + { + // a range with two bounds + minport = Integer.parseInt(ports.substring(0, sep)); + maxport = Integer.parseInt(ports.substring(sep + 1)); + } + } } } - + /** * Parse the actions argument to the constructor. */ @@ -334,18 +334,18 @@ public final class SocketPermission extends Permission implements Serializable boolean resolve_needed = false; boolean resolve_present = false; - + StringTokenizer t = new StringTokenizer(actionstring, ","); while (t.hasMoreTokens()) { - String action = t.nextToken(); - action = action.trim().toLowerCase(); - setAction(action); - - if (action.equals("resolve")) - resolve_present = true; - else - resolve_needed = true; + String action = t.nextToken(); + action = action.trim().toLowerCase(); + setAction(action); + + if (action.equals("resolve")) + resolve_present = true; + else + resolve_needed = true; } if (resolve_needed && !resolve_present) @@ -359,11 +359,11 @@ public final class SocketPermission extends Permission implements Serializable { for (int i = 0; i < ACTIONS.length; i++) { - if (action.equals(ACTIONS[i])) - { - actionmask |= 1 << i; - return; - } + if (action.equals(ACTIONS[i])) + { + actionmask |= 1 << i; + return; + } } throw new IllegalArgumentException("Unknown action " + action); } @@ -389,23 +389,23 @@ public final class SocketPermission extends Permission implements Serializable return false; if (p.actionmask != actionmask || - p.minport != minport || - p.maxport != maxport) + p.minport != minport || + p.maxport != maxport) return false; if (address != null) { - if (p.address == null) - return false; - else - return p.address.equals(address); + if (p.address == null) + return false; + else + return p.address.equals(address); } else { - if (p.hostname == null) - return false; - else - return p.hostname.equals(hostname); + if (p.hostname == null) + return false; + else + return p.hostname.equals(hostname); } } @@ -437,12 +437,12 @@ public final class SocketPermission extends Permission implements Serializable for (int i = 0; i < ACTIONS.length; i++) { - if ((actionmask & (1 << i)) != 0) - { - if (sb.length() != 0) - sb.append(","); - sb.append(ACTIONS[i]); - } + if ((actionmask & (1 << i)) != 0) + { + if (sb.length() != 0) + sb.append(","); + sb.append(ACTIONS[i]); + } } return sb.toString(); @@ -471,11 +471,11 @@ public final class SocketPermission extends Permission implements Serializable try { - return InetAddress.getAllByName(hostname); + return InetAddress.getAllByName(hostname); } catch (UnknownHostException e) { - return new InetAddress[0]; + return new InetAddress[0]; } } @@ -491,18 +491,18 @@ public final class SocketPermission extends Permission implements Serializable return null; try { - return InetAddress.getByName(hostname).internalGetCanonicalHostName(); + return InetAddress.getByName(hostname).internalGetCanonicalHostName(); } catch (UnknownHostException e) { - return null; + return null; } } - + /** * Returns true if the permission object passed it is implied by the * this permission. This will be true if: - * + * * <ul> * <li>The argument is of type <code>SocketPermission</code></li> * <li>The actions list of the argument are in this object's actions</li> @@ -511,7 +511,7 @@ public final class SocketPermission extends Permission implements Serializable * </ul> * * <p>The argument's hostname will be a subset of this object's hostname if:</p> - * + * * <ul> * <li>The argument's hostname or IP address is equal to this object's.</li> * <li>The argument's canonical hostname is equal to this object's.</li> @@ -538,10 +538,10 @@ public final class SocketPermission extends Permission implements Serializable // imply it. This is not part of the spec, but it seems necessary. if (p.hostname != null && p.hostname.length() == 0) return false; - + // Next check the actions if ((p.actionmask & actionmask) != p.actionmask) - return false; + return false; // Then check the ports if ((p.minport < minport) || (p.maxport > maxport)) @@ -554,49 +554,49 @@ public final class SocketPermission extends Permission implements Serializable // IP address which one of p's IP addresses is equal to. if (address != null) { - InetAddress[] addrs = p.getAddresses(); - for (int i = 0; i < addrs.length; i++) - { - if (address.equals(addrs[i])) - return true; - } + InetAddress[] addrs = p.getAddresses(); + for (int i = 0; i < addrs.length; i++) + { + if (address.equals(addrs[i])) + return true; + } } // Return true if this object is a wildcarded domain that // p's canonical name matches. if (hostname != null && hostname.charAt(0) == '*') { - p_canon = p.getCanonicalHostName(); - if (p_canon != null && p_canon.endsWith(hostname.substring(1))) - return true; - + p_canon = p.getCanonicalHostName(); + if (p_canon != null && p_canon.endsWith(hostname.substring(1))) + return true; + } // Return true if this one of this object's IP addresses // is equal to one of p's. if (address == null) { - InetAddress[] addrs = p.getAddresses(); - InetAddress[] p_addrs = p.getAddresses(); - - for (int i = 0; i < addrs.length; i++) - { - for (int j = 0; j < p_addrs.length; j++) - { - if (addrs[i].equals(p_addrs[j])) - return true; - } - } + InetAddress[] addrs = p.getAddresses(); + InetAddress[] p_addrs = p.getAddresses(); + + for (int i = 0; i < addrs.length; i++) + { + for (int j = 0; j < p_addrs.length; j++) + { + if (addrs[i].equals(p_addrs[j])) + return true; + } + } } // Return true if this object's canonical name equals p's. String canon = getCanonicalHostName(); if (canon != null) { - if (p_canon == null) - p_canon = p.getCanonicalHostName(); - if (p_canon != null && canon.equals(p_canon)) - return true; + if (p_canon == null) + p_canon = p.getCanonicalHostName(); + if (p_canon != null && canon.equals(p_canon)) + return true; } // Didn't make it diff --git a/java/net/URI.java b/java/net/URI.java index 933e4f451..b5fb9654f 100644 --- a/java/net/URI.java +++ b/java/net/URI.java @@ -49,7 +49,7 @@ import java.util.regex.Pattern; /** * <p> - * A URI instance represents that defined by + * A URI instance represents that defined by * <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC3986</a>, * with some deviations. * </p> @@ -157,7 +157,7 @@ import java.util.regex.Pattern; * @author Andrew John Hughes (gnu_andrew@member.fsf.org) * @since 1.4 */ -public final class URI +public final class URI implements Comparable<URI>, Serializable { /** @@ -193,7 +193,7 @@ public final class URI private static final String RFC3986_SUBDELIMS = "!$&'()*+,;="; private static final String RFC3986_REG_NAME = RFC3986_UNRESERVED + RFC3986_SUBDELIMS + "%"; - private static final String RFC3986_PCHAR = RFC3986_UNRESERVED + + private static final String RFC3986_PCHAR = RFC3986_UNRESERVED + RFC3986_SUBDELIMS + ":@%"; private static final String RFC3986_SEGMENT = RFC3986_PCHAR; private static final String RFC3986_PATH_SEGMENTS = RFC3986_SEGMENT + "/"; @@ -230,7 +230,7 @@ public final class URI * Index of fragment component in parsed URI. */ private static final int FRAGMENT_GROUP = 10; - + /** * Index of userinfo component in parsed authority section. */ @@ -294,19 +294,19 @@ public final class URI this.string = (String) is.readObject(); try { - parseURI(this.string); + parseURI(this.string); } catch (URISyntaxException x) { - // Should not happen. - throw new RuntimeException(x); + // Should not happen. + throw new RuntimeException(x); } } private void writeObject(ObjectOutputStream os) throws IOException { if (string == null) - string = toString(); + string = toString(); os.writeObject(string); } @@ -350,11 +350,11 @@ public final class URI String matched = match.group(group); if (matched == null || matched.length() == 0) { - String prevMatched = match.group(group -1); - if (prevMatched == null || prevMatched.length() == 0) - return null; - else - return ""; + String prevMatched = match.group(group -1); + if (prevMatched == null || prevMatched.length() == 0) + return null; + else + return ""; } return matched; } @@ -369,23 +369,23 @@ public final class URI private void parseURI(String str) throws URISyntaxException { Matcher matcher = URI_PATTERN.matcher(str); - + if (matcher.matches()) { - scheme = getURIGroup(matcher, SCHEME_GROUP); - rawSchemeSpecificPart = matcher.group(SCHEME_SPEC_PART_GROUP); - schemeSpecificPart = unquote(rawSchemeSpecificPart); - if (!isOpaque()) - { - rawAuthority = getURIGroup(matcher, AUTHORITY_GROUP); - rawPath = matcher.group(PATH_GROUP); - rawQuery = getURIGroup(matcher, QUERY_GROUP); - } - rawFragment = getURIGroup(matcher, FRAGMENT_GROUP); + scheme = getURIGroup(matcher, SCHEME_GROUP); + rawSchemeSpecificPart = matcher.group(SCHEME_SPEC_PART_GROUP); + schemeSpecificPart = unquote(rawSchemeSpecificPart); + if (!isOpaque()) + { + rawAuthority = getURIGroup(matcher, AUTHORITY_GROUP); + rawPath = matcher.group(PATH_GROUP); + rawQuery = getURIGroup(matcher, QUERY_GROUP); + } + rawFragment = getURIGroup(matcher, FRAGMENT_GROUP); } else throw new URISyntaxException(str, - "doesn't match URI regular expression"); + "doesn't match URI regular expression"); parseServerAuthority(); // We must eagerly unquote the parts, because this is the only time @@ -416,27 +416,27 @@ public final class URI int pos = 0; for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if (c == '%') - { - if (i + 2 >= str.length()) - throw new URISyntaxException(str, "Invalid quoted character"); - int hi = Character.digit(str.charAt(++i), 16); - int lo = Character.digit(str.charAt(++i), 16); - if (lo < 0 || hi < 0) - throw new URISyntaxException(str, "Invalid quoted character"); - buf[pos++] = (byte) (hi * 16 + lo); - } - else - buf[pos++] = (byte) c; + char c = str.charAt(i); + if (c == '%') + { + if (i + 2 >= str.length()) + throw new URISyntaxException(str, "Invalid quoted character"); + int hi = Character.digit(str.charAt(++i), 16); + int lo = Character.digit(str.charAt(++i), 16); + if (lo < 0 || hi < 0) + throw new URISyntaxException(str, "Invalid quoted character"); + buf[pos++] = (byte) (hi * 16 + lo); + } + else + buf[pos++] = (byte) c; } try { - return new String(buf, 0, pos, "utf-8"); + return new String(buf, 0, pos, "utf-8"); } catch (java.io.UnsupportedEncodingException x2) { - throw (Error) new InternalError().initCause(x2); + throw (Error) new InternalError().initCause(x2); } } @@ -488,16 +488,16 @@ public final class URI CPStringBuilder sb = new CPStringBuilder(str.length()); for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if ((legalCharacters.indexOf(c) == -1) - && (c <= 127)) - { - sb.append('%'); - sb.append(HEX.charAt(c / 16)); - sb.append(HEX.charAt(c % 16)); - } - else - sb.append(c); + char c = str.charAt(i); + if ((legalCharacters.indexOf(c) == -1) + && (c <= 127)) + { + sb.append('%'); + sb.append(HEX.charAt(c / 16)); + sb.append(HEX.charAt(c % 16)); + } + else + sb.append(c); } return sb.toString(); } @@ -659,12 +659,12 @@ public final class URI { try { - return new URI(str); + return new URI(str); } catch (URISyntaxException e) { - throw (IllegalArgumentException) new IllegalArgumentException() - .initCause(e); + throw (IllegalArgumentException) new IllegalArgumentException() + .initCause(e); } } @@ -686,32 +686,32 @@ public final class URI { if (rawAuthority != null) { - Matcher matcher = AUTHORITY_PATTERN.matcher(rawAuthority); - - if (matcher.matches()) - { - rawUserInfo = getURIGroup(matcher, AUTHORITY_USERINFO_GROUP); - rawHost = getURIGroup(matcher, AUTHORITY_HOST_GROUP); - - String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP); - - if (portStr != null && ! portStr.isEmpty()) - try - { - port = Integer.parseInt(portStr); - } - catch (NumberFormatException e) - { - URISyntaxException use = - new URISyntaxException - (string, "doesn't match URI regular expression"); - use.initCause(e); - throw use; - } - } - else - throw new URISyntaxException(string, - "doesn't match URI regular expression"); + Matcher matcher = AUTHORITY_PATTERN.matcher(rawAuthority); + + if (matcher.matches()) + { + rawUserInfo = getURIGroup(matcher, AUTHORITY_USERINFO_GROUP); + rawHost = getURIGroup(matcher, AUTHORITY_HOST_GROUP); + + String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP); + + if (portStr != null && ! portStr.isEmpty()) + try + { + port = Integer.parseInt(portStr); + } + catch (NumberFormatException e) + { + URISyntaxException use = + new URISyntaxException + (string, "doesn't match URI regular expression"); + use.initCause(e); + throw use; + } + } + else + throw new URISyntaxException(string, + "doesn't match URI regular expression"); } return this; } @@ -744,13 +744,13 @@ public final class URI return this; try { - return new URI(scheme, authority, normalizePath(path), query, - fragment); + return new URI(scheme, authority, normalizePath(path), query, + fragment); } catch (URISyntaxException e) { - throw (Error) new InternalError("Normalized URI variant could not "+ - "be constructed").initCause(e); + throw (Error) new InternalError("Normalized URI variant could not "+ + "be constructed").initCause(e); } } @@ -770,13 +770,13 @@ public final class URI * The resulting URI will be free of `.' and `..' segments, barring those * that were prepended or which couldn't be paired, respectively. * </p> - * + * * @param relativePath the relative path to be normalized. * @return the normalized path. */ private String normalizePath(String relativePath) { - /* + /* This follows the algorithm in section 5.2.4. of RFC3986, but doesn't modify the input buffer. */ @@ -785,66 +785,66 @@ public final class URI int start = 0; while (start < input.length()) { - /* A */ - if (input.indexOf("../",start) == start) - { - start += 3; - continue; - } - if (input.indexOf("./",start) == start) - { - start += 2; - continue; - } - /* B */ - if (input.indexOf("/./",start) == start) - { - start += 2; - continue; - } - if (input.indexOf("/.",start) == start - && input.charAt(start + 2) != '.') - { - start += 1; - input.setCharAt(start,'/'); - continue; - } - /* C */ - if (input.indexOf("/../",start) == start) - { - start += 3; - removeLastSegment(output); - continue; - } - if (input.indexOf("/..",start) == start) - { - start += 2; - input.setCharAt(start,'/'); - removeLastSegment(output); - continue; - } - /* D */ - if (start == input.length() - 1 && input.indexOf(".",start) == start) - { - input.delete(0,1); - continue; - } - if (start == input.length() - 2 && input.indexOf("..",start) == start) - { - input.delete(0,2); - continue; - } - /* E */ - int indexOfSlash = input.indexOf("/",start); - while (indexOfSlash == start) - { - output.append("/"); - ++start; - indexOfSlash = input.indexOf("/",start); - } - if (indexOfSlash == -1) - indexOfSlash = input.length(); - output.append(input.substring(start, indexOfSlash)); + /* A */ + if (input.indexOf("../",start) == start) + { + start += 3; + continue; + } + if (input.indexOf("./",start) == start) + { + start += 2; + continue; + } + /* B */ + if (input.indexOf("/./",start) == start) + { + start += 2; + continue; + } + if (input.indexOf("/.",start) == start + && input.charAt(start + 2) != '.') + { + start += 1; + input.setCharAt(start,'/'); + continue; + } + /* C */ + if (input.indexOf("/../",start) == start) + { + start += 3; + removeLastSegment(output); + continue; + } + if (input.indexOf("/..",start) == start) + { + start += 2; + input.setCharAt(start,'/'); + removeLastSegment(output); + continue; + } + /* D */ + if (start == input.length() - 1 && input.indexOf(".",start) == start) + { + input.delete(0,1); + continue; + } + if (start == input.length() - 2 && input.indexOf("..",start) == start) + { + input.delete(0,2); + continue; + } + /* E */ + int indexOfSlash = input.indexOf("/",start); + while (indexOfSlash == start) + { + output.append("/"); + ++start; + indexOfSlash = input.indexOf("/",start); + } + if (indexOfSlash == -1) + indexOfSlash = input.length(); + output.append(input.substring(start, indexOfSlash)); start = indexOfSlash; } return output.toString(); @@ -890,33 +890,33 @@ public final class URI try { - if (fragment != null && path != null && path.equals("") - && scheme == null && authority == null && query == null) - return new URI(this.scheme, this.schemeSpecificPart, fragment); - - if (authority == null) - { - authority = this.authority; - if (path == null) - path = ""; - if (! (path.startsWith("/"))) - { - CPStringBuilder basepath = new CPStringBuilder(this.path); - int i = this.path.lastIndexOf('/'); - - if (i >= 0) - basepath.delete(i + 1, basepath.length()); - - basepath.append(path); - path = normalizePath(basepath.toString()); - } - } - return new URI(this.scheme, authority, path, query, fragment); + if (fragment != null && path != null && path.equals("") + && scheme == null && authority == null && query == null) + return new URI(this.scheme, this.schemeSpecificPart, fragment); + + if (authority == null) + { + authority = this.authority; + if (path == null) + path = ""; + if (! (path.startsWith("/"))) + { + CPStringBuilder basepath = new CPStringBuilder(this.path); + int i = this.path.lastIndexOf('/'); + + if (i >= 0) + basepath.delete(i + 1, basepath.length()); + + basepath.append(path); + path = normalizePath(basepath.toString()); + } + } + return new URI(this.scheme, authority, path, query, fragment); } catch (URISyntaxException e) { - throw (Error) new InternalError("Resolved URI variant could not "+ - "be constructed").initCause(e); + throw (Error) new InternalError("Resolved URI variant could not "+ + "be constructed").initCause(e); } } @@ -973,21 +973,21 @@ public final class URI String basePath = rawPath; if (!(uri.getRawPath().equals(rawPath))) { - if (!(basePath.endsWith("/"))) - basePath = basePath.concat("/"); - if (!(uri.getRawPath().startsWith(basePath))) - return uri; + if (!(basePath.endsWith("/"))) + basePath = basePath.concat("/"); + if (!(uri.getRawPath().startsWith(basePath))) + return uri; } try { - return new URI(null, null, - uri.getRawPath().substring(basePath.length()), - uri.getRawQuery(), uri.getRawFragment()); + return new URI(null, null, + uri.getRawPath().substring(basePath.length()), + uri.getRawQuery(), uri.getRawFragment()); } catch (URISyntaxException e) { - throw (Error) new InternalError("Relativized URI variant could not "+ - "be constructed").initCause(e); + throw (Error) new InternalError("Relativized URI variant could not "+ + "be constructed").initCause(e); } } @@ -1144,7 +1144,7 @@ public final class URI } /** - * <p> + * <p> * Compares the URI with the given object for equality. If the * object is not a <code>URI</code>, then the method returns false. * Otherwise, the following criteria are observed: @@ -1187,40 +1187,40 @@ public final class URI URI uriObj = (URI) obj; if (scheme == null) { - if (uriObj.getScheme() != null) - return false; + if (uriObj.getScheme() != null) + return false; } else if (!(scheme.equalsIgnoreCase(uriObj.getScheme()))) - return false; + return false; if (rawFragment == null) { - if (uriObj.getRawFragment() != null) - return false; + if (uriObj.getRawFragment() != null) + return false; } else if (!(rawFragment.equalsIgnoreCase(uriObj.getRawFragment()))) - return false; + return false; boolean opaqueThis = isOpaque(); boolean opaqueObj = uriObj.isOpaque(); if (opaqueThis && opaqueObj) return rawSchemeSpecificPart.equals(uriObj.getRawSchemeSpecificPart()); else if (!opaqueThis && !opaqueObj) { - boolean common = rawPath.equalsIgnoreCase(uriObj.getRawPath()) - && ((rawQuery == null && uriObj.getRawQuery() == null) - || rawQuery.equalsIgnoreCase(uriObj.getRawQuery())); - if (rawAuthority == null && uriObj.getRawAuthority() == null) - return common; - if (host == null) - return common - && rawAuthority.equalsIgnoreCase(uriObj.getRawAuthority()); - return common - && host.equalsIgnoreCase(uriObj.getHost()) - && port == uriObj.getPort() - && (rawUserInfo == null ? - uriObj.getRawUserInfo() == null : - rawUserInfo.equalsIgnoreCase(uriObj.getRawUserInfo())); + boolean common = rawPath.equalsIgnoreCase(uriObj.getRawPath()) + && ((rawQuery == null && uriObj.getRawQuery() == null) + || rawQuery.equalsIgnoreCase(uriObj.getRawQuery())); + if (rawAuthority == null && uriObj.getRawAuthority() == null) + return common; + if (host == null) + return common + && rawAuthority.equalsIgnoreCase(uriObj.getRawAuthority()); + return common + && host.equalsIgnoreCase(uriObj.getHost()) + && port == uriObj.getPort() + && (rawUserInfo == null ? + uriObj.getRawUserInfo() == null : + rawUserInfo.equalsIgnoreCase(uriObj.getRawUserInfo())); } else return false; @@ -1278,16 +1278,16 @@ public final class URI * on whether this URI is less than, equal to or greater * than that supplied, respectively. */ - public int compareTo(URI uri) + public int compareTo(URI uri) throws ClassCastException { if (scheme == null && uri.getScheme() != null) return -1; if (scheme != null) { - int sCompare = scheme.compareToIgnoreCase(uri.getScheme()); - if (sCompare != 0) - return sCompare; + int sCompare = scheme.compareToIgnoreCase(uri.getScheme()); + if (sCompare != 0) + return sCompare; } boolean opaqueThis = isOpaque(); boolean opaqueObj = uri.isOpaque(); @@ -1297,51 +1297,51 @@ public final class URI return -1; if (opaqueThis) { - int ssCompare = - rawSchemeSpecificPart.compareTo(uri.getRawSchemeSpecificPart()); - if (ssCompare == 0) - return compareFragments(uri); - else - return ssCompare; + int ssCompare = + rawSchemeSpecificPart.compareTo(uri.getRawSchemeSpecificPart()); + if (ssCompare == 0) + return compareFragments(uri); + else + return ssCompare; } if (rawAuthority == null && uri.getRawAuthority() != null) return -1; if (rawAuthority != null) { - int aCompare = rawAuthority.compareTo(uri.getRawAuthority()); - if (aCompare != 0) - { - if (host == null) - return aCompare; - if (rawUserInfo == null && uri.getRawUserInfo() != null) - return -1; - int uCompare = rawUserInfo.compareTo(uri.getRawUserInfo()); - if (uCompare != 0) - return uCompare; - if (host == null && uri.getHost() != null) - return -1; - int hCompare = host.compareTo(uri.getHost()); - if (hCompare != 0) - return hCompare; - int uriPort = uri.getPort(); - return (uriPort == port) ? 0 : (uriPort > port) ? -1 : 1; - } + int aCompare = rawAuthority.compareTo(uri.getRawAuthority()); + if (aCompare != 0) + { + if (host == null) + return aCompare; + if (rawUserInfo == null && uri.getRawUserInfo() != null) + return -1; + int uCompare = rawUserInfo.compareTo(uri.getRawUserInfo()); + if (uCompare != 0) + return uCompare; + if (host == null && uri.getHost() != null) + return -1; + int hCompare = host.compareTo(uri.getHost()); + if (hCompare != 0) + return hCompare; + int uriPort = uri.getPort(); + return (uriPort == port) ? 0 : (uriPort > port) ? -1 : 1; + } } if (rawPath == null && uri.getRawPath() != null) return -1; if (rawPath != null) { - int pCompare = rawPath.compareTo(uri.getRawPath()); - if (pCompare != 0) - return pCompare; + int pCompare = rawPath.compareTo(uri.getRawPath()); + if (pCompare != 0) + return pCompare; } if (rawQuery == null && uri.getRawQuery() != null) return -1; if (rawQuery != null) { - int qCompare = rawQuery.compareTo(uri.getRawQuery()); - if (qCompare != 0) - return qCompare; + int qCompare = rawQuery.compareTo(uri.getRawQuery()); + if (qCompare != 0) + return qCompare; } return compareFragments(uri); } @@ -1394,25 +1394,25 @@ public final class URI CPStringBuilder encBuffer = null; for (int i = 0; i < strRep.length(); i++) { - char c = strRep.charAt(i); - if (c <= 127) - { - if (inNonAsciiBlock) - { - buffer.append(escapeCharacters(encBuffer.toString())); - inNonAsciiBlock = false; - } - buffer.append(c); - } - else - { - if (!inNonAsciiBlock) - { - encBuffer = new CPStringBuilder(); - inNonAsciiBlock = true; - } - encBuffer.append(c); - } + char c = strRep.charAt(i); + if (c <= 127) + { + if (inNonAsciiBlock) + { + buffer.append(escapeCharacters(encBuffer.toString())); + inNonAsciiBlock = false; + } + buffer.append(c); + } + else + { + if (!inNonAsciiBlock) + { + encBuffer = new CPStringBuilder(); + inNonAsciiBlock = true; + } + encBuffer.append(c); + } } return buffer.toString(); } @@ -1430,20 +1430,20 @@ public final class URI { try { - CPStringBuilder sb = new CPStringBuilder(); - // this is far from optimal, but it works - byte[] utf8 = str.getBytes("utf-8"); - for (int j = 0; j < utf8.length; j++) - { - sb.append('%'); - sb.append(HEX.charAt((utf8[j] & 0xff) / 16)); - sb.append(HEX.charAt((utf8[j] & 0xff) % 16)); - } - return sb.toString(); + CPStringBuilder sb = new CPStringBuilder(); + // this is far from optimal, but it works + byte[] utf8 = str.getBytes("utf-8"); + for (int j = 0; j < utf8.length; j++) + { + sb.append('%'); + sb.append(HEX.charAt((utf8[j] & 0xff) / 16)); + sb.append(HEX.charAt((utf8[j] & 0xff) % 16)); + } + return sb.toString(); } catch (java.io.UnsupportedEncodingException x) { - throw (Error) new InternalError("Escaping error").initCause(x); + throw (Error) new InternalError("Escaping error").initCause(x); } } diff --git a/java/net/URL.java b/java/net/URL.java index 16a606fbc..1b778b40a 100644 --- a/java/net/URL.java +++ b/java/net/URL.java @@ -203,9 +203,9 @@ public final class URL implements Serializable String s = SystemProperties.getProperty("gnu.java.net.nocache_protocol_handlers"); if (s == null) - cache_handlers = true; + cache_handlers = true; else - cache_handlers = false; + cache_handlers = false; } /** @@ -276,11 +276,11 @@ public final class URL implements Serializable if (ph != null) { - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkPermission(new NetPermission("specifyStreamHandler")); + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkPermission(new NetPermission("specifyStreamHandler")); - this.ph = ph; + this.ph = ph; } else this.ph = getURLStreamHandler(protocol); @@ -293,18 +293,18 @@ public final class URL implements Serializable this.port = port; this.authority = (host != null) ? host : ""; if (port >= 0 && host != null) - this.authority += ":" + port; + this.authority += ":" + port; int hashAt = file.indexOf('#'); if (hashAt < 0) { - this.file = file; - this.ref = null; + this.file = file; + this.ref = null; } else { - this.file = file.substring(0, hashAt); - this.ref = file.substring(hashAt + 1); + this.file = file.substring(0, hashAt); + this.ref = file.substring(hashAt + 1); } hashCode = hashCode(); // Used for serialization. } @@ -324,7 +324,7 @@ public final class URL implements Serializable public URL(String spec) throws MalformedURLException { this((URL) null, spec != null ? spec : "", (URLStreamHandler) null, - false); + false); } /** @@ -346,8 +346,8 @@ public final class URL implements Serializable public URL(URL context, String spec) throws MalformedURLException { this(context, spec, - (context == null) ? (URLStreamHandler) null : context.ph, - false); + (context == null) ? (URLStreamHandler) null : context.ph, + false); } /** @@ -395,7 +395,7 @@ public final class URL implements Serializable * */ private URL(URL context, String spec, URLStreamHandler ph, - boolean phFromUser) + boolean phFromUser) throws MalformedURLException { /* A protocol is defined by the doc as the substring before a ':' @@ -416,12 +416,12 @@ public final class URL implements Serializable int colon; int slash = spec.indexOf('/'); if ((colon = spec.indexOf("://", 1)) > 0 - && ((colon < slash || slash < 0)) + && ((colon < slash || slash < 0)) && ! spec.regionMatches(colon, "://:", 0, 4)) { - context = null; - if (! phFromUser) - ph = null; + context = null; + if (! phFromUser) + ph = null; } boolean protocolSpecified = false; @@ -429,10 +429,10 @@ public final class URL implements Serializable if ((colon = spec.indexOf(':')) > 0 && (colon < slash || slash < 0)) { - // Protocol may have been specified in spec string. + // Protocol may have been specified in spec string. protocolSpecified = true; - protocol = spec.substring(0, colon).toLowerCase(); - if (context != null) + protocol = spec.substring(0, colon).toLowerCase(); + if (context != null) { if (context.protocol.equals(protocol)) { @@ -482,11 +482,11 @@ public final class URL implements Serializable if (ph != null) { - SecurityManager s = System.getSecurityManager(); - if (s != null && phFromUser) - s.checkPermission(new NetPermission("specifyStreamHandler")); + SecurityManager s = System.getSecurityManager(); + if (s != null && phFromUser) + s.checkPermission(new NetPermission("specifyStreamHandler")); - this.ph = ph; + this.ph = ph; } else this.ph = getURLStreamHandler(protocol); @@ -502,14 +502,14 @@ public final class URL implements Serializable try { - this.ph.parseURL(this, spec, colon + 1, - hashAt < 0 ? spec.length() : hashAt); + this.ph.parseURL(this, spec, colon + 1, + hashAt < 0 ? spec.length() : hashAt); } catch (URLParseError e) { MalformedURLException mue = new MalformedURLException(e.getMessage()); mue.initCause(e); - throw mue; + throw mue; } catch (RuntimeException e) { @@ -772,13 +772,13 @@ public final class URL implements Serializable protocol = protocol.toLowerCase(); if (! this.protocol.equals(protocol)) protocolHandler = getURLStreamHandler(protocol); - + // It is an hidden feature of the JDK. If the protocol does not exist, // we keep the previously initialized protocol. if (protocolHandler != null) { - this.ph = protocolHandler; - this.protocol = protocol; + this.ph = protocolHandler; + this.protocol = protocol; } this.authority = ""; this.port = port; @@ -818,13 +818,13 @@ public final class URL implements Serializable protocol = protocol.toLowerCase(); if (! this.protocol.equals(protocol)) protocolHandler = getURLStreamHandler(protocol); - + // It is an hidden feature of the JDK. If the protocol does not exist, // we keep the previously initialized protocol. if (protocolHandler != null) { - this.ph = protocolHandler; - this.protocol = protocol; + this.ph = protocolHandler; + this.protocol = protocol; } this.host = host; this.userInfo = userInfo; @@ -902,70 +902,70 @@ public final class URL implements Serializable // First, see if a protocol handler is in our cache. if (cache_handlers) { - if ((ph = ph_cache.get(protocol)) != null) - return ph; + if ((ph = ph_cache.get(protocol)) != null) + return ph; } // If a non-default factory has been set, use it to find the protocol. if (factory != null) { - ph = factory.createURLStreamHandler(protocol); + ph = factory.createURLStreamHandler(protocol); } // Non-default factory may have returned null or a factory wasn't set. // Use the default search algorithm to find a handler for this protocol. if (ph == null) { - // Get the list of packages to check and append our default handler - // to it, along with the JDK specified default as a last resort. - // Except in very unusual environments the JDK specified one shouldn't - // ever be needed (or available). - String ph_search_path = - SystemProperties.getProperty("java.protocol.handler.pkgs"); - - // Tack our default package on at the ends. - if (ph_search_path != null) - ph_search_path += "|" + DEFAULT_SEARCH_PATH; - else - ph_search_path = DEFAULT_SEARCH_PATH; - - // Finally loop through our search path looking for a match. - StringTokenizer pkgPrefix = new StringTokenizer(ph_search_path, "|"); - - // Cache the systemClassLoader - if (systemClassLoader == null) - { - systemClassLoader = AccessController.doPrivileged - (new PrivilegedAction<ClassLoader>() { - public ClassLoader run() - { - return ClassLoader.getSystemClassLoader(); - } - }); - } - - do - { - try - { - // Try to get a class from the system/application - // classloader, initialize it, make an instance - // and try to cast it to a URLStreamHandler. - String clsName = - (pkgPrefix.nextToken() + "." + protocol + ".Handler"); - Class c = Class.forName(clsName, true, systemClassLoader); - ph = (URLStreamHandler) c.newInstance(); - } + // Get the list of packages to check and append our default handler + // to it, along with the JDK specified default as a last resort. + // Except in very unusual environments the JDK specified one shouldn't + // ever be needed (or available). + String ph_search_path = + SystemProperties.getProperty("java.protocol.handler.pkgs"); + + // Tack our default package on at the ends. + if (ph_search_path != null) + ph_search_path += "|" + DEFAULT_SEARCH_PATH; + else + ph_search_path = DEFAULT_SEARCH_PATH; + + // Finally loop through our search path looking for a match. + StringTokenizer pkgPrefix = new StringTokenizer(ph_search_path, "|"); + + // Cache the systemClassLoader + if (systemClassLoader == null) + { + systemClassLoader = AccessController.doPrivileged + (new PrivilegedAction<ClassLoader>() { + public ClassLoader run() + { + return ClassLoader.getSystemClassLoader(); + } + }); + } + + do + { + try + { + // Try to get a class from the system/application + // classloader, initialize it, make an instance + // and try to cast it to a URLStreamHandler. + String clsName = + (pkgPrefix.nextToken() + "." + protocol + ".Handler"); + Class c = Class.forName(clsName, true, systemClassLoader); + ph = (URLStreamHandler) c.newInstance(); + } catch (ThreadDeath death) { throw death; } - catch (Throwable t) - { - // Ignored. - } - } - while (ph == null && pkgPrefix.hasMoreTokens()); + catch (Throwable t) + { + // Ignored. + } + } + while (ph == null && pkgPrefix.hasMoreTokens()); } // Update the hashtable with the new protocol handler. diff --git a/java/net/URLClassLoader.java b/java/net/URLClassLoader.java index 52d297a3c..418ee77f3 100644 --- a/java/net/URLClassLoader.java +++ b/java/net/URLClassLoader.java @@ -288,8 +288,8 @@ public class URLClassLoader extends SecureClassLoader if (newUrl == null) return; // Silently ignore... - // Reset the toString() value. - thisString = null; + // Reset the toString() value. + thisString = null; // Create a loader for this URL. URLLoader loader = null; @@ -394,8 +394,8 @@ public class URLClassLoader extends SecureClassLoader newUrl); } - urlinfos.add(loader); - ArrayList<URLLoader> extra = loader.getClassPath(); + urlinfos.add(loader); + ArrayList<URLLoader> extra = loader.getClassPath(); if (extra != null) urlinfos.addAll(extra); } @@ -414,8 +414,8 @@ public class URLClassLoader extends SecureClassLoader { for (int i = 0; i < newUrls.length; i++) { - urls.add(newUrls[i]); - addURLImpl(newUrls[i]); + urls.add(newUrls[i]); + addURLImpl(newUrls[i]); } } @@ -424,7 +424,7 @@ public class URLClassLoader extends SecureClassLoader * object, if not null, has precedence. */ private String getAttributeValue(Attributes.Name name, Attributes first, - Attributes second) + Attributes second) { String result = null; if (first != null) @@ -457,7 +457,7 @@ public class URLClassLoader extends SecureClassLoader CPStringBuilder xform = new CPStringBuilder(name); for (int i = xform.length () - 1; i >= 0; --i) if (xform.charAt(i) == '.') - xform.setCharAt(i, '/'); + xform.setCharAt(i, '/'); xform.append('/'); String xformName = xform.toString(); @@ -466,22 +466,22 @@ public class URLClassLoader extends SecureClassLoader String specTitle = getAttributeValue(Attributes.Name.SPECIFICATION_TITLE, - entryAttr, attr); + entryAttr, attr); String specVersion = getAttributeValue(Attributes.Name.SPECIFICATION_VERSION, - entryAttr, attr); + entryAttr, attr); String specVendor = getAttributeValue(Attributes.Name.SPECIFICATION_VENDOR, - entryAttr, attr); + entryAttr, attr); String implTitle = getAttributeValue(Attributes.Name.IMPLEMENTATION_TITLE, - entryAttr, attr); + entryAttr, attr); String implVersion = getAttributeValue(Attributes.Name.IMPLEMENTATION_VERSION, - entryAttr, attr); + entryAttr, attr); String implVendor = getAttributeValue(Attributes.Name.IMPLEMENTATION_VENDOR, - entryAttr, attr); + entryAttr, attr); // Look if the Manifest indicates that this package is sealed // XXX - most likely not completely correct! @@ -494,9 +494,9 @@ public class URLClassLoader extends SecureClassLoader url = null; return definePackage(name, - specTitle, specVendor, specVersion, - implTitle, implVendor, implVersion, - url); + specTitle, specVendor, specVersion, + implTitle, implVendor, implVersion, + url); } /** @@ -534,47 +534,47 @@ public class URLClassLoader extends SecureClassLoader // construct the class (and watch out for those nasty IOExceptions) try { - byte[] data; - InputStream in = resource.getInputStream(); - try - { - int length = resource.getLength(); - if (length != -1) - { - // We know the length of the data. - // Just try to read it in all at once - data = new byte[length]; - int pos = 0; - while (length - pos > 0) - { - int len = in.read(data, pos, length - pos); - if (len == -1) - throw new EOFException("Not enough data reading from: " - + in); - pos += len; - } - } - else - { - // We don't know the data length. - // Have to read it in chunks. - ByteArrayOutputStream out = new ByteArrayOutputStream(4096); - byte[] b = new byte[4096]; - int l = 0; - while (l != -1) - { - l = in.read(b); - if (l != -1) - out.write(b, 0, l); - } - data = out.toByteArray(); - } - } - finally - { - in.close(); - } - final byte[] classData = data; + byte[] data; + InputStream in = resource.getInputStream(); + try + { + int length = resource.getLength(); + if (length != -1) + { + // We know the length of the data. + // Just try to read it in all at once + data = new byte[length]; + int pos = 0; + while (length - pos > 0) + { + int len = in.read(data, pos, length - pos); + if (len == -1) + throw new EOFException("Not enough data reading from: " + + in); + pos += len; + } + } + else + { + // We don't know the data length. + // Have to read it in chunks. + ByteArrayOutputStream out = new ByteArrayOutputStream(4096); + byte[] b = new byte[4096]; + int l = 0; + while (l != -1) + { + l = in.read(b); + if (l != -1) + out.write(b, 0, l); + } + data = out.toByteArray(); + } + } + finally + { + in.close(); + } + final byte[] classData = data; // Now get the CodeSource final CodeSource source = resource.getCodeSource(); @@ -620,18 +620,18 @@ public class URLClassLoader extends SecureClassLoader Certificate[] resourceCertificates = resource.getCertificates(); if(resourceCertificates != null) super.setSigners(result, resourceCertificates); - + return result; } catch (IOException ioe) { - throw new ClassNotFoundException(className + " not found in " + this, ioe); + throw new ClassNotFoundException(className + " not found in " + this, ioe); } } - + // Cached String representation of this URLClassLoader private String thisString; - + /** * Returns a String representation of this URLClassLoader giving the * actual Class name, the URLs that are searched and the parent @@ -641,25 +641,25 @@ public class URLClassLoader extends SecureClassLoader { synchronized (this) { - if (thisString == null) - { - CPStringBuilder sb = new CPStringBuilder(); - sb.append(this.getClass().getName()); - sb.append("{urls=[" ); - URL[] thisURLs = getURLs(); - for (int i = 0; i < thisURLs.length; i++) - { - sb.append(thisURLs[i]); - if (i < thisURLs.length - 1) - sb.append(','); - } - sb.append(']'); - sb.append(", parent="); - sb.append(getParent()); - sb.append('}'); - thisString = sb.toString(); - } - return thisString; + if (thisString == null) + { + CPStringBuilder sb = new CPStringBuilder(); + sb.append(this.getClass().getName()); + sb.append("{urls=[" ); + URL[] thisURLs = getURLs(); + for (int i = 0; i < thisURLs.length; i++) + { + sb.append(thisURLs[i]); + if (i < thisURLs.length - 1) + sb.append(','); + } + sb.append(']'); + sb.append(", parent="); + sb.append(getParent()); + sb.append('}'); + thisString = sb.toString(); + } + return thisString; } } diff --git a/java/net/URLConnection.java b/java/net/URLConnection.java index 674058014..e9365a3e0 100644 --- a/java/net/URLConnection.java +++ b/java/net/URLConnection.java @@ -173,7 +173,7 @@ public abstract class URLConnection private static SimpleDateFormat[] dateFormats; private static boolean dateformats_initialized; - + /** * The connection timeout period. */ @@ -236,7 +236,7 @@ public abstract class URLConnection /** * Set the connection timeout speed, in milliseconds, or zero if the timeout - * is to be considered infinite. Note that in certain socket + * is to be considered infinite. Note that in certain socket * implementations/platforms this method may not have any effect. * * Throws an <code>IllegalArgumentException</code> if timeout < 0. @@ -270,7 +270,7 @@ public abstract class URLConnection /** * Set the read timeout, in milliseconds, or zero if the timeout - * is to be considered infinite. Note that in certain socket + * is to be considered infinite. Note that in certain socket * implementations/platforms this method may not have any effect. * * Throws an <code>IllegalArgumentException</code> if timeout < 0. @@ -368,7 +368,7 @@ public abstract class URLConnection /** * Return a String representing the header value at the specified index. * This allows the caller to walk the list of header fields. The analogous - * {@link #getHeaderField(int)} method allows access to the corresponding + * {@link #getHeaderField(int)} method allows access to the corresponding * key for this header field * * @param index The index into the header field list to retrieve the value for @@ -397,8 +397,8 @@ public abstract class URLConnection /** * Returns an unmodifiable Map containing all sent header fields. - * - * @return The map of header fields. The map consists of String keys with + * + * @return The map of header fields. The map consists of String keys with * an unmodifiable List of String objects as value. * * @since 1.4 @@ -430,11 +430,11 @@ public abstract class URLConnection try { - return Integer.parseInt(value); + return Integer.parseInt(value); } catch (NumberFormatException e) { - return defaultValue; + return defaultValue; } } @@ -463,15 +463,15 @@ public abstract class URLConnection if (str != null) { - for (int i = 0; i < dateFormats.length; i++) - { - SimpleDateFormat df = dateFormats[i]; - position.setIndex(0); - position.setErrorIndex(0); - Date date = df.parse(str, position); - if (date != null) - return date.getTime(); - } + for (int i = 0; i < dateFormats.length; i++) + { + SimpleDateFormat df = dateFormats[i]; + position.setIndex(0); + position.setErrorIndex(0); + Date date = df.parse(str, position); + if (date != null) + return date.getTime(); + } } return result; @@ -480,7 +480,7 @@ public abstract class URLConnection /** * Returns a String representing the header key at the specified index. * This allows the caller to walk the list of header fields. The analogous - * {@link #getHeaderField(int)} method allows access to the corresponding + * {@link #getHeaderField(int)} method allows access to the corresponding * value for this tag. * * @param index The index into the header field list to retrieve the key for. @@ -527,7 +527,7 @@ public abstract class URLConnection connect(); // FIXME: Doc indicates that other criteria should be applied as - // heuristics to determine the true content type, e.g. see + // heuristics to determine the true content type, e.g. see // guessContentTypeFromName() and guessContentTypeFromStream methods // as well as FileNameMap class & fileNameMap field & get/set methods. String type = getContentType(); @@ -698,7 +698,7 @@ public abstract class URLConnection { if (connected) throw new IllegalStateException("Already connected"); - + allowUserInteraction = allow; } @@ -820,8 +820,8 @@ public abstract class URLConnection } /** - * Sets the value of the named request property. - * This method does overwrite the value of existing properties with + * Sets the value of the named request property. + * This method does overwrite the value of existing properties with * the new value. * * @param key The name of the property @@ -898,8 +898,8 @@ public abstract class URLConnection /** * Returns an unmodifiable Map containing the request properties. - * - * @return The map of properties. The map consists of String keys with an + * + * @return The map of properties. The map consists of String keys with an * unmodifiable List of String objects as value. * * @exception IllegalStateException If already connected @@ -1074,11 +1074,11 @@ public abstract class URLConnection handler = factory.createContentHandler(contentType); // Now try default factory. Using this factory to instantiate built-in - // content handlers is preferable + // content handlers is preferable if (handler == null) handler = defaultFactory.createContentHandler(contentType); - // User-set factory has not returned a handler. Use the default search + // User-set factory has not returned a handler. Use the default search // algorithm. if (handler == null) { @@ -1103,7 +1103,7 @@ public abstract class URLConnection { if (cArray[i] == '/') cArray[i] = '.'; - else if (! ((cArray[i] >= 'A' && cArray[i] <= 'Z') || + else if (! ((cArray[i] >= 'A' && cArray[i] <= 'Z') || (cArray[i] >= 'a' && cArray[i] <= 'z') || (cArray[i] >= '0' && cArray[i] <= '9'))) cArray[i] = '_'; @@ -1129,7 +1129,7 @@ public abstract class URLConnection return handler; } - + // We don't put these in a static initializer, because it creates problems // with initializer co-dependency: SimpleDateFormat's constructors // eventually depend on URLConnection (via the java.text.*Symbols classes). diff --git a/java/net/URLDecoder.java b/java/net/URLDecoder.java index fb7ab5916..73cedea5c 100644 --- a/java/net/URLDecoder.java +++ b/java/net/URLDecoder.java @@ -87,12 +87,12 @@ public class URLDecoder { try { - return decode(s, "UTF-8"); + return decode(s, "UTF-8"); } catch (UnsupportedEncodingException uee) { - // Should never happen since UTF-8 encoding should always be supported - return s; + // Should never happen since UTF-8 encoding should always be supported + return s; } } @@ -132,45 +132,45 @@ public class URLDecoder CPStringBuilder result = new CPStringBuilder(length); while ((i = str.indexOf('%', start)) >= 0) { - // Add all non-encoded characters to the result buffer - result.append(str.substring(start, i)); - start = i; - - // Get all consecutive encoded bytes - while ((i + 2 < length) && (str.charAt(i) == '%')) - i += 3; - - // Decode all these bytes - if ((bytes == null) || (bytes.length < ((i - start) / 3))) - bytes = new byte[((i - start) / 3)]; - - int index = 0; - try - { - while (start < i) - { - String sub = str.substring(start + 1, start + 3); - bytes[index] = (byte) Integer.parseInt(sub, 16); - index++; - start += 3; - } - } - catch (NumberFormatException nfe) - { - // One of the hex encoded strings was bad - } - - // Add the bytes as characters according to the given encoding - result.append(new String(bytes, 0, index, encoding)); - - // Make sure we skip to just after a % sign - // There might not have been enough encoded characters after the % - // or the hex chars were not actually hex chars (NumberFormatException) - if (start < length && s.charAt(start) == '%') - { - result.append('%'); - start++; - } + // Add all non-encoded characters to the result buffer + result.append(str.substring(start, i)); + start = i; + + // Get all consecutive encoded bytes + while ((i + 2 < length) && (str.charAt(i) == '%')) + i += 3; + + // Decode all these bytes + if ((bytes == null) || (bytes.length < ((i - start) / 3))) + bytes = new byte[((i - start) / 3)]; + + int index = 0; + try + { + while (start < i) + { + String sub = str.substring(start + 1, start + 3); + bytes[index] = (byte) Integer.parseInt(sub, 16); + index++; + start += 3; + } + } + catch (NumberFormatException nfe) + { + // One of the hex encoded strings was bad + } + + // Add the bytes as characters according to the given encoding + result.append(new String(bytes, 0, index, encoding)); + + // Make sure we skip to just after a % sign + // There might not have been enough encoded characters after the % + // or the hex chars were not actually hex chars (NumberFormatException) + if (start < length && s.charAt(start) == '%') + { + result.append('%'); + start++; + } } // Add any characters left diff --git a/java/net/URLEncoder.java b/java/net/URLEncoder.java index 89d9a0bd0..09c0f3de0 100644 --- a/java/net/URLEncoder.java +++ b/java/net/URLEncoder.java @@ -83,14 +83,14 @@ public class URLEncoder { try { - // We default to 8859_1 for compatibility with the same - // default elsewhere in the library. - return encode(s, System.getProperty("file.encoding", "8859_1")); + // We default to 8859_1 for compatibility with the same + // default elsewhere in the library. + return encode(s, System.getProperty("file.encoding", "8859_1")); } catch (UnsupportedEncodingException uee) { - // Should never happen since default should always be supported - return s; + // Should never happen since default should always be supported + return s; } } @@ -118,40 +118,40 @@ public class URLEncoder CPStringBuilder result = new CPStringBuilder(length); while (true) { - while (i < length && isSafe(s.charAt(i))) - i++; - - // Safe character can just be added - result.append(s.substring(start, i)); - - // Are we done? - if (i >= length) - return result.toString(); - else if (s.charAt(i) == ' ') - { - result.append('+'); // Replace space char with plus symbol. - i++; - } - else - { - // Get all unsafe characters - start = i; - char c; - while (i < length && (c = s.charAt(i)) != ' ' && ! isSafe(c)) - i++; - - // Convert them to %XY encoded strings - String unsafe = s.substring(start, i); - byte[] bytes = unsafe.getBytes(encoding); - for (int j = 0; j < bytes.length; j++) - { - result.append('%'); - int val = bytes[j]; - result.append(hex.charAt((val & 0xf0) >> 4)); - result.append(hex.charAt(val & 0x0f)); - } - } - start = i; + while (i < length && isSafe(s.charAt(i))) + i++; + + // Safe character can just be added + result.append(s.substring(start, i)); + + // Are we done? + if (i >= length) + return result.toString(); + else if (s.charAt(i) == ' ') + { + result.append('+'); // Replace space char with plus symbol. + i++; + } + else + { + // Get all unsafe characters + start = i; + char c; + while (i < length && (c = s.charAt(i)) != ' ' && ! isSafe(c)) + i++; + + // Convert them to %XY encoded strings + String unsafe = s.substring(start, i); + byte[] bytes = unsafe.getBytes(encoding); + for (int j = 0; j < bytes.length; j++) + { + result.append('%'); + int val = bytes[j]; + result.append(hex.charAt((val & 0xf0) >> 4)); + result.append(hex.charAt(val & 0x0f)); + } + } + start = i; } } diff --git a/java/net/URLStreamHandler.java b/java/net/URLStreamHandler.java index 4748191e0..5433aedd9 100644 --- a/java/net/URLStreamHandler.java +++ b/java/net/URLStreamHandler.java @@ -131,69 +131,69 @@ public abstract class URLStreamHandler String userInfo = url.getUserInfo(); String authority = url.getAuthority(); String query = null; - + // On Windows we need to change \ to / for file URLs char separator = File.separatorChar; if (url.getProtocol().equals("file") && separator != '/') { - file = file.replace(separator, '/'); - spec = spec.replace(separator, '/'); + file = file.replace(separator, '/'); + spec = spec.replace(separator, '/'); } if (spec.regionMatches(start, "//", 0, 2)) { - String genuineHost; - int hostEnd; - int colon; - int at_host; - - start += 2; - int slash = spec.indexOf('/', start); - if (slash >= 0) - hostEnd = slash; - else - hostEnd = end; - - authority = host = spec.substring(start, hostEnd); - - // We first need a genuine host name (with userinfo). - // So we check for '@': if it's present check the port in the - // section after '@' in the other case check it in the full string. - // P.S.: We don't care having '@' at the beginning of the string. - if ((at_host = host.indexOf('@')) >= 0) - { - genuineHost = host.substring(at_host); - userInfo = host.substring(0, at_host); - } - else - genuineHost = host; - - // Look for optional port number. It is valid for the non-port - // part of the host name to be null (e.g. a URL "http://:80"). - // TBD: JDK 1.2 in this case sets host to null rather than ""; - // this is undocumented and likely an unintended side effect in 1.2 - // so we'll be simple here and stick with "". Note that - // "http://" or "http:///" produce a "" host in JDK 1.2. - if ((colon = genuineHost.indexOf(':')) >= 0) - { - try - { - port = Integer.parseInt(genuineHost.substring(colon + 1)); - } - catch (NumberFormatException e) - { - // Ignore invalid port values; port is already set to u's - // port. - } - - // Now we must cut the port number in the original string. - if (at_host >= 0) - host = host.substring(0, at_host + colon); - else - host = host.substring(0, colon); - } - file = null; - start = hostEnd; + String genuineHost; + int hostEnd; + int colon; + int at_host; + + start += 2; + int slash = spec.indexOf('/', start); + if (slash >= 0) + hostEnd = slash; + else + hostEnd = end; + + authority = host = spec.substring(start, hostEnd); + + // We first need a genuine host name (with userinfo). + // So we check for '@': if it's present check the port in the + // section after '@' in the other case check it in the full string. + // P.S.: We don't care having '@' at the beginning of the string. + if ((at_host = host.indexOf('@')) >= 0) + { + genuineHost = host.substring(at_host); + userInfo = host.substring(0, at_host); + } + else + genuineHost = host; + + // Look for optional port number. It is valid for the non-port + // part of the host name to be null (e.g. a URL "http://:80"). + // TBD: JDK 1.2 in this case sets host to null rather than ""; + // this is undocumented and likely an unintended side effect in 1.2 + // so we'll be simple here and stick with "". Note that + // "http://" or "http:///" produce a "" host in JDK 1.2. + if ((colon = genuineHost.indexOf(':')) >= 0) + { + try + { + port = Integer.parseInt(genuineHost.substring(colon + 1)); + } + catch (NumberFormatException e) + { + // Ignore invalid port values; port is already set to u's + // port. + } + + // Now we must cut the port number in the original string. + if (at_host >= 0) + host = host.substring(0, at_host + colon); + else + host = host.substring(0, colon); + } + file = null; + start = hostEnd; } else if (host == null) host = ""; @@ -201,49 +201,49 @@ public abstract class URLStreamHandler if (file == null || file.length() == 0 || (start < end && spec.charAt(start) == '/')) { - // No file context available; just spec for file. - // Or this is an absolute path name; ignore any file context. - file = spec.substring(start, end); - ref = null; + // No file context available; just spec for file. + // Or this is an absolute path name; ignore any file context. + file = spec.substring(start, end); + ref = null; } else if (start < end) { - // Context is available, but only override it if there is a new file. - int lastSlash = file.lastIndexOf('/'); - if (lastSlash < 0) - file = spec.substring(start, end); - else - file = (file.substring(0, lastSlash) - + '/' + spec.substring(start, end)); - - // For URLs constructed relative to a context, we - // need to canonicalise the file path. - file = canonicalizeFilename(file); - - ref = null; + // Context is available, but only override it if there is a new file. + int lastSlash = file.lastIndexOf('/'); + if (lastSlash < 0) + file = spec.substring(start, end); + else + file = (file.substring(0, lastSlash) + + '/' + spec.substring(start, end)); + + // For URLs constructed relative to a context, we + // need to canonicalise the file path. + file = canonicalizeFilename(file); + + ref = null; } if (ref == null) { - // Normally there should be no '#' in the file part, - // but we are nice. - int hash = file.indexOf('#'); - if (hash != -1) - { - ref = file.substring(hash + 1, file.length()); - file = file.substring(0, hash); - } + // Normally there should be no '#' in the file part, + // but we are nice. + int hash = file.indexOf('#'); + if (hash != -1) + { + ref = file.substring(hash + 1, file.length()); + file = file.substring(0, hash); + } } // We care about the query tag only if there is no reference at all. if (ref == null) { - int queryTag = file.indexOf('?'); - if (queryTag != -1) - { - query = file.substring(queryTag + 1); - file = file.substring(0, queryTag); - } + int queryTag = file.indexOf('?'); + if (queryTag != -1) + { + query = file.substring(queryTag + 1); + file = file.substring(0, queryTag); + } } // XXX - Classpath used to call PlatformHelper.toCanonicalForm() on @@ -270,12 +270,12 @@ public abstract class URLStreamHandler // the general case, but it's probably not bad most of the time. while ((index = file.indexOf("/../")) >= 0) { - // Strip of the previous directory - if it exists. - int previous = file.lastIndexOf('/', index - 1); - if (previous >= 0) - file = file.substring(0, previous) + file.substring(index + 3); - else - break; + // Strip of the previous directory - if it exists. + int previous = file.lastIndexOf('/', index - 1); + if (previous >= 0) + file = file.substring(0, previous) + file.substring(index + 3); + else + break; } return file; } @@ -451,11 +451,11 @@ public abstract class URLStreamHandler try { - return InetAddress.getByName(hostname); + return InetAddress.getByName(hostname); } catch (UnknownHostException e) { - return null; + return null; } } @@ -505,7 +505,7 @@ public abstract class URLStreamHandler authority = url.getAuthority(); if (authority == null) authority = ""; - + file = url.getFile(); ref = url.getRef(); @@ -516,15 +516,15 @@ public abstract class URLStreamHandler if (protocol.length() > 0) { - sb.append(protocol); - sb.append(":"); + sb.append(protocol); + sb.append(":"); } - + // If we have superfluous leading slashes (that means, at least 2) // we always add the authority component ("//" + host) to // avoid ambiguity. Otherwise we would generate an URL like // proto://home/foo - // where we meant: + // where we meant: // host: <empty> - file: //home/foo // but URL spec says it is: // host: home - file: /foo |