Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e7c760fe
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看板
提交
e7c760fe
编写于
3月 05, 2014
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
317b9677
7ea73c94
变更
45
隐藏空白更改
内联
并排
Showing
45 changed file
with
932 addition
and
223 deletion
+932
-223
make/mapfiles/libjava/mapfile-vers
make/mapfiles/libjava/mapfile-vers
+3
-3
make/mapfiles/libjfr/mapfile-vers
make/mapfiles/libjfr/mapfile-vers
+1
-0
src/macosx/classes/com/apple/laf/AquaImageFactory.java
src/macosx/classes/com/apple/laf/AquaImageFactory.java
+20
-3
src/macosx/classes/com/apple/laf/AquaUtils.java
src/macosx/classes/com/apple/laf/AquaUtils.java
+8
-0
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+11
-2
src/macosx/native/sun/awt/CDataTransferer.m
src/macosx/native/sun/awt/CDataTransferer.m
+8
-4
src/macosx/native/sun/awt/LWCToolkit.m
src/macosx/native/sun/awt/LWCToolkit.m
+12
-3
src/share/classes/java/io/FileInputStream.java
src/share/classes/java/io/FileInputStream.java
+14
-2
src/share/classes/java/io/FileOutputStream.java
src/share/classes/java/io/FileOutputStream.java
+9
-1
src/share/classes/java/io/RandomAccessFile.java
src/share/classes/java/io/RandomAccessFile.java
+18
-3
src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
...e/classes/sun/awt/image/MultiResolutionBufferedImage.java
+71
-0
src/share/classes/sun/nio/ch/FileChannelImpl.java
src/share/classes/sun/nio/ch/FileChannelImpl.java
+23
-8
src/share/classes/sun/nio/ch/NativeThreadSet.java
src/share/classes/sun/nio/ch/NativeThreadSet.java
+11
-11
src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
...classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
+0
-1
src/share/instrument/Reentrancy.c
src/share/instrument/Reentrancy.c
+2
-0
src/share/native/com/sun/java/util/jar/pack/coding.cpp
src/share/native/com/sun/java/util/jar/pack/coding.cpp
+3
-1
src/share/native/com/sun/java/util/jar/pack/defines.h
src/share/native/com/sun/java/util/jar/pack/defines.h
+0
-4
src/share/native/common/jni_util.h
src/share/native/common/jni_util.h
+16
-1
src/share/native/java/io/FileInputStream.c
src/share/native/java/io/FileInputStream.c
+1
-1
src/share/native/java/io/RandomAccessFile.c
src/share/native/java/io/RandomAccessFile.c
+2
-2
src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
...asses/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
+2
-2
src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
+3
-3
src/solaris/native/java/net/PlainDatagramSocketImpl.c
src/solaris/native/java/net/PlainDatagramSocketImpl.c
+14
-6
src/solaris/native/java/net/PlainSocketImpl.c
src/solaris/native/java/net/PlainSocketImpl.c
+2
-1
src/solaris/native/java/net/SocketInputStream.c
src/solaris/native/java/net/SocketInputStream.c
+2
-0
src/solaris/native/java/net/bsd_close.c
src/solaris/native/java/net/bsd_close.c
+23
-6
src/solaris/native/java/net/linux_close.c
src/solaris/native/java/net/linux_close.c
+0
-1
src/solaris/native/sun/awt/gtk2_interface.c
src/solaris/native/sun/awt/gtk2_interface.c
+7
-0
src/solaris/native/sun/nio/ch/NativeThread.c
src/solaris/native/sun/nio/ch/NativeThread.c
+26
-19
src/windows/classes/sun/nio/fs/WindowsChannelFactory.java
src/windows/classes/sun/nio/fs/WindowsChannelFactory.java
+9
-6
test/ProblemList.txt
test/ProblemList.txt
+0
-5
test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
...SetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
+103
-0
test/java/lang/instrument/DaemonThread/DummyAgent.java
test/java/lang/instrument/DaemonThread/DummyAgent.java
+46
-0
test/java/lang/instrument/DaemonThread/DummyClass.java
test/java/lang/instrument/DaemonThread/DummyClass.java
+27
-0
test/java/lang/instrument/DaemonThread/TestDaemonThread.java
test/java/lang/instrument/DaemonThread/TestDaemonThread.java
+72
-0
test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java
...ang/instrument/DaemonThread/TestDaemonThreadLauncher.java
+44
-0
test/java/net/ServerSocket/AnotherSelectFdsLimit.java
test/java/net/ServerSocket/AnotherSelectFdsLimit.java
+78
-0
test/java/nio/channels/Selector/ByteServer.java
test/java/nio/channels/Selector/ByteServer.java
+35
-33
test/java/nio/channels/Selector/ReadAfterConnect.java
test/java/nio/channels/Selector/ReadAfterConnect.java
+16
-18
test/java/nio/channels/Selector/SelectAfterRead.java
test/java/nio/channels/Selector/SelectAfterRead.java
+47
-45
test/java/nio/channels/Selector/SelectWrite.java
test/java/nio/channels/Selector/SelectWrite.java
+20
-23
test/javax/swing/JMenuItem/8031573/bug8031573.html
test/javax/swing/JMenuItem/8031573/bug8031573.html
+40
-0
test/javax/swing/JMenuItem/8031573/bug8031573.java
test/javax/swing/JMenuItem/8031573/bug8031573.java
+60
-0
test/javax/xml/jaxp/transform/8004476/TestBase.java
test/javax/xml/jaxp/transform/8004476/TestBase.java
+20
-1
test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
...n/management/jmxremote/bootstrap/LocalManagementTest.java
+3
-4
未找到文件。
make/mapfiles/libjava/mapfile-vers
浏览文件 @
e7c760fe
...
...
@@ -79,7 +79,7 @@ SUNWprivate_1.1 {
Java_java_io_FileInputStream_close0;
Java_java_io_FileInputStream_initIDs;
Java_java_io_FileInputStream_open;
Java_java_io_FileInputStream_read;
Java_java_io_FileInputStream_read
0
;
Java_java_io_FileInputStream_readBytes;
Java_java_io_FileInputStream_skip;
Java_java_io_FileOutputStream_close0;
...
...
@@ -98,11 +98,11 @@ SUNWprivate_1.1 {
Java_java_io_RandomAccessFile_initIDs;
Java_java_io_RandomAccessFile_length;
Java_java_io_RandomAccessFile_open;
Java_java_io_RandomAccessFile_read;
Java_java_io_RandomAccessFile_read
0
;
Java_java_io_RandomAccessFile_readBytes;
Java_java_io_RandomAccessFile_seek0;
Java_java_io_RandomAccessFile_setLength;
Java_java_io_RandomAccessFile_write;
Java_java_io_RandomAccessFile_write
0
;
Java_java_io_RandomAccessFile_writeBytes;
Java_java_io_UnixFileSystem_canonicalize0;
Java_java_io_UnixFileSystem_checkAccess;
...
...
make/mapfiles/libjfr/mapfile-vers
浏览文件 @
e7c760fe
...
...
@@ -34,6 +34,7 @@ SUNWprivate_1.1 {
Java_oracle_jrockit_jfr_VMJFR_getPeriod;
Java_oracle_jrockit_jfr_VMJFR_descriptors;
Java_oracle_jrockit_jfr_VMJFR_redefineClass0;
Java_oracle_jrockit_jfr_VMJFR_retransformClasses0;
JNI_OnLoad;
local:
*;
...
...
src/macosx/classes/com/apple/laf/AquaImageFactory.java
浏览文件 @
e7c760fe
...
...
@@ -48,6 +48,7 @@ import com.apple.laf.AquaUtils.RecyclableObject;
import
com.apple.laf.AquaUtils.RecyclableSingleton
;
import
java.util.Arrays
;
import
java.util.List
;
import
sun.awt.image.MultiResolutionBufferedImage
;
import
sun.awt.image.MultiResolutionImage
;
public
class
AquaImageFactory
{
...
...
@@ -230,7 +231,7 @@ public class AquaImageFactory {
@Override
protected
Image
getInstance
()
{
return
Toolkit
.
getDefaultToolkit
().
getImage
(
"NSImage://"
+
namedImage
);
return
getNSIcon
(
namedImage
);
}
}
...
...
@@ -294,11 +295,27 @@ public class AquaImageFactory {
}
public
static
Icon
getMenuItemCheckIcon
()
{
return
new
InvertableImageIcon
(
AquaUtils
.
generateLightenedImage
(
Toolkit
.
getDefaultToolkit
().
getImage
(
"NSImage://NSMenuItemSelection"
),
25
));
return
new
InvertableImageIcon
(
AquaUtils
.
generateLightenedImage
(
getNSIcon
(
"NSMenuItemSelection"
),
25
));
}
public
static
Icon
getMenuItemDashIcon
()
{
return
new
InvertableImageIcon
(
AquaUtils
.
generateLightenedImage
(
Toolkit
.
getDefaultToolkit
().
getImage
(
"NSImage://NSMenuMixedState"
),
25
));
return
new
InvertableImageIcon
(
AquaUtils
.
generateLightenedImage
(
getNSIcon
(
"NSMenuMixedState"
),
25
));
}
private
static
Image
getNSIcon
(
String
imageName
)
{
Image
icon
=
Toolkit
.
getDefaultToolkit
()
.
getImage
(
"NSImage://"
+
imageName
);
if
(
icon
instanceof
MultiResolutionImage
)
{
return
icon
;
}
Image
icon2x
=
AquaUtils
.
getCImageCreator
().
createImageFromName
(
imageName
,
2
*
icon
.
getWidth
(
null
),
2
*
icon
.
getHeight
(
null
));
return
new
MultiResolutionBufferedImage
(
BufferedImage
.
TYPE_INT_ARGB_PRE
,
0
,
icon
,
icon2x
);
}
public
static
class
NineSliceMetrics
{
...
...
src/macosx/classes/com/apple/laf/AquaUtils.java
浏览文件 @
e7c760fe
...
...
@@ -48,6 +48,7 @@ import sun.security.action.GetPropertyAction;
import
sun.swing.SwingUtilities2
;
import
com.apple.laf.AquaImageFactory.SlicedImageControl
;
import
sun.awt.image.MultiResolutionBufferedImage
;
final
class
AquaUtils
{
...
...
@@ -123,6 +124,13 @@ final class AquaUtils {
static
Image
generateLightenedImage
(
final
Image
image
,
final
int
percent
)
{
final
GrayFilter
filter
=
new
GrayFilter
(
true
,
percent
);
return
(
image
instanceof
MultiResolutionBufferedImage
)
?
((
MultiResolutionBufferedImage
)
image
).
map
(
rv
->
generateLightenedImage
(
rv
,
filter
))
:
generateLightenedImage
(
image
,
filter
);
}
static
Image
generateLightenedImage
(
Image
image
,
ImageFilter
filter
)
{
final
ImageProducer
prod
=
new
FilteredImageSource
(
image
.
getSource
(),
filter
);
return
Toolkit
.
getDefaultToolkit
().
createImage
(
prod
);
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
e7c760fe
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -583,7 +583,12 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
// setVisible could have changed the native maximized state
deliverZoom
(
true
);
}
else
{
switch
(((
Frame
)
target
).
getExtendedState
())
{
int
frameState
=
((
Frame
)
target
).
getExtendedState
();
if
((
frameState
&
Frame
.
ICONIFIED
)
!=
0
)
{
// Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
frameState
=
Frame
.
ICONIFIED
;
}
switch
(
frameState
)
{
case
Frame
.
ICONIFIED
:
CWrapper
.
NSWindow
.
miniaturize
(
nsWindowPtr
);
break
;
...
...
@@ -788,6 +793,10 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
if
(
prevWindowState
==
windowState
)
return
;
final
long
nsWindowPtr
=
getNSWindowPtr
();
if
((
windowState
&
Frame
.
ICONIFIED
)
!=
0
)
{
// Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
windowState
=
Frame
.
ICONIFIED
;
}
switch
(
windowState
)
{
case
Frame
.
ICONIFIED
:
if
(
prevWindowState
==
Frame
.
MAXIMIZED_BOTH
)
{
...
...
src/macosx/native/sun/awt/CDataTransferer.m
浏览文件 @
e7c760fe
...
...
@@ -28,6 +28,7 @@
#import <AppKit/AppKit.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
#import "jni_util.h"
#include "ThreadUtilities.h"
...
...
@@ -172,7 +173,9 @@ JNF_COCOA_ENTER(env);
NSData
*
tiffImage
=
[
imageRep
TIFFRepresentation
];
jsize
tiffSize
=
(
jsize
)[
tiffImage
length
];
// #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
returnValue
=
(
*
env
)
->
NewByteArray
(
env
,
tiffSize
);
CHECK_NULL_RETURN
(
returnValue
,
nil
);
jbyte
*
tiffData
=
(
jbyte
*
)(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
returnValue
,
0
);
CHECK_NULL_RETURN
(
tiffData
,
nil
);
[
tiffImage
getBytes
:
tiffData
];
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
returnValue
,
tiffData
,
0
);
// Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
[
imageRep
release
];
...
...
@@ -184,12 +187,13 @@ JNF_COCOA_EXIT(env);
static
jobject
getImageForByteStream
(
JNIEnv
*
env
,
jbyteArray
sourceData
)
{
if
(
sourceData
==
NULL
)
return
NULL
;
CHECK_NULL_RETURN
(
sourceData
,
NULL
)
;
jsize
sourceSize
=
(
*
env
)
->
GetArrayLength
(
env
,
sourceData
);
if
(
sourceSize
==
0
)
return
NULL
;
jbyte
*
sourceBytes
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
sourceData
,
NULL
);
CHECK_NULL_RETURN
(
sourceBytes
,
NULL
);
NSData
*
rawData
=
[
NSData
dataWithBytes
:
sourceBytes
length
:
sourceSize
];
NSImage
*
newImage
=
[[
NSImage
alloc
]
initWithData
:
rawData
];
...
...
@@ -197,8 +201,7 @@ static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
[
newImage
release
];
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
sourceData
,
sourceBytes
,
JNI_ABORT
);
if
(
newImage
==
nil
)
return
NULL
;
CHECK_NULL_RETURN
(
newImage
,
NULL
);
// The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
static
JNF_CLASS_CACHE
(
jc_CImage
,
"sun/lwawt/macosx/CImage"
);
...
...
@@ -231,7 +234,8 @@ static jobjectArray CreateJavaFilenameArray(JNIEnv *env, NSArray *filenameArray)
if
(
filenameCount
==
0
)
return
nil
;
// Get the java.lang.String class object:
jclass
stringClazz
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
);
// can't be null
jclass
stringClazz
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
);
CHECK_NULL_RETURN
(
stringClazz
,
nil
);
jobject
jfilenameArray
=
(
*
env
)
->
NewObjectArray
(
env
,
filenameCount
,
stringClazz
,
NULL
);
// AWT_THREADING Safe (known object)
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
(
*
env
)
->
ExceptionDescribe
(
env
);
...
...
src/macosx/native/sun/awt/LWCToolkit.m
浏览文件 @
e7c760fe
...
...
@@ -200,13 +200,17 @@ Java_sun_lwawt_macosx_LWCToolkit_initIDs
gNumberOfButtons
=
sun_lwawt_macosx_LWCToolkit_BUTTONS
;
jclass
inputEventClazz
=
(
*
env
)
->
FindClass
(
env
,
"java/awt/event/InputEvent"
);
CHECK_NULL
(
inputEventClazz
);
jmethodID
getButtonDownMasksID
=
(
*
env
)
->
GetStaticMethodID
(
env
,
inputEventClazz
,
"getButtonDownMasks"
,
"()[I"
);
CHECK_NULL
(
getButtonDownMasksID
);
jintArray
obj
=
(
jintArray
)(
*
env
)
->
CallStaticObjectMethod
(
env
,
inputEventClazz
,
getButtonDownMasksID
);
jint
*
tmp
=
(
*
env
)
->
GetIntArrayElements
(
env
,
obj
,
JNI_FALSE
);
CHECK_NULL
(
tmp
);
gButtonDownMasks
=
(
jint
*
)
SAFE_SIZE_ARRAY_ALLOC
(
malloc
,
sizeof
(
jint
),
gNumberOfButtons
);
if
(
gButtonDownMasks
==
NULL
)
{
gNumberOfButtons
=
0
;
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
obj
,
tmp
,
JNI_ABORT
);
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
;
}
...
...
@@ -240,7 +244,7 @@ static UInt32 RGB(NSColor *c) {
return
((
ia
&
0xFF
)
<<
24
)
|
((
ir
&
0xFF
)
<<
16
)
|
((
ig
&
0xFF
)
<<
8
)
|
((
ib
&
0xFF
)
<<
0
);
}
void
doLoadNativeColors
(
JNIEnv
*
env
,
jintArray
jColors
,
BOOL
useAppleColors
)
{
BOOL
doLoadNativeColors
(
JNIEnv
*
env
,
jintArray
jColors
,
BOOL
useAppleColors
)
{
jint
len
=
(
*
env
)
->
GetArrayLength
(
env
,
jColors
);
UInt32
colorsArray
[
len
];
...
...
@@ -254,8 +258,12 @@ void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
}];
jint
*
_colors
=
(
*
env
)
->
GetPrimitiveArrayCritical
(
env
,
jColors
,
0
);
if
(
_colors
==
NULL
)
{
return
NO
;
}
memcpy
(
_colors
,
colors
,
len
*
sizeof
(
UInt32
));
(
*
env
)
->
ReleasePrimitiveArrayCritical
(
env
,
jColors
,
_colors
,
0
);
return
YES
;
}
/**
...
...
@@ -267,8 +275,9 @@ JNIEXPORT void JNICALL Java_sun_lwawt_macosx_LWCToolkit_loadNativeColors
(
JNIEnv
*
env
,
jobject
peer
,
jintArray
jSystemColors
,
jintArray
jAppleColors
)
{
JNF_COCOA_ENTER
(
env
);
doLoadNativeColors
(
env
,
jSystemColors
,
NO
);
doLoadNativeColors
(
env
,
jAppleColors
,
YES
);
if
(
doLoadNativeColors
(
env
,
jSystemColors
,
NO
))
{
doLoadNativeColors
(
env
,
jAppleColors
,
YES
);
}
JNF_COCOA_EXIT
(
env
);
}
...
...
src/share/classes/java/io/FileInputStream.java
浏览文件 @
e7c760fe
...
...
@@ -51,6 +51,12 @@ class FileInputStream extends InputStream
/* File Descriptor - handle to the open file */
private
final
FileDescriptor
fd
;
/**
* The path of the referenced file
* (null if the stream is created with a file descriptor)
*/
private
final
String
path
;
private
FileChannel
channel
=
null
;
private
final
Object
closeLock
=
new
Object
();
...
...
@@ -128,6 +134,7 @@ class FileInputStream extends InputStream
}
fd
=
new
FileDescriptor
();
fd
.
attach
(
this
);
path
=
name
;
open
(
name
);
}
...
...
@@ -164,6 +171,7 @@ class FileInputStream extends InputStream
security
.
checkRead
(
fdObj
);
}
fd
=
fdObj
;
path
=
null
;
/*
* FileDescriptor is being shared by streams.
...
...
@@ -186,7 +194,11 @@ class FileInputStream extends InputStream
* file is reached.
* @exception IOException if an I/O error occurs.
*/
public
native
int
read
()
throws
IOException
;
public
int
read
()
throws
IOException
{
return
read0
();
}
private
native
int
read0
()
throws
IOException
;
/**
* Reads a subarray as a sequence of bytes.
...
...
@@ -345,7 +357,7 @@ class FileInputStream extends InputStream
public
FileChannel
getChannel
()
{
synchronized
(
this
)
{
if
(
channel
==
null
)
{
channel
=
FileChannelImpl
.
open
(
fd
,
true
,
false
,
this
);
channel
=
FileChannelImpl
.
open
(
fd
,
path
,
true
,
false
,
this
);
}
return
channel
;
}
...
...
src/share/classes/java/io/FileOutputStream.java
浏览文件 @
e7c760fe
...
...
@@ -67,6 +67,12 @@ class FileOutputStream extends OutputStream
*/
private
FileChannel
channel
;
/**
* The path of the referenced file
* (null if the stream is created with a file descriptor)
*/
private
final
String
path
;
private
final
Object
closeLock
=
new
Object
();
private
volatile
boolean
closed
=
false
;
...
...
@@ -202,6 +208,7 @@ class FileOutputStream extends OutputStream
this
.
fd
=
new
FileDescriptor
();
fd
.
attach
(
this
);
this
.
append
=
append
;
this
.
path
=
name
;
open
(
name
,
append
);
}
...
...
@@ -239,6 +246,7 @@ class FileOutputStream extends OutputStream
}
this
.
fd
=
fdObj
;
this
.
append
=
false
;
this
.
path
=
null
;
fd
.
attach
(
this
);
}
...
...
@@ -376,7 +384,7 @@ class FileOutputStream extends OutputStream
public
FileChannel
getChannel
()
{
synchronized
(
this
)
{
if
(
channel
==
null
)
{
channel
=
FileChannelImpl
.
open
(
fd
,
false
,
true
,
append
,
this
);
channel
=
FileChannelImpl
.
open
(
fd
,
path
,
false
,
true
,
append
,
this
);
}
return
channel
;
}
...
...
src/share/classes/java/io/RandomAccessFile.java
浏览文件 @
e7c760fe
...
...
@@ -62,6 +62,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
private
FileChannel
channel
=
null
;
private
boolean
rw
;
/**
* The path of the referenced file
* (null if the stream is created with a file descriptor)
*/
private
final
String
path
;
private
Object
closeLock
=
new
Object
();
private
volatile
boolean
closed
=
false
;
...
...
@@ -233,6 +239,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
}
fd
=
new
FileDescriptor
();
fd
.
attach
(
this
);
path
=
name
;
open
(
name
,
imode
);
}
...
...
@@ -272,7 +279,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
public
final
FileChannel
getChannel
()
{
synchronized
(
this
)
{
if
(
channel
==
null
)
{
channel
=
FileChannelImpl
.
open
(
fd
,
true
,
rw
,
this
);
channel
=
FileChannelImpl
.
open
(
fd
,
path
,
true
,
rw
,
this
);
}
return
channel
;
}
...
...
@@ -309,7 +316,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @exception IOException if an I/O error occurs. Not thrown if
* end-of-file has been reached.
*/
public
native
int
read
()
throws
IOException
;
public
int
read
()
throws
IOException
{
return
read0
();
}
private
native
int
read0
()
throws
IOException
;
/**
* Reads a sub array as a sequence of bytes.
...
...
@@ -457,7 +468,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable {
* @param b the {@code byte} to be written.
* @exception IOException if an I/O error occurs.
*/
public
native
void
write
(
int
b
)
throws
IOException
;
public
void
write
(
int
b
)
throws
IOException
{
write0
(
b
);
}
private
native
void
write0
(
int
b
)
throws
IOException
;
/**
* Writes a sub array as a sequence of bytes.
...
...
src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright (c) 2014, 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.awt.image
;
import
java.awt.Image
;
import
java.awt.Graphics
;
import
java.awt.image.BufferedImage
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.function.Function
;
public
class
MultiResolutionBufferedImage
extends
BufferedImage
implements
MultiResolutionImage
{
Image
[]
resolutionVariants
;
int
baseIndex
;
public
MultiResolutionBufferedImage
(
int
imageType
,
int
baseIndex
,
Image
...
images
)
{
super
(
images
[
baseIndex
].
getWidth
(
null
),
images
[
baseIndex
].
getHeight
(
null
),
imageType
);
this
.
baseIndex
=
baseIndex
;
this
.
resolutionVariants
=
images
;
Graphics
g
=
getGraphics
();
g
.
drawImage
(
images
[
baseIndex
],
0
,
0
,
null
);
g
.
dispose
();
images
[
baseIndex
]
=
this
;
}
@Override
public
Image
getResolutionVariant
(
int
width
,
int
height
)
{
for
(
Image
image
:
resolutionVariants
)
{
if
(
width
<=
image
.
getWidth
(
null
)
&&
height
<=
image
.
getHeight
(
null
))
{
return
image
;
}
}
return
this
;
}
@Override
public
List
<
Image
>
getResolutionVariants
()
{
return
Arrays
.
asList
(
resolutionVariants
);
}
public
MultiResolutionBufferedImage
map
(
Function
<
Image
,
Image
>
mapper
)
{
return
new
MultiResolutionBufferedImage
(
getType
(),
baseIndex
,
Arrays
.
stream
(
resolutionVariants
).
map
(
mapper
)
.
toArray
(
length
->
new
Image
[
length
]));
}
}
src/share/classes/sun/nio/ch/FileChannelImpl.java
浏览文件 @
e7c760fe
...
...
@@ -29,10 +29,20 @@ import java.io.FileDescriptor;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.channels.*
;
import
java.nio.channels.ClosedByInterruptException
;
import
java.nio.channels.ClosedChannelException
;
import
java.nio.channels.FileChannel
;
import
java.nio.channels.FileLock
;
import
java.nio.channels.FileLockInterruptionException
;
import
java.nio.channels.NonReadableChannelException
;
import
java.nio.channels.NonWritableChannelException
;
import
java.nio.channels.OverlappingFileLockException
;
import
java.nio.channels.ReadableByteChannel
;
import
java.nio.channels.WritableByteChannel
;
import
java.security.AccessController
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.security.AccessController
;
import
sun.misc.Cleaner
;
import
sun.security.action.GetPropertyAction
;
...
...
@@ -56,13 +66,17 @@ public class FileChannelImpl
// Required to prevent finalization of creating stream (immutable)
private
final
Object
parent
;
// The path of the referenced file
// (null if the parent stream is created with a file descriptor)
private
final
String
path
;
// Thread-safe set of IDs of native threads, for signalling
private
final
NativeThreadSet
threads
=
new
NativeThreadSet
(
2
);
// Lock for operations involving position and size
private
final
Object
positionLock
=
new
Object
();
private
FileChannelImpl
(
FileDescriptor
fd
,
boolean
readable
,
private
FileChannelImpl
(
FileDescriptor
fd
,
String
path
,
boolean
readable
,
boolean
writable
,
boolean
append
,
Object
parent
)
{
this
.
fd
=
fd
;
...
...
@@ -70,23 +84,24 @@ public class FileChannelImpl
this
.
writable
=
writable
;
this
.
append
=
append
;
this
.
parent
=
parent
;
this
.
path
=
path
;
this
.
nd
=
new
FileDispatcherImpl
(
append
);
}
// Used by FileInputStream.getChannel() and RandomAccessFile.getChannel()
public
static
FileChannel
open
(
FileDescriptor
fd
,
public
static
FileChannel
open
(
FileDescriptor
fd
,
String
path
,
boolean
readable
,
boolean
writable
,
Object
parent
)
{
return
new
FileChannelImpl
(
fd
,
readable
,
writable
,
false
,
parent
);
return
new
FileChannelImpl
(
fd
,
path
,
readable
,
writable
,
false
,
parent
);
}
// Used by FileOutputStream.getChannel
public
static
FileChannel
open
(
FileDescriptor
fd
,
public
static
FileChannel
open
(
FileDescriptor
fd
,
String
path
,
boolean
readable
,
boolean
writable
,
boolean
append
,
Object
parent
)
{
return
new
FileChannelImpl
(
fd
,
readable
,
writable
,
append
,
parent
);
return
new
FileChannelImpl
(
fd
,
path
,
readable
,
writable
,
append
,
parent
);
}
private
void
ensureOpen
()
throws
IOException
{
...
...
@@ -110,7 +125,7 @@ public class FileChannelImpl
}
}
nd
.
preClose
(
fd
);
// signal any threads blocked on this channel
threads
.
signalAndWait
();
if
(
parent
!=
null
)
{
...
...
src/share/classes/sun/nio/ch/NativeThreadSet.java
浏览文件 @
e7c760fe
...
...
@@ -82,8 +82,9 @@ class NativeThreadSet {
// Signals all threads in this set.
//
void
signalAndWait
()
{
synchronized
(
this
)
{
synchronized
void
signalAndWait
()
{
boolean
interrupted
=
false
;
while
(
used
>
0
)
{
int
u
=
used
;
int
n
=
elts
.
length
;
for
(
int
i
=
0
;
i
<
n
;
i
++)
{
...
...
@@ -96,16 +97,15 @@ class NativeThreadSet {
break
;
}
waitingToEmpty
=
true
;
boolean
interrupted
=
false
;
while
(
used
>
0
)
{
try
{
wait
();
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
}
try
{
wait
(
50
);
}
catch
(
InterruptedException
e
)
{
interrupted
=
true
;
}
finally
{
waitingToEmpty
=
false
;
}
if
(
interrupted
)
Thread
.
currentThread
().
interrupt
();
}
if
(
interrupted
)
Thread
.
currentThread
().
interrupt
();
}
}
src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
浏览文件 @
e7c760fe
...
...
@@ -88,7 +88,6 @@ public class SimpleAsynchronousFileChannelImpl
invalidateAllLocks
();
// signal any threads blocked on this channel
nd
.
preClose
(
fdObj
);
threads
.
signalAndWait
();
// wait until all async I/O operations have completely gracefully
...
...
src/share/instrument/Reentrancy.c
浏览文件 @
e7c760fe
...
...
@@ -130,6 +130,7 @@ tryToAcquireReentrancyToken( jvmtiEnv * jvmtienv,
error
=
confirmingTLSSet
(
jvmtienv
,
thread
,
JPLIS_CURRENTLY_INSIDE_TOKEN
);
check_phase_ret_false
(
error
);
jplis_assert
(
error
==
JVMTI_ERROR_NONE
);
if
(
error
!=
JVMTI_ERROR_NONE
)
{
result
=
JNI_FALSE
;
...
...
@@ -158,6 +159,7 @@ releaseReentrancyToken( jvmtiEnv * jvmtienv,
error
=
confirmingTLSSet
(
jvmtienv
,
thread
,
JPLIS_CURRENTLY_OUTSIDE_TOKEN
);
check_phase_ret
(
error
);
jplis_assert
(
error
==
JVMTI_ERROR_NONE
);
}
src/share/native/com/sun/java/util/jar/pack/coding.cpp
浏览文件 @
e7c760fe
...
...
@@ -32,6 +32,8 @@
#include <stdlib.h>
#include <stdarg.h>
#include "jni_util.h"
#include "defines.h"
#include "bytes.h"
#include "utils.h"
...
...
@@ -147,7 +149,7 @@ coding* coding::findBySpec(int spec) {
break
;
}
coding
*
ptr
=
NEW
(
coding
,
1
);
CHECK_NULL_
0
(
ptr
);
CHECK_NULL_
RETURN
(
ptr
,
0
);
coding
*
c
=
ptr
->
initFrom
(
spec
);
if
(
c
==
null
)
{
mtrace
(
'f'
,
ptr
,
0
);
...
...
src/share/native/com/sun/java/util/jar/pack/defines.h
浏览文件 @
e7c760fe
...
...
@@ -158,10 +158,6 @@ enum { false, true };
#define CHECK_(y) _CHECK_DO(aborting(), return y)
#define CHECK_0 _CHECK_DO(aborting(), return 0)
#define CHECK_NULL(p) _CHECK_DO((p)==null, return)
#define CHECK_NULL_(y,p) _CHECK_DO((p)==null, return y)
#define CHECK_NULL_0(p) _CHECK_DO((p)==null, return 0)
#define CHECK_COUNT(t) if (t < 0){abort("bad value count");} CHECK
#define STR_TRUE "true"
...
...
src/share/native/common/jni_util.h
浏览文件 @
e7c760fe
...
...
@@ -297,6 +297,21 @@ JNU_NotifyAll(JNIEnv *env, jobject object);
} \
} while (0) \
#ifdef __cplusplus
#define JNU_CHECK_EXCEPTION(env) \
do { \
if ((env)->ExceptionCheck()) { \
return; \
} \
} while (0) \
#define JNU_CHECK_EXCEPTION_RETURN(env, y) \
do { \
if ((env)->ExceptionCheck()) { \
return (y); \
} \
} while (0)
#else
#define JNU_CHECK_EXCEPTION(env) \
do { \
if ((*env)->ExceptionCheck(env)) { \
...
...
@@ -310,7 +325,7 @@ JNU_NotifyAll(JNIEnv *env, jobject object);
return (y); \
} \
} while (0)
#endif
/* __cplusplus */
/************************************************************************
* Debugging utilities
*/
...
...
src/share/native/java/io/FileInputStream.c
浏览文件 @
e7c760fe
...
...
@@ -62,7 +62,7 @@ Java_java_io_FileInputStream_open(JNIEnv *env, jobject this, jstring path) {
}
JNIEXPORT
jint
JNICALL
Java_java_io_FileInputStream_read
(
JNIEnv
*
env
,
jobject
this
)
{
Java_java_io_FileInputStream_read
0
(
JNIEnv
*
env
,
jobject
this
)
{
return
readSingle
(
env
,
this
,
fis_fd
);
}
...
...
src/share/native/java/io/RandomAccessFile.c
浏览文件 @
e7c760fe
...
...
@@ -64,7 +64,7 @@ Java_java_io_RandomAccessFile_open(JNIEnv *env,
}
JNIEXPORT
jint
JNICALL
Java_java_io_RandomAccessFile_read
(
JNIEnv
*
env
,
jobject
this
)
{
Java_java_io_RandomAccessFile_read
0
(
JNIEnv
*
env
,
jobject
this
)
{
return
readSingle
(
env
,
this
,
raf_fd
);
}
...
...
@@ -75,7 +75,7 @@ Java_java_io_RandomAccessFile_readBytes(JNIEnv *env,
}
JNIEXPORT
void
JNICALL
Java_java_io_RandomAccessFile_write
(
JNIEnv
*
env
,
jobject
this
,
jint
byte
)
{
Java_java_io_RandomAccessFile_write
0
(
JNIEnv
*
env
,
jobject
this
,
jint
byte
)
{
writeSingle
(
env
,
this
,
byte
,
JNI_FALSE
,
raf_fd
);
}
...
...
src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
浏览文件 @
e7c760fe
...
...
@@ -149,7 +149,7 @@ class SolarisUserDefinedFileAttributeView
int
afd
=
openat
(
fd
,
nameAsBytes
(
file
,
name
),
(
O_RDONLY
|
O_XATTR
),
0
);
// wrap with channel
FileChannel
fc
=
UnixChannelFactory
.
newFileChannel
(
afd
,
true
,
false
);
FileChannel
fc
=
UnixChannelFactory
.
newFileChannel
(
afd
,
file
.
toString
(),
true
,
false
);
// read to EOF (nothing we can do if I/O error occurs)
try
{
...
...
@@ -190,7 +190,7 @@ class SolarisUserDefinedFileAttributeView
UnixFileModeAttribute
.
ALL_PERMISSIONS
);
// wrap with channel
FileChannel
fc
=
UnixChannelFactory
.
newFileChannel
(
afd
,
false
,
true
);
FileChannel
fc
=
UnixChannelFactory
.
newFileChannel
(
afd
,
f
ile
.
toString
(),
f
alse
,
true
);
// write value (nothing we can do if I/O error occurs)
try
{
...
...
src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
浏览文件 @
e7c760fe
...
...
@@ -100,10 +100,10 @@ class UnixChannelFactory {
/**
* Constructs a file channel from an existing (open) file descriptor
*/
static
FileChannel
newFileChannel
(
int
fd
,
boolean
reading
,
boolean
writing
)
{
static
FileChannel
newFileChannel
(
int
fd
,
String
path
,
boolean
reading
,
boolean
writing
)
{
FileDescriptor
fdObj
=
new
FileDescriptor
();
fdAccess
.
set
(
fdObj
,
fd
);
return
FileChannelImpl
.
open
(
fdObj
,
reading
,
writing
,
null
);
return
FileChannelImpl
.
open
(
fdObj
,
path
,
reading
,
writing
,
null
);
}
/**
...
...
@@ -134,7 +134,7 @@ class UnixChannelFactory {
throw
new
IllegalArgumentException
(
"APPEND + TRUNCATE_EXISTING not allowed"
);
FileDescriptor
fdObj
=
open
(
dfd
,
path
,
pathForPermissionCheck
,
flags
,
mode
);
return
FileChannelImpl
.
open
(
fdObj
,
flags
.
read
,
flags
.
write
,
flags
.
append
,
null
);
return
FileChannelImpl
.
open
(
fdObj
,
path
.
toString
(),
flags
.
read
,
flags
.
write
,
flags
.
append
,
null
);
}
/**
...
...
src/solaris/native/java/net/PlainDatagramSocketImpl.c
浏览文件 @
e7c760fe
...
...
@@ -517,6 +517,8 @@ Java_java_net_PlainDatagramSocketImpl_peek(JNIEnv *env, jobject this,
}
else
if
(
ret
==
JVM_IO_ERR
)
{
if
(
errno
==
EBADF
)
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
if
(
errno
==
ENOMEM
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"NET_Timeout native heap allocation failed"
);
}
else
{
NET_ThrowByNameWithLastError
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Peek failed"
);
}
...
...
@@ -617,15 +619,18 @@ Java_java_net_PlainDatagramSocketImpl_peekData(JNIEnv *env, jobject this,
"Receive timed out"
);
return
-
1
;
}
else
if
(
ret
==
JVM_IO_ERR
)
{
if
(
errno
==
ENOMEM
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"NET_Timeout native heap allocation failed"
);
#ifdef __linux__
if
(
errno
==
EBADF
)
{
}
else
if
(
errno
==
EBADF
)
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
{
NET_ThrowByNameWithLastError
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Receive failed"
);
}
#else
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
#endif
}
return
-
1
;
}
else
if
(
ret
==
JVM_IO_INTR
)
{
JNU_ThrowByName
(
env
,
JNU_JAVAIOPKG
"InterruptedIOException"
,
...
...
@@ -835,15 +840,18 @@ Java_java_net_PlainDatagramSocketImpl_receive0(JNIEnv *env, jobject this,
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketTimeoutException"
,
"Receive timed out"
);
}
else
if
(
ret
==
JVM_IO_ERR
)
{
if
(
errno
==
ENOMEM
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"NET_Timeout native heap allocation failed"
);
#ifdef __linux__
if
(
errno
==
EBADF
)
{
}
else
if
(
errno
==
EBADF
)
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
{
NET_ThrowByNameWithLastError
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Receive failed"
);
}
#else
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
#endif
}
}
else
if
(
ret
==
JVM_IO_INTR
)
{
JNU_ThrowByName
(
env
,
JNU_JAVAIOPKG
"InterruptedIOException"
,
"operation interrupted"
);
...
...
src/solaris/native/java/net/PlainSocketImpl.c
浏览文件 @
e7c760fe
...
...
@@ -708,7 +708,6 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
}
else
{
ret
=
NET_Timeout
(
fd
,
timeout
);
}
if
(
ret
==
0
)
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketTimeoutException"
,
"Accept timed out"
);
...
...
@@ -716,6 +715,8 @@ Java_java_net_PlainSocketImpl_socketAccept(JNIEnv *env, jobject this,
}
else
if
(
ret
==
JVM_IO_ERR
)
{
if
(
errno
==
EBADF
)
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
if
(
errno
==
ENOMEM
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"NET_Timeout native heap allocation failed"
);
}
else
{
NET_ThrowByNameWithLastError
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Accept failed"
);
}
...
...
src/solaris/native/java/net/SocketInputStream.c
浏览文件 @
e7c760fe
...
...
@@ -108,6 +108,8 @@ Java_java_net_SocketInputStream_socketRead0(JNIEnv *env, jobject this,
}
else
if
(
nread
==
JVM_IO_ERR
)
{
if
(
errno
==
EBADF
)
{
JNU_ThrowByName
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"Socket closed"
);
}
else
if
(
errno
==
ENOMEM
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"NET_Timeout native heap allocation failed"
);
}
else
{
NET_ThrowByNameWithLastError
(
env
,
JNU_JAVANETPKG
"SocketException"
,
"select/poll failed"
);
...
...
src/solaris/native/java/net/bsd_close.c
浏览文件 @
e7c760fe
...
...
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <signal.h>
#include <pthread.h>
#include <sys/types.h>
...
...
@@ -35,7 +36,6 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
/*
...
...
@@ -347,6 +347,10 @@ int NET_Select(int s, fd_set *readfds, fd_set *writefds,
int
NET_Timeout
(
int
s
,
long
timeout
)
{
long
prevtime
=
0
,
newtime
;
struct
timeval
t
,
*
tp
=
&
t
;
fd_set
fds
;
fd_set
*
fdsp
=
NULL
;
int
allocated
=
0
;
threadEntry_t
self
;
fdEntry_t
*
fdEntry
=
getFdEntry
(
s
);
/*
...
...
@@ -376,20 +380,29 @@ int NET_Timeout(int s, long timeout) {
t
.
tv_usec
=
0
;
}
if
(
s
<
FD_SETSIZE
)
{
fdsp
=
&
fds
;
FD_ZERO
(
fdsp
);
}
else
{
int
length
=
(
howmany
(
s
+
1
,
NFDBITS
))
*
sizeof
(
int
);
fdsp
=
(
fd_set
*
)
calloc
(
1
,
length
);
if
(
fdsp
==
NULL
)
{
return
-
1
;
// errno will be set to ENOMEM
}
allocated
=
1
;
}
FD_SET
(
s
,
fdsp
);
for
(;;)
{
fd_set
rfds
;
int
rv
;
threadEntry_t
self
;
/*
* call select on the fd. If interrupted by our wakeup signal
* errno will be set to EBADF.
*/
FD_ZERO
(
&
rfds
);
FD_SET
(
s
,
&
rfds
);
startOp
(
fdEntry
,
&
self
);
rv
=
select
(
s
+
1
,
&
rfds
,
0
,
0
,
tp
);
rv
=
select
(
s
+
1
,
fdsp
,
0
,
0
,
tp
);
endOp
(
fdEntry
,
&
self
);
/*
...
...
@@ -403,6 +416,8 @@ int NET_Timeout(int s, long timeout) {
newtime
=
now
.
tv_sec
*
1000
+
now
.
tv_usec
/
1000
;
timeout
-=
newtime
-
prevtime
;
if
(
timeout
<=
0
)
{
if
(
allocated
!=
0
)
free
(
fdsp
);
return
0
;
}
prevtime
=
newtime
;
...
...
@@ -410,6 +425,8 @@ int NET_Timeout(int s, long timeout) {
t
.
tv_usec
=
(
timeout
%
1000
)
*
1000
;
}
}
else
{
if
(
allocated
!=
0
)
free
(
fdsp
);
return
rv
;
}
...
...
src/solaris/native/java/net/linux_close.c
浏览文件 @
e7c760fe
...
...
@@ -34,7 +34,6 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
/*
...
...
src/solaris/native/sun/awt/gtk2_interface.c
浏览文件 @
e7c760fe
...
...
@@ -32,6 +32,7 @@
#include "java_awt_Transparency.h"
#include "jvm_md.h"
#include "sizecalc.h"
#include <jni_util.h>
#define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
#define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
...
...
@@ -456,13 +457,19 @@ void update_supported_actions(JNIEnv *env) {
const
gchar
*
const
*
schemes
=
NULL
;
jclass
cls_action
=
(
*
env
)
->
FindClass
(
env
,
"java/awt/Desktop$Action"
);
CHECK_NULL
(
cls_action
);
jclass
cls_xDesktopPeer
=
(
*
env
)
->
FindClass
(
env
,
"sun/awt/X11/XDesktopPeer"
);
CHECK_NULL
(
cls_xDesktopPeer
);
jfieldID
fld_supportedActions
=
(
*
env
)
->
GetStaticFieldID
(
env
,
cls_xDesktopPeer
,
"supportedActions"
,
"Ljava/util/List;"
);
CHECK_NULL
(
fld_supportedActions
);
jobject
supportedActions
=
(
*
env
)
->
GetStaticObjectField
(
env
,
cls_xDesktopPeer
,
fld_supportedActions
);
jclass
cls_arrayList
=
(
*
env
)
->
FindClass
(
env
,
"java/util/ArrayList"
);
CHECK_NULL
(
cls_arrayList
);
jmethodID
mid_arrayListAdd
=
(
*
env
)
->
GetMethodID
(
env
,
cls_arrayList
,
"add"
,
"(Ljava/lang/Object;)Z"
);
CHECK_NULL
(
mid_arrayListAdd
);
jmethodID
mid_arrayListClear
=
(
*
env
)
->
GetMethodID
(
env
,
cls_arrayList
,
"clear"
,
"()V"
);
CHECK_NULL
(
mid_arrayListClear
);
(
*
env
)
->
CallVoidMethod
(
env
,
supportedActions
,
mid_arrayListClear
);
...
...
src/solaris/native/sun/nio/ch/NativeThread.c
浏览文件 @
e7c760fe
...
...
@@ -32,27 +32,32 @@
#include "sun_nio_ch_NativeThread.h"
#include "nio_util.h"
#ifdef __linux__
#include <pthread.h>
#include <sys/signal.h>
/* Also defined in src/solaris/native/java/net/linux_close.c */
#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
#include <pthread.h>
#include <sys/signal.h>
/* Also defined in net/linux_close.c */
#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
#elif __solaris__
#include <thread.h>
#include <signal.h>
#define INTERRUPT_SIGNAL (SIGRTMAX - 2)
#elif _ALLBSD_SOURCE
#include <pthread.h>
#include <signal.h>
/* Also defined in net/bsd_close.c */
#define INTERRUPT_SIGNAL SIGIO
#else
#error "missing platform-specific definition here"
#endif
static
void
nullHandler
(
int
sig
)
{
}
#endif
JNIEXPORT
void
JNICALL
Java_sun_nio_ch_NativeThread_init
(
JNIEnv
*
env
,
jclass
cl
)
{
#ifdef __linux__
/* Install the null handler for INTERRUPT_SIGNAL. This might overwrite the
* handler previously installed by java/net/linux_close.c, but that's okay
* since neither handler actually does anything. We install our own
...
...
@@ -67,25 +72,27 @@ Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
sigemptyset
(
&
sa
.
sa_mask
);
if
(
sigaction
(
INTERRUPT_SIGNAL
,
&
sa
,
&
osa
)
<
0
)
JNU_ThrowIOExceptionWithLastError
(
env
,
"sigaction"
);
#endif
}
JNIEXPORT
jlong
JNICALL
Java_sun_nio_ch_NativeThread_current
(
JNIEnv
*
env
,
jclass
cl
)
{
#ifdef __
linux
__
return
(
long
)
pthread
_self
();
#ifdef __
solaris
__
return
(
jlong
)
thr
_self
();
#else
return
-
1
;
return
(
jlong
)
pthread_self
()
;
#endif
}
JNIEXPORT
void
JNICALL
Java_sun_nio_ch_NativeThread_signal
(
JNIEnv
*
env
,
jclass
cl
,
jlong
thread
)
{
#ifdef __linux__
if
(
pthread_kill
((
pthread_t
)
thread
,
INTERRUPT_SIGNAL
))
JNU_ThrowIOExceptionWithLastError
(
env
,
"Thread signal failed"
);
int
ret
;
#ifdef __solaris__
ret
=
thr_kill
((
thread_t
)
thread
,
INTERRUPT_SIGNAL
);
#else
ret
=
pthread_kill
((
pthread_t
)
thread
,
INTERRUPT_SIGNAL
);
#endif
if
(
ret
!=
0
)
JNU_ThrowIOExceptionWithLastError
(
env
,
"Thread signal failed"
);
}
src/windows/classes/sun/nio/fs/WindowsChannelFactory.java
浏览文件 @
e7c760fe
...
...
@@ -25,19 +25,22 @@
package
sun.nio.fs
;
import
java.nio.file.*
;
import
java.nio.channels.*
;
import
java.io.FileDescriptor
;
import
java.io.IOException
;
import
java.util.*
;
import
java.nio.channels.AsynchronousFileChannel
;
import
java.nio.channels.FileChannel
;
import
java.nio.file.LinkOption
;
import
java.nio.file.OpenOption
;
import
java.nio.file.StandardOpenOption
;
import
java.util.Set
;
import
com.sun.nio.file.ExtendedOpenOption
;
import
sun.misc.JavaIOFileDescriptorAccess
;
import
sun.misc.SharedSecrets
;
import
sun.nio.ch.FileChannelImpl
;
import
sun.nio.ch.ThreadPool
;
import
sun.nio.ch.WindowsAsynchronousFileChannelImpl
;
import
sun.misc.SharedSecrets
;
import
sun.misc.JavaIOFileDescriptorAccess
;
import
static
sun
.
nio
.
fs
.
WindowsNativeDispatcher
.*;
import
static
sun
.
nio
.
fs
.
WindowsConstants
.*;
...
...
@@ -157,7 +160,7 @@ class WindowsChannelFactory {
throw
new
IllegalArgumentException
(
"APPEND + TRUNCATE_EXISTING not allowed"
);
FileDescriptor
fdObj
=
open
(
pathForWindows
,
pathToCheck
,
flags
,
pSecurityDescriptor
);
return
FileChannelImpl
.
open
(
fdObj
,
flags
.
read
,
flags
.
write
,
flags
.
append
,
null
);
return
FileChannelImpl
.
open
(
fdObj
,
pathForWindows
,
flags
.
read
,
flags
.
write
,
flags
.
append
,
null
);
}
/**
...
...
test/ProblemList.txt
浏览文件 @
e7c760fe
...
...
@@ -183,11 +183,6 @@ java/net/DatagramSocket/SendDatagramToBadAddress.java macosx-all
# 6963118
java/nio/channels/Selector/Wakeup.java windows-all
# 7133499, 7133497
java/nio/channels/AsyncCloseAndInterrupt.java macosx-all
java/nio/channels/AsynchronousFileChannel/Lock.java macosx-all
java/nio/channels/FileChannel/Transfer.java macosx-all
# 7141822
java/nio/channels/DatagramChannel/ChangingAddress.java macosx-all
...
...
test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright (c) 2014, 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 8032078
@summary Frame.setExtendedState throws RuntimeException, if
windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
@author Anton Litvinov
*/
import
java.awt.*
;
import
sun.awt.SunToolkit
;
public
class
ExceptionOnSetExtendedStateTest
{
private
static
final
int
[]
frameStates
=
{
Frame
.
NORMAL
,
Frame
.
ICONIFIED
,
Frame
.
MAXIMIZED_BOTH
};
private
static
final
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
private
static
boolean
validatePlatform
()
{
String
osName
=
System
.
getProperty
(
"os.name"
);
if
(
osName
==
null
)
{
throw
new
RuntimeException
(
"Name of the current OS could not be retrieved."
);
}
return
osName
.
startsWith
(
"Mac"
);
}
private
static
void
testStateChange
(
int
oldState
,
int
newState
,
boolean
decoratedFrame
)
{
System
.
out
.
println
(
String
.
format
(
"testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'"
,
oldState
,
newState
,
decoratedFrame
));
Frame
frame
=
new
Frame
(
"ExceptionOnSetExtendedStateTest"
);
frame
.
setSize
(
200
,
200
);
frame
.
setUndecorated
(!
decoratedFrame
);
frame
.
setVisible
(
true
);
toolkit
.
realSync
();
frame
.
setExtendedState
(
oldState
);
sleep
(
1000
);
frame
.
setExtendedState
(
newState
);
boolean
stateWasNotChanged
=
true
;
int
currentState
=
0
;
for
(
int
i
=
0
;
(
i
<
3
)
&&
stateWasNotChanged
;
i
++)
{
sleep
(
1000
);
currentState
=
frame
.
getExtendedState
();
if
((
currentState
==
newState
)
||
(((
newState
&
Frame
.
ICONIFIED
)
!=
0
)
&&
((
currentState
&
Frame
.
ICONIFIED
)
!=
0
)))
{
stateWasNotChanged
=
false
;
}
}
frame
.
dispose
();
if
(
stateWasNotChanged
)
{
throw
new
RuntimeException
(
String
.
format
(
"Frame state was not changed. currentState='%d'"
,
currentState
));
}
}
private
static
void
sleep
(
int
millis
)
{
try
{
Thread
.
sleep
(
millis
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
{
if
(!
validatePlatform
())
{
System
.
out
.
println
(
"This test is only for OS X."
);
return
;
}
// Verify that changing states of decorated/undecorated frame to/from supported states
// and the state bit mask ICONIFIED | MAXIMIZED_BOTH does not raise RuntimeException.
for
(
int
i
=
0
;
i
<
frameStates
.
length
;
i
++)
{
testStateChange
(
frameStates
[
i
],
Frame
.
ICONIFIED
|
Frame
.
MAXIMIZED_BOTH
,
true
);
testStateChange
(
frameStates
[
i
],
Frame
.
ICONIFIED
|
Frame
.
MAXIMIZED_BOTH
,
false
);
testStateChange
(
Frame
.
ICONIFIED
|
Frame
.
MAXIMIZED_BOTH
,
frameStates
[
i
],
true
);
testStateChange
(
Frame
.
ICONIFIED
|
Frame
.
MAXIMIZED_BOTH
,
frameStates
[
i
],
false
);
}
}
}
test/java/lang/instrument/DaemonThread/DummyAgent.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright 2014 Goldman Sachs.
* Copyright (c) 2014, 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.
*/
import
java.lang.instrument.ClassFileTransformer
;
import
java.lang.instrument.IllegalClassFormatException
;
import
java.lang.instrument.Instrumentation
;
import
java.security.ProtectionDomain
;
public
class
DummyAgent
implements
ClassFileTransformer
{
@Override
public
byte
[]
transform
(
ClassLoader
loader
,
String
className
,
Class
<?>
classBeingRedefined
,
ProtectionDomain
protectionDomain
,
byte
[]
classfileBuffer
)
throws
IllegalClassFormatException
{
/* The Daemon Thread bug is timing dependent and you want the transform method
* to return ASAP - so just return the buffer will be fine
*/
return
classfileBuffer
;
}
public
static
void
premain
(
String
agentArgs
,
Instrumentation
inst
)
{
inst
.
addTransformer
(
new
DummyAgent
(),
false
);
}
}
test/java/lang/instrument/DaemonThread/DummyClass.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright 2014 Goldman Sachs.
* Copyright (c) 2014, 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.
*/
/* Just a dummy class for loading */
public
class
DummyClass
{
}
test/java/lang/instrument/DaemonThread/TestDaemonThread.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright 2014 Goldman Sachs.
* Copyright (c) 2014, 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 7142035
* @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
* @library /lib/testlibrary
*
* @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
* @run shell ../MakeJAR3.sh DummyAgent
* @run main TestDaemonThreadLauncher /timeout=240
*
*/
import
java.io.File
;
import
java.net.URL
;
import
java.net.URLClassLoader
;
public
class
TestDaemonThread
implements
Runnable
{
File
classpath
;
public
TestDaemonThread
(
File
classpath
)
{
this
.
classpath
=
classpath
;
}
@Override
public
void
run
()
{
try
{
URL
u
=
this
.
getClass
().
getClassLoader
().
getResource
(
"DummyClass.class"
);
String
path
=
u
.
getPath
();
String
parent
=
u
.
getPath
().
substring
(
0
,
path
.
lastIndexOf
(
'/'
)+
1
);
URL
parentURL
=
new
URL
(
u
,
parent
);
System
.
out
.
println
(
parentURL
);
/* Load lots of class by creating multiple classloaders */
for
(;;)
{
ClassLoader
cl
=
new
URLClassLoader
(
new
URL
[]
{
parentURL
},
null
);
cl
.
loadClass
(
"DummyClass"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Thread
t
=
new
Thread
(
new
TestDaemonThread
(
new
File
(
args
[
0
])));
/* The important part of the bug is that a Daemon thread can continue to load classes after shutdown */
t
.
setDaemon
(
true
);
t
.
start
();
Thread
.
sleep
(
200
);
}
}
test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright 2014 Goldman Sachs.
* Copyright (c) 2014, 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.
*/
import
jdk.testlibrary.JDKToolLauncher
;
import
jdk.testlibrary.OutputAnalyzer
;
import
jdk.testlibrary.ProcessTools
;
import
java.io.IOException
;
import
java.nio.file.Path
;
public
class
TestDaemonThreadLauncher
{
private
static
ProcessBuilder
processBuilder
=
new
ProcessBuilder
();
public
static
void
main
(
String
args
[])
throws
Exception
{
for
(
int
i
=
0
;
i
<
50
;
i
++)
{
ProcessBuilder
pb
=
ProcessTools
.
createJavaProcessBuilder
(
"-javaagent:DummyAgent.jar"
,
"TestDaemonThread"
,
"."
);
OutputAnalyzer
analyzer
=
new
OutputAnalyzer
(
pb
.
start
());
analyzer
.
shouldNotContain
(
"ASSERTION FAILED"
);
}
}
}
test/java/net/ServerSocket/AnotherSelectFdsLimit.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright (c) 2014, 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 8035897
* @summary FD_SETSIZE should be set on macosx
* @run main/othervm AnotherSelectFdsLimit 1023
* @run main/othervm AnotherSelectFdsLimit 1024
* @run main/othervm AnotherSelectFdsLimit 1025
* @run main/othervm AnotherSelectFdsLimit 1600
*/
import
java.io.IOException
;
import
java.net.ServerSocket
;
import
java.net.SocketTimeoutException
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
AnotherSelectFdsLimit
{
static
final
int
DEFAULT_FDS_TO_USE
=
1600
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(!
System
.
getProperty
(
"os.name"
).
contains
(
"OS X"
))
{
System
.
out
.
println
(
"Test only run on MAC. Exiting."
);
return
;
}
int
fdsToUse
=
DEFAULT_FDS_TO_USE
;
if
(
args
.
length
==
1
)
fdsToUse
=
Integer
.
parseInt
(
args
[
0
]);
System
.
out
.
println
(
"Using "
+
fdsToUse
+
" fds."
);
List
<
Thread
>
threads
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
fdsToUse
;
i
++)
threads
.
add
(
new
WorkerThread
());
for
(
Thread
t
:
threads
)
t
.
start
();
for
(
Thread
t
:
threads
)
t
.
join
();
}
static
class
WorkerThread
extends
Thread
{
public
void
run
()
{
try
(
ServerSocket
ss
=
new
ServerSocket
(
0
))
{
ss
.
setSoTimeout
(
2000
);
ss
.
accept
();
}
catch
(
SocketTimeoutException
x
)
{
// expected
}
catch
(
IOException
x
)
{
throw
new
java
.
io
.
UncheckedIOException
(
x
);
}
}
}
}
test/java/nio/channels/Selector/ByteServer.java
浏览文件 @
e7c760fe
...
...
@@ -22,52 +22,54 @@
*/
/**
*
* Utility class for tests. A simple server, which waits for a connection,
* writes out n bytes and waits.
* Utility class for tests. A simple "in-thread" server to accept connections
* and write bytes.
* @author kladko
*/
import
java.net.Socket
;
import
java.net.ServerSocket
;
import
java.net.SocketAddress
;
import
java.net.InetSocketAddress
;
import
java.io.IOException
;
import
java.io.Closeable
;
public
class
ByteServer
implements
Closeable
{
public
class
ByteServer
{
private
final
ServerSocket
ss
;
private
Socket
s
;
public
static
final
String
LOCALHOST
=
"localhost"
;
private
int
bytecount
;
private
Socket
socket
;
private
ServerSocket
serversocket
;
private
Thread
serverthread
;
volatile
Exception
savedException
;
ByteServer
()
throws
IOException
{
this
.
ss
=
new
ServerSocket
(
0
);
}
SocketAddress
address
()
{
return
new
InetSocketAddress
(
ss
.
getInetAddress
(),
ss
.
getLocalPort
());
}
public
ByteServer
(
int
bytecount
)
throws
Exception
{
this
.
bytecount
=
bytecount
;
serversocket
=
new
ServerSocket
(
0
);
void
acceptConnection
()
throws
IOException
{
if
(
s
!=
null
)
throw
new
IllegalStateException
(
"already connected"
);
this
.
s
=
ss
.
accept
();
}
public
int
port
()
{
return
serversocket
.
getLocalPort
();
void
closeConnection
()
throws
IOException
{
Socket
s
=
this
.
s
;
if
(
s
!=
null
)
{
this
.
s
=
null
;
s
.
close
();
}
}
public
void
start
()
{
serverthread
=
new
Thread
()
{
public
void
run
()
{
try
{
socket
=
serversocket
.
accept
();
socket
.
getOutputStream
().
write
(
new
byte
[
bytecount
]);
socket
.
getOutputStream
().
flush
();
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"Exception in ByteServer: "
+
e
);
System
.
exit
(
1
);
}
}
};
serverthread
.
start
();
void
write
(
int
count
)
throws
IOException
{
if
(
s
==
null
)
throw
new
IllegalStateException
(
"no connection"
);
s
.
getOutputStream
().
write
(
new
byte
[
count
]);
}
public
void
exit
()
throws
Exception
{
serverthread
.
join
();
socket
.
close
();
s
erversocket
.
close
();
public
void
close
()
throws
IO
Exception
{
if
(
s
!=
null
)
s
.
close
();
s
s
.
close
();
}
}
test/java/nio/channels/Selector/ReadAfterConnect.java
浏览文件 @
e7c760fe
...
...
@@ -27,27 +27,25 @@
* @author kladko
*/
import
java.n
et.*
;
import
java.nio.
*
;
import
java.nio.channels.
*
;
import
java.n
io.channels.Selector
;
import
java.nio.
channels.SelectionKey
;
import
java.nio.channels.
SocketChannel
;
public
class
ReadAfterConnect
{
public
static
void
main
(
String
[]
argv
)
throws
Exception
{
ByteServer
server
=
new
ByteServer
(
0
);
// server: accept connection and do nothing
server
.
start
();
InetSocketAddress
isa
=
new
InetSocketAddress
(
InetAddress
.
getByName
(
ByteServer
.
LOCALHOST
),
server
.
port
());
Selector
sel
=
Selector
.
open
();
SocketChannel
sc
=
SocketChannel
.
open
();
sc
.
connect
(
isa
);
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_READ
);
// Previously channel would get selected here, although there is nothing to read
if
(
sel
.
selectNow
()
!=
0
)
throw
new
Exception
(
"Select returned nonzero value"
);
sc
.
close
();
server
.
exit
();
try
(
ByteServer
server
=
new
ByteServer
();
SocketChannel
sc
=
SocketChannel
.
open
(
server
.
address
()))
{
server
.
acceptConnection
();
try
(
Selector
sel
=
Selector
.
open
())
{
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_READ
);
// Previously channel would get selected here, although there is nothing to read
if
(
sel
.
selectNow
()
!=
0
)
throw
new
Exception
(
"Select returned nonzero value"
);
}
}
}
}
test/java/nio/channels/Selector/SelectAfterRead.java
浏览文件 @
e7c760fe
...
...
@@ -28,60 +28,62 @@
* @author kladko
*/
import
java.net.*
;
import
java.nio.*
;
import
java.nio.channels.*
;
import
java.nio.ByteBuffer
;
import
java.nio.channels.Selector
;
import
java.nio.channels.SelectionKey
;
import
java.nio.channels.SocketChannel
;
public
class
SelectAfterRead
{
final
static
int
TIMEOUT
=
1000
;
private
static
final
int
TIMEOUT
=
1000
;
public
static
void
main
(
String
[]
argv
)
throws
Exception
{
InetAddress
lh
=
InetAddress
.
getByName
(
ByteServer
.
LOCALHOST
);
// server: accept connection and write one byte
ByteServer
server
=
new
ByteServer
(
1
);
server
.
start
();
Selector
sel
=
Selector
.
open
();
SocketChannel
sc
=
SocketChannel
.
open
();
sc
.
connect
(
new
InetSocketAddress
(
lh
,
server
.
port
()));
sc
.
read
(
ByteBuffer
.
allocate
(
1
));
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_READ
);
// previously on Windows select would select channel here, although there was
// nothing to read
if
(
sel
.
selectNow
()
!=
0
)
throw
new
Exception
(
"Select returned nonzero value"
);
sc
.
close
();
sel
.
close
();
server
.
exit
();
try
(
ByteServer
server
=
new
ByteServer
();
SocketChannel
sc
=
SocketChannel
.
open
(
server
.
address
()))
{
server
.
acceptConnection
();
server
.
write
(
1
);
try
(
Selector
sel
=
Selector
.
open
())
{
sc
.
read
(
ByteBuffer
.
allocate
(
1
));
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_READ
);
// previously on Windows select would select channel here, although there was
// nothing to read
if
(
sel
.
selectNow
()
!=
0
)
throw
new
Exception
(
"Select returned nonzero value"
);
}
}
// Now we will test a two reads combination
// server: accept connection and write two bytes
server
=
new
ByteServer
(
2
);
server
.
start
();
sc
=
SocketChannel
.
open
();
sc
.
connect
(
new
InetSocketAddress
(
lh
,
server
.
port
()));
sc
.
configureBlocking
(
false
);
sel
=
Selector
.
open
();
sc
.
register
(
sel
,
SelectionKey
.
OP_READ
);
if
(
sel
.
select
(
TIMEOUT
)
!=
1
)
throw
new
Exception
(
"One selected key expected"
);
sel
.
selectedKeys
().
clear
();
// previously on Windows a channel would get selected only once
if
(
sel
.
selectNow
()
!=
1
)
throw
new
Exception
(
"One selected key expected"
);
// Previously on Windows two consequent reads would cause select()
// to select a channel, although there was nothing remaining to
// read in the channel
if
(
sc
.
read
(
ByteBuffer
.
allocate
(
1
))
!=
1
)
throw
new
Exception
(
"One byte expected"
);
if
(
sc
.
read
(
ByteBuffer
.
allocate
(
1
))
!=
1
)
throw
new
Exception
(
"One byte expected"
);
if
(
sel
.
selectNow
()
!=
0
)
throw
new
Exception
(
"Select returned nonzero value"
);
sc
.
close
();
sel
.
close
();
server
.
exit
();
try
(
ByteServer
server
=
new
ByteServer
();
SocketChannel
sc
=
SocketChannel
.
open
(
server
.
address
()))
{
server
.
acceptConnection
();
server
.
write
(
2
);
try
(
Selector
sel
=
Selector
.
open
())
{
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_READ
);
if
(
sel
.
select
(
TIMEOUT
)
!=
1
)
throw
new
Exception
(
"One selected key expected"
);
sel
.
selectedKeys
().
clear
();
// previously on Windows a channel would get selected only once
if
(
sel
.
selectNow
()
!=
1
)
throw
new
Exception
(
"One selected key expected"
);
// Previously on Windows two consequent reads would cause select()
// to select a channel, although there was nothing remaining to
// read in the channel
if
(
sc
.
read
(
ByteBuffer
.
allocate
(
1
))
!=
1
)
throw
new
Exception
(
"One byte expected"
);
if
(
sc
.
read
(
ByteBuffer
.
allocate
(
1
))
!=
1
)
throw
new
Exception
(
"One byte expected"
);
if
(
sel
.
selectNow
()
!=
0
)
throw
new
Exception
(
"Select returned nonzero value"
);
}
}
}
}
test/java/nio/channels/Selector/SelectWrite.java
浏览文件 @
e7c760fe
...
...
@@ -22,36 +22,33 @@
*/
/* @test
@bug 4645302
@summary Socket with OP_WRITE would get selected only once
@author kladko
*
@bug 4645302
*
@summary Socket with OP_WRITE would get selected only once
*
@author kladko
*/
import
java.net.*
;
import
java.nio.*
;
import
java.nio.channels.*
;
import
java.nio.channels.Selector
;
import
java.nio.channels.SelectionKey
;
import
java.nio.channels.SocketChannel
;
public
class
SelectWrite
{
public
static
void
main
(
String
[]
argv
)
throws
Exception
{
ByteServer
server
=
new
ByteServer
(
0
);
// server: accept connection and do nothing
server
.
start
();
InetSocketAddress
isa
=
new
InetSocketAddress
(
InetAddress
.
getByName
(
ByteServer
.
LOCALHOST
),
server
.
port
());
Selector
sel
=
Selector
.
open
();
SocketChannel
sc
=
SocketChannel
.
open
(
);
sc
.
connect
(
isa
);
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_WRITE
);
sel
.
select
();
sel
.
selectedKeys
().
clear
(
);
if
(
sel
.
select
()
==
0
)
{
throw
new
Exception
(
"Select returned zero"
);
try
(
ByteServer
server
=
new
ByteServer
(
);
SocketChannel
sc
=
SocketChannel
.
open
(
server
.
address
()))
{
server
.
acceptConnection
();
try
(
Selector
sel
=
Selector
.
open
())
{
sc
.
configureBlocking
(
false
);
sc
.
register
(
sel
,
SelectionKey
.
OP_WRITE
);
sel
.
select
(
);
sel
.
selectedKeys
().
clear
(
);
if
(
sel
.
select
()
==
0
)
{
throw
new
Exception
(
"Select returned zero"
);
}
}
}
sc
.
close
();
sel
.
close
();
}
}
test/javax/swing/JMenuItem/8031573/bug8031573.html
0 → 100644
浏览文件 @
e7c760fe
<!--
Copyright (c) 2014, 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.
-->
<html>
<body>
Verify that high resolution system icons are used JCheckBoxMenuItem
on HiDPI displays.
If the display does not support HiDPI mode press PASS.
1. Run the test on HiDPI Display.
2. Press the Menu in the applet
3. Check that the icon on the JCheckBoxMenuItem is smooth
If so, press PASS, else press FAIL.
<applet
code=
"bug8031573.class"
width=
250
height=
250
></applet>
</body>
</html>
test/javax/swing/JMenuItem/8031573/bug8031573.java
0 → 100644
浏览文件 @
e7c760fe
/*
* Copyright (c) 2014, 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.
*/
import
java.awt.FlowLayout
;
import
javax.swing.JApplet
;
import
javax.swing.JCheckBoxMenuItem
;
import
javax.swing.JMenu
;
import
javax.swing.JMenuBar
;
import
javax.swing.SwingUtilities
;
/* @test
* @bug 8031573
* @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
* in high resolution on Retina
* @author Alexander Scherbatiy
* @run applet/manual=yesno bug8031573.html
*/
public
class
bug8031573
extends
JApplet
{
@Override
public
void
init
()
{
try
{
SwingUtilities
.
invokeAndWait
(
new
Runnable
()
{
@Override
public
void
run
()
{
JMenuBar
bar
=
new
JMenuBar
();
JMenu
menu
=
new
JMenu
(
"Menu"
);
JCheckBoxMenuItem
checkBoxMenuItem
=
new
JCheckBoxMenuItem
(
"JCheckBoxMenuItem"
);
checkBoxMenuItem
.
setSelected
(
true
);
menu
.
add
(
checkBoxMenuItem
);
bar
.
add
(
menu
);
setJMenuBar
(
bar
);
}
});
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
test/javax/xml/jaxp/transform/8004476/TestBase.java
浏览文件 @
e7c760fe
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
* 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.
*/
import
java.security.Policy
;
/**
...
...
test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
浏览文件 @
e7c760fe
...
...
@@ -32,6 +32,7 @@ import java.util.ArrayList;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicReference
;
import
jdk.testlibrary.ProcessTools
;
/**
* @test
...
...
@@ -43,11 +44,9 @@ import java.util.concurrent.atomic.AtomicReference;
* both agent properties and jvmstat buffer.
* @build jdk.testlibrary.ProcessTools
* @build TestManager TestApplication
* @run main/othervm/timeout=300 LocalManagementTest
* @run main/othervm/timeout=300
-XX:+UsePerfData
LocalManagementTest
*/
import
jdk.testlibrary.ProcessTools
;
public
class
LocalManagementTest
{
private
static
final
String
TEST_CLASSPATH
=
System
.
getProperty
(
"test.class.path"
);
private
static
final
String
TEST_JDK
=
System
.
getProperty
(
"test.jdk"
);
...
...
@@ -240,4 +239,4 @@ public class LocalManagementTest {
}
}
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录