Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f9c0499e
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f9c0499e
编写于
5月 18, 2011
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
4b939f2a
f490bba9
变更
150
显示空白变更内容
内联
并排
Showing
150 changed file
with
2733 addition
and
683 deletion
+2733
-683
make/com/sun/nio/sctp/FILES_java.gmk
make/com/sun/nio/sctp/FILES_java.gmk
+1
-1
make/java/management/mapfile-vers
make/java/management/mapfile-vers
+1
-0
make/java/nio/FILES_java.gmk
make/java/nio/FILES_java.gmk
+2
-2
make/sun/xawt/mapfile-vers
make/sun/xawt/mapfile-vers
+0
-1
src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java
...com/sun/management/GarbageCollectionNotificationInfo.java
+237
-0
src/share/classes/com/sun/nio/sctp/MessageInfo.java
src/share/classes/com/sun/nio/sctp/MessageInfo.java
+2
-2
src/share/classes/com/sun/nio/sctp/SctpChannel.java
src/share/classes/com/sun/nio/sctp/SctpChannel.java
+15
-15
src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
+15
-15
src/share/classes/com/sun/nio/sctp/SctpServerChannel.java
src/share/classes/com/sun/nio/sctp/SctpServerChannel.java
+3
-3
src/share/classes/com/sun/nio/sctp/SctpSocketOption.java
src/share/classes/com/sun/nio/sctp/SctpSocketOption.java
+1
-1
src/share/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java
...e/classes/com/sun/nio/sctp/SctpStandardSocketOptions.java
+7
-7
src/share/classes/java/awt/Component.java
src/share/classes/java/awt/Component.java
+6
-5
src/share/classes/java/awt/Container.java
src/share/classes/java/awt/Container.java
+25
-9
src/share/classes/java/awt/Toolkit.java
src/share/classes/java/awt/Toolkit.java
+27
-41
src/share/classes/java/lang/SafeVarargs.java
src/share/classes/java/lang/SafeVarargs.java
+20
-8
src/share/classes/java/lang/Throwable.java
src/share/classes/java/lang/Throwable.java
+29
-8
src/share/classes/java/net/SocketOption.java
src/share/classes/java/net/SocketOption.java
+1
-1
src/share/classes/java/net/StandardSocketOptions.java
src/share/classes/java/net/StandardSocketOptions.java
+2
-2
src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java
...es/java/nio/channels/AsynchronousServerSocketChannel.java
+2
-2
src/share/classes/java/nio/channels/AsynchronousSocketChannel.java
.../classes/java/nio/channels/AsynchronousSocketChannel.java
+5
-5
src/share/classes/java/nio/channels/DatagramChannel.java
src/share/classes/java/nio/channels/DatagramChannel.java
+8
-8
src/share/classes/java/nio/channels/MulticastChannel.java
src/share/classes/java/nio/channels/MulticastChannel.java
+4
-4
src/share/classes/java/nio/channels/NetworkChannel.java
src/share/classes/java/nio/channels/NetworkChannel.java
+2
-2
src/share/classes/java/nio/channels/ServerSocketChannel.java
src/share/classes/java/nio/channels/ServerSocketChannel.java
+2
-2
src/share/classes/java/nio/channels/SocketChannel.java
src/share/classes/java/nio/channels/SocketChannel.java
+6
-6
src/share/classes/java/nio/charset/Charset.java
src/share/classes/java/nio/charset/Charset.java
+1
-1
src/share/classes/java/nio/charset/StandardCharsets.java
src/share/classes/java/nio/charset/StandardCharsets.java
+3
-3
src/share/classes/java/nio/file/Path.java
src/share/classes/java/nio/file/Path.java
+5
-5
src/share/classes/java/nio/file/StandardWatchEventKinds.java
src/share/classes/java/nio/file/StandardWatchEventKinds.java
+4
-4
src/share/classes/java/nio/file/WatchEvent.java
src/share/classes/java/nio/file/WatchEvent.java
+4
-4
src/share/classes/java/nio/file/WatchService.java
src/share/classes/java/nio/file/WatchService.java
+2
-2
src/share/classes/java/nio/file/Watchable.java
src/share/classes/java/nio/file/Watchable.java
+1
-1
src/share/classes/java/sql/BatchUpdateException.java
src/share/classes/java/sql/BatchUpdateException.java
+3
-3
src/share/classes/java/util/Formatter.java
src/share/classes/java/util/Formatter.java
+6
-6
src/share/classes/java/util/concurrent/Phaser.java
src/share/classes/java/util/concurrent/Phaser.java
+1
-1
src/share/classes/java/util/concurrent/locks/LockSupport.java
...share/classes/java/util/concurrent/locks/LockSupport.java
+4
-0
src/share/classes/java/util/logging/LogManager.java
src/share/classes/java/util/logging/LogManager.java
+27
-4
src/share/classes/java/util/logging/Logger.java
src/share/classes/java/util/logging/Logger.java
+22
-3
src/share/classes/java/util/regex/Pattern.java
src/share/classes/java/util/regex/Pattern.java
+1
-1
src/share/classes/java/util/zip/ZipCoder.java
src/share/classes/java/util/zip/ZipCoder.java
+4
-4
src/share/classes/java/util/zip/ZipFile.java
src/share/classes/java/util/zip/ZipFile.java
+2
-2
src/share/classes/java/util/zip/ZipInputStream.java
src/share/classes/java/util/zip/ZipInputStream.java
+2
-2
src/share/classes/java/util/zip/ZipOutputStream.java
src/share/classes/java/util/zip/ZipOutputStream.java
+2
-2
src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html
...asses/javax/imageio/metadata/doc-files/jpeg_metadata.html
+31
-4
src/share/classes/javax/management/loading/package.html
src/share/classes/javax/management/loading/package.html
+2
-2
src/share/classes/javax/management/modelmbean/package.html
src/share/classes/javax/management/modelmbean/package.html
+2
-2
src/share/classes/javax/management/monitor/package.html
src/share/classes/javax/management/monitor/package.html
+2
-2
src/share/classes/javax/management/openmbean/package.html
src/share/classes/javax/management/openmbean/package.html
+2
-2
src/share/classes/javax/management/package.html
src/share/classes/javax/management/package.html
+2
-2
src/share/classes/javax/management/relation/package.html
src/share/classes/javax/management/relation/package.html
+2
-2
src/share/classes/javax/management/remote/package.html
src/share/classes/javax/management/remote/package.html
+2
-2
src/share/classes/javax/management/timer/Timer.java
src/share/classes/javax/management/timer/Timer.java
+5
-1
src/share/classes/javax/swing/ComboBoxModel.java
src/share/classes/javax/swing/ComboBoxModel.java
+3
-1
src/share/classes/javax/swing/DefaultComboBoxModel.java
src/share/classes/javax/swing/DefaultComboBoxModel.java
+11
-22
src/share/classes/javax/swing/JComboBox.java
src/share/classes/javax/swing/JComboBox.java
+37
-35
src/share/classes/javax/swing/MutableComboBoxModel.java
src/share/classes/javax/swing/MutableComboBoxModel.java
+8
-6
src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
...e/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
+1
-1
src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
...re/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
+2
-2
src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
...are/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
+12
-0
src/share/classes/sun/awt/FontDescriptor.java
src/share/classes/sun/awt/FontDescriptor.java
+3
-3
src/share/classes/sun/java2d/opengl/OGLRenderer.java
src/share/classes/sun/java2d/opengl/OGLRenderer.java
+16
-2
src/share/classes/sun/java2d/pipe/AAShapePipe.java
src/share/classes/sun/java2d/pipe/AAShapePipe.java
+17
-13
src/share/classes/sun/java2d/pipe/AlphaColorPipe.java
src/share/classes/sun/java2d/pipe/AlphaColorPipe.java
+4
-0
src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java
src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java
+8
-0
src/share/classes/sun/java2d/pipe/LoopPipe.java
src/share/classes/sun/java2d/pipe/LoopPipe.java
+4
-0
src/share/classes/sun/java2d/pipe/ParallelogramPipe.java
src/share/classes/sun/java2d/pipe/ParallelogramPipe.java
+11
-1
src/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java
...lasses/sun/java2d/pipe/PixelToParallelogramConverter.java
+24
-12
src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java
...n/management/GarbageCollectionNotifInfoCompositeData.java
+219
-0
src/share/classes/sun/management/GarbageCollectorImpl.java
src/share/classes/sun/management/GarbageCollectorImpl.java
+104
-5
src/share/classes/sun/management/GcInfoCompositeData.java
src/share/classes/sun/management/GcInfoCompositeData.java
+44
-3
src/share/classes/sun/management/MemoryManagerImpl.java
src/share/classes/sun/management/MemoryManagerImpl.java
+14
-2
src/share/classes/sun/management/VMManagement.java
src/share/classes/sun/management/VMManagement.java
+1
-0
src/share/classes/sun/management/VMManagementImpl.java
src/share/classes/sun/management/VMManagementImpl.java
+6
-0
src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java
...asses/sun/nio/ch/AsynchronousServerSocketChannelImpl.java
+3
-3
src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java
...are/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java
+6
-6
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+16
-16
src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
+10
-10
src/share/classes/sun/nio/ch/ExtendedSocketOption.java
src/share/classes/sun/nio/ch/ExtendedSocketOption.java
+1
-1
src/share/classes/sun/nio/ch/NativeThreadSet.java
src/share/classes/sun/nio/ch/NativeThreadSet.java
+6
-1
src/share/classes/sun/nio/ch/Net.java
src/share/classes/sun/nio/ch/Net.java
+5
-5
src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
+4
-4
src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
+2
-2
src/share/classes/sun/nio/ch/SocketAdaptor.java
src/share/classes/sun/nio/ch/SocketAdaptor.java
+14
-14
src/share/classes/sun/nio/ch/SocketChannelImpl.java
src/share/classes/sun/nio/ch/SocketChannelImpl.java
+9
-9
src/share/classes/sun/nio/fs/AbstractPoller.java
src/share/classes/sun/nio/fs/AbstractPoller.java
+4
-4
src/share/classes/sun/nio/fs/AbstractWatchKey.java
src/share/classes/sun/nio/fs/AbstractWatchKey.java
+7
-7
src/share/classes/sun/nio/fs/PollingWatchService.java
src/share/classes/sun/nio/fs/PollingWatchService.java
+12
-12
src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
+0
-12
src/share/classes/sun/security/ssl/JsseJce.java
src/share/classes/sun/security/ssl/JsseJce.java
+3
-3
src/share/classes/sun/text/bidi/BidiBase.java
src/share/classes/sun/text/bidi/BidiBase.java
+0
-4
src/share/classes/sun/text/resources/BreakIteratorRules_th.java
...are/classes/sun/text/resources/BreakIteratorRules_th.java
+1
-11
src/share/javavm/export/jmm.h
src/share/javavm/export/jmm.h
+4
-1
src/share/native/sun/management/GarbageCollectorImpl.c
src/share/native/sun/management/GarbageCollectorImpl.c
+15
-1
src/share/native/sun/management/VMManagementImpl.c
src/share/native/sun/management/VMManagementImpl.c
+7
-0
src/share/native/sun/nio/ch/genSocketOptionRegistry.c
src/share/native/sun/nio/ch/genSocketOptionRegistry.c
+16
-16
src/share/sample/nio/chatserver/ChatServer.java
src/share/sample/nio/chatserver/ChatServer.java
+3
-3
src/share/sample/nio/file/WatchDir.java
src/share/sample/nio/file/WatchDir.java
+1
-1
src/share/sample/nio/multicast/Reader.java
src/share/sample/nio/multicast/Reader.java
+1
-1
src/share/sample/nio/multicast/Sender.java
src/share/sample/nio/multicast/Sender.java
+1
-1
src/solaris/classes/sun/awt/X11/XRobotPeer.java
src/solaris/classes/sun/awt/X11/XRobotPeer.java
+1
-2
src/solaris/classes/sun/nio/ch/SctpChannelImpl.java
src/solaris/classes/sun/nio/ch/SctpChannelImpl.java
+1
-1
src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java
src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java
+1
-1
src/solaris/classes/sun/nio/ch/SctpNet.java
src/solaris/classes/sun/nio/ch/SctpNet.java
+1
-1
src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java
src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java
+2
-2
src/solaris/classes/sun/nio/fs/LinuxWatchService.java
src/solaris/classes/sun/nio/fs/LinuxWatchService.java
+10
-10
src/solaris/classes/sun/nio/fs/SolarisWatchService.java
src/solaris/classes/sun/nio/fs/SolarisWatchService.java
+9
-9
src/solaris/native/sun/awt/awt_Robot.c
src/solaris/native/sun/awt/awt_Robot.c
+3
-104
src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
+11
-10
src/windows/classes/sun/awt/windows/WFramePeer.java
src/windows/classes/sun/awt/windows/WFramePeer.java
+10
-2
src/windows/classes/sun/java2d/d3d/D3DRenderer.java
src/windows/classes/sun/java2d/d3d/D3DRenderer.java
+16
-2
src/windows/classes/sun/nio/fs/WindowsWatchService.java
src/windows/classes/sun/nio/fs/WindowsWatchService.java
+5
-5
src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp
src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp
+8
-0
src/windows/native/sun/security/mscapi/security.cpp
src/windows/native/sun/security/mscapi/security.cpp
+1
-1
src/windows/native/sun/windows/Devices.h
src/windows/native/sun/windows/Devices.h
+1
-1
src/windows/native/sun/windows/awt_Choice.cpp
src/windows/native/sun/windows/awt_Choice.cpp
+6
-0
src/windows/native/sun/windows/awt_Component.cpp
src/windows/native/sun/windows/awt_Component.cpp
+0
-1
src/windows/native/sun/windows/awt_Frame.cpp
src/windows/native/sun/windows/awt_Frame.cpp
+0
-11
test/ProblemList.txt
test/ProblemList.txt
+3
-0
test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java
...ectorMXBean/GarbageCollectionNotificationContentTest.java
+163
-0
test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java
...ageCollectorMXBean/GarbageCollectionNotificationTest.java
+128
-0
test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java
test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java
+1
-1
test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java
.../com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java
+1
-1
test/java/awt/Component/Revalidate/Revalidate.java
test/java/awt/Component/Revalidate/Revalidate.java
+1
-1
test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java
...iner/ValidateRoot/InvalidateMustRespectValidateRoots.java
+1
-1
test/java/awt/Paint/PgramUserBoundsTest.java
test/java/awt/Paint/PgramUserBoundsTest.java
+126
-0
test/java/awt/Toolkit/Headless/ExceptionContract/ExceptionContract.java
...Toolkit/Headless/ExceptionContract/ExceptionContract.java
+336
-0
test/java/awt/geom/Arc2D/SerializationTest.java
test/java/awt/geom/Arc2D/SerializationTest.java
+100
-0
test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java
...a/nio/channels/AsynchronousServerSocketChannel/Basic.java
+1
-1
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
+2
-2
test/java/nio/channels/DatagramChannel/BasicMulticastTests.java
...ava/nio/channels/DatagramChannel/BasicMulticastTests.java
+2
-2
test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java
...o/channels/DatagramChannel/MulticastSendReceiveTests.java
+2
-2
test/java/nio/channels/DatagramChannel/SocketOptionTests.java
.../java/nio/channels/DatagramChannel/SocketOptionTests.java
+1
-1
test/java/nio/channels/FileChannel/ClosedByInterrupt.java
test/java/nio/channels/FileChannel/ClosedByInterrupt.java
+10
-5
test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java
...a/nio/channels/ServerSocketChannel/SocketOptionTests.java
+1
-1
test/java/nio/channels/SocketChannel/Shutdown.java
test/java/nio/channels/SocketChannel/Shutdown.java
+1
-1
test/java/nio/channels/SocketChannel/SocketOptionTests.java
test/java/nio/channels/SocketChannel/SocketOptionTests.java
+1
-1
test/java/nio/charset/StandardCharsets/Standard.java
test/java/nio/charset/StandardCharsets/Standard.java
+14
-14
test/java/nio/file/Files/CheckPermissions.java
test/java/nio/file/Files/CheckPermissions.java
+1
-1
test/java/nio/file/WatchService/Basic.java
test/java/nio/file/WatchService/Basic.java
+7
-7
test/java/nio/file/WatchService/FileTreeModifier.java
test/java/nio/file/WatchService/FileTreeModifier.java
+1
-1
test/java/nio/file/WatchService/LotsOfEvents.java
test/java/nio/file/WatchService/LotsOfEvents.java
+1
-1
test/java/nio/file/WatchService/SensitivityModifier.java
test/java/nio/file/WatchService/SensitivityModifier.java
+1
-1
test/java/nio/file/WatchService/WithSecurityManager.java
test/java/nio/file/WatchService/WithSecurityManager.java
+1
-1
test/java/text/Bidi/Bug7041232.java
test/java/text/Bidi/Bug7041232.java
+48
-0
test/java/util/logging/LoggingDeadlock3.java
test/java/util/logging/LoggingDeadlock3.java
+81
-0
test/java/util/logging/LoggingDeadlock3.props
test/java/util/logging/LoggingDeadlock3.props
+3
-0
test/java/util/logging/LoggingDeadlock4.java
test/java/util/logging/LoggingDeadlock4.java
+111
-0
test/javax/management/timer/StartTest.java
test/javax/management/timer/StartTest.java
+98
-0
test/javax/swing/JComboBox/7031551/bug7031551.java
test/javax/swing/JComboBox/7031551/bug7031551.java
+123
-0
test/javax/swing/JTable/6788484/bug6788484.java
test/javax/swing/JTable/6788484/bug6788484.java
+9
-1
未找到文件。
make/com/sun/nio/sctp/FILES_java.gmk
浏览文件 @
f9c0499e
...
...
@@ -38,7 +38,7 @@ FILES_java = \
com/sun/nio/sctp/SctpMultiChannel.java \
com/sun/nio/sctp/SctpServerChannel.java \
com/sun/nio/sctp/SctpSocketOption.java \
com/sun/nio/sctp/SctpStandardSocketOption.java \
com/sun/nio/sctp/SctpStandardSocketOption
s
.java \
com/sun/nio/sctp/SendFailedNotification.java \
com/sun/nio/sctp/ShutdownNotification.java \
\
...
...
make/java/management/mapfile-vers
浏览文件 @
f9c0499e
...
...
@@ -49,6 +49,7 @@ SUNWprivate_1.1 {
Java_sun_management_Flag_setStringValue;
Java_sun_management_GarbageCollectorImpl_getCollectionCount;
Java_sun_management_GarbageCollectorImpl_getCollectionTime;
Java_sun_management_GarbageCollectorImpl_setNotificationEnabled;
Java_sun_management_GcInfoBuilder_fillGcAttributeInfo;
Java_sun_management_GcInfoBuilder_getLastGcInfo0;
Java_sun_management_GcInfoBuilder_getNumGcExtAttributes;
...
...
make/java/nio/FILES_java.gmk
浏览文件 @
f9c0499e
...
...
@@ -71,7 +71,7 @@ FILES_src = \
java/nio/charset/CoderMalfunctionError.java \
java/nio/charset/CodingErrorAction.java \
java/nio/charset/MalformedInputException.java \
java/nio/charset/StandardCharset.java \
java/nio/charset/StandardCharset
s
.java \
java/nio/charset/UnmappableCharacterException.java \
\
java/nio/charset/spi/CharsetProvider.java \
...
...
@@ -116,7 +116,7 @@ FILES_src = \
java/nio/file/SimpleFileVisitor.java \
java/nio/file/StandardCopyOption.java \
java/nio/file/StandardOpenOption.java \
java/nio/file/StandardWatchEventKind.java \
java/nio/file/StandardWatchEventKind
s
.java \
java/nio/file/TempFileHelper.java \
java/nio/file/WatchEvent.java \
java/nio/file/WatchKey.java \
...
...
make/sun/xawt/mapfile-vers
浏览文件 @
f9c0499e
...
...
@@ -158,7 +158,6 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
Java_sun_awt_X11_XRobotPeer_setup;
Java_sun_awt_X11_XRobotPeer__1dispose;
Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
Java_java_awt_Component_initIDs;
Java_java_awt_Container_initIDs;
...
...
src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
com.sun.management
;
import
javax.management.Notification
;
import
javax.management.openmbean.CompositeData
;
import
javax.management.openmbean.CompositeDataView
;
import
javax.management.openmbean.CompositeType
;
import
java.util.Collection
;
import
java.util.Collections
;
import
sun.management.GarbageCollectionNotifInfoCompositeData
;
/**
* The information about a garbage collection
*
* <p>
* A garbage collection notification is emitted by {@link GarbageCollectorMXBean}
* when the Java virtual machine completes a garbage collection action
* The notification emitted will contain the garbage collection notification
* information about the status of the memory:
* <u1>
* <li>The name of the garbage collector used perform the collection.</li>
* <li>The action performed by the garbage collector.</li>
* <li>The cause of the garbage collection action.</li>
* <li>A {@link GcInfo} object containing some statistics about the GC cycle
(start time, end time) and the memory usage before and after
the GC cycle.</li>
* </u1>
*
* <p>
* A {@link CompositeData CompositeData} representing
* the {@code GarbageCollectionNotificationInfo} object
* is stored in the
* {@linkplain javax.management.Notification#setUserData userdata}
* of a {@linkplain javax.management.Notification notification}.
* The {@link #from from} method is provided to convert from
* a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo}
* object. For example:
*
* <blockquote><pre>
* Notification notif;
*
* // receive the notification emitted by a GarbageCollectorMXBean and set to notif
* ...
*
* String notifType = notif.getType();
* if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
* // retrieve the garbage collection notification information
* CompositeData cd = (CompositeData) notif.getUserData();
* GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
* ....
* }
* </pre></blockquote>
*
* <p>
* The type of the notification emitted by a {@code GarbageCollectorMXBean} is:
* <ul>
* <li>A {@linkplain #GARBAGE_COLLECTION_NOTIFICATION garbage collection notification}.
* <br>Used by every notification emitted by the garbage collector, the details about
* the notification are provided in the {@linkplain #getGcAction action} String
* <p></li>
* </ul>
**/
public
class
GarbageCollectionNotificationInfo
implements
CompositeDataView
{
private
final
String
gcName
;
private
final
String
gcAction
;
private
final
String
gcCause
;
private
final
GcInfo
gcInfo
;
private
final
CompositeData
cdata
;
/**
* Notification type denoting that
* the Java virtual machine has completed a garbage collection cycle.
* This notification is emitted by a {@link GarbageCollectorMXBean}.
* The value of this notification type is
* {@code com.sun.management.gc.notification}.
*/
public
static
final
String
GARBAGE_COLLECTION_NOTIFICATION
=
"com.sun.management.gc.notification"
;
/**
* Constructs a {@code GarbageCollectionNotificationInfo} object.
*
* @param gcName The name of the garbage collector used to perform the collection
* @param gcAction The name of the action performed by the garbage collector
* @param gcCause The cause the garbage collection action
* @param gcInfo a GcInfo object providing statistics about the GC cycle
*/
public
GarbageCollectionNotificationInfo
(
String
gcName
,
String
gcAction
,
String
gcCause
,
GcInfo
gcInfo
)
{
if
(
gcName
==
null
)
{
throw
new
NullPointerException
(
"Null gcName"
);
}
if
(
gcAction
==
null
)
{
throw
new
NullPointerException
(
"Null gcAction"
);
}
if
(
gcCause
==
null
)
{
throw
new
NullPointerException
(
"Null gcCause"
);
}
this
.
gcName
=
gcName
;
this
.
gcAction
=
gcAction
;
this
.
gcCause
=
gcCause
;
this
.
gcInfo
=
gcInfo
;
this
.
cdata
=
new
GarbageCollectionNotifInfoCompositeData
(
this
);
}
GarbageCollectionNotificationInfo
(
CompositeData
cd
)
{
GarbageCollectionNotifInfoCompositeData
.
validateCompositeData
(
cd
);
this
.
gcName
=
GarbageCollectionNotifInfoCompositeData
.
getGcName
(
cd
);
this
.
gcAction
=
GarbageCollectionNotifInfoCompositeData
.
getGcAction
(
cd
);
this
.
gcCause
=
GarbageCollectionNotifInfoCompositeData
.
getGcCause
(
cd
);
this
.
gcInfo
=
GarbageCollectionNotifInfoCompositeData
.
getGcInfo
(
cd
);
this
.
cdata
=
cd
;
}
/**
* Returns the name of the garbage collector used to perform the collection
*
* @return the name of the garbage collector used to perform the collection
*/
public
String
getGcName
()
{
return
gcName
;
}
/**
* Returns the action of the performed by the garbage collector
*
* @return the the action of the performed by the garbage collector
*/
public
String
getGcAction
()
{
return
gcAction
;
}
/**
* Returns the cause the garbage collection
*
* @return the the cause the garbage collection
*/
public
String
getGcCause
()
{
return
gcCause
;
}
/**
* Returns the GC information related to the last garbage collection
*
* @return the GC information related to the
* last garbage collection
*/
public
GcInfo
getGcInfo
()
{
return
gcInfo
;
}
/**
* Returns a {@code GarbageCollectionNotificationInfo} object represented by the
* given {@code CompositeData}.
* The given {@code CompositeData} must contain
* the following attributes:
* <blockquote>
* <table border>
* <tr>
* <th align=left>Attribute Name</th>
* <th align=left>Type</th>
* </tr>
* <tr>
* <td>gcName</td>
* <td>{@code java.lang.String}</td>
* </tr>
* <tr>
* <td>gcAction</td>
* <td>{@code java.lang.String}</td>
* </tr>
* <tr>
* <td>gcCause</td>
* <td>{@code java.lang.String}</td>
* </tr>
* <tr>
* <td>gcInfo</td>
* <td>{@code javax.management.openmbean.CompositeData}</td>
* </tr>
* </table>
* </blockquote>
*
* @param cd {@code CompositeData} representing a
* {@code GarbageCollectionNotificationInfo}
*
* @throws IllegalArgumentException if {@code cd} does not
* represent a {@code GarbaageCollectionNotificationInfo} object.
*
* @return a {@code GarbageCollectionNotificationInfo} object represented
* by {@code cd} if {@code cd} is not {@code null};
* {@code null} otherwise.
*/
public
static
GarbageCollectionNotificationInfo
from
(
CompositeData
cd
)
{
if
(
cd
==
null
)
{
return
null
;
}
if
(
cd
instanceof
GarbageCollectionNotifInfoCompositeData
)
{
return
((
GarbageCollectionNotifInfoCompositeData
)
cd
).
getGarbageCollectionNotifInfo
();
}
else
{
return
new
GarbageCollectionNotificationInfo
(
cd
);
}
}
public
CompositeData
toCompositeData
(
CompositeType
ct
)
{
return
cdata
;
}
}
src/share/classes/com/sun/nio/sctp/MessageInfo.java
浏览文件 @
f9c0499e
...
...
@@ -179,7 +179,7 @@ public abstract class MessageInfo {
* completely received. For messages being sent {@code true} indicates that
* the message is complete, {@code false} indicates that the message is not
* complete. How the send channel interprets this value depends on the value
* of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
* of its {@link SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE
* SCTP_EXPLICIT_COMPLETE} socket option.
*
* @return {@code true} if, and only if, the message is complete
...
...
@@ -192,7 +192,7 @@ public abstract class MessageInfo {
* <P> For messages being sent {@code true} indicates that
* the message is complete, {@code false} indicates that the message is not
* complete. How the send channel interprets this value depends on the value
* of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
* of its {@link SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE
* SCTP_EXPLICIT_COMPLETE} socket option.
*
* @param complete
...
...
src/share/classes/com/sun/nio/sctp/SctpChannel.java
浏览文件 @
f9c0499e
...
...
@@ -65,55 +65,55 @@ import java.nio.channels.SelectionKey;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS
* <td> {@link SctpStandardSocketOption
s
#SCTP_DISABLE_FRAGMENTS
* SCTP_DISABLE_FRAGMENTS} </td>
* <td> Enables or disables message fragmentation </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
* <td> {@link SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE
* SCTP_EXPLICIT_COMPLETE} </td>
* <td> Enables or disables explicit message completion </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
* <td> {@link SctpStandardSocketOption
s
#SCTP_FRAGMENT_INTERLEAVE
* SCTP_FRAGMENT_INTERLEAVE} </td>
* <td> Controls how the presentation of messages occur for the message
* receiver </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
* <td> {@link SctpStandardSocketOption
s
#SCTP_INIT_MAXSTREAMS
* SCTP_INIT_MAXSTREAMS} </td>
* <td> The maximum number of streams requested by the local endpoint during
* association initialization </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} </td>
* <td> {@link SctpStandardSocketOption
s
#SCTP_NODELAY SCTP_NODELAY} </td>
* <td> Enables or disable a Nagle-like algorithm </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR
* <td> {@link SctpStandardSocketOption
s
#SCTP_PRIMARY_ADDR
* SCTP_PRIMARY_ADDR} </td>
* <td> Requests that the local SCTP stack use the given peer address as the
* association primary </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR
* <td> {@link SctpStandardSocketOption
s
#SCTP_SET_PEER_PRIMARY_ADDR
* SCTP_SET_PEER_PRIMARY_ADDR} </td>
* <td> Requests that the peer mark the enclosed address as the association
* primary </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SO_SNDBUF
* <td> {@link SctpStandardSocketOption
s
#SO_SNDBUF
* SO_SNDBUF} </td>
* <td> The size of the socket send buffer </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SO_RCVBUF
* <td> {@link SctpStandardSocketOption
s
#SO_RCVBUF
* SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SO_LINGER
* <td> {@link SctpStandardSocketOption
s
#SO_LINGER
* SO_LINGER} </td>
* <td> Linger on close if data is present (when configured in blocking mode
* only) </td>
...
...
@@ -449,7 +449,7 @@ public abstract class SctpChannel
* <P> This is a convience method and is equivalent to evaluating the
* following expression:
* <blockquote><pre>
* setOption(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
* setOption(SctpStandardSocketOption
s
.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
* .connect(remote);
* </pre></blockquote>
*
...
...
@@ -651,7 +651,7 @@ public abstract class SctpChannel
* @throws IOException
* If an I/O error occurs
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
abstract
<
T
>
T
getOption
(
SctpSocketOption
<
T
>
name
)
throws
IOException
;
...
...
@@ -680,7 +680,7 @@ public abstract class SctpChannel
* @throws IOException
* If an I/O error occurs
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
abstract
<
T
>
SctpChannel
setOption
(
SctpSocketOption
<
T
>
name
,
T
value
)
throws
IOException
;
...
...
@@ -731,7 +731,7 @@ public abstract class SctpChannel
* MessageInfo} will return {@code false}, and more invocations of this
* method will be necessary to completely consume the messgae. Only
* one message at a time will be partially delivered in any stream. The
* socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
* socket option {@link SctpStandardSocketOption
s
#SCTP_FRAGMENT_INTERLEAVE
* SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
* messages occurs.
*
...
...
@@ -804,7 +804,7 @@ public abstract class SctpChannel
* and sufficient room becomes available, then the remaining bytes in the
* given byte buffer are transmitted as a single message. Sending a message
* is atomic unless explicit message completion {@link
* SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
* SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
* socket option is enabled on this channel's socket.
*
* <P> The message is transferred from the byte buffer as if by a regular
...
...
src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
浏览文件 @
f9c0499e
...
...
@@ -69,55 +69,55 @@ import java.nio.channels.SelectionKey;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_DISABLE_FRAGMENTS
* <td> {@link SctpStandardSocketOption
s
#SCTP_DISABLE_FRAGMENTS
* SCTP_DISABLE_FRAGMENTS} </td>
* <td> Enables or disables message fragmentation </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE
* <td> {@link SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE
* SCTP_EXPLICIT_COMPLETE} </td>
* <td> Enables or disables explicit message completion </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
* <td> {@link SctpStandardSocketOption
s
#SCTP_FRAGMENT_INTERLEAVE
* SCTP_FRAGMENT_INTERLEAVE} </td>
* <td> Controls how the presentation of messages occur for the message
* receiver </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
* <td> {@link SctpStandardSocketOption
s
#SCTP_INIT_MAXSTREAMS
* SCTP_INIT_MAXSTREAMS} </td>
* <td> The maximum number of streams requested by the local endpoint during
* association initialization </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_NODELAY SCTP_NODELAY} </td>
* <td> {@link SctpStandardSocketOption
s
#SCTP_NODELAY SCTP_NODELAY} </td>
* <td> Enables or disable a Nagle-like algorithm </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_PRIMARY_ADDR
* <td> {@link SctpStandardSocketOption
s
#SCTP_PRIMARY_ADDR
* SCTP_PRIMARY_ADDR} </td>
* <td> Requests that the local SCTP stack use the given peer address as the
* association primary </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_SET_PEER_PRIMARY_ADDR
* <td> {@link SctpStandardSocketOption
s
#SCTP_SET_PEER_PRIMARY_ADDR
* SCTP_SET_PEER_PRIMARY_ADDR} </td>
* <td> Requests that the peer mark the enclosed address as the association
* primary </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SO_SNDBUF
* <td> {@link SctpStandardSocketOption
s
#SO_SNDBUF
* SO_SNDBUF} </td>
* <td> The size of the socket send buffer </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SO_RCVBUF
* <td> {@link SctpStandardSocketOption
s
#SO_RCVBUF
* SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SO_LINGER
* <td> {@link SctpStandardSocketOption
s
#SO_LINGER
* SO_LINGER} </td>
* <td> Linger on close if data is present (when configured in blocking mode
* only) </td>
...
...
@@ -450,7 +450,7 @@ public abstract class SctpMultiChannel
* @throws IOException
* If an I/O error occurs
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
abstract
<
T
>
T
getOption
(
SctpSocketOption
<
T
>
name
,
Association
association
)
...
...
@@ -489,7 +489,7 @@ public abstract class SctpMultiChannel
* @throws IOException
* If an I/O error occurs
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
abstract
<
T
>
SctpMultiChannel
setOption
(
SctpSocketOption
<
T
>
name
,
T
value
,
...
...
@@ -542,7 +542,7 @@ public abstract class SctpMultiChannel
* MessageInfo} will return {@code false}, and more invocations of this
* method will be necessary to completely consume the messgae. Only
* one message at a time will be partially delivered in any stream. The
* socket option {@link SctpStandardSocketOption#SCTP_FRAGMENT_INTERLEAVE
* socket option {@link SctpStandardSocketOption
s
#SCTP_FRAGMENT_INTERLEAVE
* SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
* messages occurs.
*
...
...
@@ -635,14 +635,14 @@ public abstract class SctpMultiChannel
* underlying output buffer, then the remaining bytes in the given byte
* buffer are transmitted as a single message. Sending a message
* is atomic unless explicit message completion {@link
* SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
* SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
* socket option is enabled on this channel's socket.
*
* <P> If this channel is in non-blocking mode, there is sufficient room
* in the underlying output buffer, and an implicit association setup is
* required, then the remaining bytes in the given byte buffer are
* transmitted as a single message, subject to {@link
* SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
* SctpStandardSocketOption
s
#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
* If for any reason the message cannot
* be delivered an {@link AssociationChangeNotification association
* changed} notification is put on the SCTP stack with its {@code event} parameter set
...
...
src/share/classes/com/sun/nio/sctp/SctpServerChannel.java
浏览文件 @
f9c0499e
...
...
@@ -53,7 +53,7 @@ import java.nio.channels.spi.AbstractSelectableChannel;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
* <td> {@link SctpStandardSocketOption
s
#SCTP_INIT_MAXSTREAMS
* SCTP_INIT_MAXSTREAMS} </td>
* <td> The maximum number of streams requested by the local endpoint during
* association initialization </td>
...
...
@@ -360,7 +360,7 @@ public abstract class SctpServerChannel
* @throws IOException
* If an I/O error occurs
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
abstract
<
T
>
T
getOption
(
SctpSocketOption
<
T
>
name
)
throws
IOException
;
...
...
@@ -388,7 +388,7 @@ public abstract class SctpServerChannel
* @throws IOException
* If an I/O error occurs
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
abstract
<
T
>
SctpServerChannel
setOption
(
SctpSocketOption
<
T
>
name
,
T
value
)
...
...
src/share/classes/com/sun/nio/sctp/SctpSocketOption.java
浏览文件 @
f9c0499e
...
...
@@ -33,6 +33,6 @@ import java.net.SocketOption;
*
* @since 1.7
*
* @see SctpStandardSocketOption
* @see SctpStandardSocketOption
s
*/
public
interface
SctpSocketOption
<
T
>
extends
SocketOption
<
T
>
{
}
src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption.java
→
src/share/classes/com/sun/nio/sctp/SctpStandardSocketOption
s
.java
浏览文件 @
f9c0499e
...
...
@@ -34,8 +34,8 @@ import sun.nio.ch.SctpStdSocketOption;
*
* @since 1.7
*/
public
class
SctpStandardSocketOption
{
private
SctpStandardSocketOption
()
{}
public
class
SctpStandardSocketOption
s
{
private
SctpStandardSocketOption
s
()
{}
/**
* Enables or disables message fragmentation.
*
...
...
@@ -127,7 +127,7 @@ public class SctpStandardSocketOption {
* association initialization.
*
* <P> The value of this socket option is an {@link
* SctpStandardSocketOption.InitMaxStreams InitMaxStreams}, that represents
* SctpStandardSocketOption
s
.InitMaxStreams InitMaxStreams}, that represents
* the maximum number of inbound and outbound streams that an association
* on the channel is prepared to support.
*
...
...
@@ -157,9 +157,9 @@ public class SctpStandardSocketOption {
* the endpoints default value.
*/
public
static
final
SctpSocketOption
<
SctpStandardSocketOption
.
InitMaxStreams
>
SCTP_INIT_MAXSTREAMS
=
new
SctpStdSocketOption
<
SctpStandardSocketOption
.
InitMaxStreams
>(
"SCTP_INIT_MAXSTREAMS"
,
SctpStandardSocketOption
.
InitMaxStreams
.
class
);
<
SctpStandardSocketOption
s
.
InitMaxStreams
>
SCTP_INIT_MAXSTREAMS
=
new
SctpStdSocketOption
<
SctpStandardSocketOption
s
.
InitMaxStreams
>(
"SCTP_INIT_MAXSTREAMS"
,
SctpStandardSocketOption
s
.
InitMaxStreams
.
class
);
/**
* Enables or disables a Nagle-like algorithm.
...
...
@@ -310,7 +310,7 @@ public class SctpStandardSocketOption {
* This class is used to set the maximum number of inbound/outbound streams
* used by the local endpoint during association initialization. An
* instance of this class is used to set the {@link
* SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS}
* SctpStandardSocketOption
s
#SCTP_INIT_MAXSTREAMS SCTP_INIT_MAXSTREAMS}
* socket option.
*
* @since 1.7
...
...
src/share/classes/java/awt/Component.java
浏览文件 @
f9c0499e
...
...
@@ -2887,11 +2887,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
/**
* Invalidates this component and its ancestors.
* <p>
* All the ancestors of this component up to the nearest validate root are
* marked invalid also. If there is no a validate root container for this
* component, all of its ancestors up to the root of the hierarchy are
* marked invalid as well. Marking a container <i>invalid</i> indicates
* that the container needs to be laid out.
* By default, all the ancestors of the component up to the top-most
* container of the hierarchy are marked invalid. If the {@code
* java.awt.smartInvalidate} system property is set to {@code true},
* invalidation stops on the nearest validate root of this component.
* Marking a container <i>invalid</i> indicates that the container needs to
* be laid out.
* <p>
* This method is called automatically when any layout-related information
* changes (e.g. setting the bounds of the component, or adding the
...
...
src/share/classes/java/awt/Container.java
浏览文件 @
f9c0499e
...
...
@@ -41,6 +41,8 @@ import java.io.ObjectStreamField;
import
java.io.PrintStream
;
import
java.io.PrintWriter
;
import
java.security.AccessController
;
import
java.util.Arrays
;
import
java.util.EventListener
;
import
java.util.HashSet
;
...
...
@@ -60,6 +62,8 @@ import sun.awt.dnd.SunDropTargetEvent;
import
sun.java2d.pipe.Region
;
import
sun.security.action.GetBooleanAction
;
/**
* A generic Abstract Window Toolkit(AWT) container object is a component
* that can contain other AWT components.
...
...
@@ -1506,12 +1510,18 @@ public class Container extends Component {
* Layout-related changes, such as bounds of the validate root descendants,
* do not affect the layout of the validate root parent. This peculiarity
* enables the {@code invalidate()} method to stop invalidating the
* component hierarchy when the method encounters a validate root.
* component hierarchy when the method encounters a validate root. However,
* to preserve backward compatibility this new optimized behavior is
* enabled only when the {@code java.awt.smartInvalidate} system property
* value is set to {@code true}.
* <p>
* If a component hierarchy contains validate roots, the {@code validate()}
* method must be invoked on the validate root of a previously invalidated
* component, rather than on the top-level container (such as a {@code
* Frame} object) to restore the validity of the hierarchy later.
* If a component hierarchy contains validate roots and the new optimized
* {@code invalidate()} behavior is enabled, the {@code validate()} method
* must be invoked on the validate root of a previously invalidated
* component to restore the validity of the hierarchy later. Otherwise,
* calling the {@code validate()} method on the top-level container (such
* as a {@code Frame} object) should be used to restore the validity of the
* component hierarchy.
* <p>
* The {@code Window} class and the {@code Applet} class are the validate
* roots in AWT. Swing introduces more validate roots.
...
...
@@ -1527,13 +1537,20 @@ public class Container extends Component {
return
false
;
}
private
static
final
boolean
isJavaAwtSmartInvalidate
;
static
{
// Don't lazy-read because every app uses invalidate()
isJavaAwtSmartInvalidate
=
AccessController
.
doPrivileged
(
new
GetBooleanAction
(
"java.awt.smartInvalidate"
));
}
/**
* Invalidates the parent of the container unless the container
* is a validate root.
*/
@Override
void
invalidateParent
()
{
if
(!
isValidateRoot
())
{
if
(!
is
JavaAwtSmartInvalidate
||
!
is
ValidateRoot
())
{
super
.
invalidateParent
();
}
}
...
...
@@ -1572,9 +1589,8 @@ public class Container extends Component {
* automatically. Note that the ancestors of the container may be
* invalidated also (see {@link Component#invalidate} for details.)
* Therefore, to restore the validity of the hierarchy, the {@code
* validate()} method should be invoked on a validate root of an
* invalidated component, or on the top-most container if the hierarchy
* does not contain validate roots.
* validate()} method should be invoked on the top-most invalid
* container of the hierarchy.
* <p>
* Validating the container may be a quite time-consuming operation. For
* performance reasons a developer may postpone the validation of the
...
...
src/share/classes/java/awt/Toolkit.java
浏览文件 @
f9c0499e
...
...
@@ -466,10 +466,7 @@ public abstract class Toolkit {
*/
protected
void
loadSystemColors
(
int
[]
systemColors
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
}
/**
...
...
@@ -504,10 +501,7 @@ public abstract class Toolkit {
*/
public
void
setDynamicLayout
(
boolean
dynamic
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
}
/**
...
...
@@ -531,9 +525,8 @@ public abstract class Toolkit {
*/
protected
boolean
isDynamicLayoutSet
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
isDynamicLayoutSet
();
}
else
{
...
...
@@ -569,9 +562,8 @@ public abstract class Toolkit {
*/
public
boolean
isDynamicLayoutActive
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
isDynamicLayoutActive
();
}
else
{
...
...
@@ -615,9 +607,7 @@ public abstract class Toolkit {
*/
public
Insets
getScreenInsets
(
GraphicsConfiguration
gc
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
getScreenInsets
(
gc
);
}
else
{
...
...
@@ -1200,10 +1190,7 @@ public abstract class Toolkit {
* security manager's <code>checkPermission</code> method with a <code>
* RuntimePermission("queuePrintJob")</code> permission.
*
* @param frame the parent of the print dialog. May be null if and only
* if jobAttributes is not null and jobAttributes.getDialog()
* returns JobAttributes.DialogType.NONE or
* JobAttributes.DialogType.COMMON.
* @param frame the parent of the print dialog. May not be null.
* @param jobtitle the title of the PrintJob. A null title is equivalent
* to "".
* @param jobAttributes a set of job attributes which will control the
...
...
@@ -1359,9 +1346,8 @@ public abstract class Toolkit {
* @since 1.4
*/
public
Clipboard
getSystemSelection
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
getSystemSelection
();
}
else
{
...
...
@@ -1391,9 +1377,7 @@ public abstract class Toolkit {
* @since JDK1.1
*/
public
int
getMenuShortcutKeyMask
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
return
Event
.
CTRL_MASK
;
}
...
...
@@ -1418,7 +1402,10 @@ public abstract class Toolkit {
* @since 1.3
*/
public
boolean
getLockingKeyState
(
int
keyCode
)
throws
UnsupportedOperationException
{
throws
UnsupportedOperationException
{
GraphicsEnvironment
.
checkHeadless
();
if
(!
(
keyCode
==
KeyEvent
.
VK_CAPS_LOCK
||
keyCode
==
KeyEvent
.
VK_NUM_LOCK
||
keyCode
==
KeyEvent
.
VK_SCROLL_LOCK
||
keyCode
==
KeyEvent
.
VK_KANA_LOCK
))
{
throw
new
IllegalArgumentException
(
"invalid key for Toolkit.getLockingKeyState"
);
...
...
@@ -1449,7 +1436,10 @@ public abstract class Toolkit {
* @since 1.3
*/
public
void
setLockingKeyState
(
int
keyCode
,
boolean
on
)
throws
UnsupportedOperationException
{
throws
UnsupportedOperationException
{
GraphicsEnvironment
.
checkHeadless
();
if
(!
(
keyCode
==
KeyEvent
.
VK_CAPS_LOCK
||
keyCode
==
KeyEvent
.
VK_NUM_LOCK
||
keyCode
==
KeyEvent
.
VK_SCROLL_LOCK
||
keyCode
==
KeyEvent
.
VK_KANA_LOCK
))
{
throw
new
IllegalArgumentException
(
"invalid key for Toolkit.setLockingKeyState"
);
...
...
@@ -1523,9 +1513,8 @@ public abstract class Toolkit {
*/
public
Dimension
getBestCursorSize
(
int
preferredWidth
,
int
preferredHeight
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
// Override to implement custom cursor support.
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
...
...
@@ -1553,9 +1542,8 @@ public abstract class Toolkit {
* @since 1.2
*/
public
int
getMaximumCursorColors
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
// Override to implement custom cursor support.
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
getMaximumCursorColors
();
...
...
@@ -1605,9 +1593,8 @@ public abstract class Toolkit {
public
boolean
isFrameStateSupported
(
int
state
)
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
isFrameStateSupported
(
state
);
...
...
@@ -2614,9 +2601,8 @@ public abstract class Toolkit {
* @since 1.7
*/
public
boolean
areExtraMouseButtonsEnabled
()
throws
HeadlessException
{
if
(
GraphicsEnvironment
.
isHeadless
()){
throw
new
HeadlessException
();
}
GraphicsEnvironment
.
checkHeadless
();
return
Toolkit
.
getDefaultToolkit
().
areExtraMouseButtonsEnabled
();
}
}
src/share/classes/java/lang/SafeVarargs.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2011,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -32,7 +32,7 @@ import java.lang.annotation.*;
* constructor does not perform potentially unsafe operations on its
* varargs parameter. Applying this annotation to a method or
* constructor suppresses unchecked warnings about a
* <i>non-reifiable</i> variable
-
arity (vararg) type and suppresses
* <i>non-reifiable</i> variable
arity (vararg) type and suppresses
* unchecked warnings about parameterized array creation at call
* sites.
*
...
...
@@ -41,11 +41,10 @@ import java.lang.annotation.*;
* additional usage restrictions on this annotation type; it is a
* compile-time error if a method or constructor declaration is
* annotated with a {@code @SafeVarargs} annotation, and either:
* <ul>
* <li> the declaration is a fixed
-
arity method or constructor
* <li> the declaration is a fixed
arity method or constructor
*
* <li> the declaration is a variable
-
arity method that is neither
* <li> the declaration is a variable
arity method that is neither
* {@code static} nor {@code final}.
*
* </ul>
...
...
@@ -55,15 +54,28 @@ import java.lang.annotation.*;
*
* <ul>
*
* <li> The variable
-
arity parameter has a reifiable element type,
* <li> The variable
arity parameter has a reifiable element type,
* which includes primitive types, {@code Object}, and {@code String}.
* (The unchecked warnings this annotation type suppresses already do
* not occur for a reifiable element type.)
*
* <li> The body of the method or constructor declaration performs
* potentially unsafe operations, such as an assignment to an element
* of the variable-arity parameter's array that generates an unchecked
* warning.
* of the variable arity parameter's array that generates an unchecked
* warning. Some unsafe operations do not trigger an unchecked
* warning. For example, the aliasing in
*
* <blockquote><pre>
* @SafeVarargs // Not actually safe!
* static void m(List<String>... stringLists) {
* Object[] array = stringLists;
* List<Integer> tmpList = Arrays.asList(42);
* array[0] = tmpList; // Semantically invalid, but compiles without warnings
* String s = stringLists[0].get(0); // Oh no, ClassCastException at runtime!
* }
* </pre></blockquote>
*
* leads to a {@code ClassCastException} at runtime.
*
* <p>Future versions of the platform may mandate compiler errors for
* such unsafe operations.
...
...
src/share/classes/java/lang/Throwable.java
浏览文件 @
f9c0499e
...
...
@@ -336,7 +336,10 @@ public class Throwable implements Serializable {
* Disabling of suppression should only occur in exceptional
* circumstances where special requirements exist, such as a
* virtual machine reusing exception objects under low-memory
* situations.
* situations. Circumstances where a given exception object is
* repeatedly caught and rethrown, such as to implement control
* flow between two sub-systems, is another situation where
* immutable throwable objects would be appropriate.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
...
...
@@ -423,6 +426,18 @@ public class Throwable implements Serializable {
* {@link #Throwable(String,Throwable)}, this method cannot be called
* even once.
*
* <p>An example of using this method on a legacy throwable type
* without other support for setting the cause is:
*
* <pre>
* try {
* lowLevelOp();
* } catch (LowLevelException le) {
* throw (HighLevelException)
* new HighLevelException().initCause(le); // Legacy constructor
* }
* </pre>
*
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
...
...
@@ -762,7 +777,8 @@ public class Throwable implements Serializable {
* @see java.lang.Throwable#printStackTrace()
*/
public
synchronized
Throwable
fillInStackTrace
()
{
if
(
stackTrace
!=
null
)
{
if
(
stackTrace
!=
null
||
backtrace
!=
null
/* Out of protocol state */
)
{
fillInStackTrace
(
0
);
stackTrace
=
UNASSIGNED_STACK
;
}
...
...
@@ -788,7 +804,8 @@ public class Throwable implements Serializable {
* this throwable is permitted to return a zero-length array from this
* method. Generally speaking, the array returned by this method will
* contain one element for every frame that would be printed by
* {@code printStackTrace}.
* {@code printStackTrace}. Writes to the returned array do not
* affect future calls to this method.
*
* @return an array of stack trace elements representing the stack trace
* pertaining to this throwable.
...
...
@@ -801,7 +818,8 @@ public class Throwable implements Serializable {
private
synchronized
StackTraceElement
[]
getOurStackTrace
()
{
// Initialize stack trace field with information from
// backtrace if this is the first call to this method
if
(
stackTrace
==
UNASSIGNED_STACK
)
{
if
(
stackTrace
==
UNASSIGNED_STACK
||
(
stackTrace
==
null
&&
backtrace
!=
null
)
/* Out of protocol state */
)
{
int
depth
=
getStackTraceDepth
();
stackTrace
=
new
StackTraceElement
[
depth
];
for
(
int
i
=
0
;
i
<
depth
;
i
++)
...
...
@@ -849,7 +867,8 @@ public class Throwable implements Serializable {
}
synchronized
(
this
)
{
if
(
this
.
stackTrace
==
null
)
// Immutable stack
if
(
this
.
stackTrace
==
null
&&
// Immutable stack
backtrace
==
null
)
// Test for out of protocol state
return
;
this
.
stackTrace
=
defensiveCopy
;
}
...
...
@@ -971,8 +990,8 @@ public class Throwable implements Serializable {
/**
* Appends the specified exception to the exceptions that were
* suppressed in order to deliver this exception. This method is
* t
ypically called (automatically and implicitly) by the {@code
* try}-with-resources statement.
* t
hread-safe and typically called (automatically and implicitly)
*
by the {@code
try}-with-resources statement.
*
* <p>The suppression behavior is enabled <em>unless</em> disabled
* {@linkplain #Throwable(String, Throwable, boolean, boolean) via
...
...
@@ -1043,7 +1062,9 @@ public class Throwable implements Serializable {
*
* If no exceptions were suppressed or {@linkplain
* #Throwable(String, Throwable, boolean, boolean) suppression is
* disabled}, an empty array is returned.
* disabled}, an empty array is returned. This method is
* thread-safe. Writes to the returned array do not affect future
* calls to this method.
*
* @return an array containing all of the exceptions that were
* suppressed to deliver this exception.
...
...
src/share/classes/java/net/SocketOption.java
浏览文件 @
f9c0499e
...
...
@@ -38,7 +38,7 @@ package java.net;
*
* @since 1.7
*
* @see StandardSocketOption
* @see StandardSocketOption
s
*/
public
interface
SocketOption
<
T
>
{
...
...
src/share/classes/java/net/StandardSocketOption.java
→
src/share/classes/java/net/StandardSocketOption
s
.java
浏览文件 @
f9c0499e
...
...
@@ -38,8 +38,8 @@ package java.net;
* @since 1.7
*/
public
final
class
StandardSocketOption
{
private
StandardSocketOption
()
{
}
public
final
class
StandardSocketOption
s
{
private
StandardSocketOption
s
()
{
}
// -- SOL_SOCKET --
...
...
src/share/classes/java/nio/channels/AsynchronousServerSocketChannel.java
浏览文件 @
f9c0499e
...
...
@@ -58,11 +58,11 @@ import java.io.IOException;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_RCVBUF SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> Re-use address </td>
* </tr>
* </table>
...
...
src/share/classes/java/nio/channels/AsynchronousSocketChannel.java
浏览文件 @
f9c0499e
...
...
@@ -68,23 +68,23 @@ import java.nio.ByteBuffer;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_SNDBUF SO_SNDBUF} </td>
* <td> The size of the socket send buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_RCVBUF SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_KEEPALIVE SO_KEEPALIVE} </td>
* <td> Keep connection alive </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> Re-use address </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} </td>
* <td> {@link java.net.StandardSocketOption
s
#TCP_NODELAY TCP_NODELAY} </td>
* <td> Disable the Nagle algorithm </td>
* </tr>
* </table>
...
...
src/share/classes/java/nio/channels/DatagramChannel.java
浏览文件 @
f9c0499e
...
...
@@ -63,37 +63,37 @@ import java.nio.channels.spi.SelectorProvider;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_SNDBUF SO_SNDBUF} </td>
* <td> The size of the socket send buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_RCVBUF SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> Re-use address </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_BROADCAST SO_BROADCAST} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_BROADCAST SO_BROADCAST} </td>
* <td> Allow transmission of broadcast datagrams </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#IP_TOS IP_TOS} </td>
* <td> {@link java.net.StandardSocketOption
s
#IP_TOS IP_TOS} </td>
* <td> The Type of Service (ToS) octet in the Internet Protocol (IP) header </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#IP_MULTICAST_IF IP_MULTICAST_IF} </td>
* <td> {@link java.net.StandardSocketOption
s
#IP_MULTICAST_IF IP_MULTICAST_IF} </td>
* <td> The network interface for Internet Protocol (IP) multicast datagrams </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#IP_MULTICAST_TTL
* <td> {@link java.net.StandardSocketOption
s
#IP_MULTICAST_TTL
* IP_MULTICAST_TTL} </td>
* <td> The <em>time-to-live</em> for Internet Protocol (IP) multicast
* datagrams </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#IP_MULTICAST_LOOP
* <td> {@link java.net.StandardSocketOption
s
#IP_MULTICAST_LOOP
* IP_MULTICAST_LOOP} </td>
* <td> Loopback for Internet Protocol (IP) multicast datagrams </td>
* </tr>
...
...
src/share/classes/java/nio/channels/MulticastChannel.java
浏览文件 @
f9c0499e
...
...
@@ -30,7 +30,7 @@ import java.net.NetworkInterface;
import
java.io.IOException
;
import
java.net.ProtocolFamily
;
// javadoc
import
java.net.StandardProtocolFamily
;
// javadoc
import
java.net.StandardSocketOption
;
// javadoc
import
java.net.StandardSocketOption
s
;
// javadoc
/**
* A network channel that supports Internet Protocol (IP) multicasting.
...
...
@@ -93,7 +93,7 @@ import java.net.StandardSocketOption; // javadoc
* a specific address, rather than the wildcard address then it is implementation
* specific if multicast datagrams are received by the socket. </p></li>
*
* <li><p> The {@link StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} option should be
* <li><p> The {@link StandardSocketOption
s
#SO_REUSEADDR SO_REUSEADDR} option should be
* enabled prior to {@link NetworkChannel#bind binding} the socket. This is
* required to allow multiple members of the group to bind to the same
* address. </p></li>
...
...
@@ -107,9 +107,9 @@ import java.net.StandardSocketOption; // javadoc
* NetworkInterface ni = NetworkInterface.getByName("hme0");
*
* DatagramChannel dc = DatagramChannel.open(StandardProtocolFamily.INET)
* .setOption(StandardSocketOption.SO_REUSEADDR, true)
* .setOption(StandardSocketOption
s
.SO_REUSEADDR, true)
* .bind(new InetSocketAddress(5000))
* .setOption(StandardSocketOption.IP_MULTICAST_IF, ni);
* .setOption(StandardSocketOption
s
.IP_MULTICAST_IF, ni);
*
* InetAddress group = InetAddress.getByName("225.4.5.6");
*
...
...
src/share/classes/java/nio/channels/NetworkChannel.java
浏览文件 @
f9c0499e
...
...
@@ -124,7 +124,7 @@ public interface NetworkChannel
* @throws IOException
* If an I/O error occurs
*
* @see java.net.StandardSocketOption
* @see java.net.StandardSocketOption
s
*/
<
T
>
NetworkChannel
setOption
(
SocketOption
<
T
>
name
,
T
value
)
throws
IOException
;
...
...
@@ -144,7 +144,7 @@ public interface NetworkChannel
* @throws IOException
* If an I/O error occurs
*
* @see java.net.StandardSocketOption
* @see java.net.StandardSocketOption
s
*/
<
T
>
T
getOption
(
SocketOption
<
T
>
name
)
throws
IOException
;
...
...
src/share/classes/java/nio/channels/ServerSocketChannel.java
浏览文件 @
f9c0499e
...
...
@@ -52,11 +52,11 @@ import java.nio.channels.spi.SelectorProvider;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_RCVBUF SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> Re-use address </td>
* </tr>
* </table>
...
...
src/share/classes/java/nio/channels/SocketChannel.java
浏览文件 @
f9c0499e
...
...
@@ -72,28 +72,28 @@ import java.nio.channels.spi.SelectorProvider;
* <th>Description</th>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_SNDBUF SO_SNDBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_SNDBUF SO_SNDBUF} </td>
* <td> The size of the socket send buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_RCVBUF SO_RCVBUF} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_RCVBUF SO_RCVBUF} </td>
* <td> The size of the socket receive buffer </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_KEEPALIVE SO_KEEPALIVE} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_KEEPALIVE SO_KEEPALIVE} </td>
* <td> Keep connection alive </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_REUSEADDR SO_REUSEADDR} </td>
* <td> Re-use address </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#SO_LINGER SO_LINGER} </td>
* <td> {@link java.net.StandardSocketOption
s
#SO_LINGER SO_LINGER} </td>
* <td> Linger on close if data is present (when configured in blocking mode
* only) </td>
* </tr>
* <tr>
* <td> {@link java.net.StandardSocketOption#TCP_NODELAY TCP_NODELAY} </td>
* <td> {@link java.net.StandardSocketOption
s
#TCP_NODELAY TCP_NODELAY} </td>
* <td> Disable the Nagle algorithm </td>
* </tr>
* </table>
...
...
src/share/classes/java/nio/charset/Charset.java
浏览文件 @
f9c0499e
...
...
@@ -215,7 +215,7 @@ import sun.security.action.GetPropertyAction;
* determined during virtual-machine startup and typically depends upon the
* locale and charset being used by the underlying operating system. </p>
*
* <p>The {@link StandardCharset} class defines constants for each of the
* <p>The {@link StandardCharset
s
} class defines constants for each of the
* standard charsets.
*
* <h4>Terminology</h4>
...
...
src/share/classes/java/nio/charset/StandardCharset.java
→
src/share/classes/java/nio/charset/StandardCharset
s
.java
浏览文件 @
f9c0499e
...
...
@@ -32,10 +32,10 @@ package java.nio.charset;
* @see <a href="Charset#standard">Standard Charsets</a>
* @since 1.7
*/
public
final
class
StandardCharset
{
public
final
class
StandardCharset
s
{
private
StandardCharset
()
{
throw
new
AssertionError
(
"No java.nio.charset.StandardCharset instances for you!"
);
private
StandardCharset
s
()
{
throw
new
AssertionError
(
"No java.nio.charset.StandardCharset
s
instances for you!"
);
}
/**
* Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the
...
...
src/share/classes/java/nio/file/Path.java
浏览文件 @
f9c0499e
...
...
@@ -72,7 +72,7 @@ import java.util.Iterator;
* directory and is UTF-8 encoded.
* <pre>
* Path path = FileSystems.getDefault().getPath("logs", "access.log");
* BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
* BufferReader reader = Files.newBufferedReader(path, StandardCharset
s
.UTF_8);
* </pre>
*
* <a name="interop"><h4>Interoperability</h4></a>
...
...
@@ -609,11 +609,11 @@ public interface Path
* directory can be watched. The {@code events} parameter is the events to
* register and may contain the following events:
* <ul>
* <li>{@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE} -
* <li>{@link StandardWatchEventKind
s
#ENTRY_CREATE ENTRY_CREATE} -
* entry created or moved into the directory</li>
* <li>{@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE} -
* <li>{@link StandardWatchEventKind
s
#ENTRY_DELETE ENTRY_DELETE} -
* entry deleted or moved out of the directory</li>
* <li>{@link StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} -
* <li>{@link StandardWatchEventKind
s
#ENTRY_MODIFY ENTRY_MODIFY} -
* entry in directory was modified</li>
* </ul>
*
...
...
@@ -622,7 +622,7 @@ public interface Path
* that locates the directory entry that is created, deleted, or modified.
*
* <p> The set of events may include additional implementation specific
* event that are not defined by the enum {@link StandardWatchEventKind}
* event that are not defined by the enum {@link StandardWatchEventKind
s
}
*
* <p> The {@code modifiers} parameter specifies <em>modifiers</em> that
* qualify how the directory is registered. This release does not define any
...
...
src/share/classes/java/nio/file/StandardWatchEventKind.java
→
src/share/classes/java/nio/file/StandardWatchEventKind
s
.java
浏览文件 @
f9c0499e
...
...
@@ -31,8 +31,8 @@ package java.nio.file;
* @since 1.7
*/
public
final
class
StandardWatchEventKind
{
private
StandardWatchEventKind
()
{
}
public
final
class
StandardWatchEventKind
s
{
private
StandardWatchEventKind
s
()
{
}
/**
* A special event to indicate that events may have been lost or
...
...
@@ -44,8 +44,8 @@ public final class StandardWatchEventKind {
*
* @see WatchService
*/
public
static
final
WatchEvent
.
Kind
<
Void
>
OVERFLOW
=
new
StdWatchEventKind
<
Void
>(
"OVERFLOW"
,
Void
.
class
);
public
static
final
WatchEvent
.
Kind
<
Object
>
OVERFLOW
=
new
StdWatchEventKind
<
Object
>(
"OVERFLOW"
,
Object
.
class
);
/**
* Directory entry created.
...
...
src/share/classes/java/nio/file/WatchEvent.java
浏览文件 @
f9c0499e
...
...
@@ -50,7 +50,7 @@ public interface WatchEvent<T> {
* An event kind, for the purposes of identification.
*
* @since 1.7
* @see StandardWatchEventKind
* @see StandardWatchEventKind
s
*/
public
static
interface
Kind
<
T
>
{
/**
...
...
@@ -98,9 +98,9 @@ public interface WatchEvent<T> {
/**
* Returns the context for the event.
*
* <p> In the case of {@link StandardWatchEventKind#ENTRY_CREATE ENTRY_CREATE},
* {@link StandardWatchEventKind#ENTRY_DELETE ENTRY_DELETE}, and {@link
* StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} events the context is
* <p> In the case of {@link StandardWatchEventKind
s
#ENTRY_CREATE ENTRY_CREATE},
* {@link StandardWatchEventKind
s
#ENTRY_DELETE ENTRY_DELETE}, and {@link
* StandardWatchEventKind
s
#ENTRY_MODIFY ENTRY_MODIFY} events the context is
* a {@code Path} that is the {@link Path#relativize relative} path between
* the directory registered with the watch service, and the entry that is
* created, deleted, or modified.
...
...
src/share/classes/java/nio/file/WatchService.java
浏览文件 @
f9c0499e
...
...
@@ -68,7 +68,7 @@ import java.util.concurrent.TimeUnit;
* of events that it may accumulate. Where an implementation <em>knowingly</em>
* discards events then it arranges for the key's {@link WatchKey#pollEvents
* pollEvents} method to return an element with an event type of {@link
* StandardWatchEventKind#OVERFLOW OVERFLOW}. This event can be used by the
* StandardWatchEventKind
s
#OVERFLOW OVERFLOW}. This event can be used by the
* consumer as a trigger to re-examine the state of the object.
*
* <p> When an event is reported to indicate that a file in a watched directory
...
...
@@ -87,7 +87,7 @@ import java.util.concurrent.TimeUnit;
* are detected, their timeliness, and whether their ordering is preserved are
* highly implementation specific. For example, when a file in a watched
* directory is modified then it may result in a single {@link
* StandardWatchEventKind#ENTRY_MODIFY ENTRY_MODIFY} event in some
* StandardWatchEventKind
s
#ENTRY_MODIFY ENTRY_MODIFY} event in some
* implementations but several events in other implementations. Short-lived
* files (meaning files that are deleted very quickly after they are created)
* may not be detected by primitive implementations that periodically poll the
...
...
src/share/classes/java/nio/file/Watchable.java
浏览文件 @
f9c0499e
...
...
@@ -53,7 +53,7 @@ public interface Watchable {
* those specified by the {@code events} and {@code modifiers} parameters.
* Changing the event set does not cause pending events for the object to be
* discarded. Objects are automatically registered for the {@link
* StandardWatchEventKind#OVERFLOW OVERFLOW} event. This event is not
* StandardWatchEventKind
s
#OVERFLOW OVERFLOW} event. This event is not
* required to be present in the array of events.
*
* <p> Otherwise the file system object has not yet been registered with the
...
...
src/share/classes/java/sql/BatchUpdateException.java
浏览文件 @
f9c0499e
...
...
@@ -89,7 +89,7 @@ public class BatchUpdateException extends SQLException {
* The <code>cause</code> is not initialized, and may subsequently be
* initialized by a call to the
* {@link Throwable#initCause(java.lang.Throwable)} method. The vendor code
* is intialized to 0.
* is in
i
tialized to 0.
* <p>
*
* @param reason a description of the exception
...
...
@@ -188,7 +188,7 @@ public class BatchUpdateException extends SQLException {
* @since 1.6
*/
public
BatchUpdateException
(
Throwable
cause
)
{
this
(
null
,
null
,
0
,
null
,
cause
);
this
(
(
cause
==
null
?
null
:
cause
.
toString
())
,
null
,
0
,
null
,
cause
);
}
/**
...
...
@@ -214,7 +214,7 @@ public class BatchUpdateException extends SQLException {
* @since 1.6
*/
public
BatchUpdateException
(
int
[]
updateCounts
,
Throwable
cause
)
{
this
(
null
,
null
,
0
,
updateCounts
,
cause
);
this
(
(
cause
==
null
?
null
:
cause
.
toString
())
,
null
,
0
,
updateCounts
,
cause
);
}
/**
...
...
src/share/classes/java/util/Formatter.java
浏览文件 @
f9c0499e
...
...
@@ -826,7 +826,7 @@ import sun.misc.FormattedFloatingDecimal;
*
* <li> <a href="#dndec"><b>Float and Double</b></a>
*
* <li> <a href="#dndec"><b>BigDecimal</b></a>
* <li> <a href="#dn
b
dec"><b>BigDecimal</b></a>
*
* </ol>
*
...
...
@@ -1362,7 +1362,7 @@ import sun.misc.FormattedFloatingDecimal;
* precision is not provided, then all of the digits as returned by {@link
* Double#toHexString(double)} will be output.
*
* <p><a name="dndec"><b> BigDecimal </b></a>
* <p><a name="dn
b
dec"><b> BigDecimal </b></a>
*
* <p> The following conversions may be applied {@link java.math.BigDecimal
* BigDecimal}.
...
...
@@ -1372,7 +1372,7 @@ import sun.misc.FormattedFloatingDecimal;
* <tr><td valign="top"> {@code 'e'}
* <td valign="top"> <tt>'\u0065'</tt>
* <td> Requires the output to be formatted using <a
* name="scientific">computerized scientific notation</a>. The <a
* name="
b
scientific">computerized scientific notation</a>. The <a
* href="#l10n algorithm">localization algorithm</a> is applied.
*
* <p> The formatting of the magnitude <i>m</i> depends upon its value.
...
...
@@ -1427,11 +1427,11 @@ import sun.misc.FormattedFloatingDecimal;
*
* <p> If <i>m</i> is greater than or equal to 10<sup>-4</sup> but less
* than 10<sup>precision</sup> then it is represented in <i><a
* href="#decimal">decimal format</a></i>.
* href="#
b
decimal">decimal format</a></i>.
*
* <p> If <i>m</i> is less than 10<sup>-4</sup> or greater than or equal to
* 10<sup>precision</sup>, then it is represented in <i><a
* href="#scientific">computerized scientific notation</a></i>.
* href="#
b
scientific">computerized scientific notation</a></i>.
*
* <p> The total number of significant digits in <i>m</i> is equal to the
* precision. If the precision is not specified, then the default value is
...
...
@@ -1447,7 +1447,7 @@ import sun.misc.FormattedFloatingDecimal;
*
* <tr><td valign="top"> {@code 'f'}
* <td valign="top"> <tt>'\u0066'</tt>
* <td> Requires the output to be formatted using <a name="decimal">decimal
* <td> Requires the output to be formatted using <a name="
b
decimal">decimal
* format</a>. The <a href="#l10n algorithm">localization algorithm</a> is
* applied.
*
...
...
src/share/classes/java/util/concurrent/Phaser.java
浏览文件 @
f9c0499e
...
...
@@ -159,7 +159,7 @@ import java.util.concurrent.locks.LockSupport;
* void runTasks(List<Runnable> tasks) {
* final Phaser phaser = new Phaser(1); // "1" to register self
* // create and start threads
* for (Runnable task : tasks) {
* for (
final
Runnable task : tasks) {
* phaser.register();
* new Thread() {
* public void run() {
...
...
src/share/classes/java/util/concurrent/locks/LockSupport.java
浏览文件 @
f9c0499e
...
...
@@ -275,10 +275,14 @@ public class LockSupport {
* snapshot -- the thread may have since unblocked or blocked on a
* different blocker object.
*
* @param t the thread
* @return the blocker
* @throws NullPointerException if argument is null
* @since 1.6
*/
public
static
Object
getBlocker
(
Thread
t
)
{
if
(
t
==
null
)
throw
new
NullPointerException
();
return
unsafe
.
getObjectVolatile
(
t
,
parkBlockerOffset
);
}
...
...
src/share/classes/java/util/logging/LogManager.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
1
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -342,12 +342,35 @@ public class LogManager {
// already been created with the given name it is returned.
// Otherwise a new logger instance is created and registered
// in the LogManager global namespace.
// This method will always return a non-null Logger object.
// Synchronization is not required here. All synchronization for
// adding a new Logger object is handled by addLogger().
Logger
demandLogger
(
String
name
)
{
Logger
result
=
getLogger
(
name
);
if
(
result
==
null
)
{
result
=
new
Logger
(
name
,
null
);
addLogger
(
result
);
// only allocate the new logger once
Logger
newLogger
=
new
Logger
(
name
,
null
);
do
{
if
(
addLogger
(
newLogger
))
{
// We successfully added the new Logger that we
// created above so return it without refetching.
return
newLogger
;
}
// We didn't add the new Logger that we created above
// because another thread added a Logger with the same
// name after our null check above and before our call
// to addLogger(). We have to refetch the Logger because
// addLogger() returns a boolean instead of the Logger
// reference itself. However, if the thread that created
// the other Logger is not holding a strong reference to
// the other Logger, then it is possible for the other
// Logger to be GC'ed after we saw it in addLogger() and
// before we can refetch it. If it has been GC'ed then
// we'll just loop around and try again.
result
=
getLogger
(
name
);
}
while
(
result
==
null
);
}
return
result
;
}
...
...
src/share/classes/java/util/logging/Logger.java
浏览文件 @
f9c0499e
...
...
@@ -310,7 +310,20 @@ public class Logger {
* @return a suitable Logger
* @throws NullPointerException if the name is null.
*/
public
static
synchronized
Logger
getLogger
(
String
name
)
{
// Synchronization is not required here. All synchronization for
// adding a new Logger object is handled by LogManager.addLogger().
public
static
Logger
getLogger
(
String
name
)
{
// This method is intentionally not a wrapper around a call
// to getLogger(name, resourceBundleName). If it were then
// this sequence:
//
// getLogger("Foo", "resourceBundleForFoo");
// getLogger("Foo");
//
// would throw an IllegalArgumentException in the second call
// because the wrapper would result in an attempt to replace
// the existing "resourceBundleForFoo" with null.
LogManager
manager
=
LogManager
.
getLogManager
();
return
manager
.
demandLogger
(
name
);
}
...
...
@@ -355,7 +368,10 @@ public class Logger {
* a different resource bundle name.
* @throws NullPointerException if the name is null.
*/
public
static
synchronized
Logger
getLogger
(
String
name
,
String
resourceBundleName
)
{
// Synchronization is not required here. All synchronization for
// adding a new Logger object is handled by LogManager.addLogger().
public
static
Logger
getLogger
(
String
name
,
String
resourceBundleName
)
{
LogManager
manager
=
LogManager
.
getLogManager
();
Logger
result
=
manager
.
demandLogger
(
name
);
if
(
result
.
resourceBundleName
==
null
)
{
...
...
@@ -417,7 +433,10 @@ public class Logger {
* @throws MissingResourceException if the resourceBundleName is non-null and
* no corresponding resource can be found.
*/
public
static
synchronized
Logger
getAnonymousLogger
(
String
resourceBundleName
)
{
// Synchronization is not required here. All synchronization for
// adding a new anonymous Logger object is handled by doSetParent().
public
static
Logger
getAnonymousLogger
(
String
resourceBundleName
)
{
LogManager
manager
=
LogManager
.
getLogManager
();
// cleanup some Loggers that have been GC'ed
manager
.
drainLoggerRefQueueBounded
();
...
...
src/share/classes/java/util/regex/Pattern.java
浏览文件 @
f9c0499e
...
...
@@ -213,7 +213,7 @@ import java.util.Arrays;
* <td headers="matches">A character in the Greek block (<a href="#ubc">block</a>)</td></tr>
* <tr><td valign="top" headers="construct unicode"><tt>\p{Lu}</tt></td>
* <td headers="matches">An uppercase letter (<a href="#ucc">category</a>)</td></tr>
* <tr><td valign="top" headers="construct unicode"><tt>\p{
i
sAlphabetic}</tt></td>
* <tr><td valign="top" headers="construct unicode"><tt>\p{
I
sAlphabetic}</tt></td>
* <td headers="matches">An alphabetic character (<a href="#ubpc">binary property</a>)</td></tr>
* <tr><td valign="top" headers="construct unicode"><tt>\p{Sc}</tt></td>
* <td headers="matches">A currency symbol</td></tr>
...
...
src/share/classes/java/util/zip/ZipCoder.java
浏览文件 @
f9c0499e
...
...
@@ -28,7 +28,7 @@ package java.util.zip;
import
java.nio.ByteBuffer
;
import
java.nio.CharBuffer
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharset
;
import
java.nio.charset.StandardCharset
s
;
import
java.nio.charset.CharsetDecoder
;
import
java.nio.charset.CharsetEncoder
;
import
java.nio.charset.CoderResult
;
...
...
@@ -107,7 +107,7 @@ final class ZipCoder {
if
(
isUTF8
)
return
getBytes
(
s
);
if
(
utf8
==
null
)
utf8
=
new
ZipCoder
(
StandardCharset
.
UTF_8
);
utf8
=
new
ZipCoder
(
StandardCharset
s
.
UTF_8
);
return
utf8
.
getBytes
(
s
);
}
...
...
@@ -116,7 +116,7 @@ final class ZipCoder {
if
(
isUTF8
)
return
toString
(
ba
,
len
);
if
(
utf8
==
null
)
utf8
=
new
ZipCoder
(
StandardCharset
.
UTF_8
);
utf8
=
new
ZipCoder
(
StandardCharset
s
.
UTF_8
);
return
utf8
.
toString
(
ba
,
len
);
}
...
...
@@ -132,7 +132,7 @@ final class ZipCoder {
private
ZipCoder
(
Charset
cs
)
{
this
.
cs
=
cs
;
this
.
isUTF8
=
cs
.
name
().
equals
(
StandardCharset
.
UTF_8
.
name
());
this
.
isUTF8
=
cs
.
name
().
equals
(
StandardCharset
s
.
UTF_8
.
name
());
}
static
ZipCoder
get
(
Charset
charset
)
{
...
...
src/share/classes/java/util/zip/ZipFile.java
浏览文件 @
f9c0499e
...
...
@@ -31,7 +31,7 @@ import java.io.IOException;
import
java.io.EOFException
;
import
java.io.File
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharset
;
import
java.nio.charset.StandardCharset
s
;
import
java.util.ArrayDeque
;
import
java.util.Deque
;
import
java.util.Enumeration
;
...
...
@@ -141,7 +141,7 @@ class ZipFile implements ZipConstants, Closeable {
* @since 1.3
*/
public
ZipFile
(
File
file
,
int
mode
)
throws
IOException
{
this
(
file
,
mode
,
StandardCharset
.
UTF_8
);
this
(
file
,
mode
,
StandardCharset
s
.
UTF_8
);
}
/**
...
...
src/share/classes/java/util/zip/ZipInputStream.java
浏览文件 @
f9c0499e
...
...
@@ -30,7 +30,7 @@ import java.io.IOException;
import
java.io.EOFException
;
import
java.io.PushbackInputStream
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharset
;
import
java.nio.charset.StandardCharset
s
;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
/**
...
...
@@ -76,7 +76,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
* @param in the actual input stream
*/
public
ZipInputStream
(
InputStream
in
)
{
this
(
in
,
StandardCharset
.
UTF_8
);
this
(
in
,
StandardCharset
s
.
UTF_8
);
}
/**
...
...
src/share/classes/java/util/zip/ZipOutputStream.java
浏览文件 @
f9c0499e
...
...
@@ -28,7 +28,7 @@ package java.util.zip;
import
java.io.OutputStream
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.StandardCharset
;
import
java.nio.charset.StandardCharset
s
;
import
java.util.Vector
;
import
java.util.HashSet
;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
...
...
@@ -101,7 +101,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
* @param out the actual output stream
*/
public
ZipOutputStream
(
OutputStream
out
)
{
this
(
out
,
StandardCharset
.
UTF_8
);
this
(
out
,
StandardCharset
s
.
UTF_8
);
}
/**
...
...
src/share/classes/javax/imageio/metadata/doc-files/jpeg_metadata.html
浏览文件 @
f9c0499e
...
...
@@ -211,6 +211,20 @@ to any listeners.
<p>
<a
name=
optcolor
><b>
Optional ColorSpace support:
</b></a>
Handling of PhotoYCC (YCC), PhotoYCCA (YCCA), RGBA and YCbCrA color spaces
by the standard plugin, as described below, is dependent on capabilities
of the libraries used to interpret the JPEG data. Thus all consequential
behaviors are optional. If the support is not available when decoding,
the color space will be treated as unrecognized and the appropriate
default color space for the specified number of component channels
may be used.
When writing, an Exception may be thrown if no suitable conversion
can be applied before encoding.
But where the support for these color spaces is available, the behavior
must be as documented.
<p>
When reading, the contents of the stream are interpreted by the usual
JPEG conventions, as follows:
...
...
@@ -241,8 +255,11 @@ JPEG conventions, as follows:
2-channel images are assumed to be grayscale with an alpha channel.
For 3- and 4-channel images, the component ids are consulted. If these
values are 1-3 for a 3-channel image, then the image is assumed to be
YCbCr. If these values are 1-4 for a 4-channel image, then the image
is assumed to be YCbCrA. If these values are > 4, they are checked
YCbCr. Subject to the availability of the
<a
href=
#optcolor
>
optional color space support
</a>
described above, if these values are 1-4 for a 4-channel image,
then the image is assumed to be YCbCrA.
If these values are > 4, they are checked
against the ASCII codes for 'R', 'G', 'B', 'A', 'C', 'c'. These can
encode the following colorspaces:
<p>
...
...
@@ -346,12 +363,16 @@ If no metadata object is specified, then the following defaults apply:
component ids in the frame and scan headers are set to 1, 2, and 3.
<li>
RGBA images are converted to YCbCrA, subsampled in the
<li>
Subject to the
<a
href=
#optcolor
>
optional library support
</a>
described above,
RGBA images are converted to YCbCrA, subsampled in the
chrominance channels by half both vertically and horizontally, and
written without any special marker segments. The component ids
in the frame and scan headers are set to 1, 2, 3, and 4.
<li>
PhotoYCC and YCCAimages are subsampled by half in the chrominance
<li>
Subject to the
<a
href=
#optcolor
>
optional library support
</a>
described above,
PhotoYCC and YCCAimages are subsampled by half in the chrominance
channels both vertically and horizontally and written with an
Adobe
<code>
APP14
</code>
marker segment and 'Y','C', and 'c' (and
'A' if an alpha channel is present) as component ids in the frame
...
...
@@ -433,6 +454,8 @@ in the frame header node of the metadata object, regardless of color space.)
</ul>
<li>
RGBA images:
Subject to the
<a
href=
#optcolor
>
optional library support
</a>
described above,
<ul>
<li>
If an
<code>
app0JFIF
</code>
node is present in the metadata object,
it is ignored and a warning is sent to listeners, as JFIF does not
...
...
@@ -456,6 +479,8 @@ in the frame header node of the metadata object, regardless of color space.)
</ul>
<li>
PhotoYCC Images:
Subject to the
<a
href=
#optcolor
>
optional library support
</a>
described above,
<ul>
<li>
If an
<code>
app0JFIF
</code>
node is present in the metadata object,
the image is converted to sRGB, and then to YCbCr during encoding,
...
...
@@ -471,6 +496,8 @@ in the frame header node of the metadata object, regardless of color space.)
</ul>
<li>
PhotoYCCA Images:
Subject to the
<a
href=
#optcolor
>
optional library support
</a>
described above,
<ul>
<li>
If an
<code>
app0JFIF
</code>
node is present in the metadata object,
it is ignored and a warning is sent to listeners, as JFIF does not
...
...
src/share/classes/javax/management/loading/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
javax.management.loading package
</title>
<!--
Copyright (c) 1999, 20
06
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1999, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -68,7 +68,7 @@ questions.
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/jmx/"
>
Java
SE 6
Platform documentation on JMX technology
</a>
,
Java Platform documentation on JMX technology
</a>
,
in particular the
<a
href=
"{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf"
>
JMX Specification, version 1.4(pdf).
</a>
...
...
src/share/classes/javax/management/modelmbean/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
javax.management.modelmbean package
</title>
<!--
Copyright (c) 2000, 20
06
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -116,7 +116,7 @@ mbs.invoke(mapName, "get", new Object[] {"key"}, new String[] {Object.class.getN
<li>
See the
<i>
JMX 1.4 Specification
</i>
PDF document available from the
<a
href=
"{@docRoot}/../technotes/guides/jmx/"
>
Java
SE 6 Platform documentation on JMX
</a>
Java
Platform documentation on JMX technology
</a>
</ul>
@since 1.5
...
...
src/share/classes/javax/management/monitor/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
javax.management.monitor package
</title>
<!--
Copyright (c) 1999, 20
06
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1999, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -184,7 +184,7 @@ questions.
</ul>
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/jmx/"
>
Java
SE 6
Platform documentation on JMX technology
</a>
,
Java Platform documentation on JMX technology
</a>
,
in particular the
<a
href=
"{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf"
>
JMX Specification, version 1.4(pdf).
</a>
...
...
src/share/classes/javax/management/openmbean/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
javax.management.openmbean package
</title>
<!--
Copyright (c) 2001, 20
07
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2001, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -143,7 +143,7 @@ questions.
</ul>
@see
<a
href=
"{@docRoot}/../technotes/guides/jmx/"
>
Java
SE 6
Platform documentation on JMX technology
</a>
,
Java Platform documentation on JMX technology
</a>
,
in particular the
<a
href=
"{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf"
>
JMX Specification, version 1.4
</a>
...
...
src/share/classes/javax/management/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
javax.management package
</title>
<!--
Copyright (c) 1999, 20
06
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 1999, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -391,7 +391,7 @@ questions.
<p
id=
"spec"
>
@see
<a
href=
"{@docRoot}/../technotes/guides/jmx/index.html"
>
Java
SE 6
Platform documentation on JMX technology
</a>
Java Platform documentation on JMX technology
</a>
in particular the
<a
href=
"{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf"
>
JMX Specification, version 1.4(pdf).
</a>
...
...
src/share/classes/javax/management/relation/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
javax.management.relation package
</title>
<!--
Copyright (c) 2000, 20
06
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2000, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -137,7 +137,7 @@ Set<ObjectName> dependentASet = dependentAMap.keySet();
</pre>
@see
<a
href=
"{@docRoot}/../technotes/guides/jmx/"
>
Java
SE 6
Platform documentation on JMX technology
</a>
,
Java Platform documentation on JMX technology
</a>
,
in particular the
<a
href=
"{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf"
>
JMX Specification, version 1.4
</a>
...
...
src/share/classes/javax/management/remote/package.html
浏览文件 @
f9c0499e
...
...
@@ -2,7 +2,7 @@
<head>
<title>
JMX
<sup><font
size=
"-2"
>
TM
</font></sup>
Remote API.
</title>
<!--
Copyright (c) 2002, 20
06
, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2002, 20
11
, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it
...
...
@@ -195,7 +195,7 @@ rmi://192.18.1.9 username 1
@see
<a
href=
"{@docRoot}/../technotes/guides/jmx/"
>
Java
SE 6
Platform documentation on JMX technology
</a>
,
Java Platform documentation on JMX technology
</a>
,
in particular the
<a
href=
"{@docRoot}/../technotes/guides/jmx/JMX_1_4_specification.pdf"
>
JMX Specification, version 1.4
</a>
...
...
src/share/classes/javax/management/timer/Timer.java
浏览文件 @
f9c0499e
...
...
@@ -26,6 +26,7 @@
package
javax.management.timer
;
import
static
com
.
sun
.
jmx
.
defaults
.
JmxProperties
.
TIMER_LOGGER
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Hashtable
;
import
java.util.Iterator
;
...
...
@@ -1003,7 +1004,10 @@ public class Timer extends NotificationBroadcasterSupport
Integer
notifID
;
Date
date
;
for
(
Object
[]
obj
:
timerTable
.
values
())
{
ArrayList
<
Object
[]>
values
=
new
ArrayList
<
Object
[]>(
timerTable
.
values
());
for
(
Object
[]
obj
:
values
)
{
// Retrieve the timer notification and the date notification.
//
...
...
src/share/classes/javax/swing/ComboBoxModel.java
浏览文件 @
f9c0499e
...
...
@@ -33,9 +33,11 @@ package javax.swing;
* <code>ListModel</code>. This disjoint behavior allows for the temporary
* storage and retrieval of a selected item in the model.
*
* @param <E> the type of the elements of this model
*
* @author Arnaud Weber
*/
public
interface
ComboBoxModel
extends
ListModel
{
public
interface
ComboBoxModel
<
E
>
extends
ListModel
<
E
>
{
/**
* Set the selected item. The implementation of this method should notify
...
...
src/share/classes/javax/swing/DefaultComboBoxModel.java
浏览文件 @
f9c0499e
...
...
@@ -24,39 +24,28 @@
*/
package
javax.swing
;
import
java.beans.*
;
import
java.util.*
;
import
java.awt.*
;
import
java.awt.event.*
;
import
java.io.Serializable
;
import
java.io.ObjectOutputStream
;
import
java.io.ObjectInputStream
;
import
java.io.IOException
;
import
javax.swing.event.*
;
import
javax.swing.plaf.*
;
import
javax.swing.border.*
;
import
javax.accessibility.*
;
/**
* The default model for combo boxes.
*
* @param <E> the type of the elements of this model
*
* @author Arnaud Weber
* @author Tom Santos
*/
public
class
DefaultComboBoxModel
extends
AbstractListModel
implements
MutableComboBoxModel
,
Serializable
{
Vector
objects
;
public
class
DefaultComboBoxModel
<
E
>
extends
AbstractListModel
<
E
>
implements
MutableComboBoxModel
<
E
>
,
Serializable
{
Vector
<
E
>
objects
;
Object
selectedObject
;
/**
* Constructs an empty DefaultComboBoxModel object.
*/
public
DefaultComboBoxModel
()
{
objects
=
new
Vector
();
objects
=
new
Vector
<
E
>
();
}
/**
...
...
@@ -65,8 +54,8 @@ public class DefaultComboBoxModel extends AbstractListModel implements MutableCo
*
* @param items an array of Object objects
*/
public
DefaultComboBoxModel
(
final
Object
items
[])
{
objects
=
new
Vector
();
public
DefaultComboBoxModel
(
final
E
items
[])
{
objects
=
new
Vector
<
E
>
();
objects
.
ensureCapacity
(
items
.
length
);
int
i
,
c
;
...
...
@@ -84,7 +73,7 @@ public class DefaultComboBoxModel extends AbstractListModel implements MutableCo
*
* @param v a Vector object ...
*/
public
DefaultComboBoxModel
(
Vector
<
?
>
v
)
{
public
DefaultComboBoxModel
(
Vector
<
E
>
v
)
{
objects
=
v
;
if
(
getSize
()
>
0
)
{
...
...
@@ -117,7 +106,7 @@ public class DefaultComboBoxModel extends AbstractListModel implements MutableCo
}
// implements javax.swing.ListModel
public
Object
getElementAt
(
int
index
)
{
public
E
getElementAt
(
int
index
)
{
if
(
index
>=
0
&&
index
<
objects
.
size
()
)
return
objects
.
elementAt
(
index
);
else
...
...
@@ -136,7 +125,7 @@ public class DefaultComboBoxModel extends AbstractListModel implements MutableCo
}
// implements javax.swing.MutableComboBoxModel
public
void
addElement
(
Object
anObject
)
{
public
void
addElement
(
E
anObject
)
{
objects
.
addElement
(
anObject
);
fireIntervalAdded
(
this
,
objects
.
size
()-
1
,
objects
.
size
()-
1
);
if
(
objects
.
size
()
==
1
&&
selectedObject
==
null
&&
anObject
!=
null
)
{
...
...
@@ -145,7 +134,7 @@ public class DefaultComboBoxModel extends AbstractListModel implements MutableCo
}
// implements javax.swing.MutableComboBoxModel
public
void
insertElementAt
(
Object
anObject
,
int
index
)
{
public
void
insertElementAt
(
E
anObject
,
int
index
)
{
objects
.
insertElementAt
(
anObject
,
index
);
fireIntervalAdded
(
this
,
index
,
index
);
}
...
...
src/share/classes/javax/swing/JComboBox.java
浏览文件 @
f9c0499e
...
...
@@ -69,6 +69,8 @@ import javax.accessibility.*;
* @see ComboBoxModel
* @see DefaultComboBoxModel
*
* @param <E> the type of the elements of this combo box
*
* @beaninfo
* attribute: isContainer false
* description: A combination of a text field and a drop-down list.
...
...
@@ -76,7 +78,7 @@ import javax.accessibility.*;
* @author Arnaud Weber
* @author Mark Davidson
*/
public
class
JComboBox
extends
JComponent
public
class
JComboBox
<
E
>
extends
JComponent
implements
ItemSelectable
,
ListDataListener
,
ActionListener
,
Accessible
{
/**
* @see #getUIClassID
...
...
@@ -91,7 +93,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @see #getModel
* @see #setModel
*/
protected
ComboBoxModel
dataModel
;
protected
ComboBoxModel
<
E
>
dataModel
;
/**
* This protected field is implementation specific. Do not access directly
* or override. Use the accessor methods instead.
...
...
@@ -99,7 +101,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @see #getRenderer
* @see #setRenderer
*/
protected
ListCellRenderer
renderer
;
protected
ListCellRenderer
<?
super
E
>
renderer
;
/**
* This protected field is implementation specific. Do not access directly
* or override. Use the accessor methods instead.
...
...
@@ -156,7 +158,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
*/
protected
Object
selectedItemReminder
=
null
;
private
Object
prototypeDisplayValue
;
private
E
prototypeDisplayValue
;
// Flag to ensure that infinite loops do not occur with ActionEvents.
private
boolean
firingActionEvent
=
false
;
...
...
@@ -175,7 +177,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* displayed list of items
* @see DefaultComboBoxModel
*/
public
JComboBox
(
ComboBoxModel
aModel
)
{
public
JComboBox
(
ComboBoxModel
<
E
>
aModel
)
{
super
();
setModel
(
aModel
);
init
();
...
...
@@ -189,9 +191,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @param items an array of objects to insert into the combo box
* @see DefaultComboBoxModel
*/
public
JComboBox
(
final
Object
items
[]
)
{
public
JComboBox
(
E
[]
items
)
{
super
();
setModel
(
new
DefaultComboBoxModel
(
items
));
setModel
(
new
DefaultComboBoxModel
<
E
>
(
items
));
init
();
}
...
...
@@ -203,9 +205,9 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @param items an array of vectors to insert into the combo box
* @see DefaultComboBoxModel
*/
public
JComboBox
(
Vector
<
?
>
items
)
{
public
JComboBox
(
Vector
<
E
>
items
)
{
super
();
setModel
(
new
DefaultComboBoxModel
(
items
));
setModel
(
new
DefaultComboBoxModel
<
E
>
(
items
));
init
();
}
...
...
@@ -219,7 +221,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
*/
public
JComboBox
()
{
super
();
setModel
(
new
DefaultComboBoxModel
());
setModel
(
new
DefaultComboBoxModel
<
E
>
());
init
();
}
...
...
@@ -263,7 +265,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
public
void
updateUI
()
{
setUI
((
ComboBoxUI
)
UIManager
.
getUI
(
this
));
ListCellRenderer
renderer
=
getRenderer
();
ListCellRenderer
<?
super
E
>
renderer
=
getRenderer
();
if
(
renderer
instanceof
Component
)
{
SwingUtilities
.
updateComponentTreeUI
((
Component
)
renderer
);
}
...
...
@@ -302,8 +304,8 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* bound: true
* description: Model that the combo box uses to get data to display.
*/
public
void
setModel
(
ComboBoxModel
aModel
)
{
ComboBoxModel
oldModel
=
dataModel
;
public
void
setModel
(
ComboBoxModel
<
E
>
aModel
)
{
ComboBoxModel
<
E
>
oldModel
=
dataModel
;
if
(
oldModel
!=
null
)
{
oldModel
.
removeListDataListener
(
this
);
}
...
...
@@ -322,7 +324,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @return the <code>ComboBoxModel</code> that provides the displayed
* list of items
*/
public
ComboBoxModel
getModel
()
{
public
ComboBoxModel
<
E
>
getModel
()
{
return
dataModel
;
}
...
...
@@ -461,8 +463,8 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* expert: true
* description: The renderer that paints the item selected in the list.
*/
public
void
setRenderer
(
ListCellRenderer
aRenderer
)
{
ListCellRenderer
oldRenderer
=
renderer
;
public
void
setRenderer
(
ListCellRenderer
<?
super
E
>
aRenderer
)
{
ListCellRenderer
<?
super
E
>
oldRenderer
=
renderer
;
renderer
=
aRenderer
;
firePropertyChange
(
"renderer"
,
oldRenderer
,
renderer
);
invalidate
();
...
...
@@ -475,7 +477,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @return the <code>ListCellRenderer</code> that displays
* the selected item.
*/
public
ListCellRenderer
getRenderer
()
{
public
ListCellRenderer
<?
super
E
>
getRenderer
()
{
return
renderer
;
}
...
...
@@ -558,7 +560,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
// will be rejected.
boolean
found
=
false
;
for
(
int
i
=
0
;
i
<
dataModel
.
getSize
();
i
++)
{
Object
element
=
dataModel
.
getElementAt
(
i
);
E
element
=
dataModel
.
getElementAt
(
i
);
if
(
anObject
.
equals
(
element
))
{
found
=
true
;
objectToSelect
=
element
;
...
...
@@ -640,7 +642,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
public
int
getSelectedIndex
()
{
Object
sObject
=
dataModel
.
getSelectedItem
();
int
i
,
c
;
Object
obj
;
E
obj
;
for
(
i
=
0
,
c
=
dataModel
.
getSize
();
i
<
c
;
i
++
)
{
obj
=
dataModel
.
getElementAt
(
i
);
...
...
@@ -658,7 +660,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* @see #setPrototypeDisplayValue
* @since 1.4
*/
public
Object
getPrototypeDisplayValue
()
{
public
E
getPrototypeDisplayValue
()
{
return
prototypeDisplayValue
;
}
...
...
@@ -683,7 +685,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* attribute: visualUpdate true
* description: The display prototype value, used to compute display width and height.
*/
public
void
setPrototypeDisplayValue
(
Object
prototypeDisplayValue
)
{
public
void
setPrototypeDisplayValue
(
E
prototypeDisplayValue
)
{
Object
oldValue
=
this
.
prototypeDisplayValue
;
this
.
prototypeDisplayValue
=
prototypeDisplayValue
;
firePropertyChange
(
"prototypeDisplayValue"
,
oldValue
,
prototypeDisplayValue
);
...
...
@@ -708,12 +710,12 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* }
* </pre>
*
* @param
anObject the Object
to add to the list
* @param
item the item
to add to the list
* @see MutableComboBoxModel
*/
public
void
addItem
(
Object
anObject
)
{
public
void
addItem
(
E
item
)
{
checkMutableComboBoxModel
();
((
MutableComboBoxModel
)
dataModel
).
addElement
(
anObject
);
((
MutableComboBoxModel
<
E
>)
dataModel
).
addElement
(
item
);
}
/**
...
...
@@ -721,14 +723,14 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* This method works only if the <code>JComboBox</code> uses a
* mutable data model.
*
* @param
anObject the <code>Object</code>
to add to the list
* @param
item the item
to add to the list
* @param index an integer specifying the position at which
* to add the item
* @see MutableComboBoxModel
*/
public
void
insertItemAt
(
Object
anObject
,
int
index
)
{
public
void
insertItemAt
(
E
item
,
int
index
)
{
checkMutableComboBoxModel
();
((
MutableComboBoxModel
)
dataModel
).
insertElementAt
(
anObject
,
index
);
((
MutableComboBoxModel
<
E
>)
dataModel
).
insertElementAt
(
item
,
index
);
}
/**
...
...
@@ -756,7 +758,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
*/
public
void
removeItemAt
(
int
anIndex
)
{
checkMutableComboBoxModel
();
((
MutableComboBoxModel
)
dataModel
).
removeElementAt
(
anIndex
);
((
MutableComboBoxModel
<
E
>
)
dataModel
).
removeElementAt
(
anIndex
);
}
/**
...
...
@@ -764,7 +766,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
*/
public
void
removeAllItems
()
{
checkMutableComboBoxModel
();
MutableComboBoxModel
model
=
(
MutableComboBoxModel
)
dataModel
;
MutableComboBoxModel
<
E
>
model
=
(
MutableComboBoxModel
<
E
>
)
dataModel
;
int
size
=
model
.
getSize
();
if
(
model
instanceof
DefaultComboBoxModel
)
{
...
...
@@ -772,7 +774,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
}
else
{
for
(
int
i
=
0
;
i
<
size
;
++
i
)
{
Object
element
=
model
.
getElementAt
(
0
);
E
element
=
model
.
getElementAt
(
0
);
model
.
removeElement
(
element
);
}
}
...
...
@@ -1188,11 +1190,11 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
private
static
class
ComboBoxActionPropertyChangeListener
extends
ActionPropertyChangeListener
<
JComboBox
>
{
ComboBoxActionPropertyChangeListener
(
JComboBox
b
,
Action
a
)
{
extends
ActionPropertyChangeListener
<
JComboBox
<?>
>
{
ComboBoxActionPropertyChangeListener
(
JComboBox
<?>
b
,
Action
a
)
{
super
(
b
,
a
);
}
protected
void
actionPropertyChanged
(
JComboBox
cb
,
protected
void
actionPropertyChanged
(
JComboBox
<?>
cb
,
Action
action
,
PropertyChangeEvent
e
)
{
if
(
AbstractAction
.
shouldReconfigure
(
e
))
{
...
...
@@ -1454,10 +1456,10 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
*
* @param index an integer indicating the list position, where the first
* item starts at zero
* @return the
<code>Object</code>
at that list position; or
* @return the
item
at that list position; or
* <code>null</code> if out of range
*/
public
Object
getItemAt
(
int
index
)
{
public
E
getItemAt
(
int
index
)
{
return
dataModel
.
getElementAt
(
index
);
}
...
...
src/share/classes/javax/swing/MutableComboBoxModel.java
浏览文件 @
f9c0499e
...
...
@@ -27,19 +27,21 @@ package javax.swing;
/**
* A mutable version of <code>ComboBoxModel</code>.
*
* @param <E> the type of the elements of this model
*
* @author Tom Santos
*/
public
interface
MutableComboBoxModel
extends
ComboBoxModel
{
public
interface
MutableComboBoxModel
<
E
>
extends
ComboBoxModel
<
E
>
{
/**
* Adds an item at the end of the model. The implementation of this method
* should notify all registered <code>ListDataListener</code>s that the
* item has been added.
*
* @param
obj the <code>Object</code>
to be added
* @param
item the item
to be added
*/
public
void
addElement
(
Object
obj
);
public
void
addElement
(
E
item
);
/**
* Removes an item from the model. The implementation of this method should
...
...
@@ -55,17 +57,17 @@ public interface MutableComboBoxModel extends ComboBoxModel {
* should notify all registered <code>ListDataListener</code>s that the
* item has been added.
*
* @param
obj the <code>Object</code>
to be added
* @param
item the item
to be added
* @param index location to add the object
*/
public
void
insertElementAt
(
Object
obj
,
int
index
);
public
void
insertElementAt
(
E
item
,
int
index
);
/**
* Removes an item at a specific index. The implementation of this method
* should notify all registered <code>ListDataListener</code>s that the
* item has been removed.
*
* @param index location of
object
to be removed
* @param index location of
the item
to be removed
*/
public
void
removeElementAt
(
int
index
);
}
src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
浏览文件 @
f9c0499e
...
...
@@ -40,7 +40,7 @@ import sun.awt.shell.ShellFolder;
*
* @author Jeff Dinkins
*/
public
class
BasicDirectoryModel
extends
AbstractListModel
implements
PropertyChangeListener
{
public
class
BasicDirectoryModel
extends
AbstractListModel
<
Object
>
implements
PropertyChangeListener
{
private
JFileChooser
filechooser
=
null
;
// PENDING(jeff) pick the size more sensibly
...
...
src/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java
浏览文件 @
f9c0499e
...
...
@@ -906,7 +906,7 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
DirectoryComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
{
protected
class
DirectoryComboBoxModel
extends
AbstractListModel
<
Object
>
implements
ComboBoxModel
<
Object
>
{
Vector
<
File
>
directories
=
new
Vector
<
File
>();
int
[]
depths
=
null
;
File
selectedDirectory
=
null
;
...
...
@@ -1063,7 +1063,7 @@ public class MetalFileChooserUI extends BasicFileChooserUI {
/**
* Data model for a type-face selection combo-box.
*/
protected
class
FilterComboBoxModel
extends
AbstractListModel
implements
ComboBoxModel
,
PropertyChangeListener
{
protected
class
FilterComboBoxModel
extends
AbstractListModel
<
Object
>
implements
ComboBoxModel
<
Object
>
,
PropertyChangeListener
{
protected
FileFilter
[]
filters
;
protected
FilterComboBoxModel
()
{
super
();
...
...
src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java
浏览文件 @
f9c0499e
...
...
@@ -488,6 +488,18 @@ public class SynthTabbedPaneUI extends BasicTabbedPaneUI
paintContentBorder
(
tabContentContext
,
g
,
tabPlacement
,
selectedIndex
);
}
protected
void
paintTabArea
(
Graphics
g
,
int
tabPlacement
,
int
selectedIndex
)
{
// This can be invoked from ScrollabeTabPanel
Insets
insets
=
tabPane
.
getInsets
();
int
x
=
insets
.
left
;
int
y
=
insets
.
top
;
int
width
=
tabPane
.
getWidth
()
-
insets
.
left
-
insets
.
right
;
int
height
=
tabPane
.
getHeight
()
-
insets
.
top
-
insets
.
bottom
;
paintTabArea
(
tabAreaContext
,
g
,
tabPlacement
,
selectedIndex
,
new
Rectangle
(
x
,
y
,
width
,
height
));
}
private
void
paintTabArea
(
SynthContext
ss
,
Graphics
g
,
int
tabPlacement
,
int
selectedIndex
,
...
...
src/share/classes/sun/awt/FontDescriptor.java
浏览文件 @
f9c0499e
...
...
@@ -26,7 +26,7 @@ package sun.awt;
import
java.nio.charset.Charset
;
import
java.nio.charset.CharsetEncoder
;
import
java.nio.charset.StandardCharset
;
import
java.nio.charset.StandardCharset
s
;
import
sun.nio.cs.HistoricallyNamedCharset
;
public
class
FontDescriptor
implements
Cloneable
{
...
...
@@ -105,8 +105,8 @@ public class FontDescriptor implements Cloneable {
if
(
useUnicode
&&
unicodeEncoder
==
null
)
{
try
{
this
.
unicodeEncoder
=
isLE
?
StandardCharset
.
UTF_16LE
.
newEncoder
():
StandardCharset
.
UTF_16BE
.
newEncoder
();
StandardCharset
s
.
UTF_16LE
.
newEncoder
():
StandardCharset
s
.
UTF_16BE
.
newEncoder
();
}
catch
(
IllegalArgumentException
x
)
{}
}
return
useUnicode
;
...
...
src/share/classes/sun/java2d/opengl/OGLRenderer.java
浏览文件 @
f9c0499e
...
...
@@ -102,15 +102,20 @@ class OGLRenderer extends BufferedRenderPipe {
final
ParallelogramPipe
realpipe
=
oglr
.
getAAParallelogramPipe
();
return
new
ParallelogramPipe
()
{
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
{
GraphicsPrimitive
.
tracePrimitive
(
"OGLFillAAParallelogram"
);
realpipe
.
fillParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
);
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
@@ -118,6 +123,7 @@ class OGLRenderer extends BufferedRenderPipe {
{
GraphicsPrimitive
.
tracePrimitive
(
"OGLDrawAAParallelogram"
);
realpipe
.
drawParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
,
lw2
);
}
...
...
@@ -166,21 +172,29 @@ class OGLRenderer extends BufferedRenderPipe {
oglr
.
fillSpans
(
sg2d
,
si
,
transx
,
transy
);
}
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
{
GraphicsPrimitive
.
tracePrimitive
(
"OGLFillParallelogram"
);
oglr
.
fillParallelogram
(
sg2d
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
);
oglr
.
fillParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
);
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
double
lw1
,
double
lw2
)
{
GraphicsPrimitive
.
tracePrimitive
(
"OGLDrawParallelogram"
);
oglr
.
drawParallelogram
(
sg2d
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
,
lw2
);
oglr
.
drawParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
,
lw2
);
}
public
void
copyArea
(
SunGraphics2D
sg2d
,
int
x
,
int
y
,
int
w
,
int
h
,
int
dx
,
int
dy
)
...
...
src/share/classes/sun/java2d/pipe/AAShapePipe.java
浏览文件 @
f9c0499e
...
...
@@ -68,21 +68,23 @@ public class AAShapePipe
renderPath
(
sg
,
s
,
null
);
}
private
static
Rectangle2D
computeBBox
(
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
private
static
Rectangle2D
computeBBox
(
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
)
{
double
lox
,
loy
,
hix
,
hiy
;
lox
=
hix
=
x
;
loy
=
hiy
=
y
;
if
(
dx1
<
0
)
{
lox
+=
dx1
;
}
else
{
hix
+=
dx1
;
}
if
(
dy1
<
0
)
{
loy
+=
dy1
;
}
else
{
hiy
+=
dy1
;
}
if
(
dx2
<
0
)
{
lox
+=
dx2
;
}
else
{
hix
+=
dx2
;
}
if
(
dy2
<
0
)
{
loy
+=
dy2
;
}
else
{
hiy
+=
dy2
;
}
return
new
Rectangle2D
.
Double
(
lox
,
loy
,
hix
-
lox
,
hiy
-
loy
);
if
((
ux2
-=
ux1
)
<
0
)
{
ux1
+=
ux2
;
ux2
=
-
ux2
;
}
if
((
uy2
-=
uy1
)
<
0
)
{
uy1
+=
uy2
;
uy2
=
-
uy2
;
}
return
new
Rectangle2D
.
Double
(
ux1
,
uy1
,
ux2
,
uy2
);
}
public
void
fillParallelogram
(
SunGraphics2D
sg
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
...
...
@@ -97,10 +99,12 @@ public class AAShapePipe
return
;
}
renderTiles
(
sg
,
computeBBox
(
x
,
y
,
dx1
,
dy1
,
dx2
,
d
y2
),
aatg
,
abox
);
renderTiles
(
sg
,
computeBBox
(
ux1
,
uy1
,
ux2
,
u
y2
),
aatg
,
abox
);
}
public
void
drawParallelogram
(
SunGraphics2D
sg
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
@@ -118,7 +122,7 @@ public class AAShapePipe
// Note that bbox is of the original shape, not the wide path.
// This is appropriate for handing to Paint methods...
renderTiles
(
sg
,
computeBBox
(
x
,
y
,
dx1
,
dy1
,
dx2
,
d
y2
),
aatg
,
abox
);
renderTiles
(
sg
,
computeBBox
(
ux1
,
uy1
,
ux2
,
u
y2
),
aatg
,
abox
);
}
private
static
byte
[]
theTile
;
...
...
src/share/classes/sun/java2d/pipe/AlphaColorPipe.java
浏览文件 @
f9c0499e
...
...
@@ -66,6 +66,8 @@ public class AlphaColorPipe implements CompositePipe, ParallelogramPipe {
}
public
void
fillParallelogram
(
SunGraphics2D
sg
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
...
...
@@ -75,6 +77,8 @@ public class AlphaColorPipe implements CompositePipe, ParallelogramPipe {
}
public
void
drawParallelogram
(
SunGraphics2D
sg
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
src/share/classes/sun/java2d/pipe/BufferedRenderPipe.java
浏览文件 @
f9c0499e
...
...
@@ -408,6 +408,8 @@ public abstract class BufferedRenderPipe
}
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
...
...
@@ -429,6 +431,8 @@ public abstract class BufferedRenderPipe
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
@@ -454,6 +458,8 @@ public abstract class BufferedRenderPipe
private
class
AAParallelogramPipe
implements
ParallelogramPipe
{
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
...
...
@@ -475,6 +481,8 @@ public abstract class BufferedRenderPipe
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
src/share/classes/sun/java2d/pipe/LoopPipe.java
浏览文件 @
f9c0499e
...
...
@@ -352,6 +352,8 @@ public class LoopPipe
}
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
...
...
@@ -362,6 +364,8 @@ public class LoopPipe
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
src/share/classes/sun/java2d/pipe/ParallelogramPipe.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2011
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -40,9 +40,17 @@ import sun.java2d.SunGraphics2D;
* => (x+dx2, y+dy2)
* => origin
* </pre>
* The four u[xy][12] parameters are the unsorted extreme coordinates
* of the primitive in user space. They may have been generated by a
* line or a rectangle so they could have u[xy]2 < u[xy]1 in some cases.
* They should be sorted before calculating the bounds of the original
* primitive (such as for calculating the user space bounds for the
* Paint.createContext() method).
*/
public
interface
ParallelogramPipe
{
public
void
fillParallelogram
(
SunGraphics2D
sg
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
);
...
...
@@ -59,6 +67,8 @@ public interface ParallelogramPipe {
* difference between the outer and inner parallelograms.
*/
public
void
drawParallelogram
(
SunGraphics2D
sg
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
src/share/classes/sun/java2d/pipe/PixelToParallelogramConverter.java
浏览文件 @
f9c0499e
...
...
@@ -175,8 +175,8 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
}
public
boolean
drawGeneralLine
(
SunGraphics2D
sg2d
,
double
x1
,
double
y1
,
double
x2
,
double
y2
)
double
ux1
,
double
u
y1
,
double
ux2
,
double
u
y2
)
{
if
(
sg2d
.
strokeState
==
SunGraphics2D
.
STROKE_CUSTOM
||
sg2d
.
strokeState
==
SunGraphics2D
.
STROKE_THINDASHED
)
...
...
@@ -194,13 +194,14 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
double
lw
=
bs
.
getLineWidth
();
// Save the original dx, dy in case we need it to transform
// the linewidth as a perpendicular vector below
double
dx
=
x2
-
x1
;
double
dy
=
y2
-
y1
;
double
dx
=
ux2
-
ux1
;
double
dy
=
uy2
-
uy1
;
double
x1
,
y1
,
x2
,
y2
;
switch
(
sg2d
.
transformState
)
{
case
SunGraphics2D
.
TRANSFORM_GENERIC
:
case
SunGraphics2D
.
TRANSFORM_TRANSLATESCALE
:
{
double
coords
[]
=
{
x1
,
y1
,
x2
,
y2
};
double
coords
[]
=
{
ux1
,
uy1
,
ux2
,
u
y2
};
sg2d
.
transform
.
transform
(
coords
,
0
,
coords
,
0
,
2
);
x1
=
coords
[
0
];
y1
=
coords
[
1
];
...
...
@@ -213,13 +214,17 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
{
double
tx
=
sg2d
.
transform
.
getTranslateX
();
double
ty
=
sg2d
.
transform
.
getTranslateY
();
x1
+=
tx
;
y1
+=
ty
;
x2
+=
tx
;
y2
+=
ty
;
x1
=
ux1
+
tx
;
y1
=
uy1
+
ty
;
x2
=
ux2
+
tx
;
y2
=
uy2
+
ty
;
}
break
;
case
SunGraphics2D
.
TRANSFORM_ISIDENT
:
x1
=
ux1
;
y1
=
uy1
;
x2
=
ux2
;
y2
=
uy2
;
break
;
default
:
throw
new
InternalError
(
"unknown TRANSFORM state..."
);
...
...
@@ -279,7 +284,8 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
dx
+=
udx
;
dy
+=
udy
;
}
outrenderer
.
fillParallelogram
(
sg2d
,
px
,
py
,
-
udy
,
udx
,
dx
,
dy
);
outrenderer
.
fillParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
px
,
py
,
-
udy
,
udx
,
dx
,
dy
);
return
true
;
}
...
...
@@ -313,7 +319,8 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
px
=
newx
;
py
=
newy
;
}
outrenderer
.
fillParallelogram
(
sg2d
,
px
,
py
,
dx1
,
dy1
,
dx2
,
dy2
);
outrenderer
.
fillParallelogram
(
sg2d
,
rx
,
ry
,
rx
+
rw
,
ry
+
rh
,
px
,
py
,
dx1
,
dy1
,
dx2
,
dy2
);
}
public
void
drawRectangle
(
SunGraphics2D
sg2d
,
...
...
@@ -360,10 +367,12 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
// entire hole in the middle of the parallelogram
// so we can just fill the outer parallelogram.
fillOuterParallelogram
(
sg2d
,
rx
,
ry
,
rx
+
rw
,
ry
+
rh
,
px
,
py
,
dx1
,
dy1
,
dx2
,
dy2
,
len1
,
len2
,
lw1
,
lw2
);
}
else
{
outrenderer
.
drawParallelogram
(
sg2d
,
rx
,
ry
,
rx
+
rw
,
ry
+
rh
,
px
,
py
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
/
len1
,
lw2
/
len2
);
}
...
...
@@ -377,6 +386,8 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
* and issues a single fillParallelogram request to fill it.
*/
public
void
fillOuterParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
px
,
double
py
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
@@ -412,6 +423,7 @@ public class PixelToParallelogramConverter extends PixelToShapeConverter
dx2
+=
udx2
;
dy2
+=
udy2
;
outrenderer
.
fillParallelogram
(
sg2d
,
px
,
py
,
dx1
,
dy1
,
dx2
,
dy2
);
outrenderer
.
fillParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
px
,
py
,
dx1
,
dy1
,
dx2
,
dy2
);
}
}
src/share/classes/sun/management/GarbageCollectionNotifInfoCompositeData.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package
sun.management
;
import
com.sun.management.GarbageCollectionNotificationInfo
;
import
com.sun.management.GcInfo
;
import
java.lang.reflect.Method
;
import
javax.management.openmbean.CompositeData
;
import
javax.management.openmbean.CompositeType
;
import
javax.management.openmbean.CompositeDataSupport
;
import
javax.management.openmbean.OpenDataException
;
import
javax.management.openmbean.OpenType
;
import
javax.management.openmbean.SimpleType
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.lang.reflect.Field
;
import
java.util.HashMap
;
/**
* A CompositeData for GarbageCollectionNotificationInfo for the local management support.
* This class avoids the performance penalty paid to the
* construction of a CompositeData use in the local case.
*/
public
class
GarbageCollectionNotifInfoCompositeData
extends
LazyCompositeData
{
private
final
GarbageCollectionNotificationInfo
gcNotifInfo
;
public
GarbageCollectionNotifInfoCompositeData
(
GarbageCollectionNotificationInfo
info
)
{
this
.
gcNotifInfo
=
info
;
}
public
GarbageCollectionNotificationInfo
getGarbageCollectionNotifInfo
()
{
return
gcNotifInfo
;
}
public
static
CompositeData
toCompositeData
(
GarbageCollectionNotificationInfo
info
)
{
GarbageCollectionNotifInfoCompositeData
gcnicd
=
new
GarbageCollectionNotifInfoCompositeData
(
info
);
return
gcnicd
.
getCompositeData
();
}
private
CompositeType
getCompositeTypeByBuilder
()
{
final
GcInfoBuilder
builder
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
GcInfoBuilder
>()
{
public
GcInfoBuilder
run
()
{
try
{
Class
cl
=
Class
.
forName
(
"com.sun.management.GcInfo"
);
Field
f
=
cl
.
getDeclaredField
(
"builder"
);
f
.
setAccessible
(
true
);
return
(
GcInfoBuilder
)
f
.
get
(
gcNotifInfo
.
getGcInfo
());
}
catch
(
ClassNotFoundException
e
)
{
return
null
;
}
catch
(
NoSuchFieldException
e
)
{
return
null
;
}
catch
(
IllegalAccessException
e
)
{
return
null
;
}
}
});
CompositeType
gict
=
null
;
synchronized
(
compositeTypeByBuilder
)
{
gict
=
compositeTypeByBuilder
.
get
(
builder
);
if
(
gict
==
null
)
{
OpenType
[]
gcNotifInfoItemTypes
=
new
OpenType
[]
{
SimpleType
.
STRING
,
SimpleType
.
STRING
,
SimpleType
.
STRING
,
builder
.
getGcInfoCompositeType
(),
};
try
{
final
String
typeName
=
"sun.management.GarbageCollectionNotifInfoCompositeType"
;
gict
=
new
CompositeType
(
typeName
,
"CompositeType for GC notification info"
,
gcNotifInfoItemNames
,
gcNotifInfoItemNames
,
gcNotifInfoItemTypes
);
compositeTypeByBuilder
.
put
(
builder
,
gict
);
}
catch
(
OpenDataException
e
)
{
// shouldn't reach here
throw
Util
.
newException
(
e
);
}
}
}
return
gict
;
}
protected
CompositeData
getCompositeData
()
{
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// gcNotifInfoItemNames!
final
Object
[]
gcNotifInfoItemValues
;
gcNotifInfoItemValues
=
new
Object
[]
{
gcNotifInfo
.
getGcName
(),
gcNotifInfo
.
getGcAction
(),
gcNotifInfo
.
getGcCause
(),
GcInfoCompositeData
.
toCompositeData
(
gcNotifInfo
.
getGcInfo
())
};
CompositeType
gict
=
getCompositeTypeByBuilder
();
try
{
return
new
CompositeDataSupport
(
gict
,
gcNotifInfoItemNames
,
gcNotifInfoItemValues
);
}
catch
(
OpenDataException
e
)
{
// Should never reach here
throw
new
AssertionError
(
e
);
}
}
// private static MappedMXBeanType gcInfoMapType;
private
static
final
String
GC_NAME
=
"gcName"
;
private
static
final
String
GC_ACTION
=
"gcAction"
;
private
static
final
String
GC_CAUSE
=
"gcCause"
;
private
static
final
String
GC_INFO
=
"gcInfo"
;
private
static
final
String
[]
gcNotifInfoItemNames
=
{
GC_NAME
,
GC_ACTION
,
GC_CAUSE
,
GC_INFO
};
private
static
HashMap
<
GcInfoBuilder
,
CompositeType
>
compositeTypeByBuilder
=
new
HashMap
<
GcInfoBuilder
,
CompositeType
>();
public
static
String
getGcName
(
CompositeData
cd
)
{
String
gcname
=
getString
(
cd
,
GC_NAME
);
if
(
gcname
==
null
)
{
throw
new
IllegalArgumentException
(
"Invalid composite data: "
+
"Attribute "
+
GC_NAME
+
" has null value"
);
}
return
gcname
;
}
public
static
String
getGcAction
(
CompositeData
cd
)
{
String
gcaction
=
getString
(
cd
,
GC_ACTION
);
if
(
gcaction
==
null
)
{
throw
new
IllegalArgumentException
(
"Invalid composite data: "
+
"Attribute "
+
GC_ACTION
+
" has null value"
);
}
return
gcaction
;
}
public
static
String
getGcCause
(
CompositeData
cd
)
{
String
gccause
=
getString
(
cd
,
GC_CAUSE
);
if
(
gccause
==
null
)
{
throw
new
IllegalArgumentException
(
"Invalid composite data: "
+
"Attribute "
+
GC_CAUSE
+
" has null value"
);
}
return
gccause
;
}
public
static
GcInfo
getGcInfo
(
CompositeData
cd
)
{
CompositeData
gcInfoData
=
(
CompositeData
)
cd
.
get
(
GC_INFO
);
return
GcInfo
.
from
(
gcInfoData
);
}
/** Validate if the input CompositeData has the expected
* CompositeType (i.e. contain all attributes with expected
* names and types).
*/
public
static
void
validateCompositeData
(
CompositeData
cd
)
{
if
(
cd
==
null
)
{
throw
new
NullPointerException
(
"Null CompositeData"
);
}
if
(!
isTypeMatched
(
getBaseGcNotifInfoCompositeType
(),
cd
.
getCompositeType
()))
{
throw
new
IllegalArgumentException
(
"Unexpected composite type for GarbageCollectionNotificationInfo"
);
}
}
// This is only used for validation.
private
static
CompositeType
baseGcNotifInfoCompositeType
=
null
;
private
static
synchronized
CompositeType
getBaseGcNotifInfoCompositeType
()
{
if
(
baseGcNotifInfoCompositeType
==
null
)
{
try
{
OpenType
[]
baseGcNotifInfoItemTypes
=
new
OpenType
[]
{
SimpleType
.
STRING
,
SimpleType
.
STRING
,
SimpleType
.
STRING
,
GcInfoCompositeData
.
getBaseGcInfoCompositeType
()
};
baseGcNotifInfoCompositeType
=
new
CompositeType
(
"sun.management.BaseGarbageCollectionNotifInfoCompositeType"
,
"CompositeType for Base GarbageCollectionNotificationInfo"
,
gcNotifInfoItemNames
,
gcNotifInfoItemNames
,
baseGcNotifInfoItemTypes
);
}
catch
(
OpenDataException
e
)
{
// shouldn't reach here
throw
Util
.
newException
(
e
);
}
}
return
baseGcNotifInfoCompositeType
;
}
private
static
final
long
serialVersionUID
=
-
1805123446483771292L
;
}
src/share/classes/sun/management/GarbageCollectorImpl.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -26,6 +26,7 @@
package
sun.management
;
import
com.sun.management.GarbageCollectorMXBean
;
import
com.sun.management.GarbageCollectionNotificationInfo
;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.MemoryPoolMXBean
;
import
java.lang.management.MemoryUsage
;
...
...
@@ -35,9 +36,15 @@ import javax.management.openmbean.CompositeData;
import
javax.management.MBeanInfo
;
import
javax.management.MBeanAttributeInfo
;
import
javax.management.ObjectName
;
import
javax.management.MBeanNotificationInfo
;
import
javax.management.Notification
;
import
javax.management.NotificationFilter
;
import
javax.management.NotificationListener
;
import
javax.management.ListenerNotFoundException
;
import
java.util.List
;
import
java.util.ListIterator
;
import
java.util.Map
;
/**
* Implementation class for the garbage collector.
...
...
@@ -78,19 +85,111 @@ class GarbageCollectorImpl extends MemoryManagerImpl
// Sun JDK extension
private
GcInfoBuilder
gcInfoBuilder
;
public
GcInfo
getLastGcInfo
()
{
synchronized
(
this
)
{
if
(
gcInfoBuilder
==
null
)
{
private
synchronized
GcInfoBuilder
getGcInfoBuilder
(
)
{
if
(
gcInfoBuilder
==
null
)
{
gcInfoBuilder
=
new
GcInfoBuilder
(
this
,
getAllPoolNames
());
}
return
gcInfoBuilder
;
}
GcInfo
info
=
gcInfoBuilder
.
getLastGcInfo
();
public
GcInfo
getLastGcInfo
()
{
GcInfo
info
=
getGcInfoBuilder
().
getLastGcInfo
();
return
info
;
}
private
final
static
String
notifName
=
"javax.management.Notification"
;
private
final
static
String
[]
gcNotifTypes
=
{
GarbageCollectionNotificationInfo
.
GARBAGE_COLLECTION_NOTIFICATION
};
private
MBeanNotificationInfo
[]
notifInfo
=
null
;
public
MBeanNotificationInfo
[]
getNotificationInfo
()
{
synchronized
(
this
)
{
if
(
notifInfo
==
null
)
{
notifInfo
=
new
MBeanNotificationInfo
[
1
];
notifInfo
[
0
]
=
new
MBeanNotificationInfo
(
gcNotifTypes
,
notifName
,
"GC Notification"
);
}
}
return
notifInfo
;
}
private
static
long
seqNumber
=
0
;
private
static
long
getNextSeqNumber
()
{
return
++
seqNumber
;
}
void
createGCNotification
(
long
timestamp
,
String
gcName
,
String
gcAction
,
String
gcCause
,
GcInfo
gcInfo
)
{
if
(!
hasListeners
())
{
return
;
}
Notification
notif
=
new
Notification
(
GarbageCollectionNotificationInfo
.
GARBAGE_COLLECTION_NOTIFICATION
,
getObjectName
(),
getNextSeqNumber
(),
timestamp
,
gcName
);
GarbageCollectionNotificationInfo
info
=
new
GarbageCollectionNotificationInfo
(
gcName
,
gcAction
,
gcCause
,
gcInfo
);
CompositeData
cd
=
GarbageCollectionNotifInfoCompositeData
.
toCompositeData
(
info
);
notif
.
setUserData
(
cd
);
sendNotification
(
notif
);
}
public
synchronized
void
addNotificationListener
(
NotificationListener
listener
,
NotificationFilter
filter
,
Object
handback
)
{
boolean
before
=
hasListeners
();
super
.
addNotificationListener
(
listener
,
filter
,
handback
);
boolean
after
=
hasListeners
();
if
(!
before
&&
after
)
{
setNotificationEnabled
(
this
,
true
);
}
}
public
synchronized
void
removeNotificationListener
(
NotificationListener
listener
)
throws
ListenerNotFoundException
{
boolean
before
=
hasListeners
();
super
.
removeNotificationListener
(
listener
);
boolean
after
=
hasListeners
();
if
(
before
&&
!
after
)
{
setNotificationEnabled
(
this
,
false
);
}
}
public
synchronized
void
removeNotificationListener
(
NotificationListener
listener
,
NotificationFilter
filter
,
Object
handback
)
throws
ListenerNotFoundException
{
boolean
before
=
hasListeners
();
super
.
removeNotificationListener
(
listener
,
filter
,
handback
);
boolean
after
=
hasListeners
();
if
(
before
&&
!
after
)
{
setNotificationEnabled
(
this
,
false
);
}
}
public
ObjectName
getObjectName
()
{
return
Util
.
newObjectName
(
ManagementFactory
.
GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE
,
getName
());
}
native
void
setNotificationEnabled
(
GarbageCollectorMXBean
gc
,
boolean
enabled
);
}
src/share/classes/sun/management/GcInfoCompositeData.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2004, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 20
11
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -27,6 +27,7 @@ package sun.management;
import
java.lang.management.MemoryUsage
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Field
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.HashMap
;
...
...
@@ -41,6 +42,9 @@ import javax.management.openmbean.SimpleType;
import
javax.management.openmbean.OpenType
;
import
javax.management.openmbean.OpenDataException
;
import
com.sun.management.GcInfo
;
import
com.sun.management.GarbageCollectionNotificationInfo
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
/**
* A CompositeData for GcInfo for the local management support.
...
...
@@ -64,6 +68,44 @@ public class GcInfoCompositeData extends LazyCompositeData {
return
info
;
}
public
static
CompositeData
toCompositeData
(
final
GcInfo
info
)
{
final
GcInfoBuilder
builder
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
GcInfoBuilder
>()
{
public
GcInfoBuilder
run
()
{
try
{
Class
cl
=
Class
.
forName
(
"com.sun.management.GcInfo"
);
Field
f
=
cl
.
getDeclaredField
(
"builder"
);
f
.
setAccessible
(
true
);
return
(
GcInfoBuilder
)
f
.
get
(
info
);
}
catch
(
ClassNotFoundException
e
)
{
return
null
;
}
catch
(
NoSuchFieldException
e
)
{
return
null
;
}
catch
(
IllegalAccessException
e
)
{
return
null
;
}
}
});
final
Object
[]
extAttr
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Object
[]>()
{
public
Object
[]
run
()
{
try
{
Class
cl
=
Class
.
forName
(
"com.sun.management.GcInfo"
);
Field
f
=
cl
.
getDeclaredField
(
"extAttributes"
);
f
.
setAccessible
(
true
);
return
(
Object
[])
f
.
get
(
info
);
}
catch
(
ClassNotFoundException
e
)
{
return
null
;
}
catch
(
NoSuchFieldException
e
)
{
return
null
;
}
catch
(
IllegalAccessException
e
)
{
return
null
;
}
}
});
GcInfoCompositeData
gcicd
=
new
GcInfoCompositeData
(
info
,
builder
,
extAttr
);
return
gcicd
.
getCompositeData
();
}
protected
CompositeData
getCompositeData
()
{
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// baseGcInfoItemNames!
...
...
@@ -115,7 +157,6 @@ public class GcInfoCompositeData extends LazyCompositeData {
}
}
private
static
final
String
ID
=
"id"
;
private
static
final
String
START_TIME
=
"startTime"
;
private
static
final
String
END_TIME
=
"endTime"
;
...
...
@@ -231,7 +272,7 @@ public class GcInfoCompositeData extends LazyCompositeData {
// This is only used for validation.
private
static
CompositeType
baseGcInfoCompositeType
=
null
;
private
static
synchronized
CompositeType
getBaseGcInfoCompositeType
()
{
static
synchronized
CompositeType
getBaseGcInfoCompositeType
()
{
if
(
baseGcInfoCompositeType
==
null
)
{
try
{
baseGcInfoCompositeType
=
...
...
src/share/classes/sun/management/MemoryManagerImpl.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,6 +29,7 @@ import java.lang.management.ManagementFactory;
import
java.lang.management.MemoryManagerMXBean
;
import
java.lang.management.MemoryPoolMXBean
;
import
javax.management.MBeanNotificationInfo
;
import
javax.management.ObjectName
;
/**
...
...
@@ -38,7 +39,8 @@ import javax.management.ObjectName;
* ManagementFactory.getMemoryManagerMXBeans() returns a list
* of instances of this class.
*/
class
MemoryManagerImpl
implements
MemoryManagerMXBean
{
class
MemoryManagerImpl
extends
NotificationEmitterSupport
implements
MemoryManagerMXBean
{
private
final
String
name
;
private
final
boolean
isValid
;
...
...
@@ -76,6 +78,16 @@ class MemoryManagerImpl implements MemoryManagerMXBean {
}
private
native
MemoryPoolMXBean
[]
getMemoryPools0
();
private
MBeanNotificationInfo
[]
notifInfo
=
null
;
public
MBeanNotificationInfo
[]
getNotificationInfo
()
{
synchronized
(
this
)
{
if
(
notifInfo
==
null
)
{
notifInfo
=
new
MBeanNotificationInfo
[
0
];
}
}
return
notifInfo
;
}
public
ObjectName
getObjectName
()
{
return
Util
.
newObjectName
(
ManagementFactory
.
MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE
,
getName
());
}
...
...
src/share/classes/sun/management/VMManagement.java
浏览文件 @
f9c0499e
...
...
@@ -45,6 +45,7 @@ public interface VMManagement {
public
boolean
isSynchronizerUsageSupported
();
public
boolean
isThreadAllocatedMemorySupported
();
public
boolean
isThreadAllocatedMemoryEnabled
();
public
boolean
isGcNotificationSupported
();
// Class Loading Subsystem
public
long
getTotalClassCount
();
...
...
src/share/classes/sun/management/VMManagementImpl.java
浏览文件 @
f9c0499e
...
...
@@ -56,6 +56,8 @@ class VMManagementImpl implements VMManagement {
private
static
boolean
objectMonitorUsageSupport
;
private
static
boolean
synchronizerUsageSupport
;
private
static
boolean
threadAllocatedMemorySupport
;
private
static
boolean
gcNotificationSupport
;
static
{
version
=
getVersion0
();
...
...
@@ -100,6 +102,10 @@ class VMManagementImpl implements VMManagement {
return
threadAllocatedMemorySupport
;
}
public
boolean
isGcNotificationSupported
()
{
return
gcNotificationSupport
;
}
public
native
boolean
isThreadContentionMonitoringEnabled
();
public
native
boolean
isThreadCpuTimeEnabled
();
public
native
boolean
isThreadAllocatedMemoryEnabled
();
...
...
src/share/classes/sun/nio/ch/AsynchronousServerSocketChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -28,7 +28,7 @@ package sun.nio.ch;
import
java.nio.channels.*
;
import
java.net.SocketAddress
;
import
java.net.SocketOption
;
import
java.net.StandardSocketOption
;
import
java.net.StandardSocketOption
s
;
import
java.net.InetSocketAddress
;
import
java.io.FileDescriptor
;
import
java.io.IOException
;
...
...
@@ -214,8 +214,8 @@ abstract class AsynchronousServerSocketChannelImpl
private
static
Set
<
SocketOption
<?>>
defaultOptions
()
{
HashSet
<
SocketOption
<?>>
set
=
new
HashSet
<
SocketOption
<?>>(
2
);
set
.
add
(
StandardSocketOption
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
s
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_REUSEADDR
);
return
Collections
.
unmodifiableSet
(
set
);
}
}
...
...
src/share/classes/sun/nio/ch/AsynchronousSocketChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -28,7 +28,7 @@ package sun.nio.ch;
import
java.nio.ByteBuffer
;
import
java.nio.channels.*
;
import
java.net.SocketOption
;
import
java.net.StandardSocketOption
;
import
java.net.StandardSocketOption
s
;
import
java.net.SocketAddress
;
import
java.net.InetSocketAddress
;
import
java.io.IOException
;
...
...
@@ -483,11 +483,11 @@ abstract class AsynchronousSocketChannelImpl
private
static
Set
<
SocketOption
<?>>
defaultOptions
()
{
HashSet
<
SocketOption
<?>>
set
=
new
HashSet
<
SocketOption
<?>>(
5
);
set
.
add
(
StandardSocketOption
.
SO_SNDBUF
);
set
.
add
(
StandardSocketOption
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
.
SO_KEEPALIVE
);
set
.
add
(
StandardSocketOption
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
.
TCP_NODELAY
);
set
.
add
(
StandardSocketOption
s
.
SO_SNDBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_KEEPALIVE
);
set
.
add
(
StandardSocketOption
s
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
s
.
TCP_NODELAY
);
return
Collections
.
unmodifiableSet
(
set
);
}
}
...
...
src/share/classes/sun/nio/ch/DatagramChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -188,7 +188,7 @@ class DatagramChannelImpl
synchronized
(
stateLock
)
{
ensureOpen
();
if
(
name
==
StandardSocketOption
.
IP_TOS
)
{
if
(
name
==
StandardSocketOption
s
.
IP_TOS
)
{
// IPv4 only; no-op for IPv6
if
(
family
==
StandardProtocolFamily
.
INET
)
{
Net
.
setSocketOption
(
fd
,
family
,
name
,
value
);
...
...
@@ -196,15 +196,15 @@ class DatagramChannelImpl
return
this
;
}
if
(
name
==
StandardSocketOption
.
IP_MULTICAST_TTL
||
name
==
StandardSocketOption
.
IP_MULTICAST_LOOP
)
if
(
name
==
StandardSocketOption
s
.
IP_MULTICAST_TTL
||
name
==
StandardSocketOption
s
.
IP_MULTICAST_LOOP
)
{
// options are protocol dependent
Net
.
setSocketOption
(
fd
,
family
,
name
,
value
);
return
this
;
}
if
(
name
==
StandardSocketOption
.
IP_MULTICAST_IF
)
{
if
(
name
==
StandardSocketOption
s
.
IP_MULTICAST_IF
)
{
if
(
value
==
null
)
throw
new
IllegalArgumentException
(
"Cannot set IP_MULTICAST_IF to 'null'"
);
NetworkInterface
interf
=
(
NetworkInterface
)
value
;
...
...
@@ -243,7 +243,7 @@ class DatagramChannelImpl
synchronized
(
stateLock
)
{
ensureOpen
();
if
(
name
==
StandardSocketOption
.
IP_TOS
)
{
if
(
name
==
StandardSocketOption
s
.
IP_TOS
)
{
// IPv4 only; always return 0 on IPv6
if
(
family
==
StandardProtocolFamily
.
INET
)
{
return
(
T
)
Net
.
getSocketOption
(
fd
,
family
,
name
);
...
...
@@ -252,13 +252,13 @@ class DatagramChannelImpl
}
}
if
(
name
==
StandardSocketOption
.
IP_MULTICAST_TTL
||
name
==
StandardSocketOption
.
IP_MULTICAST_LOOP
)
if
(
name
==
StandardSocketOption
s
.
IP_MULTICAST_TTL
||
name
==
StandardSocketOption
s
.
IP_MULTICAST_LOOP
)
{
return
(
T
)
Net
.
getSocketOption
(
fd
,
family
,
name
);
}
if
(
name
==
StandardSocketOption
.
IP_MULTICAST_IF
)
{
if
(
name
==
StandardSocketOption
s
.
IP_MULTICAST_IF
)
{
if
(
family
==
StandardProtocolFamily
.
INET
)
{
int
address
=
Net
.
getInterface4
(
fd
);
if
(
address
==
0
)
...
...
@@ -291,14 +291,14 @@ class DatagramChannelImpl
private
static
Set
<
SocketOption
<?>>
defaultOptions
()
{
HashSet
<
SocketOption
<?>>
set
=
new
HashSet
<
SocketOption
<?>>(
8
);
set
.
add
(
StandardSocketOption
.
SO_SNDBUF
);
set
.
add
(
StandardSocketOption
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
.
SO_BROADCAST
);
set
.
add
(
StandardSocketOption
.
IP_TOS
);
set
.
add
(
StandardSocketOption
.
IP_MULTICAST_IF
);
set
.
add
(
StandardSocketOption
.
IP_MULTICAST_TTL
);
set
.
add
(
StandardSocketOption
.
IP_MULTICAST_LOOP
);
set
.
add
(
StandardSocketOption
s
.
SO_SNDBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
s
.
SO_BROADCAST
);
set
.
add
(
StandardSocketOption
s
.
IP_TOS
);
set
.
add
(
StandardSocketOption
s
.
IP_MULTICAST_IF
);
set
.
add
(
StandardSocketOption
s
.
IP_MULTICAST_TTL
);
set
.
add
(
StandardSocketOption
s
.
IP_MULTICAST_LOOP
);
return
Collections
.
unmodifiableSet
(
set
);
}
}
...
...
src/share/classes/sun/nio/ch/DatagramSocketAdaptor.java
浏览文件 @
f9c0499e
...
...
@@ -312,46 +312,46 @@ public class DatagramSocketAdaptor
public
void
setSendBufferSize
(
int
size
)
throws
SocketException
{
if
(
size
<=
0
)
throw
new
IllegalArgumentException
(
"Invalid send size"
);
setIntOption
(
StandardSocketOption
.
SO_SNDBUF
,
size
);
setIntOption
(
StandardSocketOption
s
.
SO_SNDBUF
,
size
);
}
public
int
getSendBufferSize
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
SO_SNDBUF
);
return
getIntOption
(
StandardSocketOption
s
.
SO_SNDBUF
);
}
public
void
setReceiveBufferSize
(
int
size
)
throws
SocketException
{
if
(
size
<=
0
)
throw
new
IllegalArgumentException
(
"Invalid receive size"
);
setIntOption
(
StandardSocketOption
.
SO_RCVBUF
,
size
);
setIntOption
(
StandardSocketOption
s
.
SO_RCVBUF
,
size
);
}
public
int
getReceiveBufferSize
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
SO_RCVBUF
);
return
getIntOption
(
StandardSocketOption
s
.
SO_RCVBUF
);
}
public
void
setReuseAddress
(
boolean
on
)
throws
SocketException
{
setBooleanOption
(
StandardSocketOption
.
SO_REUSEADDR
,
on
);
setBooleanOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
on
);
}
public
boolean
getReuseAddress
()
throws
SocketException
{
return
getBooleanOption
(
StandardSocketOption
.
SO_REUSEADDR
);
return
getBooleanOption
(
StandardSocketOption
s
.
SO_REUSEADDR
);
}
public
void
setBroadcast
(
boolean
on
)
throws
SocketException
{
setBooleanOption
(
StandardSocketOption
.
SO_BROADCAST
,
on
);
setBooleanOption
(
StandardSocketOption
s
.
SO_BROADCAST
,
on
);
}
public
boolean
getBroadcast
()
throws
SocketException
{
return
getBooleanOption
(
StandardSocketOption
.
SO_BROADCAST
);
return
getBooleanOption
(
StandardSocketOption
s
.
SO_BROADCAST
);
}
public
void
setTrafficClass
(
int
tc
)
throws
SocketException
{
setIntOption
(
StandardSocketOption
.
IP_TOS
,
tc
);
setIntOption
(
StandardSocketOption
s
.
IP_TOS
,
tc
);
}
public
int
getTrafficClass
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
IP_TOS
);
return
getIntOption
(
StandardSocketOption
s
.
IP_TOS
);
}
public
void
close
()
{
...
...
src/share/classes/sun/nio/ch/ExtendedSocketOption.java
浏览文件 @
f9c0499e
...
...
@@ -29,7 +29,7 @@ import java.net.SocketOption;
/**
* Defines socket options that are supported by the implementation
* but not defined in StandardSocketOption.
* but not defined in StandardSocketOption
s
.
*/
class
ExtendedSocketOption
{
...
...
src/share/classes/sun/nio/ch/NativeThreadSet.java
浏览文件 @
f9c0499e
...
...
@@ -96,11 +96,16 @@ class NativeThreadSet {
break
;
}
waitingToEmpty
=
true
;
boolean
interrupted
=
false
;
while
(
used
>
0
)
{
try
{
wait
();
}
catch
(
InterruptedException
ignore
)
{
}
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
}
}
if
(
interrupted
)
Thread
.
currentThread
().
interrupt
();
}
}
}
src/share/classes/sun/nio/ch/Net.java
浏览文件 @
f9c0499e
...
...
@@ -237,26 +237,26 @@ class Net { // package-private
throw
new
AssertionError
(
"Should not reach here"
);
// special handling
if
(
name
==
StandardSocketOption
.
SO_RCVBUF
||
name
==
StandardSocketOption
.
SO_SNDBUF
)
if
(
name
==
StandardSocketOption
s
.
SO_RCVBUF
||
name
==
StandardSocketOption
s
.
SO_SNDBUF
)
{
int
i
=
((
Integer
)
value
).
intValue
();
if
(
i
<
0
)
throw
new
IllegalArgumentException
(
"Invalid send/receive buffer size"
);
}
if
(
name
==
StandardSocketOption
.
SO_LINGER
)
{
if
(
name
==
StandardSocketOption
s
.
SO_LINGER
)
{
int
i
=
((
Integer
)
value
).
intValue
();
if
(
i
<
0
)
value
=
Integer
.
valueOf
(-
1
);
if
(
i
>
65535
)
value
=
Integer
.
valueOf
(
65535
);
}
if
(
name
==
StandardSocketOption
.
IP_TOS
)
{
if
(
name
==
StandardSocketOption
s
.
IP_TOS
)
{
int
i
=
((
Integer
)
value
).
intValue
();
if
(
i
<
0
||
i
>
255
)
throw
new
IllegalArgumentException
(
"Invalid IP_TOS value"
);
}
if
(
name
==
StandardSocketOption
.
IP_MULTICAST_TTL
)
{
if
(
name
==
StandardSocketOption
s
.
IP_MULTICAST_TTL
)
{
int
i
=
((
Integer
)
value
).
intValue
();
if
(
i
<
0
||
i
>
255
)
throw
new
IllegalArgumentException
(
"Invalid TTL/hop value"
);
...
...
src/share/classes/sun/nio/ch/ServerSocketAdaptor.java
浏览文件 @
f9c0499e
...
...
@@ -169,7 +169,7 @@ public class ServerSocketAdaptor // package-private
public
void
setReuseAddress
(
boolean
on
)
throws
SocketException
{
try
{
ssc
.
setOption
(
StandardSocketOption
.
SO_REUSEADDR
,
on
);
ssc
.
setOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
on
);
}
catch
(
IOException
x
)
{
Net
.
translateToSocketException
(
x
);
}
...
...
@@ -177,7 +177,7 @@ public class ServerSocketAdaptor // package-private
public
boolean
getReuseAddress
()
throws
SocketException
{
try
{
return
ssc
.
getOption
(
StandardSocketOption
.
SO_REUSEADDR
).
booleanValue
();
return
ssc
.
getOption
(
StandardSocketOption
s
.
SO_REUSEADDR
).
booleanValue
();
}
catch
(
IOException
x
)
{
Net
.
translateToSocketException
(
x
);
return
false
;
// Never happens
...
...
@@ -197,7 +197,7 @@ public class ServerSocketAdaptor // package-private
if
(
size
<=
0
)
throw
new
IllegalArgumentException
(
"size cannot be 0 or negative"
);
try
{
ssc
.
setOption
(
StandardSocketOption
.
SO_RCVBUF
,
size
);
ssc
.
setOption
(
StandardSocketOption
s
.
SO_RCVBUF
,
size
);
}
catch
(
IOException
x
)
{
Net
.
translateToSocketException
(
x
);
}
...
...
@@ -205,7 +205,7 @@ public class ServerSocketAdaptor // package-private
public
int
getReceiveBufferSize
()
throws
SocketException
{
try
{
return
ssc
.
getOption
(
StandardSocketOption
.
SO_RCVBUF
).
intValue
();
return
ssc
.
getOption
(
StandardSocketOption
s
.
SO_RCVBUF
).
intValue
();
}
catch
(
IOException
x
)
{
Net
.
translateToSocketException
(
x
);
return
-
1
;
// Never happens
...
...
src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -160,8 +160,8 @@ class ServerSocketChannelImpl
private
static
Set
<
SocketOption
<?>>
defaultOptions
()
{
HashSet
<
SocketOption
<?>>
set
=
new
HashSet
<
SocketOption
<?>>(
2
);
set
.
add
(
StandardSocketOption
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
s
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_REUSEADDR
);
return
Collections
.
unmodifiableSet
(
set
);
}
}
...
...
src/share/classes/sun/nio/ch/SocketAdaptor.java
浏览文件 @
f9c0499e
...
...
@@ -318,21 +318,21 @@ public class SocketAdaptor
}
public
void
setTcpNoDelay
(
boolean
on
)
throws
SocketException
{
setBooleanOption
(
StandardSocketOption
.
TCP_NODELAY
,
on
);
setBooleanOption
(
StandardSocketOption
s
.
TCP_NODELAY
,
on
);
}
public
boolean
getTcpNoDelay
()
throws
SocketException
{
return
getBooleanOption
(
StandardSocketOption
.
TCP_NODELAY
);
return
getBooleanOption
(
StandardSocketOption
s
.
TCP_NODELAY
);
}
public
void
setSoLinger
(
boolean
on
,
int
linger
)
throws
SocketException
{
if
(!
on
)
linger
=
-
1
;
setIntOption
(
StandardSocketOption
.
SO_LINGER
,
linger
);
setIntOption
(
StandardSocketOption
s
.
SO_LINGER
,
linger
);
}
public
int
getSoLinger
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
SO_LINGER
);
return
getIntOption
(
StandardSocketOption
s
.
SO_LINGER
);
}
public
void
sendUrgentData
(
int
data
)
throws
IOException
{
...
...
@@ -366,46 +366,46 @@ public class SocketAdaptor
// size 0 valid for SocketChannel, invalid for Socket
if
(
size
<=
0
)
throw
new
IllegalArgumentException
(
"Invalid send size"
);
setIntOption
(
StandardSocketOption
.
SO_SNDBUF
,
size
);
setIntOption
(
StandardSocketOption
s
.
SO_SNDBUF
,
size
);
}
public
int
getSendBufferSize
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
SO_SNDBUF
);
return
getIntOption
(
StandardSocketOption
s
.
SO_SNDBUF
);
}
public
void
setReceiveBufferSize
(
int
size
)
throws
SocketException
{
// size 0 valid for SocketChannel, invalid for Socket
if
(
size
<=
0
)
throw
new
IllegalArgumentException
(
"Invalid receive size"
);
setIntOption
(
StandardSocketOption
.
SO_RCVBUF
,
size
);
setIntOption
(
StandardSocketOption
s
.
SO_RCVBUF
,
size
);
}
public
int
getReceiveBufferSize
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
SO_RCVBUF
);
return
getIntOption
(
StandardSocketOption
s
.
SO_RCVBUF
);
}
public
void
setKeepAlive
(
boolean
on
)
throws
SocketException
{
setBooleanOption
(
StandardSocketOption
.
SO_KEEPALIVE
,
on
);
setBooleanOption
(
StandardSocketOption
s
.
SO_KEEPALIVE
,
on
);
}
public
boolean
getKeepAlive
()
throws
SocketException
{
return
getBooleanOption
(
StandardSocketOption
.
SO_KEEPALIVE
);
return
getBooleanOption
(
StandardSocketOption
s
.
SO_KEEPALIVE
);
}
public
void
setTrafficClass
(
int
tc
)
throws
SocketException
{
setIntOption
(
StandardSocketOption
.
IP_TOS
,
tc
);
setIntOption
(
StandardSocketOption
s
.
IP_TOS
,
tc
);
}
public
int
getTrafficClass
()
throws
SocketException
{
return
getIntOption
(
StandardSocketOption
.
IP_TOS
);
return
getIntOption
(
StandardSocketOption
s
.
IP_TOS
);
}
public
void
setReuseAddress
(
boolean
on
)
throws
SocketException
{
setBooleanOption
(
StandardSocketOption
.
SO_REUSEADDR
,
on
);
setBooleanOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
on
);
}
public
boolean
getReuseAddress
()
throws
SocketException
{
return
getBooleanOption
(
StandardSocketOption
.
SO_REUSEADDR
);
return
getBooleanOption
(
StandardSocketOption
s
.
SO_REUSEADDR
);
}
public
void
close
()
throws
IOException
{
...
...
src/share/classes/sun/nio/ch/SocketChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -170,7 +170,7 @@ class SocketChannelImpl
throw
new
ClosedChannelException
();
// special handling for IP_TOS: no-op when IPv6
if
(
name
==
StandardSocketOption
.
IP_TOS
)
{
if
(
name
==
StandardSocketOption
s
.
IP_TOS
)
{
if
(!
Net
.
isIPv6Available
())
Net
.
setSocketOption
(
fd
,
StandardProtocolFamily
.
INET
,
name
,
value
);
return
this
;
...
...
@@ -197,7 +197,7 @@ class SocketChannelImpl
throw
new
ClosedChannelException
();
// special handling for IP_TOS: always return 0 when IPv6
if
(
name
==
StandardSocketOption
.
IP_TOS
)
{
if
(
name
==
StandardSocketOption
s
.
IP_TOS
)
{
return
(
Net
.
isIPv6Available
())
?
(
T
)
Integer
.
valueOf
(
0
)
:
(
T
)
Net
.
getSocketOption
(
fd
,
StandardProtocolFamily
.
INET
,
name
);
}
...
...
@@ -212,14 +212,14 @@ class SocketChannelImpl
private
static
Set
<
SocketOption
<?>>
defaultOptions
()
{
HashSet
<
SocketOption
<?>>
set
=
new
HashSet
<
SocketOption
<?>>(
8
);
set
.
add
(
StandardSocketOption
.
SO_SNDBUF
);
set
.
add
(
StandardSocketOption
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
.
SO_KEEPALIVE
);
set
.
add
(
StandardSocketOption
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
.
SO_LINGER
);
set
.
add
(
StandardSocketOption
.
TCP_NODELAY
);
set
.
add
(
StandardSocketOption
s
.
SO_SNDBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_RCVBUF
);
set
.
add
(
StandardSocketOption
s
.
SO_KEEPALIVE
);
set
.
add
(
StandardSocketOption
s
.
SO_REUSEADDR
);
set
.
add
(
StandardSocketOption
s
.
SO_LINGER
);
set
.
add
(
StandardSocketOption
s
.
TCP_NODELAY
);
// additional options required by socket adaptor
set
.
add
(
StandardSocketOption
.
IP_TOS
);
set
.
add
(
StandardSocketOption
s
.
IP_TOS
);
set
.
add
(
ExtendedSocketOption
.
SO_OOBINLINE
);
return
Collections
.
unmodifiableSet
(
set
);
}
...
...
src/share/classes/sun/nio/fs/AbstractPoller.java
浏览文件 @
f9c0499e
...
...
@@ -105,16 +105,16 @@ abstract class AbstractPoller implements Runnable {
Set
<
WatchEvent
.
Kind
<?>>
eventSet
=
new
HashSet
<>(
events
.
length
);
for
(
WatchEvent
.
Kind
<?>
event:
events
)
{
// standard events
if
(
event
==
StandardWatchEventKind
.
ENTRY_CREATE
||
event
==
StandardWatchEventKind
.
ENTRY_MODIFY
||
event
==
StandardWatchEventKind
.
ENTRY_DELETE
)
if
(
event
==
StandardWatchEventKind
s
.
ENTRY_CREATE
||
event
==
StandardWatchEventKind
s
.
ENTRY_MODIFY
||
event
==
StandardWatchEventKind
s
.
ENTRY_DELETE
)
{
eventSet
.
add
(
event
);
continue
;
}
// OVERFLOW is ignored
if
(
event
==
StandardWatchEventKind
.
OVERFLOW
)
{
if
(
event
==
StandardWatchEventKind
s
.
OVERFLOW
)
{
if
(
events
.
length
==
1
)
throw
new
IllegalArgumentException
(
"No events to register"
);
continue
;
...
...
src/share/classes/sun/nio/fs/AbstractWatchKey.java
浏览文件 @
f9c0499e
...
...
@@ -42,8 +42,8 @@ abstract class AbstractWatchKey implements WatchKey {
/**
* Special event to signal overflow
*/
static
final
Event
<
Void
>
OVERFLOW_EVENT
=
new
Event
<
Void
>(
StandardWatchEventKind
.
OVERFLOW
,
null
);
static
final
Event
<
Object
>
OVERFLOW_EVENT
=
new
Event
<
Object
>(
StandardWatchEventKinds
.
OVERFLOW
,
null
);
/**
* Possible key states
...
...
@@ -103,14 +103,14 @@ abstract class AbstractWatchKey implements WatchKey {
*/
@SuppressWarnings
(
"unchecked"
)
final
void
signalEvent
(
WatchEvent
.
Kind
<?>
kind
,
Object
context
)
{
boolean
isModify
=
(
kind
==
StandardWatchEventKind
.
ENTRY_MODIFY
);
boolean
isModify
=
(
kind
==
StandardWatchEventKind
s
.
ENTRY_MODIFY
);
synchronized
(
this
)
{
int
size
=
events
.
size
();
if
(
size
>
0
)
{
// if the previous event is an OVERFLOW event or this is a
// repeated event then we simply increment the counter
WatchEvent
<?>
prev
=
events
.
get
(
size
-
1
);
if
((
prev
.
kind
()
==
StandardWatchEventKind
.
OVERFLOW
)
||
if
((
prev
.
kind
()
==
StandardWatchEventKind
s
.
OVERFLOW
)
||
((
kind
==
prev
.
kind
()
&&
Objects
.
equals
(
context
,
prev
.
context
()))))
{
...
...
@@ -124,7 +124,7 @@ abstract class AbstractWatchKey implements WatchKey {
if
(
isModify
)
{
WatchEvent
<?>
ev
=
lastModifyEvents
.
get
(
context
);
if
(
ev
!=
null
)
{
assert
ev
.
kind
()
==
StandardWatchEventKind
.
ENTRY_MODIFY
;
assert
ev
.
kind
()
==
StandardWatchEventKind
s
.
ENTRY_MODIFY
;
((
Event
<?>)
ev
).
increment
();
return
;
}
...
...
@@ -138,7 +138,7 @@ abstract class AbstractWatchKey implements WatchKey {
// if the list has reached the limit then drop pending events
// and queue an OVERFLOW event
if
(
size
>=
MAX_EVENT_LIST_SIZE
)
{
kind
=
StandardWatchEventKind
.
OVERFLOW
;
kind
=
StandardWatchEventKind
s
.
OVERFLOW
;
isModify
=
false
;
context
=
null
;
}
...
...
@@ -149,7 +149,7 @@ abstract class AbstractWatchKey implements WatchKey {
new
Event
<
Object
>((
WatchEvent
.
Kind
<
Object
>)
kind
,
context
);
if
(
isModify
)
{
lastModifyEvents
.
put
(
context
,
ev
);
}
else
if
(
kind
==
StandardWatchEventKind
.
OVERFLOW
)
{
}
else
if
(
kind
==
StandardWatchEventKind
s
.
OVERFLOW
)
{
// drop all pending events
events
.
clear
();
lastModifyEvents
.
clear
();
...
...
src/share/classes/sun/nio/fs/PollingWatchService.java
浏览文件 @
f9c0499e
...
...
@@ -80,16 +80,16 @@ class PollingWatchService
new
HashSet
<
WatchEvent
.
Kind
<?>>(
events
.
length
);
for
(
WatchEvent
.
Kind
<?>
event:
events
)
{
// standard events
if
(
event
==
StandardWatchEventKind
.
ENTRY_CREATE
||
event
==
StandardWatchEventKind
.
ENTRY_MODIFY
||
event
==
StandardWatchEventKind
.
ENTRY_DELETE
)
if
(
event
==
StandardWatchEventKind
s
.
ENTRY_CREATE
||
event
==
StandardWatchEventKind
s
.
ENTRY_MODIFY
||
event
==
StandardWatchEventKind
s
.
ENTRY_DELETE
)
{
eventSet
.
add
(
event
);
continue
;
}
// OVERFLOW is ignored
if
(
event
==
StandardWatchEventKind
.
OVERFLOW
)
{
if
(
event
==
StandardWatchEventKind
s
.
OVERFLOW
)
{
if
(
events
.
length
==
1
)
throw
new
IllegalArgumentException
(
"No events to register"
);
continue
;
...
...
@@ -355,16 +355,16 @@ class PollingWatchService
new
CacheEntry
(
lastModified
,
tickCount
));
// queue ENTRY_CREATE if event enabled
if
(
events
.
contains
(
StandardWatchEventKind
.
ENTRY_CREATE
))
{
signalEvent
(
StandardWatchEventKind
.
ENTRY_CREATE
,
entry
.
getFileName
());
if
(
events
.
contains
(
StandardWatchEventKind
s
.
ENTRY_CREATE
))
{
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_CREATE
,
entry
.
getFileName
());
continue
;
}
else
{
// if ENTRY_CREATE is not enabled and ENTRY_MODIFY is
// enabled then queue event to avoid missing out on
// modifications to the file immediately after it is
// created.
if
(
events
.
contains
(
StandardWatchEventKind
.
ENTRY_MODIFY
))
{
signalEvent
(
StandardWatchEventKind
.
ENTRY_MODIFY
,
entry
.
getFileName
());
if
(
events
.
contains
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
))
{
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
,
entry
.
getFileName
());
}
}
continue
;
...
...
@@ -372,8 +372,8 @@ class PollingWatchService
// check if file has changed
if
(
e
.
lastModified
!=
lastModified
)
{
if
(
events
.
contains
(
StandardWatchEventKind
.
ENTRY_MODIFY
))
{
signalEvent
(
StandardWatchEventKind
.
ENTRY_MODIFY
,
if
(
events
.
contains
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
))
{
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
,
entry
.
getFileName
());
}
}
...
...
@@ -403,8 +403,8 @@ class PollingWatchService
Path
name
=
mapEntry
.
getKey
();
// remove from map and queue delete event (if enabled)
i
.
remove
();
if
(
events
.
contains
(
StandardWatchEventKind
.
ENTRY_DELETE
))
{
signalEvent
(
StandardWatchEventKind
.
ENTRY_DELETE
,
name
);
if
(
events
.
contains
(
StandardWatchEventKind
s
.
ENTRY_DELETE
))
{
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_DELETE
,
name
);
}
}
}
...
...
src/share/classes/sun/security/jgss/spi/GSSContextSpi.java
浏览文件 @
f9c0499e
...
...
@@ -24,22 +24,10 @@
*/
/*
* ===========================================================================
* IBM Confidential
* OCO Source Materials
* Licensed Materials - Property of IBM
*
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
*
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with the U.S.
* Copyright Office.
*
* Copyright 1997 The Open Group Research Institute. All rights reserved.
* ===========================================================================
*
*/
package
sun.security.jgss.spi
;
import
org.ietf.jgss.*
;
...
...
src/share/classes/sun/security/ssl/JsseJce.java
浏览文件 @
f9c0499e
...
...
@@ -62,7 +62,7 @@ final class JsseJce {
// Flag indicating whether EC crypto is available.
// If null, then we have not checked yet.
// If yes, then all the EC based crypto we need is available.
private
static
volatile
Boolean
ecAvailable
;
private
static
Boolean
ecAvailable
;
// Flag indicating whether Kerberos crypto is available.
// If true, then all the Kerberos-based crypto we need is available.
...
...
@@ -190,7 +190,7 @@ final class JsseJce {
// no instantiation of this class
}
static
boolean
isEcAvailable
()
{
s
ynchronized
s
tatic
boolean
isEcAvailable
()
{
if
(
ecAvailable
==
null
)
{
try
{
JsseJce
.
getSignature
(
SIGNATURE_ECDSA
);
...
...
@@ -206,7 +206,7 @@ final class JsseJce {
return
ecAvailable
;
}
static
void
clearEcAvailable
()
{
s
ynchronized
s
tatic
void
clearEcAvailable
()
{
ecAvailable
=
null
;
}
...
...
src/share/classes/sun/text/bidi/BidiBase.java
浏览文件 @
f9c0499e
...
...
@@ -2889,10 +2889,6 @@ public class BidiBase {
verifyValidPara
();
verifyRange
(
start
,
0
,
limit
);
verifyRange
(
limit
,
0
,
length
+
1
);
if
(
getParagraphIndex
(
start
)
!=
getParagraphIndex
(
limit
-
1
))
{
/* the line crosses a paragraph boundary */
throw
new
IllegalArgumentException
();
}
return
BidiLine
.
setLine
(
bidi
,
this
,
newBidi
,
newBidiBase
,
start
,
limit
);
}
...
...
src/share/classes/sun/text/resources/BreakIteratorRules_th.java
浏览文件 @
f9c0499e
...
...
@@ -27,17 +27,7 @@
*/
/*
* IBM Confidential
* OCO Source Materials
*
* IBM Java(tm)2 SDK, Standard Edition, v 1.2
*
* (C) Copyright IBM Corp. 1999
*
* The source code for this program is not published or otherwise divested of
* its trade secrets, irrespective of what has been deposited with the U.S.
* Copyright office.
*
* (C) Copyright IBM Corp. 1999 All Rights Reserved.
*/
/*
...
...
src/share/javavm/export/jmm.h
浏览文件 @
f9c0499e
...
...
@@ -48,7 +48,7 @@ enum {
JMM_VERSION_1_0
=
0x20010000
,
JMM_VERSION_1_1
=
0x20010100
,
// JDK 6
JMM_VERSION_1_2
=
0x20010200
,
// JDK 7
JMM_VERSION
=
0x2001020
0
JMM_VERSION
=
0x2001020
1
};
typedef
struct
{
...
...
@@ -293,6 +293,9 @@ typedef struct jmmInterface_1_ {
jlongArray
ids
,
jboolean
lockedMonitors
,
jboolean
lockedSynchronizers
);
void
(
JNICALL
*
SetGCNotificationEnabled
)
(
JNIEnv
*
env
,
jobject
mgr
,
jboolean
enabled
);
}
JmmInterface
;
#ifdef __cplusplus
...
...
src/share/native/sun/management/GarbageCollectorImpl.c
浏览文件 @
f9c0499e
/*
* Copyright (c) 2003, 20
04
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
11
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -36,3 +36,17 @@ JNIEXPORT jlong JNICALL Java_sun_management_GarbageCollectorImpl_getCollectionTi
(
JNIEnv
*
env
,
jobject
mgr
)
{
return
jmm_interface
->
GetLongAttribute
(
env
,
mgr
,
JMM_GC_TIME_MS
);
}
JNIEXPORT
void
JNICALL
Java_sun_management_GarbageCollectorImpl_setNotificationEnabled
(
JNIEnv
*
env
,
jobject
dummy
,
jobject
gc
,
jboolean
enabled
)
{
if
(
gc
==
NULL
)
{
JNU_ThrowNullPointerException
(
env
,
"Invalid GarbageCollectorMBean"
);
return
;
}
if
((
jmm_version
>
JMM_VERSION_1_2
)
||
(
jmm_version
==
JMM_VERSION_1_2
&&
((
jmm_version
&
0xFF
)
>=
1
)))
{
jmm_interface
->
SetGCNotificationEnabled
(
env
,
gc
,
enabled
);
}
}
src/share/native/sun/management/VMManagementImpl.c
浏览文件 @
f9c0499e
...
...
@@ -95,6 +95,13 @@ Java_sun_management_VMManagementImpl_initOptionalSupportFields
value
=
mos
.
isThreadAllocatedMemorySupported
;
setStaticBooleanField
(
env
,
cls
,
"threadAllocatedMemorySupport"
,
value
);
if
((
jmm_version
>
JMM_VERSION_1_2
)
||
(
jmm_version
==
JMM_VERSION_1_2
&&
((
jmm_version
&
0xFF
)
>=
1
)))
{
setStaticBooleanField
(
env
,
cls
,
"gcNotificationSupport"
,
JNI_TRUE
);
}
else
{
setStaticBooleanField
(
env
,
cls
,
"gcNotificationSupport"
,
JNI_FALSE
);
}
}
JNIEXPORT
jobjectArray
JNICALL
...
...
src/share/native/sun/nio/ch/genSocketOptionRegistry.c
浏览文件 @
f9c0499e
...
...
@@ -63,7 +63,7 @@ int main(int argc, const char* argv[]) {
out
(
"// AUTOMATICALLY GENERATED FILE - DO NOT EDIT "
);
out
(
"package sun.nio.ch; "
);
out
(
"import java.net.SocketOption; "
);
out
(
"import java.net.StandardSocketOption
;
"
);
out
(
"import java.net.StandardSocketOption
s;
"
);
out
(
"import java.net.ProtocolFamily; "
);
out
(
"import java.net.StandardProtocolFamily; "
);
out
(
"import java.util.Map; "
);
...
...
@@ -95,23 +95,23 @@ int main(int argc, const char* argv[]) {
out
(
" Map<RegistryKey,OptionKey> map = "
);
out
(
" new HashMap<RegistryKey,OptionKey>(); "
);
emit_unspec
(
"StandardSocketOption.SO_BROADCAST"
,
SOL_SOCKET
,
SO_BROADCAST
);
emit_unspec
(
"StandardSocketOption.SO_KEEPALIVE"
,
SOL_SOCKET
,
SO_KEEPALIVE
);
emit_unspec
(
"StandardSocketOption.SO_LINGER"
,
SOL_SOCKET
,
SO_LINGER
);
emit_unspec
(
"StandardSocketOption.SO_SNDBUF"
,
SOL_SOCKET
,
SO_SNDBUF
);
emit_unspec
(
"StandardSocketOption.SO_RCVBUF"
,
SOL_SOCKET
,
SO_RCVBUF
);
emit_unspec
(
"StandardSocketOption.SO_REUSEADDR"
,
SOL_SOCKET
,
SO_REUSEADDR
);
emit_unspec
(
"StandardSocketOption.TCP_NODELAY"
,
IPPROTO_TCP
,
TCP_NODELAY
);
emit_unspec
(
"StandardSocketOption
s
.SO_BROADCAST"
,
SOL_SOCKET
,
SO_BROADCAST
);
emit_unspec
(
"StandardSocketOption
s
.SO_KEEPALIVE"
,
SOL_SOCKET
,
SO_KEEPALIVE
);
emit_unspec
(
"StandardSocketOption
s
.SO_LINGER"
,
SOL_SOCKET
,
SO_LINGER
);
emit_unspec
(
"StandardSocketOption
s
.SO_SNDBUF"
,
SOL_SOCKET
,
SO_SNDBUF
);
emit_unspec
(
"StandardSocketOption
s
.SO_RCVBUF"
,
SOL_SOCKET
,
SO_RCVBUF
);
emit_unspec
(
"StandardSocketOption
s
.SO_REUSEADDR"
,
SOL_SOCKET
,
SO_REUSEADDR
);
emit_unspec
(
"StandardSocketOption
s
.TCP_NODELAY"
,
IPPROTO_TCP
,
TCP_NODELAY
);
emit_inet
(
"StandardSocketOption.IP_TOS"
,
IPPROTO_IP
,
IP_TOS
);
emit_inet
(
"StandardSocketOption.IP_MULTICAST_IF"
,
IPPROTO_IP
,
IP_MULTICAST_IF
);
emit_inet
(
"StandardSocketOption.IP_MULTICAST_TTL"
,
IPPROTO_IP
,
IP_MULTICAST_TTL
);
emit_inet
(
"StandardSocketOption.IP_MULTICAST_LOOP"
,
IPPROTO_IP
,
IP_MULTICAST_LOOP
);
emit_inet
(
"StandardSocketOption
s
.IP_TOS"
,
IPPROTO_IP
,
IP_TOS
);
emit_inet
(
"StandardSocketOption
s
.IP_MULTICAST_IF"
,
IPPROTO_IP
,
IP_MULTICAST_IF
);
emit_inet
(
"StandardSocketOption
s
.IP_MULTICAST_TTL"
,
IPPROTO_IP
,
IP_MULTICAST_TTL
);
emit_inet
(
"StandardSocketOption
s
.IP_MULTICAST_LOOP"
,
IPPROTO_IP
,
IP_MULTICAST_LOOP
);
#ifdef AF_INET6
emit_inet6
(
"StandardSocketOption.IP_MULTICAST_IF"
,
IPPROTO_IPV6
,
IPV6_MULTICAST_IF
);
emit_inet6
(
"StandardSocketOption.IP_MULTICAST_TTL"
,
IPPROTO_IPV6
,
IPV6_MULTICAST_HOPS
);
emit_inet6
(
"StandardSocketOption.IP_MULTICAST_LOOP"
,
IPPROTO_IPV6
,
IPV6_MULTICAST_LOOP
);
emit_inet6
(
"StandardSocketOption
s
.IP_MULTICAST_IF"
,
IPPROTO_IPV6
,
IPV6_MULTICAST_IF
);
emit_inet6
(
"StandardSocketOption
s
.IP_MULTICAST_TTL"
,
IPPROTO_IPV6
,
IPV6_MULTICAST_HOPS
);
emit_inet6
(
"StandardSocketOption
s
.IP_MULTICAST_LOOP"
,
IPPROTO_IPV6
,
IPV6_MULTICAST_LOOP
);
#endif
emit_unspec
(
"ExtendedSocketOption.SO_OOBINLINE"
,
SOL_SOCKET
,
SO_OOBINLINE
);
...
...
src/share/sample/nio/chatserver/ChatServer.java
浏览文件 @
f9c0499e
...
...
@@ -32,7 +32,7 @@
import
java.io.IOException
;
import
java.net.InetSocketAddress
;
import
java.net.SocketAddress
;
import
java.net.StandardSocketOption
;
import
java.net.StandardSocketOption
s
;
import
java.nio.channels.*
;
import
java.util.*
;
import
java.util.concurrent.Executors
;
...
...
@@ -105,7 +105,7 @@ public class ChatServer implements Runnable {
*/
private
AsynchronousServerSocketChannel
createListener
(
AsynchronousChannelGroup
channelGroup
)
throws
IOException
{
final
AsynchronousServerSocketChannel
listener
=
openChannel
(
channelGroup
);
listener
.
setOption
(
StandardSocketOption
.
SO_REUSEADDR
,
true
);
listener
.
setOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
true
);
listener
.
bind
(
new
InetSocketAddress
(
port
));
return
listener
;
}
...
...
@@ -123,7 +123,7 @@ public class ChatServer implements Runnable {
private
void
handleNewConnection
(
AsynchronousSocketChannel
channel
)
{
Client
client
=
new
Client
(
channel
,
new
ClientReader
(
this
,
new
NameReader
(
this
)));
try
{
channel
.
setOption
(
StandardSocketOption
.
TCP_NODELAY
,
true
);
channel
.
setOption
(
StandardSocketOption
s
.
TCP_NODELAY
,
true
);
}
catch
(
IOException
e
)
{
// ignore
}
...
...
src/share/sample/nio/file/WatchDir.java
浏览文件 @
f9c0499e
...
...
@@ -30,7 +30,7 @@
*/
import
java.nio.file.*
;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
.*;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
s
.*;
import
static
java
.
nio
.
file
.
LinkOption
.*;
import
java.nio.file.attribute.*
;
import
java.io.IOException
;
...
...
src/share/sample/nio/multicast/Reader.java
浏览文件 @
f9c0499e
...
...
@@ -96,7 +96,7 @@ public class Reader {
family
=
StandardProtocolFamily
.
INET6
;
}
DatagramChannel
dc
=
DatagramChannel
.
open
(
family
)
.
setOption
(
StandardSocketOption
.
SO_REUSEADDR
,
true
)
.
setOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
true
)
.
bind
(
new
InetSocketAddress
(
target
.
port
()));
if
(
includeList
.
isEmpty
())
{
...
...
src/share/sample/nio/multicast/Sender.java
浏览文件 @
f9c0499e
...
...
@@ -59,7 +59,7 @@ public class Sender {
family
=
StandardProtocolFamily
.
INET6
;
DatagramChannel
dc
=
DatagramChannel
.
open
(
family
).
bind
(
new
InetSocketAddress
(
0
));
if
(
target
.
interf
()
!=
null
)
{
dc
.
setOption
(
StandardSocketOption
.
IP_MULTICAST_IF
,
target
.
interf
());
dc
.
setOption
(
StandardSocketOption
s
.
IP_MULTICAST_IF
,
target
.
interf
());
}
// send multicast packet
...
...
src/solaris/classes/sun/awt/X11/XRobotPeer.java
浏览文件 @
f9c0499e
...
...
@@ -48,7 +48,7 @@ class XRobotPeer implements RobotPeer {
}
public
void
dispose
()
{
_dispose
();
// does nothing
}
public
void
mouseMove
(
int
x
,
int
y
)
{
...
...
@@ -88,7 +88,6 @@ class XRobotPeer implements RobotPeer {
}
private
static
native
synchronized
void
setup
(
int
numberOfButtons
,
int
[]
buttonDownMasks
);
private
static
native
synchronized
void
_dispose
();
private
static
native
synchronized
void
mouseMoveImpl
(
X11GraphicsConfig
xgc
,
int
x
,
int
y
);
private
static
native
synchronized
void
mousePressImpl
(
int
buttons
);
...
...
src/solaris/classes/sun/nio/ch/SctpChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -55,7 +55,7 @@ import com.sun.nio.sctp.SctpChannel;
import
com.sun.nio.sctp.SctpSocketOption
;
import
sun.nio.ch.PollArrayWrapper
;
import
sun.nio.ch.SelChImpl
;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
.*;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
s
.*;
import
static
sun
.
nio
.
ch
.
SctpResultContainer
.
SEND_FAILED
;
import
static
sun
.
nio
.
ch
.
SctpResultContainer
.
ASSOCIATION_CHANGED
;
import
static
sun
.
nio
.
ch
.
SctpResultContainer
.
PEER_ADDRESS_CHANGED
;
...
...
src/solaris/classes/sun/nio/ch/SctpMultiChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -53,7 +53,7 @@ import com.sun.nio.sctp.MessageInfo;
import
com.sun.nio.sctp.SctpChannel
;
import
com.sun.nio.sctp.SctpMultiChannel
;
import
com.sun.nio.sctp.SctpSocketOption
;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
.*;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
s
.*;
import
static
sun
.
nio
.
ch
.
SctpResultContainer
.*;
/**
...
...
src/solaris/classes/sun/nio/ch/SctpNet.java
浏览文件 @
f9c0499e
...
...
@@ -35,7 +35,7 @@ import java.util.HashSet;
import
java.security.AccessController
;
import
sun.security.action.GetPropertyAction
;
import
com.sun.nio.sctp.SctpSocketOption
;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
.*;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
s
.*;
public
class
SctpNet
{
static
final
String
osName
=
AccessController
.
doPrivileged
(
...
...
src/solaris/classes/sun/nio/ch/SctpServerChannelImpl.java
浏览文件 @
f9c0499e
...
...
@@ -40,7 +40,7 @@ import com.sun.nio.sctp.IllegalUnbindException;
import
com.sun.nio.sctp.SctpChannel
;
import
com.sun.nio.sctp.SctpServerChannel
;
import
com.sun.nio.sctp.SctpSocketOption
;
import
com.sun.nio.sctp.SctpStandardSocketOption
;
import
com.sun.nio.sctp.SctpStandardSocketOption
s
;
/**
* An implementation of SctpServerChannel
...
...
@@ -386,7 +386,7 @@ public class SctpServerChannelImpl extends SctpServerChannel
private
static
Set
<
SctpSocketOption
<?>>
defaultOptions
()
{
HashSet
<
SctpSocketOption
<?>>
set
=
new
HashSet
<
SctpSocketOption
<?>>(
1
);
set
.
add
(
SctpStandardSocketOption
.
SCTP_INIT_MAXSTREAMS
);
set
.
add
(
SctpStandardSocketOption
s
.
SCTP_INIT_MAXSTREAMS
);
return
Collections
.
unmodifiableSet
(
set
);
}
}
...
...
src/solaris/classes/sun/nio/fs/LinuxWatchService.java
浏览文件 @
f9c0499e
...
...
@@ -210,15 +210,15 @@ class LinuxWatchService
int
mask
=
0
;
for
(
WatchEvent
.
Kind
<?>
event:
events
)
{
if
(
event
==
StandardWatchEventKind
.
ENTRY_CREATE
)
{
if
(
event
==
StandardWatchEventKind
s
.
ENTRY_CREATE
)
{
mask
|=
IN_CREATE
|
IN_MOVED_TO
;
continue
;
}
if
(
event
==
StandardWatchEventKind
.
ENTRY_DELETE
)
{
if
(
event
==
StandardWatchEventKind
s
.
ENTRY_DELETE
)
{
mask
|=
IN_DELETE
|
IN_MOVED_FROM
;
continue
;
}
if
(
event
==
StandardWatchEventKind
.
ENTRY_MODIFY
)
{
if
(
event
==
StandardWatchEventKind
s
.
ENTRY_MODIFY
)
{
mask
|=
IN_MODIFY
|
IN_ATTRIB
;
continue
;
}
...
...
@@ -378,17 +378,17 @@ class LinuxWatchService
*/
private
WatchEvent
.
Kind
<?>
maskToEventKind
(
int
mask
)
{
if
((
mask
&
IN_MODIFY
)
>
0
)
return
StandardWatchEventKind
.
ENTRY_MODIFY
;
return
StandardWatchEventKind
s
.
ENTRY_MODIFY
;
if
((
mask
&
IN_ATTRIB
)
>
0
)
return
StandardWatchEventKind
.
ENTRY_MODIFY
;
return
StandardWatchEventKind
s
.
ENTRY_MODIFY
;
if
((
mask
&
IN_CREATE
)
>
0
)
return
StandardWatchEventKind
.
ENTRY_CREATE
;
return
StandardWatchEventKind
s
.
ENTRY_CREATE
;
if
((
mask
&
IN_MOVED_TO
)
>
0
)
return
StandardWatchEventKind
.
ENTRY_CREATE
;
return
StandardWatchEventKind
s
.
ENTRY_CREATE
;
if
((
mask
&
IN_DELETE
)
>
0
)
return
StandardWatchEventKind
.
ENTRY_DELETE
;
return
StandardWatchEventKind
s
.
ENTRY_DELETE
;
if
((
mask
&
IN_MOVED_FROM
)
>
0
)
return
StandardWatchEventKind
.
ENTRY_DELETE
;
return
StandardWatchEventKind
s
.
ENTRY_DELETE
;
return
null
;
}
...
...
@@ -400,7 +400,7 @@ class LinuxWatchService
if
((
mask
&
IN_Q_OVERFLOW
)
>
0
)
{
for
(
Map
.
Entry
<
Integer
,
LinuxWatchKey
>
entry:
wdToKey
.
entrySet
())
{
entry
.
getValue
()
.
signalEvent
(
StandardWatchEventKind
.
OVERFLOW
,
null
);
.
signalEvent
(
StandardWatchEventKind
s
.
OVERFLOW
,
null
);
}
return
;
}
...
...
src/solaris/classes/sun/nio/fs/SolarisWatchService.java
浏览文件 @
f9c0499e
...
...
@@ -486,7 +486,7 @@ class SolarisWatchService
void
processDirectoryEvents
(
SolarisWatchKey
key
,
int
mask
)
{
if
((
mask
&
(
FILE_MODIFIED
|
FILE_ATTRIB
))
!=
0
)
{
registerChildren
(
key
.
getDirectory
(),
key
,
key
.
events
().
contains
(
StandardWatchEventKind
.
ENTRY_CREATE
));
key
.
events
().
contains
(
StandardWatchEventKind
s
.
ENTRY_CREATE
));
}
}
...
...
@@ -504,14 +504,14 @@ class SolarisWatchService
// entry modified
if
(((
mask
&
(
FILE_MODIFIED
|
FILE_ATTRIB
))
!=
0
)
&&
events
.
contains
(
StandardWatchEventKind
.
ENTRY_MODIFY
))
events
.
contains
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
))
{
key
.
signalEvent
(
StandardWatchEventKind
.
ENTRY_MODIFY
,
node
.
name
());
key
.
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
,
node
.
name
());
}
// entry removed
if
(((
mask
&
(
FILE_REMOVED
))
!=
0
)
&&
events
.
contains
(
StandardWatchEventKind
.
ENTRY_DELETE
))
events
.
contains
(
StandardWatchEventKind
s
.
ENTRY_DELETE
))
{
// Due to 6636438/6636412 we may get a remove event for cases
// where a rmdir/unlink/rename is attempted but fails. Until
...
...
@@ -527,7 +527,7 @@ class SolarisWatchService
}
catch
(
UnixException
x
)
{
}
if
(
removed
)
key
.
signalEvent
(
StandardWatchEventKind
.
ENTRY_DELETE
,
node
.
name
());
key
.
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_DELETE
,
node
.
name
());
}
return
false
;
}
...
...
@@ -547,7 +547,7 @@ class SolarisWatchService
// if the ENTRY_MODIFY event is not enabled then we don't need
// modification events for entries in the directory
int
events
=
FILE_NOFOLLOW
;
if
(
parent
.
events
().
contains
(
StandardWatchEventKind
.
ENTRY_MODIFY
))
if
(
parent
.
events
().
contains
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
))
events
|=
(
FILE_MODIFIED
|
FILE_ATTRIB
);
DirectoryStream
<
Path
>
stream
=
null
;
...
...
@@ -567,7 +567,7 @@ class SolarisWatchService
// send ENTRY_CREATE if enabled
if
(
sendEvents
)
{
parent
.
signalEvent
(
StandardWatchEventKind
.
ENTRY_CREATE
,
name
);
parent
.
signalEvent
(
StandardWatchEventKind
s
.
ENTRY_CREATE
,
name
);
}
// register it
...
...
@@ -602,12 +602,12 @@ class SolarisWatchService
// update events, rembering if ENTRY_MODIFY was previously
// enabled or disabled.
boolean
wasModifyEnabled
=
key
.
events
()
.
contains
(
StandardWatchEventKind
.
ENTRY_MODIFY
);
.
contains
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
);
key
.
setEvents
(
events
);
// check if ENTRY_MODIFY has changed
boolean
isModifyEnabled
=
events
.
contains
(
StandardWatchEventKind
.
ENTRY_MODIFY
);
.
contains
(
StandardWatchEventKind
s
.
ENTRY_MODIFY
);
if
(
wasModifyEnabled
==
isModifyEnabled
)
{
return
;
}
...
...
src/solaris/native/sun/awt/awt_Robot.c
浏览文件 @
f9c0499e
...
...
@@ -48,28 +48,12 @@
#ifdef __linux__
#include <sys/socket.h>
#endif
#include <dlfcn.h>
extern
struct
X11GraphicsConfigIDs
x11GraphicsConfigIDs
;
static
jint
*
masks
;
static
jint
num_buttons
;
static
unsigned
int
s_robotInstanceCounter
=
0
;
static
void
*
xcompositeLibHandle
=
NULL
;
static
Bool
xcompositeExtAvailable
=
False
;
static
Bool
xcompositeExtTested
=
False
;
typedef
Status
(
*
T_XCompositeQueryVersion
)(
Display
*
dpy
,
int
*
major_versionp
,
int
*
minor_versionp
);
typedef
Window
(
*
T_XCompositeGetOverlayWindow
)(
Display
*
dpy
,
Window
window
);
typedef
void
(
*
T_XCompositeReleaseOverlayWindow
)(
Display
*
dpy
,
Window
window
);
static
T_XCompositeQueryVersion
XCompositeQueryVersion
=
NULL
;
static
T_XCompositeGetOverlayWindow
XCompositeGetOverlayWindow
=
NULL
;
static
T_XCompositeReleaseOverlayWindow
XCompositeReleaseOverlayWindow
=
NULL
;
static
int32_t
isXTestAvailable
()
{
int32_t
major_opcode
,
first_event
,
first_error
;
int32_t
event_basep
,
error_basep
,
majorp
,
minorp
;
...
...
@@ -210,80 +194,8 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButton
}
AWT_UNLOCK
();
s_robotInstanceCounter
++
;
}
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_XRobotPeer__1dispose
(
JNIEnv
*
env
,
jclass
cls
)
{
if
(
--
s_robotInstanceCounter
)
{
return
;
}
// This is the last instance of the XRobotPeer being released
if
(
xcompositeExtTested
&&
xcompositeExtAvailable
&&
xcompositeLibHandle
)
{
// The lib is loaded in IsXCompositeAvailable(). Unload under AWT_LOCK
// so that the shutdown function of the lib behaves correctly.
AWT_LOCK
();
dlclose
(
xcompositeLibHandle
);
AWT_UNLOCK
();
}
xcompositeExtTested
=
False
;
xcompositeExtAvailable
=
False
;
xcompositeLibHandle
=
NULL
;
}
/*
* Returns True only if XCOMPOSITE is of version 0.3 or higher.
* The functions that we need are available since that version.
*
* Must be invoked under AWT_LOCK.
*
* Leaves the library loaded if the version is correct.
*/
static
Bool
IsXCompositeAvailable
()
{
if
(
!
xcompositeExtTested
)
{
int
opcode
,
eventb
,
errorb
;
if
(
XQueryExtension
(
awt_display
,
"Composite"
,
&
opcode
,
&
eventb
,
&
errorb
))
{
xcompositeLibHandle
=
dlopen
(
"libXcomposite.so.1"
,
RTLD_LAZY
|
RTLD_GLOBAL
);
#ifndef __linux__
/* SOLARIS */
if
(
xcompositeLibHandle
==
NULL
)
{
xcompositeLibHandle
=
dlopen
(
"/usr/sfw/lib/libXcomposite.so.1"
,
RTLD_LAZY
|
RTLD_GLOBAL
);
}
#endif
if
(
xcompositeLibHandle
)
{
int
major
,
minor
;
XCompositeQueryVersion
=
(
T_XCompositeQueryVersion
)
dlsym
(
xcompositeLibHandle
,
"XCompositeQueryVersion"
);
if
(
XCompositeQueryVersion
&&
XCompositeQueryVersion
(
awt_display
,
&
major
,
&
minor
))
{
if
(
major
>=
0
&&
minor
>=
3
)
{
XCompositeGetOverlayWindow
=
(
T_XCompositeGetOverlayWindow
)
dlsym
(
xcompositeLibHandle
,
"XCompositeGetOverlayWindow"
);
XCompositeReleaseOverlayWindow
=
(
T_XCompositeReleaseOverlayWindow
)
dlsym
(
xcompositeLibHandle
,
"XCompositeReleaseOverlayWindow"
);
if
(
XCompositeGetOverlayWindow
&&
XCompositeReleaseOverlayWindow
)
{
xcompositeExtAvailable
=
True
;
}
}
}
if
(
!
xcompositeExtAvailable
)
{
dlclose
(
xcompositeLibHandle
);
}
/* else the lib is unloaded in _dispose() */
}
}
xcompositeExtTested
=
True
;
}
return
xcompositeExtAvailable
;
}
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl
(
JNIEnv
*
env
,
...
...
@@ -299,7 +211,7 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
jint
*
ary
;
/* Array of jints for sending pixel values back
* to parent process.
*/
Window
w
indow
;
Window
rootW
indow
;
AwtGraphicsConfigDataPtr
adata
;
DTRACE_PRINTLN6
(
"RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)"
,
xgc
,
x
,
y
,
width
,
height
,
pixelArray
);
...
...
@@ -316,24 +228,14 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
adata
=
(
AwtGraphicsConfigDataPtr
)
JNU_GetLongFieldAsPtr
(
env
,
xgc
,
x11GraphicsConfigIDs
.
aData
);
DASSERT
(
adata
!=
NULL
);
window
=
XRootWindow
(
awt_display
,
adata
->
awt_visInfo
.
screen
);
if
(
IsXCompositeAvailable
())
{
// Use 'composite overlay window' instead of the root window.
// See 6903034 for details.
window
=
XCompositeGetOverlayWindow
(
awt_display
,
window
);
}
image
=
getWindowImage
(
awt_display
,
window
,
x
,
y
,
width
,
height
);
rootWindow
=
XRootWindow
(
awt_display
,
adata
->
awt_visInfo
.
screen
);
image
=
getWindowImage
(
awt_display
,
rootWindow
,
x
,
y
,
width
,
height
);
/* Array to use to crunch around the pixel values */
ary
=
(
jint
*
)
malloc
(
width
*
height
*
sizeof
(
jint
));
if
(
ary
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"OutOfMemoryError"
);
XDestroyImage
(
image
);
if
(
IsXCompositeAvailable
())
{
XCompositeReleaseOverlayWindow
(
awt_display
,
window
);
}
AWT_UNLOCK
();
return
;
}
...
...
@@ -354,9 +256,6 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
free
(
ary
);
XDestroyImage
(
image
);
if
(
IsXCompositeAvailable
())
{
XCompositeReleaseOverlayWindow
(
awt_display
,
window
);
}
AWT_UNLOCK
();
}
...
...
src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c
浏览文件 @
f9c0499e
...
...
@@ -892,7 +892,8 @@ Java_sun_nio_fs_UnixNativeDispatcher_getpwuid(JNIEnv* env, jclass this, jint uid
if
(
res
!=
0
||
p
==
NULL
||
p
->
pw_name
==
NULL
||
*
(
p
->
pw_name
)
==
'\0'
)
{
/* not found or error */
if
(
errno
!=
0
&&
errno
!=
ENOENT
)
if
(
errno
==
0
)
errno
=
ENOENT
;
throwUnixException
(
env
,
errno
);
}
else
{
jsize
len
=
strlen
(
p
->
pw_name
);
...
...
@@ -941,15 +942,15 @@ Java_sun_nio_fs_UnixNativeDispatcher_getgrgid(JNIEnv* env, jclass this, jint gid
retry
=
0
;
if
(
res
!=
0
||
g
==
NULL
||
g
->
gr_name
==
NULL
||
*
(
g
->
gr_name
)
==
'\0'
)
{
/* not found or error */
if
(
errno
!=
0
&&
errno
!=
ENOENT
)
{
if
(
errno
==
ERANGE
)
{
/* insufficient buffer size so need larger buffer */
buflen
+=
ENT_BUF_SIZE
;
retry
=
1
;
}
else
{
if
(
errno
==
0
)
errno
=
ENOENT
;
throwUnixException
(
env
,
errno
);
}
}
}
else
{
jsize
len
=
strlen
(
g
->
gr_name
);
result
=
(
*
env
)
->
NewByteArray
(
env
,
len
);
...
...
src/windows/classes/sun/awt/windows/WFramePeer.java
浏览文件 @
f9c0499e
...
...
@@ -107,10 +107,18 @@ class WFramePeer extends WWindowPeer implements FramePeer {
Rectangle
currentDevBounds
=
currentDevGC
.
getBounds
();
Rectangle
primaryDevBounds
=
primaryDevGC
.
getBounds
();
boolean
isCurrentDevLarger
=
((
currentDevBounds
.
width
-
primaryDevBounds
.
width
>
0
)
||
(
currentDevBounds
.
height
-
primaryDevBounds
.
height
>
0
));
// the window manager doesn't seem to compensate for differences when
// the primary monitor is larger than the monitor that display the window
if
(
isCurrentDevLarger
)
{
b
.
width
-=
(
currentDevBounds
.
width
-
primaryDevBounds
.
width
);
b
.
height
-=
(
currentDevBounds
.
height
-
primaryDevBounds
.
height
);
}
}
}
@Override
public
boolean
updateGraphicsData
(
GraphicsConfiguration
gc
)
{
...
...
src/windows/classes/sun/java2d/d3d/D3DRenderer.java
浏览文件 @
f9c0499e
...
...
@@ -102,15 +102,20 @@ class D3DRenderer extends BufferedRenderPipe {
final
ParallelogramPipe
realpipe
=
d3dr
.
getAAParallelogramPipe
();
return
new
ParallelogramPipe
()
{
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
{
GraphicsPrimitive
.
tracePrimitive
(
"D3DFillAAParallelogram"
);
realpipe
.
fillParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
);
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
...
...
@@ -118,6 +123,7 @@ class D3DRenderer extends BufferedRenderPipe {
{
GraphicsPrimitive
.
tracePrimitive
(
"D3DDrawAAParallelogram"
);
realpipe
.
drawParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
,
lw2
);
}
...
...
@@ -167,21 +173,29 @@ class D3DRenderer extends BufferedRenderPipe {
d3dr
.
fillSpans
(
sg2d
,
si
,
transx
,
transy
);
}
public
void
fillParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
)
{
GraphicsPrimitive
.
tracePrimitive
(
"D3DFillParallelogram"
);
d3dr
.
fillParallelogram
(
sg2d
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
);
d3dr
.
fillParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
);
}
public
void
drawParallelogram
(
SunGraphics2D
sg2d
,
double
ux1
,
double
uy1
,
double
ux2
,
double
uy2
,
double
x
,
double
y
,
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
,
double
lw1
,
double
lw2
)
{
GraphicsPrimitive
.
tracePrimitive
(
"D3DDrawParallelogram"
);
d3dr
.
drawParallelogram
(
sg2d
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
,
lw2
);
d3dr
.
drawParallelogram
(
sg2d
,
ux1
,
uy1
,
ux2
,
uy2
,
x
,
y
,
dx1
,
dy1
,
dx2
,
dy2
,
lw1
,
lw2
);
}
public
void
copyArea
(
SunGraphics2D
sg2d
,
int
x
,
int
y
,
int
w
,
int
h
,
int
dx
,
int
dy
)
...
...
src/windows/classes/sun/nio/fs/WindowsWatchService.java
浏览文件 @
f9c0499e
...
...
@@ -464,15 +464,15 @@ class WindowsWatchService
{
switch
(
action
)
{
case
FILE_ACTION_MODIFIED
:
return
StandardWatchEventKind
.
ENTRY_MODIFY
;
return
StandardWatchEventKind
s
.
ENTRY_MODIFY
;
case
FILE_ACTION_ADDED
:
case
FILE_ACTION_RENAMED_NEW_NAME
:
return
StandardWatchEventKind
.
ENTRY_CREATE
;
return
StandardWatchEventKind
s
.
ENTRY_CREATE
;
case
FILE_ACTION_REMOVED
:
case
FILE_ACTION_RENAMED_OLD_NAME
:
return
StandardWatchEventKind
.
ENTRY_DELETE
;
return
StandardWatchEventKind
s
.
ENTRY_DELETE
;
default
:
return
null
;
// action not recognized
...
...
@@ -548,7 +548,7 @@ class WindowsWatchService
if
(
info
.
error
()
!=
0
)
{
// buffer overflow
if
(
info
.
error
()
==
ERROR_NOTIFY_ENUM_DIR
)
{
key
.
signalEvent
(
StandardWatchEventKind
.
OVERFLOW
,
null
);
key
.
signalEvent
(
StandardWatchEventKind
s
.
OVERFLOW
,
null
);
}
else
{
// other error so cancel key
implCancelKey
(
key
);
...
...
@@ -562,7 +562,7 @@ class WindowsWatchService
processEvents
(
key
,
info
.
bytesTransferred
());
}
else
{
// insufficient buffer size
key
.
signalEvent
(
StandardWatchEventKind
.
OVERFLOW
,
null
);
key
.
signalEvent
(
StandardWatchEventKind
s
.
OVERFLOW
,
null
);
}
// start read for next batch of changes
...
...
src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp
浏览文件 @
f9c0499e
...
...
@@ -192,6 +192,14 @@ void D3DPipelineManager::NotifyAdapterEventListeners(UINT adapter,
pMgr
=
D3DPipelineManager
::
GetInstance
();
RETURN_IF_NULL
(
pMgr
);
hMon
=
pMgr
->
pd3d9
->
GetAdapterMonitor
(
adapter
);
/*
* If we don't have devices initialized yet, no sense to clear them.
*/
if
(
!
Devices
::
GetInstance
()){
return
;
}
gdiScreen
=
AwtWin32GraphicsDevice
::
GetScreenFromHMONITOR
(
hMon
);
JNU_CallStaticMethodByName
(
env
,
NULL
,
...
...
src/windows/native/sun/security/mscapi/security.cpp
浏览文件 @
f9c0499e
...
...
@@ -705,7 +705,7 @@ JNIEXPORT jobject JNICALL Java_sun_security_mscapi_RSAKeyPairGenerator_generateR
HCRYPTPROV
hCryptProv
=
NULL
;
HCRYPTKEY
hKeyPair
;
DWORD
dwFlags
=
(
keySize
<<
16
)
|
CRYPT_EXPORTABLE
;
jobject
keypair
;
jobject
keypair
=
NULL
;
const
char
*
pszKeyContainerName
=
NULL
;
// UUID
__try
...
...
src/windows/native/sun/windows/Devices.h
浏览文件 @
f9c0499e
...
...
@@ -36,6 +36,7 @@ class AwtWin32GraphicsDevice;
class
Devices
{
public:
static
Devices
*
GetInstance
();
static
BOOL
UpdateInstance
(
JNIEnv
*
env
);
int
GetNumDevices
()
{
return
numDevices
;
}
AwtWin32GraphicsDevice
*
GetDeviceReference
(
int
index
,
BOOL
adjust
=
TRUE
);
...
...
@@ -59,7 +60,6 @@ friend class InstanceAccess;
private:
Devices
(
int
numElements
);
void
AddReference
();
static
Devices
*
GetInstance
();
AwtWin32GraphicsDevice
**
devices
;
int
refCount
;
...
...
src/windows/native/sun/windows/awt_Choice.cpp
浏览文件 @
f9c0499e
...
...
@@ -396,6 +396,12 @@ LRESULT CALLBACK AwtChoice::ListWindowProc(HWND hwnd, UINT message,
DASSERT
(
::
IsWindow
(
hwnd
));
// This branch is required for the proper work of AwtComponent::GetComponent() method
// while hovering drop-down list
if
(
message
==
WmAwtIsComponent
)
{
return
(
LRESULT
)
TRUE
;
}
switch
(
message
)
{
case
WM_LBUTTONDOWN
:
{
DWORD
curPos
=
::
GetMessagePos
();
...
...
src/windows/native/sun/windows/awt_Component.cpp
浏览文件 @
f9c0499e
...
...
@@ -364,7 +364,6 @@ AwtComponent* AwtComponent::GetComponentImpl(HWND hWnd) {
AwtComponent
*
component
=
(
AwtComponent
*
)
::
GetWindowLongPtr
(
hWnd
,
GWLP_USERDATA
);
DASSERT
(
!
component
||
!
IsBadReadPtr
(
component
,
sizeof
(
AwtComponent
))
);
DASSERT
(
!
component
||
component
->
GetHWnd
()
==
hWnd
);
return
component
;
}
...
...
src/windows/native/sun/windows/awt_Frame.cpp
浏览文件 @
f9c0499e
...
...
@@ -344,17 +344,6 @@ LRESULT AwtFrame::ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, Ms
SetImeTargetComponent
(
NULL
);
}
break
;
// TODO: when a Choice's list is dropped down and we're scrolling in
// the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
case
WM_MOUSEWHEEL
:
focusOwner
=
AwtComponent
::
GetComponent
(
sm_focusOwner
);
if
(
focusOwner
!=
NULL
&&
focusOwner
!=
this
)
// avoid recursive calls
{
retValue
=
focusOwner
->
WindowProc
(
message
,
wParam
,
lParam
);
mr
=
mrConsume
;
}
break
;
case
WM_SETFOCUS
:
if
(
sm_inSynthesizeFocus
)
break
;
// pass it up the WindowProc chain
...
...
test/ProblemList.txt
浏览文件 @
f9c0499e
...
...
@@ -195,6 +195,9 @@ java/beans/XMLEncoder/6329581/Test6329581.java generic-all
# jdk_lang
# requires junit
java/lang/invoke/InvokeDynamicPrintArgs.java generic-all
# Times out on solaris 10 sparc
java/lang/ClassLoader/Assert.java generic-all
...
...
test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationContentTest.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7036199
* @summary Check that GarbageCollectionNotification contents are reasonable
* @author Frederic Parain
* @run main/othervm GarbageCollectionNotificationContentTest
*/
import
java.util.*
;
import
java.lang.management.*
;
import
java.lang.reflect.*
;
import
javax.management.*
;
import
javax.management.openmbean.*
;
import
com.sun.management.GarbageCollectionNotificationInfo
;
import
com.sun.management.GcInfo
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.lang.reflect.Field
;
public
class
GarbageCollectionNotificationContentTest
{
private
static
HashMap
<
String
,
GarbageCollectionNotificationInfo
>
listenerInvoked
=
new
HashMap
<
String
,
GarbageCollectionNotificationInfo
>();
static
volatile
long
count
=
0
;
static
volatile
long
number
=
0
;
static
Object
synchronizer
=
new
Object
();
static
class
GcListener
implements
NotificationListener
{
public
void
handleNotification
(
Notification
notif
,
Object
handback
)
{
String
type
=
notif
.
getType
();
if
(
type
.
equals
(
GarbageCollectionNotificationInfo
.
GARBAGE_COLLECTION_NOTIFICATION
))
{
GarbageCollectionNotificationInfo
gcNotif
=
GarbageCollectionNotificationInfo
.
from
((
CompositeData
)
notif
.
getUserData
());
String
source
=
((
ObjectName
)
notif
.
getSource
()).
getCanonicalName
();
synchronized
(
synchronizer
)
{
if
(
listenerInvoked
.
get
(
source
)
==
null
)
{
listenerInvoked
.
put
(((
ObjectName
)
notif
.
getSource
()).
getCanonicalName
(),
gcNotif
);
count
++;
if
(
count
>=
number
)
{
synchronizer
.
notify
();
}
}
}
}
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
MBeanServer
mbs
=
ManagementFactory
.
getPlatformMBeanServer
();
final
Boolean
isNotificationSupported
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Boolean
>()
{
public
Boolean
run
()
{
try
{
Class
cl
=
Class
.
forName
(
"sun.management.VMManagementImpl"
);
Field
f
=
cl
.
getDeclaredField
(
"gcNotificationSupport"
);
f
.
setAccessible
(
true
);
return
f
.
getBoolean
(
null
);
}
catch
(
ClassNotFoundException
e
)
{
return
false
;
}
catch
(
NoSuchFieldException
e
)
{
return
false
;
}
catch
(
IllegalAccessException
e
)
{
return
false
;
}
}
});
if
(!
isNotificationSupported
)
{
System
.
out
.
println
(
"GC Notification not supported by the JVM, test skipped"
);
return
;
}
final
ObjectName
gcMXBeanPattern
=
new
ObjectName
(
"java.lang:type=GarbageCollector,*"
);
Set
<
ObjectName
>
names
=
mbs
.
queryNames
(
gcMXBeanPattern
,
null
);
if
(
names
.
isEmpty
())
throw
new
Exception
(
"Test incorrect: no GC MXBeans"
);
number
=
names
.
size
();
for
(
ObjectName
n
:
names
)
{
if
(
mbs
.
isInstanceOf
(
n
,
"javax.management.NotificationEmitter"
))
{
listenerInvoked
.
put
(
n
.
getCanonicalName
(),
null
);
GcListener
listener
=
new
GcListener
();
mbs
.
addNotificationListener
(
n
,
listener
,
null
,
null
);
}
}
// Invocation of System.gc() to trigger major GC
System
.
gc
();
// Allocation of many short living and small objects to trigger minor GC
Object
data
[]
=
new
Object
[
32
];
for
(
int
i
=
0
;
i
<
100000000
;
i
++)
{
data
[
i
%
32
]
=
new
int
[
8
];
}
int
wakeup
=
0
;
synchronized
(
synchronizer
)
{
while
(
count
!=
number
)
{
synchronizer
.
wait
(
10000
);
wakeup
++;
if
(
wakeup
>
10
)
break
;
}
}
for
(
GarbageCollectionNotificationInfo
notif
:
listenerInvoked
.
values
()
)
{
checkGarbageCollectionNotificationInfoContent
(
notif
);
}
System
.
out
.
println
(
"Test passed"
);
}
private
static
void
checkGarbageCollectionNotificationInfoContent
(
GarbageCollectionNotificationInfo
notif
)
throws
Exception
{
System
.
out
.
println
(
"GC notification for "
+
notif
.
getGcName
());
System
.
out
.
print
(
"Action: "
+
notif
.
getGcAction
());
System
.
out
.
println
(
" Cause: "
+
notif
.
getGcCause
());
GcInfo
info
=
notif
.
getGcInfo
();
System
.
out
.
print
(
"GC Info #"
+
info
.
getId
());
System
.
out
.
print
(
" start:"
+
info
.
getStartTime
());
System
.
out
.
print
(
" end:"
+
info
.
getEndTime
());
System
.
out
.
println
(
" ("
+
info
.
getDuration
()
+
"ms)"
);
Map
<
String
,
MemoryUsage
>
usage
=
info
.
getMemoryUsageBeforeGc
();
List
<
String
>
pnames
=
new
ArrayList
<
String
>();
for
(
Map
.
Entry
entry
:
usage
.
entrySet
()
)
{
String
poolname
=
(
String
)
entry
.
getKey
();
pnames
.
add
(
poolname
);
MemoryUsage
busage
=
(
MemoryUsage
)
entry
.
getValue
();
MemoryUsage
ausage
=
(
MemoryUsage
)
info
.
getMemoryUsageAfterGc
().
get
(
poolname
);
if
(
ausage
==
null
)
{
throw
new
RuntimeException
(
"After Gc Memory does not exist"
+
" for "
+
poolname
);
}
System
.
out
.
println
(
"Usage for pool "
+
poolname
);
System
.
out
.
println
(
" Before GC: "
+
busage
);
System
.
out
.
println
(
" After GC: "
+
ausage
);
}
// check if memory usage for all memory pools are returned
List
<
MemoryPoolMXBean
>
pools
=
ManagementFactory
.
getMemoryPoolMXBeans
();
for
(
MemoryPoolMXBean
p
:
pools
)
{
if
(!
pnames
.
contains
(
p
.
getName
()))
{
throw
new
RuntimeException
(
"GcInfo does not contain "
+
"memory usage for pool "
+
p
.
getName
());
}
}
}
}
test/com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7036199
* @summary Check that GarbageCollection notification are thrown by every GarbageCollectorMXBean
* @author Frederic Parain
* @run main/othervm GarbageCollectionNotificationTest
*/
import
java.util.*
;
import
java.lang.management.*
;
import
java.lang.reflect.*
;
import
javax.management.*
;
import
javax.management.openmbean.*
;
import
com.sun.management.GarbageCollectionNotificationInfo
;
import
com.sun.management.GcInfo
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.lang.reflect.Field
;
public
class
GarbageCollectionNotificationTest
{
private
static
HashMap
<
String
,
Boolean
>
listenerInvoked
=
new
HashMap
<
String
,
Boolean
>();
static
volatile
long
count
=
0
;
static
volatile
long
number
=
0
;
static
Object
synchronizer
=
new
Object
();
static
class
GcListener
implements
NotificationListener
{
public
void
handleNotification
(
Notification
notif
,
Object
handback
)
{
String
type
=
notif
.
getType
();
if
(
type
.
equals
(
GarbageCollectionNotificationInfo
.
GARBAGE_COLLECTION_NOTIFICATION
))
{
GarbageCollectionNotificationInfo
gcNotif
=
GarbageCollectionNotificationInfo
.
from
((
CompositeData
)
notif
.
getUserData
());
String
source
=
((
ObjectName
)
notif
.
getSource
()).
getCanonicalName
();
synchronized
(
synchronizer
)
{
if
(!
listenerInvoked
.
get
(
source
))
{
listenerInvoked
.
put
(((
ObjectName
)
notif
.
getSource
()).
getCanonicalName
(),
true
);
count
++;
if
(
count
>=
number
)
{
synchronizer
.
notify
();
}
}
}
}
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
MBeanServer
mbs
=
ManagementFactory
.
getPlatformMBeanServer
();
final
Boolean
isNotificationSupported
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Boolean
>()
{
public
Boolean
run
()
{
try
{
Class
cl
=
Class
.
forName
(
"sun.management.VMManagementImpl"
);
Field
f
=
cl
.
getDeclaredField
(
"gcNotificationSupport"
);
f
.
setAccessible
(
true
);
return
f
.
getBoolean
(
null
);
}
catch
(
ClassNotFoundException
e
)
{
return
false
;
}
catch
(
NoSuchFieldException
e
)
{
return
false
;
}
catch
(
IllegalAccessException
e
)
{
return
false
;
}
}
});
if
(!
isNotificationSupported
)
{
System
.
out
.
println
(
"GC Notification not supported by the JVM, test skipped"
);
return
;
}
final
ObjectName
gcMXBeanPattern
=
new
ObjectName
(
"java.lang:type=GarbageCollector,*"
);
Set
<
ObjectName
>
names
=
mbs
.
queryNames
(
gcMXBeanPattern
,
null
);
if
(
names
.
isEmpty
())
throw
new
Exception
(
"Test incorrect: no GC MXBeans"
);
number
=
names
.
size
();
for
(
ObjectName
n
:
names
)
{
if
(
mbs
.
isInstanceOf
(
n
,
"javax.management.NotificationEmitter"
))
{
listenerInvoked
.
put
(
n
.
getCanonicalName
(),
false
);
GcListener
listener
=
new
GcListener
();
mbs
.
addNotificationListener
(
n
,
listener
,
null
,
null
);
}
}
// Invocation of System.gc() to trigger major GC
System
.
gc
();
// Allocation of many short living and small objects to trigger minor GC
Object
data
[]
=
new
Object
[
32
];
for
(
int
i
=
0
;
i
<
100000000
;
i
++)
{
data
[
i
%
32
]
=
new
int
[
8
];
}
int
wakeup
=
0
;
synchronized
(
synchronizer
)
{
while
(
count
!=
number
)
{
synchronizer
.
wait
(
10000
);
wakeup
++;
if
(
wakeup
>
10
)
break
;
}
}
for
(
String
source
:
listenerInvoked
.
keySet
())
{
if
(!
listenerInvoked
.
get
(
source
))
throw
new
Exception
(
"Test incorrect: notifications have not been sent for "
+
source
);
}
System
.
out
.
println
(
"Test passed"
);
}
}
test/com/sun/nio/sctp/SctpChannel/SocketOptionTests.java
浏览文件 @
f9c0499e
...
...
@@ -40,7 +40,7 @@ import com.sun.nio.sctp.SctpServerChannel;
import
com.sun.nio.sctp.SctpSocketOption
;
import
java.security.AccessController
;
import
sun.security.action.GetPropertyAction
;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
.*;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
s
.*;
import
static
java
.
lang
.
System
.
out
;
public
class
SocketOptionTests
{
...
...
test/com/sun/nio/sctp/SctpMultiChannel/SocketOptionTests.java
浏览文件 @
f9c0499e
...
...
@@ -48,7 +48,7 @@ import com.sun.nio.sctp.SctpServerChannel;
import
com.sun.nio.sctp.SctpSocketOption
;
import
java.security.AccessController
;
import
sun.security.action.GetPropertyAction
;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
.*;
import
static
com
.
sun
.
nio
.
sctp
.
SctpStandardSocketOption
s
.*;
import
static
java
.
lang
.
System
.
out
;
public
class
SocketOptionTests
{
...
...
test/java/awt/Component/Revalidate/Revalidate.java
浏览文件 @
f9c0499e
...
...
@@ -26,7 +26,7 @@
@bug 7036669
@summary Test Component.revalidate() method
@author anthony.petrov@oracle.com: area=awt.component
@run main Revalidate
@run main
/othervm -Djava.awt.smartInvalidate=true
Revalidate
*/
import
java.awt.*
;
...
...
test/java/awt/Container/ValidateRoot/InvalidateMustRespectValidateRoots.java
浏览文件 @
f9c0499e
...
...
@@ -26,7 +26,7 @@
@bug 6852592
@summary invalidate() must stop when it encounters a validate root
@author anthony.petrov@sun.com
@run main InvalidateMustRespectValidateRoots
@run main
/othervm -Djava.awt.smartInvalidate=true
InvalidateMustRespectValidateRoots
*/
import
javax.swing.*
;
...
...
test/java/awt/Paint/PgramUserBoundsTest.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 7043054
* @summary Verifies that Paint objects receive the appropriate user space
* bounds in their createContext() method
* @run main PgramUserBoundsTest
*/
import
java.awt.Color
;
import
java.awt.Graphics2D
;
import
java.awt.Paint
;
import
java.awt.PaintContext
;
import
java.awt.RenderingHints
;
import
java.awt.Rectangle
;
import
java.awt.geom.AffineTransform
;
import
java.awt.geom.Line2D
;
import
java.awt.geom.Rectangle2D
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.ColorModel
;
public
class
PgramUserBoundsTest
{
static
final
int
MinX
=
10
;
static
final
int
MinY
=
20
;
static
final
int
MaxX
=
30
;
static
final
int
MaxY
=
50
;
static
AffineTransform
identity
=
new
AffineTransform
();
public
static
void
main
(
String
argv
[])
{
BufferedImage
bimg
=
new
BufferedImage
(
100
,
100
,
BufferedImage
.
TYPE_INT_RGB
);
Graphics2D
g2d
=
bimg
.
createGraphics
();
g2d
.
setPaint
(
new
BoundsCheckerPaint
(
MinX
,
MinY
,
MaxX
,
MaxY
));
testAll
(
g2d
);
g2d
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
testAll
(
g2d
);
}
static
void
testAll
(
Graphics2D
g2d
)
{
g2d
.
setTransform
(
identity
);
g2d
.
translate
(
100
,
100
);
testPrimitives
(
g2d
);
g2d
.
setTransform
(
identity
);
g2d
.
scale
(
10
,
10
);
testPrimitives
(
g2d
);
g2d
.
setTransform
(
identity
);
g2d
.
rotate
(
Math
.
PI
/
6
);
testPrimitives
(
g2d
);
}
static
void
testPrimitives
(
Graphics2D
g2d
)
{
testLine
(
g2d
);
testRect
(
g2d
);
}
static
void
testLine
(
Graphics2D
g2d
)
{
testLine
(
g2d
,
MinX
,
MinY
,
MaxX
,
MaxY
);
testLine
(
g2d
,
MaxX
,
MinY
,
MinX
,
MaxY
);
testLine
(
g2d
,
MinX
,
MaxY
,
MaxX
,
MinY
);
testLine
(
g2d
,
MaxX
,
MaxY
,
MinX
,
MinY
);
}
static
void
testRect
(
Graphics2D
g2d
)
{
g2d
.
fillRect
(
MinX
,
MinY
,
MaxX
-
MinX
,
MaxY
-
MinY
);
g2d
.
fill
(
new
Rectangle
(
MinX
,
MinY
,
MaxX
-
MinX
,
MaxY
-
MinY
));
}
static
void
testLine
(
Graphics2D
g2d
,
int
x1
,
int
y1
,
int
x2
,
int
y2
)
{
g2d
.
drawLine
(
x1
,
y1
,
x2
,
y2
);
g2d
.
draw
(
new
Line2D
.
Double
(
x1
,
y1
,
x2
,
y2
));
}
static
class
BoundsCheckerPaint
implements
Paint
{
private
Color
c
=
Color
.
WHITE
;
private
Rectangle2D
expectedBounds
;
public
BoundsCheckerPaint
(
double
x1
,
double
y1
,
double
x2
,
double
y2
)
{
expectedBounds
=
new
Rectangle2D
.
Double
();
expectedBounds
.
setFrameFromDiagonal
(
x1
,
y1
,
x2
,
y2
);
}
public
int
getTransparency
()
{
return
c
.
getTransparency
();
}
public
PaintContext
createContext
(
ColorModel
cm
,
Rectangle
deviceBounds
,
Rectangle2D
userBounds
,
AffineTransform
xform
,
RenderingHints
hints
)
{
System
.
out
.
println
(
"user bounds = "
+
userBounds
);
if
(!
userBounds
.
equals
(
expectedBounds
))
{
throw
new
RuntimeException
(
"bounds fail to match"
);
}
return
c
.
createContext
(
cm
,
deviceBounds
,
userBounds
,
xform
,
hints
);
}
}
}
test/java/awt/Toolkit/Headless/ExceptionContract/ExceptionContract.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 7040577
@library ../../../regtesthelpers
@build Sysout
@summary Default implementation of Toolkit.loadSystemColors(int[]) and many others doesn't throw HE in hl env
@author andrei dmitriev: area=awt.headless
@run main/othervm -Djava.awt.headless=true ExceptionContract
*/
import
java.awt.*
;
import
java.util.Properties
;
import
test.java.awt.regtesthelpers.Sysout
;
import
java.awt.datatransfer.Clipboard
;
import
java.awt.dnd.*
;
import
java.awt.dnd.peer.DragSourceContextPeer
;
import
java.awt.font.TextAttribute
;
import
java.awt.im.InputMethodHighlight
;
import
java.awt.image.*
;
import
java.awt.peer.*
;
import
java.net.URL
;
import
java.util.Map
;
import
java.util.Properties
;
public
class
ExceptionContract
{
private
static
boolean
passed
=
false
;
public
static
void
main
(
String
[]
args
)
{
//Case1
try
{
new
_Toolkit
().
getLockingKeyState
(
1
);
}
catch
(
HeadlessException
he
){
passed
=
true
;
}
if
(!
passed
){
throw
new
RuntimeException
(
"Tk.getLockingKeyState() didn't throw HeadlessException while in the headless mode."
);
}
passed
=
false
;
//Case2
try
{
new
_Toolkit
().
setLockingKeyState
(
1
,
true
);
}
catch
(
HeadlessException
he
){
passed
=
true
;
}
if
(!
passed
){
throw
new
RuntimeException
(
"Tk.setLockingKeyState() didn't throw HeadlessException while in the headless mode."
);
}
passed
=
false
;
//Case3
try
{
new
_Toolkit
().
createCustomCursor
(
new
BufferedImage
(
16
,
16
,
BufferedImage
.
TYPE_INT_RGB
),
new
Point
(
0
,
0
),
"Custom cursor"
);
}
catch
(
HeadlessException
he
){
he
.
printStackTrace
();
passed
=
true
;
}
if
(!
passed
){
throw
new
RuntimeException
(
"Tk.createCustomCursor(args) didn't throw HeadlessException while in the headless mode."
);
}
}
static
class
_Toolkit
extends
Toolkit
{
@Override
public
Cursor
createCustomCursor
(
Image
cursor
,
Point
hotSpot
,
String
name
)
throws
IndexOutOfBoundsException
,
HeadlessException
{
return
super
.
createCustomCursor
(
cursor
,
hotSpot
,
name
);
}
@Override
public
void
setLockingKeyState
(
int
keyCode
,
boolean
on
)
throws
UnsupportedOperationException
{
super
.
setLockingKeyState
(
keyCode
,
on
);
}
@Override
public
boolean
getLockingKeyState
(
int
keyCode
)
throws
UnsupportedOperationException
{
return
super
.
getLockingKeyState
(
keyCode
);
}
@Override
public
void
loadSystemColors
(
int
[]
systemColors
)
throws
HeadlessException
{
return
;
}
@Override
protected
DesktopPeer
createDesktopPeer
(
Desktop
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
ButtonPeer
createButton
(
Button
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
TextFieldPeer
createTextField
(
TextField
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
LabelPeer
createLabel
(
Label
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
ListPeer
createList
(
List
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
CheckboxPeer
createCheckbox
(
Checkbox
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
ScrollbarPeer
createScrollbar
(
Scrollbar
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
ScrollPanePeer
createScrollPane
(
ScrollPane
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
TextAreaPeer
createTextArea
(
TextArea
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
ChoicePeer
createChoice
(
Choice
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
FramePeer
createFrame
(
Frame
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
CanvasPeer
createCanvas
(
Canvas
target
)
{
return
null
;
}
@Override
protected
PanelPeer
createPanel
(
Panel
target
)
{
return
null
;
}
@Override
protected
WindowPeer
createWindow
(
Window
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
DialogPeer
createDialog
(
Dialog
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
MenuBarPeer
createMenuBar
(
MenuBar
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
MenuPeer
createMenu
(
Menu
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
PopupMenuPeer
createPopupMenu
(
PopupMenu
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
MenuItemPeer
createMenuItem
(
MenuItem
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
FileDialogPeer
createFileDialog
(
FileDialog
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
CheckboxMenuItemPeer
createCheckboxMenuItem
(
CheckboxMenuItem
target
)
throws
HeadlessException
{
return
null
;
}
@Override
protected
FontPeer
getFontPeer
(
String
name
,
int
style
)
{
return
null
;
}
@Override
public
Dimension
getScreenSize
()
throws
HeadlessException
{
return
null
;
}
@Override
public
int
getScreenResolution
()
throws
HeadlessException
{
return
0
;
}
@Override
public
ColorModel
getColorModel
()
throws
HeadlessException
{
return
null
;
}
@Override
public
String
[]
getFontList
()
{
return
new
String
[
0
];
}
@Override
public
FontMetrics
getFontMetrics
(
Font
font
)
{
return
null
;
}
@Override
public
void
sync
()
{
}
@Override
public
Image
getImage
(
String
filename
)
{
return
null
;
}
@Override
public
Image
getImage
(
URL
url
)
{
return
null
;
}
@Override
public
Image
createImage
(
String
filename
)
{
return
null
;
}
@Override
public
Image
createImage
(
URL
url
)
{
return
null
;
}
@Override
public
boolean
prepareImage
(
Image
image
,
int
width
,
int
height
,
ImageObserver
observer
)
{
return
false
;
}
@Override
public
int
checkImage
(
Image
image
,
int
width
,
int
height
,
ImageObserver
observer
)
{
return
0
;
}
@Override
public
Image
createImage
(
ImageProducer
producer
)
{
return
null
;
}
@Override
public
Image
createImage
(
byte
[]
imagedata
,
int
imageoffset
,
int
imagelength
)
{
return
null
;
}
@Override
public
PrintJob
getPrintJob
(
Frame
frame
,
String
jobtitle
,
Properties
props
)
{
return
null
;
}
@Override
public
void
beep
()
{
}
@Override
public
Clipboard
getSystemClipboard
()
throws
HeadlessException
{
return
null
;
}
@Override
protected
EventQueue
getSystemEventQueueImpl
()
{
return
null
;
}
@Override
public
DragSourceContextPeer
createDragSourceContextPeer
(
DragGestureEvent
dge
)
throws
InvalidDnDOperationException
{
return
null
;
}
@Override
public
boolean
isModalityTypeSupported
(
Dialog
.
ModalityType
modalityType
)
{
return
false
;
}
@Override
public
boolean
isModalExclusionTypeSupported
(
Dialog
.
ModalExclusionType
modalExclusionType
)
{
return
false
;
}
@Override
public
Map
<
TextAttribute
,
?>
mapInputMethodHighlight
(
InputMethodHighlight
highlight
)
throws
HeadlessException
{
return
null
;
}
}
}
test/java/awt/geom/Arc2D/SerializationTest.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 7040717 6522514
* @summary Verifies that subclasses of Arc2D can be serialized.
* @run main SerializationTest
*/
import
java.awt.geom.Rectangle2D
;
import
java.awt.geom.Arc2D
;
import
java.io.Serializable
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
public
class
SerializationTest
{
static
boolean
failed
;
public
static
void
main
(
String
args
[])
{
test
(
new
Arc
());
test
(
new
ArcF
());
test
(
new
ArcD
());
if
(
failed
)
throw
new
RuntimeException
(
"some tests failed"
);
}
public
static
void
test
(
Object
a
)
{
try
{
File
objectbin
=
new
File
(
"object.bin"
);
FileOutputStream
fos
=
new
FileOutputStream
(
objectbin
);
ObjectOutputStream
out
=
new
ObjectOutputStream
(
fos
);
out
.
writeObject
(
a
);
fos
.
close
();
FileInputStream
fis
=
new
FileInputStream
(
objectbin
);
ObjectInputStream
in
=
new
ObjectInputStream
(
fis
);
Object
o
=
in
.
readObject
();
fis
.
close
();
System
.
err
.
println
(
o
);
}
catch
(
Throwable
ex
)
{
ex
.
printStackTrace
();
failed
=
true
;
}
}
static
class
Arc
extends
Arc2D
implements
Serializable
{
public
Arc
()
{
super
(
Arc2D
.
OPEN
);
}
public
Rectangle2D
makeBounds
(
double
x
,
double
y
,
double
w
,
double
h
)
{
return
new
Rectangle2D
.
Double
(
x
,
y
,
w
,
h
);
}
public
double
getX
()
{
return
0
;
}
public
double
getY
()
{
return
0
;
}
public
double
getWidth
()
{
return
0
;
}
public
double
getHeight
()
{
return
0
;
}
public
double
getAngleExtent
()
{
return
0
;
}
public
double
getAngleStart
()
{
return
0
;
}
public
void
setAngleExtent
(
double
angExt
)
{
}
public
void
setAngleStart
(
double
angExt
)
{
}
public
void
setFrame
(
double
x
,
double
y
,
double
w
,
double
h
)
{}
public
void
setArc
(
double
x
,
double
y
,
double
w
,
double
h
,
double
s
,
double
e
,
int
c
)
{
}
public
boolean
isEmpty
()
{
return
false
;
};
}
static
class
ArcF
extends
Arc2D
.
Float
implements
Serializable
{
public
ArcF
()
{
}
}
static
class
ArcD
extends
Arc2D
.
Double
implements
Serializable
{
public
ArcD
()
{
}
}
}
test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java
浏览文件 @
f9c0499e
...
...
@@ -29,7 +29,7 @@
import
java.nio.channels.*
;
import
java.net.*
;
import
static
java
.
net
.
StandardSocketOption
.*;
import
static
java
.
net
.
StandardSocketOption
s
.*;
import
java.io.IOException
;
import
java.util.Set
;
import
java.util.concurrent.ExecutionException
;
...
...
test/java/nio/channels/AsynchronousSocketChannel/Basic.java
浏览文件 @
f9c0499e
...
...
@@ -29,7 +29,7 @@
import
java.nio.ByteBuffer
;
import
java.nio.channels.*
;
import
static
java
.
net
.
StandardSocketOption
.*;
import
static
java
.
net
.
StandardSocketOption
s
.*;
import
java.net.*
;
import
java.util.Random
;
import
java.util.concurrent.*
;
...
...
@@ -383,7 +383,7 @@ public class Basic {
// write bytes and close connection
SocketChannel
sc
=
server
.
accept
();
ByteBuffer
src
=
genBuffer
();
sc
.
setOption
(
StandardSocketOption
.
SO_SNDBUF
,
src
.
remaining
());
sc
.
setOption
(
StandardSocketOption
s
.
SO_SNDBUF
,
src
.
remaining
());
while
(
src
.
hasRemaining
())
sc
.
write
(
src
);
sc
.
close
();
...
...
test/java/nio/channels/DatagramChannel/BasicMulticastTests.java
浏览文件 @
f9c0499e
...
...
@@ -52,7 +52,7 @@ public class BasicMulticastTests {
StandardProtocolFamily
.
INET
:
StandardProtocolFamily
.
INET6
;
DatagramChannel
dc
=
DatagramChannel
.
open
(
family
)
.
setOption
(
StandardSocketOption
.
SO_REUSEADDR
,
true
)
.
setOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
true
)
.
bind
(
new
InetSocketAddress
(
source
,
0
));
// check existing key is returned
...
...
@@ -115,7 +115,7 @@ public class BasicMulticastTests {
System
.
out
.
println
(
"Exception Tests"
);
DatagramChannel
dc
=
DatagramChannel
.
open
(
StandardProtocolFamily
.
INET
)
.
setOption
(
StandardSocketOption
.
SO_REUSEADDR
,
true
)
.
setOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
true
)
.
bind
(
new
InetSocketAddress
(
0
));
InetAddress
group
=
InetAddress
.
getByName
(
"225.4.5.6"
);
...
...
test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java
浏览文件 @
f9c0499e
...
...
@@ -59,7 +59,7 @@ public class MulticastSendReceiveTests {
StandardProtocolFamily
.
INET6
:
StandardProtocolFamily
.
INET
;
DatagramChannel
dc
=
DatagramChannel
.
open
(
family
)
.
bind
(
new
InetSocketAddress
(
local
,
0
))
.
setOption
(
StandardSocketOption
.
IP_MULTICAST_IF
,
nif
);
.
setOption
(
StandardSocketOption
s
.
IP_MULTICAST_IF
,
nif
);
int
id
=
rand
.
nextInt
();
byte
[]
msg
=
Integer
.
toString
(
id
).
getBytes
(
"UTF-8"
);
ByteBuffer
buf
=
ByteBuffer
.
wrap
(
msg
);
...
...
@@ -146,7 +146,7 @@ public class MulticastSendReceiveTests {
System
.
out
.
format
(
"\nTest DatagramChannel to %s socket\n"
,
family
.
name
());
try
(
DatagramChannel
dc
=
(
family
==
UNSPEC
)
?
DatagramChannel
.
open
()
:
DatagramChannel
.
open
(
family
))
{
dc
.
setOption
(
StandardSocketOption
.
SO_REUSEADDR
,
true
)
dc
.
setOption
(
StandardSocketOption
s
.
SO_REUSEADDR
,
true
)
.
bind
(
new
InetSocketAddress
(
0
));
// join group
...
...
test/java/nio/channels/DatagramChannel/SocketOptionTests.java
浏览文件 @
f9c0499e
...
...
@@ -31,7 +31,7 @@ import java.nio.channels.*;
import
java.net.*
;
import
java.io.IOException
;
import
java.util.*
;
import
static
java
.
net
.
StandardSocketOption
.*;
import
static
java
.
net
.
StandardSocketOption
s
.*;
public
class
SocketOptionTests
{
...
...
test/java/nio/channels/FileChannel/ClosedByInterrupt.java
浏览文件 @
f9c0499e
...
...
@@ -52,13 +52,16 @@ public class ClosedByInterrupt {
fc
.
write
(
bb
);
}
// test with 1-
8
concurrent threads
for
(
int
i
=
1
;
i
<=
8
;
i
++)
{
// test with 1-
16
concurrent threads
for
(
int
i
=
1
;
i
<=
16
;
i
++)
{
System
.
out
.
format
(
"%d thread(s)%n"
,
i
);
test
(
f
,
i
);
if
(
failed
)
break
;
}
if
(
failed
)
throw
new
RuntimeException
(
"Test failed"
);
}
/**
...
...
@@ -132,12 +135,14 @@ public class ClosedByInterrupt {
// give the interruptible thread a chance
try
{
Thread
.
sleep
(
rand
.
nextInt
(
50
));
}
catch
(
InterruptedException
ignore
)
{
}
}
catch
(
InterruptedException
e
)
{
unexpected
(
e
);
}
}
}
}
catch
(
ClosedByInterruptException
e
)
{
if
(
interruptible
)
{
if
(
Thread
.
currentThread
().
isI
nterrupted
())
{
if
(
Thread
.
i
nterrupted
())
{
expected
(
e
+
" thrown and interrupt status set"
);
}
else
{
unexpected
(
e
+
" thrown but interrupt status not set"
);
...
...
@@ -158,7 +163,7 @@ public class ClosedByInterrupt {
}
static
void
expected
(
Exception
e
)
{
System
.
out
.
format
(
"%s (
not
expected)%n"
,
e
);
System
.
out
.
format
(
"%s (expected)%n"
,
e
);
}
static
void
expected
(
String
msg
)
{
...
...
test/java/nio/channels/ServerSocketChannel/SocketOptionTests.java
浏览文件 @
f9c0499e
...
...
@@ -32,7 +32,7 @@ import java.nio.channels.*;
import
java.net.*
;
import
java.io.IOException
;
import
java.util.*
;
import
static
java
.
net
.
StandardSocketOption
.*;
import
static
java
.
net
.
StandardSocketOption
s
.*;
public
class
SocketOptionTests
{
...
...
test/java/nio/channels/SocketChannel/Shutdown.java
浏览文件 @
f9c0499e
...
...
@@ -39,7 +39,7 @@ public class Shutdown {
static
void
acceptAndReset
(
ServerSocketChannel
ssc
)
throws
IOException
{
SocketChannel
peer
=
ssc
.
accept
();
try
{
peer
.
setOption
(
StandardSocketOption
.
SO_LINGER
,
0
);
peer
.
setOption
(
StandardSocketOption
s
.
SO_LINGER
,
0
);
peer
.
configureBlocking
(
false
);
peer
.
write
(
ByteBuffer
.
wrap
(
new
byte
[
128
*
1024
]));
}
finally
{
...
...
test/java/nio/channels/SocketChannel/SocketOptionTests.java
浏览文件 @
f9c0499e
...
...
@@ -32,7 +32,7 @@ import java.nio.channels.*;
import
java.net.*
;
import
java.io.IOException
;
import
java.util.*
;
import
static
java
.
net
.
StandardSocketOption
.*;
import
static
java
.
net
.
StandardSocketOption
s
.*;
public
class
SocketOptionTests
{
...
...
test/java/nio/charset/StandardCharset/Standard.java
→
test/java/nio/charset/StandardCharset
s
/Standard.java
浏览文件 @
f9c0499e
...
...
@@ -44,25 +44,25 @@ public class Standard {
"UTF-16BE"
,
"UTF-16LE"
,
"UTF-16"
};
public
static
void
realMain
(
String
[]
args
)
{
check
(
StandardCharset
.
US_ASCII
instanceof
Charset
);
check
(
StandardCharset
.
ISO_8859_1
instanceof
Charset
);
check
(
StandardCharset
.
UTF_8
instanceof
Charset
);
check
(
StandardCharset
.
UTF_16BE
instanceof
Charset
);
check
(
StandardCharset
.
UTF_16LE
instanceof
Charset
);
check
(
StandardCharset
.
UTF_16
instanceof
Charset
);
check
(
StandardCharset
s
.
US_ASCII
instanceof
Charset
);
check
(
StandardCharset
s
.
ISO_8859_1
instanceof
Charset
);
check
(
StandardCharset
s
.
UTF_8
instanceof
Charset
);
check
(
StandardCharset
s
.
UTF_16BE
instanceof
Charset
);
check
(
StandardCharset
s
.
UTF_16LE
instanceof
Charset
);
check
(
StandardCharset
s
.
UTF_16
instanceof
Charset
);
check
(
"US-ASCII"
.
equals
(
StandardCharset
.
US_ASCII
.
name
()));
check
(
"ISO-8859-1"
.
equals
(
StandardCharset
.
ISO_8859_1
.
name
()));
check
(
"UTF-8"
.
equals
(
StandardCharset
.
UTF_8
.
name
()));
check
(
"UTF-16BE"
.
equals
(
StandardCharset
.
UTF_16BE
.
name
()));
check
(
"UTF-16LE"
.
equals
(
StandardCharset
.
UTF_16LE
.
name
()));
check
(
"UTF-16"
.
equals
(
StandardCharset
.
UTF_16
.
name
()));
check
(
"US-ASCII"
.
equals
(
StandardCharset
s
.
US_ASCII
.
name
()));
check
(
"ISO-8859-1"
.
equals
(
StandardCharset
s
.
ISO_8859_1
.
name
()));
check
(
"UTF-8"
.
equals
(
StandardCharset
s
.
UTF_8
.
name
()));
check
(
"UTF-16BE"
.
equals
(
StandardCharset
s
.
UTF_16BE
.
name
()));
check
(
"UTF-16LE"
.
equals
(
StandardCharset
s
.
UTF_16LE
.
name
()));
check
(
"UTF-16"
.
equals
(
StandardCharset
s
.
UTF_16
.
name
()));
Set
<
String
>
charsets
=
new
HashSet
<>();
Field
standardCharsetFields
[]
=
StandardCharset
.
class
.
getFields
();
Field
standardCharsetFields
[]
=
StandardCharset
s
.
class
.
getFields
();
for
(
Field
charsetField
:
standardCharsetFields
)
{
check
(
StandardCharset
.
class
==
charsetField
.
getDeclaringClass
());
check
(
StandardCharset
s
.
class
==
charsetField
.
getDeclaringClass
());
check
(
Modifier
.
isFinal
(
charsetField
.
getModifiers
()));
check
(
Modifier
.
isStatic
(
charsetField
.
getModifiers
()));
check
(
Modifier
.
isPublic
(
charsetField
.
getModifiers
()));
...
...
test/java/nio/file/Files/CheckPermissions.java
浏览文件 @
f9c0499e
...
...
@@ -540,7 +540,7 @@ public class CheckPermissions {
try
(
WatchService
watcher
=
FileSystems
.
getDefault
().
newWatchService
())
{
prepare
();
testdir
.
register
(
watcher
,
StandardWatchEventKind
.
ENTRY_DELETE
);
testdir
.
register
(
watcher
,
StandardWatchEventKind
s
.
ENTRY_DELETE
);
assertCheckRead
(
testdir
);
}
...
...
test/java/nio/file/WatchService/Basic.java
浏览文件 @
f9c0499e
...
...
@@ -29,7 +29,7 @@
*/
import
java.nio.file.*
;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
.*;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
s
.*;
import
java.nio.file.attribute.*
;
import
java.io.*
;
import
java.util.*
;
...
...
@@ -100,7 +100,7 @@ public class Basic {
// remove key and check that we got the ENTRY_CREATE event
takeExpectedKey
(
watcher
,
myKey
);
checkExpectedEvent
(
myKey
.
pollEvents
(),
StandardWatchEventKind
.
ENTRY_CREATE
,
name
);
StandardWatchEventKind
s
.
ENTRY_CREATE
,
name
);
System
.
out
.
println
(
"reset key"
);
if
(!
myKey
.
reset
())
...
...
@@ -121,7 +121,7 @@ public class Basic {
Files
.
delete
(
file
);
takeExpectedKey
(
watcher
,
myKey
);
checkExpectedEvent
(
myKey
.
pollEvents
(),
StandardWatchEventKind
.
ENTRY_DELETE
,
name
);
StandardWatchEventKind
s
.
ENTRY_DELETE
,
name
);
System
.
out
.
println
(
"reset key"
);
if
(!
myKey
.
reset
())
...
...
@@ -149,7 +149,7 @@ public class Basic {
// remove key and check that we got the ENTRY_MODIFY event
takeExpectedKey
(
watcher
,
myKey
);
checkExpectedEvent
(
myKey
.
pollEvents
(),
StandardWatchEventKind
.
ENTRY_MODIFY
,
name
);
StandardWatchEventKind
s
.
ENTRY_MODIFY
,
name
);
System
.
out
.
println
(
"OKAY"
);
// done
...
...
@@ -424,7 +424,7 @@ public class Basic {
// check that key1 got ENTRY_CREATE
takeExpectedKey
(
watcher1
,
key1
);
checkExpectedEvent
(
key1
.
pollEvents
(),
StandardWatchEventKind
.
ENTRY_CREATE
,
name2
);
StandardWatchEventKind
s
.
ENTRY_CREATE
,
name2
);
// check that key2 got zero events
WatchKey
key
=
watcher2
.
poll
();
...
...
@@ -437,7 +437,7 @@ public class Basic {
// check that key2 got ENTRY_DELETE
takeExpectedKey
(
watcher2
,
key2
);
checkExpectedEvent
(
key2
.
pollEvents
(),
StandardWatchEventKind
.
ENTRY_DELETE
,
name1
);
StandardWatchEventKind
s
.
ENTRY_DELETE
,
name1
);
// check that key1 got zero events
key
=
watcher1
.
poll
();
...
...
@@ -458,7 +458,7 @@ public class Basic {
Files
.
createFile
(
file1
);
takeExpectedKey
(
watcher2
,
key2
);
checkExpectedEvent
(
key2
.
pollEvents
(),
StandardWatchEventKind
.
ENTRY_CREATE
,
name1
);
StandardWatchEventKind
s
.
ENTRY_CREATE
,
name1
);
System
.
out
.
println
(
"OKAY"
);
...
...
test/java/nio/file/WatchService/FileTreeModifier.java
浏览文件 @
f9c0499e
...
...
@@ -28,7 +28,7 @@
*/
import
java.nio.file.*
;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
.*;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
s
.*;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.*
;
...
...
test/java/nio/file/WatchService/LotsOfEvents.java
浏览文件 @
f9c0499e
...
...
@@ -29,7 +29,7 @@
*/
import
java.nio.file.*
;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
.*;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
s
.*;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.*
;
...
...
test/java/nio/file/WatchService/SensitivityModifier.java
浏览文件 @
f9c0499e
...
...
@@ -29,7 +29,7 @@
*/
import
java.nio.file.*
;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
.*;
import
static
java
.
nio
.
file
.
StandardWatchEventKind
s
.*;
import
java.io.OutputStream
;
import
java.io.IOException
;
import
java.util.Random
;
...
...
test/java/nio/file/WatchService/WithSecurityManager.java
浏览文件 @
f9c0499e
...
...
@@ -66,7 +66,7 @@ public class WithSecurityManager {
// attempt to register directory
try
{
dir
.
register
(
dir
.
getFileSystem
().
newWatchService
(),
new
WatchEvent
.
Kind
<?>[]{
StandardWatchEventKind
.
ENTRY_CREATE
},
new
WatchEvent
.
Kind
<?>[]{
StandardWatchEventKind
s
.
ENTRY_CREATE
},
modifiers
);
if
(
expectedToFail
)
throw
new
RuntimeException
(
"SecurityException not thrown"
);
...
...
test/java/text/Bidi/Bug7041232.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7041232
* @summary verify that an unexpected exception isn't thrown for unnatural data to keep backward compatibility with JDK 6.
*/
import
java.text.*
;
public
class
Bug7041232
{
public
static
void
main
(
String
[]
args
)
{
String
UnicodeChars
;
StringBuffer
sb
=
new
StringBuffer
();
// Generates String which includes U+2028(line separator) and
// U+2029(paragraph separator)
for
(
int
i
=
0x2000
;
i
<
0x2100
;
i
++)
{
sb
.
append
((
char
)
i
);
}
UnicodeChars
=
sb
.
toString
();
Bidi
bidi
=
new
Bidi
(
UnicodeChars
,
Bidi
.
DIRECTION_DEFAULT_LEFT_TO_RIGHT
);
bidi
.
createLineBidi
(
0
,
UnicodeChars
.
length
());
}
}
test/java/util/logging/LoggingDeadlock3.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6487638 7041595
* @summary Calling LogManager.addLogger() and Logger.getLogger() cause deadlock
* @author Serguei Spitsyn
* @build LoggingDeadlock3
* @run main/timeout=15 LoggingDeadlock3
*/
import
java.io.*
;
import
java.util.logging.LogManager
;
import
java.util.logging.Logger
;
public
class
LoggingDeadlock3
{
static
final
int
ITER_CNT
=
50000
;
static
final
String
MSG_PASSED
=
"LoggingDeadlock3: passed"
;
static
final
LogManager
logMgr
=
LogManager
.
getLogManager
();
static
final
PrintStream
out
=
System
.
out
;
public
static
void
main
(
String
args
[])
throws
Exception
{
String
tstSrc
=
System
.
getProperty
(
"test.src"
);
File
fname
=
new
File
(
tstSrc
,
"LoggingDeadlock3.props"
);
String
prop
=
fname
.
getCanonicalPath
();
System
.
setProperty
(
"java.util.logging.config.file"
,
prop
);
logMgr
.
readConfiguration
();
Thread
t1
=
new
Thread
(
new
AddLogger
());
Thread
t2
=
new
Thread
(
new
GetLogger
());
t1
.
start
();
t2
.
start
();
t1
.
join
();
t2
.
join
();
out
.
println
(
"\n"
+
MSG_PASSED
);
}
public
static
class
MyLogger
extends
Logger
{
protected
MyLogger
(
String
name
)
{
super
(
name
,
null
);
}
}
public
static
class
GetLogger
implements
Runnable
{
public
void
run
()
{
for
(
int
cnt
=
0
;
cnt
<
ITER_CNT
*
8
;
cnt
++)
{
Logger
logger
=
Logger
.
getLogger
(
"com.sun.Hello"
+
cnt
/
10
);
if
(
cnt
%
1000
==
0
)
out
.
print
(
"1"
);
if
(
cnt
%
10000
==
0
)
out
.
println
();
}
}
}
public
static
class
AddLogger
implements
Runnable
{
public
void
run
()
{
for
(
int
cnt
=
0
;
cnt
<
ITER_CNT
;
cnt
++)
{
Logger
addLogger
=
new
MyLogger
(
"com.sun.Hello"
+
cnt
);
logMgr
.
addLogger
(
addLogger
);
if
(
cnt
%
100
==
0
)
out
.
print
(
"2"
);
if
(
cnt
%
1000
==
0
)
out
.
println
();
}
}
}
}
test/java/util/logging/LoggingDeadlock3.props
0 → 100644
浏览文件 @
f9c0499e
com.sun.LEVEL=FINE
com.sun.level=FINE
com.sun.Hello.level=INFO
test/java/util/logging/LoggingDeadlock4.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6977677
* @summary Deadlock between LogManager.<clinit> and Logger.getLogger()
* @author Daniel D. Daugherty
* @build LoggingDeadlock4
* @run main/timeout=15 LoggingDeadlock4
*/
import
java.awt.Container
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.logging.LogManager
;
import
java.util.logging.Logger
;
public
class
LoggingDeadlock4
{
private
static
CountDownLatch
barrier
=
new
CountDownLatch
(
1
);
private
static
CountDownLatch
lmIsRunning
=
new
CountDownLatch
(
1
);
private
static
CountDownLatch
logIsRunning
=
new
CountDownLatch
(
1
);
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
"main: LoggingDeadlock4 is starting."
);
// Loading the java.awt.Container class will create a
// sun.util.logging.PlatformLogger$JavaLogger object
// that has to be redirected when the LogManager class
// is initialized. This can cause a deadlock between
// LogManager.<clinit> and Logger.getLogger().
try
{
Class
.
forName
(
"java.awt.Container"
);
}
catch
(
ClassNotFoundException
cnfe
)
{
throw
new
RuntimeException
(
"Test failed: could not load"
+
" java.awt.Container."
+
cnfe
);
}
Thread
lmThread
=
new
Thread
(
"LogManagerThread"
)
{
public
void
run
()
{
// let main know LogManagerThread is running
lmIsRunning
.
countDown
();
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
": is running."
);
try
{
barrier
.
await
();
// wait for race to start
}
catch
(
InterruptedException
e
)
{
}
LogManager
manager
=
LogManager
.
getLogManager
();
}
};
lmThread
.
start
();
Thread
logThread
=
new
Thread
(
"LoggerThread"
)
{
public
void
run
()
{
// let main know LoggerThread is running
logIsRunning
.
countDown
();
System
.
out
.
println
(
Thread
.
currentThread
().
getName
()
+
": is running."
);
try
{
barrier
.
await
();
// wait for race to start
}
catch
(
InterruptedException
e
)
{
}
Logger
foo
=
Logger
.
getLogger
(
"foo logger"
);
}
};
logThread
.
start
();
try
{
// wait for LogManagerThread and LoggerThread to get going
lmIsRunning
.
await
();
logIsRunning
.
await
();
}
catch
(
InterruptedException
e
)
{
}
barrier
.
countDown
();
// start the race
try
{
lmThread
.
join
();
logThread
.
join
();
}
catch
(
InterruptedException
ie
)
{
}
System
.
out
.
println
(
"main: LoggingDeadlock4 is done."
);
}
}
test/javax/management/timer/StartTest.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6659215
* @summary Test on timer start method with past notifications
* @author Shanliang JIANG
* @run clean StartTest
* @run build StartTest
* @run main StartTest
*/
import
java.util.Date
;
import
javax.management.timer.Timer
;
import
javax.management.Notification
;
import
javax.management.NotificationListener
;
public
class
StartTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
System
.
out
.
println
(
">>> Test on timer start method with past notifications."
);
System
.
out
.
println
(
">>> Create a Timer object."
);
Timer
timer
=
new
Timer
();
System
.
out
.
println
(
">>> Set the flag (setSendPastNotification) to true."
);
timer
.
setSendPastNotifications
(
true
);
timer
.
addNotificationListener
(
myListener
,
null
,
null
);
System
.
out
.
println
(
">>> Add notifications: "
+
SENT
);
Date
date
=
new
Date
();
for
(
int
i
=
0
;
i
<
SENT
;
i
++)
{
timer
.
addNotification
(
"testType"
+
i
,
"testMsg"
+
i
,
"testData"
+
i
,
date
);
}
System
.
out
.
println
(
">>> The notifications should be sent at "
+
date
);
System
.
out
.
println
(
">>> Sleep 100 ms to have past notifications."
);
Thread
.
sleep
(
100
);
System
.
out
.
println
(
">>> Start the timer at "
+
new
Date
());
timer
.
start
();
System
.
out
.
println
(
">>> Stop the timer."
);
Thread
.
sleep
(
100
);
stopping
=
true
;
timer
.
stop
();
if
(
received
!=
SENT
)
{
throw
new
RuntimeException
(
"Expected to receive "
+
SENT
+
" but got "
+
received
);
}
System
.
out
.
println
(
">>> Received all expected notifications."
);
System
.
out
.
println
(
">>> Bye bye!"
);
}
private
static
NotificationListener
myListener
=
new
NotificationListener
()
{
public
void
handleNotification
(
Notification
n
,
Object
hb
)
{
if
(!
stopping
)
{
received
++;
System
.
out
.
println
(
">>> myListener-handleNotification: received "
+
n
.
getSequenceNumber
());
}
}
};
private
static
int
SENT
=
10
;
private
static
volatile
int
received
=
0
;
private
static
volatile
boolean
stopping
=
false
;
}
test/javax/swing/JComboBox/7031551/bug7031551.java
0 → 100644
浏览文件 @
f9c0499e
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 7031551
* @summary Generics: JComboBox
* @author Pavel Porvatov
*/
import
javax.swing.*
;
import
java.util.Vector
;
public
class
bug7031551
{
private
static
final
String
TEST_ELEMENT1
=
"Test1"
;
private
static
final
String
TEST_ELEMENT2
=
"Test2"
;
private
static
final
String
TEST_ELEMENT3
=
"Test3"
;
/**
* @param args the command line arguments
*/
@SuppressWarnings
(
"unchecked"
)
public
static
void
main
(
String
[]
args
)
{
testRawSignatures
();
testGenericSignatures
();
}
@SuppressWarnings
(
"unchecked"
)
private
static
void
testRawSignatures
()
{
// Test JComboBox
ComboBoxModel
rawTestModel
=
new
DefaultComboBoxModel
();
JComboBox
rawTestComboBox
=
new
JComboBox
();
rawTestComboBox
=
new
JComboBox
(
rawTestModel
);
rawTestComboBox
=
new
JComboBox
(
new
Object
[]{
TEST_ELEMENT1
});
rawTestComboBox
=
new
JComboBox
(
new
Vector
());
Object
unused1
=
rawTestComboBox
.
getPrototypeDisplayValue
();
rawTestComboBox
.
setPrototypeDisplayValue
(
TEST_ELEMENT1
);
ListCellRenderer
unused2
=
rawTestComboBox
.
getRenderer
();
rawTestComboBox
.
setRenderer
(
new
DefaultListCellRenderer
());
ComboBoxModel
unused3
=
rawTestComboBox
.
getModel
();
rawTestComboBox
.
setModel
(
rawTestModel
);
rawTestComboBox
.
addItem
(
TEST_ELEMENT2
);
rawTestComboBox
.
insertItemAt
(
TEST_ELEMENT3
,
1
);
rawTestComboBox
.
removeItem
(
TEST_ELEMENT2
);
assertEquals
(
rawTestComboBox
.
getItemAt
(
0
),
TEST_ELEMENT3
);
rawTestComboBox
.
removeAllItems
();
// Test DefaultComboBoxModel
DefaultComboBoxModel
testModel
=
new
DefaultComboBoxModel
();
testModel
=
new
DefaultComboBoxModel
(
new
Vector
());
testModel
=
new
DefaultComboBoxModel
(
new
Object
[]{
TEST_ELEMENT1
});
testModel
.
addElement
(
TEST_ELEMENT2
);
testModel
.
insertElementAt
(
TEST_ELEMENT3
,
1
);
assertEquals
(
testModel
.
getElementAt
(
2
),
TEST_ELEMENT2
);
}
private
static
void
testGenericSignatures
()
{
// Test JComboBox
ComboBoxModel
<
String
>
stringTestModel
=
new
DefaultComboBoxModel
<
String
>();
JComboBox
<
String
>
stringTestComboBox
=
new
JComboBox
<
String
>();
stringTestComboBox
=
new
JComboBox
<
String
>(
stringTestModel
);
stringTestComboBox
=
new
JComboBox
<
String
>(
new
String
[]{
TEST_ELEMENT1
});
stringTestComboBox
=
new
JComboBox
<
String
>(
new
Vector
<
String
>());
String
unused1
=
stringTestComboBox
.
getPrototypeDisplayValue
();
stringTestComboBox
.
setPrototypeDisplayValue
(
TEST_ELEMENT1
);
ListCellRenderer
<?
super
String
>
unused2
=
stringTestComboBox
.
getRenderer
();
stringTestComboBox
.
setRenderer
(
new
DefaultListCellRenderer
());
ComboBoxModel
unused3
=
stringTestComboBox
.
getModel
();
stringTestComboBox
.
setModel
(
stringTestModel
);
stringTestComboBox
.
addItem
(
TEST_ELEMENT2
);
stringTestComboBox
.
insertItemAt
(
TEST_ELEMENT3
,
1
);
stringTestComboBox
.
removeItem
(
TEST_ELEMENT2
);
assertEquals
(
stringTestComboBox
.
getItemAt
(
0
),
TEST_ELEMENT3
);
stringTestComboBox
.
removeAllItems
();
// Test DefaultComboBoxModel
DefaultComboBoxModel
<
String
>
testModel
=
new
DefaultComboBoxModel
<
String
>();
testModel
=
new
DefaultComboBoxModel
<
String
>(
new
Vector
<
String
>());
testModel
=
new
DefaultComboBoxModel
<
String
>(
new
String
[]{
TEST_ELEMENT1
});
testModel
.
addElement
(
TEST_ELEMENT2
);
testModel
.
insertElementAt
(
TEST_ELEMENT3
,
1
);
assertEquals
(
testModel
.
getElementAt
(
2
),
TEST_ELEMENT2
);
}
private
static
void
assertEquals
(
Object
expectedObject
,
Object
actualObject
)
{
if
(!
expectedObject
.
equals
(
actualObject
))
{
throw
new
RuntimeException
(
"Expected: "
+
expectedObject
+
" but was: "
+
actualObject
);
}
}
}
test/javax/swing/JTable/6788484/bug6788484.java
浏览文件 @
f9c0499e
/*
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010,
2011
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -24,9 +24,17 @@
/* @test
@bug 6788484
@summary NPE in DefaultTableCellHeaderRenderer.getColumnSortOrder() with null table
@compile -XDignore.symbol.file=true bug6788484.java
@author Alexander Potochkin
@run main bug6788484
*/
/*
* Compile with -XDignore.symbol.file=true option as a workaround for
* specific behaviour described in 6380059 which restricts proprietary
* package loading
*/
import
sun.swing.table.DefaultTableCellHeaderRenderer
;
import
javax.swing.*
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录