Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a86a5927
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看板
提交
a86a5927
编写于
8月 27, 2008
作者:
S
sherman
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
2a6ead18
94036782
变更
35
隐藏空白更改
内联
并排
Showing
35 changed file
with
904 addition
and
175 deletion
+904
-175
make/java/java/FILES_java.gmk
make/java/java/FILES_java.gmk
+2
-1
make/java/jli/Makefile
make/java/jli/Makefile
+5
-1
make/java/jli/mapfile-vers
make/java/jli/mapfile-vers
+5
-1
make/java/net/mapfile-vers
make/java/net/mapfile-vers
+1
-1
make/java/nio/FILES_java.gmk
make/java/nio/FILES_java.gmk
+1
-0
make/java/nio/mapfile-linux
make/java/nio/mapfile-linux
+2
-0
src/share/bin/emessages.h
src/share/bin/emessages.h
+2
-2
src/share/bin/java.c
src/share/bin/java.c
+51
-51
src/share/bin/java.h
src/share/bin/java.h
+8
-12
src/share/classes/java/lang/management/PlatformComponent.java
...share/classes/java/lang/management/PlatformComponent.java
+18
-0
src/share/classes/java/net/NetworkInterface.java
src/share/classes/java/net/NetworkInterface.java
+23
-7
src/share/classes/java/net/ServerSocket.java
src/share/classes/java/net/ServerSocket.java
+24
-12
src/share/classes/java/nio/Bits.java
src/share/classes/java/nio/Bits.java
+63
-3
src/share/classes/java/nio/BufferPoolMXBean.java
src/share/classes/java/nio/BufferPoolMXBean.java
+94
-0
src/share/classes/java/nio/Direct-X-Buffer.java
src/share/classes/java/nio/Direct-X-Buffer.java
+11
-7
src/share/classes/javax/net/ssl/SSLServerSocket.java
src/share/classes/javax/net/ssl/SSLServerSocket.java
+16
-10
src/share/classes/sun/misc/JavaNioAccess.java
src/share/classes/sun/misc/JavaNioAccess.java
+32
-0
src/share/classes/sun/misc/SharedSecrets.java
src/share/classes/sun/misc/SharedSecrets.java
+15
-0
src/share/classes/sun/nio/ch/FileChannelImpl.java
src/share/classes/sun/nio/ch/FileChannelImpl.java
+67
-4
src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
...s/sun/reflect/generics/factory/CoreReflectionFactory.java
+5
-1
src/share/classes/sun/security/util/DerIndefLenConverter.java
...share/classes/sun/security/util/DerIndefLenConverter.java
+13
-2
src/solaris/bin/java_md.c
src/solaris/bin/java_md.c
+21
-21
src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
+7
-5
src/solaris/native/java/net/NetworkInterface.c
src/solaris/native/java/net/NetworkInterface.c
+2
-2
src/solaris/native/java/net/PlainDatagramSocketImpl.c
src/solaris/native/java/net/PlainDatagramSocketImpl.c
+1
-1
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
+21
-1
src/windows/bin/java_md.c
src/windows/bin/java_md.c
+21
-21
src/windows/native/java/net/NetworkInterface.c
src/windows/native/java/net/NetworkInterface.c
+5
-5
src/windows/native/java/net/NetworkInterface_winXP.c
src/windows/native/java/net/NetworkInterface_winXP.c
+2
-2
src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
...indows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+1
-1
src/windows/native/java/net/net_util_md.h
src/windows/native/java/net/net_util_md.h
+1
-1
test/java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
.../java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
+156
-0
test/java/net/NetworkInterface/IndexTest.java
test/java/net/NetworkInterface/IndexTest.java
+58
-0
test/java/nio/BufferPoolMXBean/Basic.java
test/java/nio/BufferPoolMXBean/Basic.java
+106
-0
test/sun/security/util/DerValue/Indefinite.java
test/sun/security/util/DerValue/Indefinite.java
+44
-0
未找到文件。
make/java/java/FILES_java.gmk
浏览文件 @
a86a5927
...
@@ -449,6 +449,7 @@ JAVA_JAVA_java = \
...
@@ -449,6 +449,7 @@ JAVA_JAVA_java = \
sun/misc/JavaLangAccess.java \
sun/misc/JavaLangAccess.java \
sun/misc/JavaIOAccess.java \
sun/misc/JavaIOAccess.java \
sun/misc/JavaIODeleteOnExitAccess.java \
sun/misc/JavaIODeleteOnExitAccess.java \
sun/misc/JavaIOFileDescriptorAccess.java
sun/misc/JavaIOFileDescriptorAccess.java \
sun/misc/JavaNioAccess.java
FILES_java = $(JAVA_JAVA_java)
FILES_java = $(JAVA_JAVA_java)
make/java/jli/Makefile
浏览文件 @
a86a5927
...
@@ -113,7 +113,11 @@ ifeq ($(PLATFORM), windows)
...
@@ -113,7 +113,11 @@ ifeq ($(PLATFORM), windows)
JAVALIB
=
JAVALIB
=
OTHER_LCF
=
-export
:JLI_Launch
\
OTHER_LCF
=
-export
:JLI_Launch
\
-export
:JLI_ManifestIterate
\
-export
:JLI_ManifestIterate
\
-export
:JLI_SetTraceLauncher
-export
:JLI_SetTraceLauncher
\
-export
:JLI_ReportErrorMessage
\
-export
:JLI_ReportErrorMessageSys
\
-export
:JLI_ReportMessage
\
-export
:JLI_ReportExceptionDescription
endif
endif
...
...
make/java/jli/mapfile-vers
浏览文件 @
a86a5927
#
#
# Copyright 2005-200
6
Sun Microsystems, Inc. All Rights Reserved.
# Copyright 2005-200
8
Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
#
# This code is free software; you can redistribute it and/or modify it
# This code is free software; you can redistribute it and/or modify it
...
@@ -30,6 +30,10 @@ SUNWprivate_1.1 {
...
@@ -30,6 +30,10 @@ SUNWprivate_1.1 {
JLI_Launch;
JLI_Launch;
JLI_ManifestIterate;
JLI_ManifestIterate;
JLI_SetTraceLauncher;
JLI_SetTraceLauncher;
JLI_ReportErrorMessage;
JLI_ReportErrorMessageSys;
JLI_ReportMessage;
JLI_ReportExceptionDescription;
local:
local:
*;
*;
};
};
make/java/net/mapfile-vers
浏览文件 @
a86a5927
...
@@ -57,7 +57,7 @@ SUNWprivate_1.1 {
...
@@ -57,7 +57,7 @@ SUNWprivate_1.1 {
Java_java_net_Inet6AddressImpl_isReachable0;
Java_java_net_Inet6AddressImpl_isReachable0;
Java_java_net_NetworkInterface_init;
Java_java_net_NetworkInterface_init;
Java_java_net_NetworkInterface_getByName0;
Java_java_net_NetworkInterface_getByName0;
Java_java_net_NetworkInterface_getByIndex;
Java_java_net_NetworkInterface_getByIndex
0
;
Java_java_net_NetworkInterface_getByInetAddress0;
Java_java_net_NetworkInterface_getByInetAddress0;
Java_java_net_NetworkInterface_getAll;
Java_java_net_NetworkInterface_getAll;
Java_java_net_NetworkInterface_isUp0;
Java_java_net_NetworkInterface_isUp0;
...
...
make/java/nio/FILES_java.gmk
浏览文件 @
a86a5927
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
FILES_src = \
FILES_src = \
java/nio/Bits.java \
java/nio/Bits.java \
java/nio/Buffer.java \
java/nio/Buffer.java \
java/nio/BufferPoolMXBean.java \
java/nio/ByteOrder.java \
java/nio/ByteOrder.java \
java/nio/MappedByteBuffer.java \
java/nio/MappedByteBuffer.java \
java/nio/StringCharBuffer.java \
java/nio/StringCharBuffer.java \
...
...
make/java/nio/mapfile-linux
浏览文件 @
a86a5927
...
@@ -18,6 +18,8 @@ SUNWprivate_1.1 {
...
@@ -18,6 +18,8 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_EPollArrayWrapper_fdLimit;
Java_sun_nio_ch_EPollArrayWrapper_fdLimit;
Java_sun_nio_ch_EPollArrayWrapper_init;
Java_sun_nio_ch_EPollArrayWrapper_init;
Java_sun_nio_ch_EPollArrayWrapper_interrupt;
Java_sun_nio_ch_EPollArrayWrapper_interrupt;
Java_sun_nio_ch_EPollArrayWrapper_offsetofData;
Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent;
Java_sun_nio_ch_FileChannelImpl_close0;
Java_sun_nio_ch_FileChannelImpl_close0;
Java_sun_nio_ch_FileChannelImpl_force0;
Java_sun_nio_ch_FileChannelImpl_force0;
Java_sun_nio_ch_FileChannelImpl_initIDs;
Java_sun_nio_ch_FileChannelImpl_initIDs;
...
...
src/share/bin/emessages.h
浏览文件 @
a86a5927
...
@@ -25,8 +25,8 @@
...
@@ -25,8 +25,8 @@
/*
/*
* This file primarily consists of all the error and warning messages, that
* This file primarily consists of all the error and warning messages, that
* are used in
ReportErrorMessage. All message must be defined here, in order
* are used in
JLI_ReportErrorMessage. All message must be defined here, in
*
to help in I18N/L10N
the messages.
*
order to help with localizing
the messages.
*/
*/
#ifndef _EMESSAGES_H
#ifndef _EMESSAGES_H
...
...
src/share/bin/java.c
浏览文件 @
a86a5927
...
@@ -148,7 +148,7 @@ static void ShowSplashScreen();
...
@@ -148,7 +148,7 @@ static void ShowSplashScreen();
static
jboolean
IsWildCardEnabled
();
static
jboolean
IsWildCardEnabled
();
#define ARG_CHECK(n, f, a) if (n < 1) { \
#define ARG_CHECK(n, f, a) if (n < 1) { \
ReportErrorMessage(f, a); \
JLI_
ReportErrorMessage(f, a); \
printUsage = JNI_TRUE; \
printUsage = JNI_TRUE; \
*pret = 1; \
*pret = 1; \
return JNI_TRUE; \
return JNI_TRUE; \
...
@@ -326,15 +326,15 @@ JavaMain(void * _args)
...
@@ -326,15 +326,15 @@ JavaMain(void * _args)
start
=
CounterGet
();
start
=
CounterGet
();
if
(
!
InitializeJVM
(
&
vm
,
&
env
,
&
ifn
))
{
if
(
!
InitializeJVM
(
&
vm
,
&
env
,
&
ifn
))
{
ReportErrorMessage
(
JVM_ERROR1
);
JLI_
ReportErrorMessage
(
JVM_ERROR1
);
exit
(
1
);
exit
(
1
);
}
}
if
(
printVersion
||
showVersion
)
{
if
(
printVersion
||
showVersion
)
{
PrintJavaVersion
(
env
,
showVersion
);
PrintJavaVersion
(
env
,
showVersion
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
if
(
printVersion
)
{
if
(
printVersion
)
{
...
@@ -347,8 +347,8 @@ JavaMain(void * _args)
...
@@ -347,8 +347,8 @@ JavaMain(void * _args)
if
(
printXUsage
||
printUsage
||
(
jarfile
==
0
&&
classname
==
0
))
{
if
(
printXUsage
||
printUsage
||
(
jarfile
==
0
&&
classname
==
0
))
{
PrintUsage
(
env
,
printXUsage
);
PrintUsage
(
env
,
printXUsage
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
ret
=
1
;
ret
=
1
;
}
}
goto
leave
;
goto
leave
;
...
@@ -397,43 +397,43 @@ JavaMain(void * _args)
...
@@ -397,43 +397,43 @@ JavaMain(void * _args)
if
(
jarfile
!=
0
)
{
if
(
jarfile
!=
0
)
{
mainClassName
=
GetMainClassName
(
env
,
jarfile
);
mainClassName
=
GetMainClassName
(
env
,
jarfile
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
if
(
mainClassName
==
NULL
)
{
if
(
mainClassName
==
NULL
)
{
ReportErrorMessage
(
JAR_ERROR1
,
jarfile
,
GEN_ERROR
);
JLI_
ReportErrorMessage
(
JAR_ERROR1
,
jarfile
,
GEN_ERROR
);
goto
leave
;
goto
leave
;
}
}
classname
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
mainClassName
,
0
);
classname
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
mainClassName
,
0
);
if
(
classname
==
NULL
)
{
if
(
classname
==
NULL
)
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
mainClass
=
LoadClass
(
env
,
classname
);
mainClass
=
LoadClass
(
env
,
classname
);
if
(
mainClass
==
NULL
)
{
/* exception occured */
if
(
mainClass
==
NULL
)
{
/* exception occured */
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
JLI_
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
goto
leave
;
goto
leave
;
}
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
mainClassName
,
classname
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
mainClassName
,
classname
);
}
else
{
}
else
{
mainClassName
=
NewPlatformString
(
env
,
classname
);
mainClassName
=
NewPlatformString
(
env
,
classname
);
if
(
mainClassName
==
NULL
)
{
if
(
mainClassName
==
NULL
)
{
ReportErrorMessage
(
CLS_ERROR2
,
classname
,
GEN_ERROR
);
JLI_
ReportErrorMessage
(
CLS_ERROR2
,
classname
,
GEN_ERROR
);
goto
leave
;
goto
leave
;
}
}
classname
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
mainClassName
,
0
);
classname
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
mainClassName
,
0
);
if
(
classname
==
NULL
)
{
if
(
classname
==
NULL
)
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
mainClass
=
LoadClass
(
env
,
classname
);
mainClass
=
LoadClass
(
env
,
classname
);
if
(
mainClass
==
NULL
)
{
/* exception occured */
if
(
mainClass
==
NULL
)
{
/* exception occured */
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
JLI_
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
goto
leave
;
goto
leave
;
}
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
mainClassName
,
classname
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
mainClassName
,
classname
);
...
@@ -444,10 +444,10 @@ JavaMain(void * _args)
...
@@ -444,10 +444,10 @@ JavaMain(void * _args)
"([Ljava/lang/String;)V"
);
"([Ljava/lang/String;)V"
);
if
(
mainID
==
NULL
)
{
if
(
mainID
==
NULL
)
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
}
else
{
}
else
{
ReportErrorMessage
(
CLS_ERROR3
);
JLI_
ReportErrorMessage
(
CLS_ERROR3
);
}
}
goto
leave
;
goto
leave
;
}
}
...
@@ -459,8 +459,8 @@ JavaMain(void * _args)
...
@@ -459,8 +459,8 @@ JavaMain(void * _args)
mainID
,
JNI_TRUE
);
mainID
,
JNI_TRUE
);
if
(
obj
==
NULL
)
{
/* exception occurred */
if
(
obj
==
NULL
)
{
/* exception occurred */
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
...
@@ -469,14 +469,14 @@ JavaMain(void * _args)
...
@@ -469,14 +469,14 @@ JavaMain(void * _args)
(
*
env
)
->
GetObjectClass
(
env
,
obj
),
(
*
env
)
->
GetObjectClass
(
env
,
obj
),
"getModifiers"
,
"()I"
);
"getModifiers"
,
"()I"
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
mods
=
(
*
env
)
->
CallIntMethod
(
env
,
obj
,
mid
);
mods
=
(
*
env
)
->
CallIntMethod
(
env
,
obj
,
mid
);
if
((
mods
&
1
)
==
0
)
{
/* if (!Modifier.isPublic(mods)) ... */
if
((
mods
&
1
)
==
0
)
{
/* if (!Modifier.isPublic(mods)) ... */
ReportErrorMessage
(
CLS_ERROR4
);
JLI_
ReportErrorMessage
(
CLS_ERROR4
);
goto
leave
;
goto
leave
;
}
}
}
}
...
@@ -484,8 +484,8 @@ JavaMain(void * _args)
...
@@ -484,8 +484,8 @@ JavaMain(void * _args)
/* Build argument array */
/* Build argument array */
mainArgs
=
NewPlatformStringArray
(
env
,
argv
,
argc
);
mainArgs
=
NewPlatformStringArray
(
env
,
argv
,
argc
);
if
(
mainArgs
==
NULL
)
{
if
(
mainArgs
==
NULL
)
{
ReportExceptionDescription
(
env
);
JLI_
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
goto
leave
;
}
}
...
@@ -506,7 +506,7 @@ JavaMain(void * _args)
...
@@ -506,7 +506,7 @@ JavaMain(void * _args)
* launcher's return code except by calling System.exit.
* launcher's return code except by calling System.exit.
*/
*/
if
((
*
vm
)
->
DetachCurrentThread
(
vm
)
!=
0
)
{
if
((
*
vm
)
->
DetachCurrentThread
(
vm
)
!=
0
)
{
ReportErrorMessage
(
JVM_ERROR2
);
JLI_
ReportErrorMessage
(
JVM_ERROR2
);
ret
=
1
;
ret
=
1
;
goto
leave
;
goto
leave
;
}
}
...
@@ -635,7 +635,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
...
@@ -635,7 +635,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
if
(
loopCount
>
knownVMsCount
)
{
if
(
loopCount
>
knownVMsCount
)
{
if
(
!
speculative
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR1
);
JLI_
ReportErrorMessage
(
CFG_ERROR1
);
exit
(
1
);
exit
(
1
);
}
else
{
}
else
{
return
"ERROR"
;
return
"ERROR"
;
...
@@ -645,7 +645,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
...
@@ -645,7 +645,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
if
(
nextIdx
<
0
)
{
if
(
nextIdx
<
0
)
{
if
(
!
speculative
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR2
,
knownVMs
[
jvmidx
].
alias
);
JLI_
ReportErrorMessage
(
CFG_ERROR2
,
knownVMs
[
jvmidx
].
alias
);
exit
(
1
);
exit
(
1
);
}
else
{
}
else
{
return
"ERROR"
;
return
"ERROR"
;
...
@@ -660,7 +660,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
...
@@ -660,7 +660,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
switch
(
knownVMs
[
jvmidx
].
flag
)
{
switch
(
knownVMs
[
jvmidx
].
flag
)
{
case
VM_WARN
:
case
VM_WARN
:
if
(
!
speculative
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_WARN1
,
jvmtype
,
knownVMs
[
0
].
name
+
1
);
JLI_
ReportErrorMessage
(
CFG_WARN1
,
jvmtype
,
knownVMs
[
0
].
name
+
1
);
}
}
/* fall through */
/* fall through */
case
VM_IGNORE
:
case
VM_IGNORE
:
...
@@ -670,7 +670,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
...
@@ -670,7 +670,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
break
;
break
;
case
VM_ERROR
:
case
VM_ERROR
:
if
(
!
speculative
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR3
,
jvmtype
);
JLI_
ReportErrorMessage
(
CFG_ERROR3
,
jvmtype
);
exit
(
1
);
exit
(
1
);
}
else
{
}
else
{
return
"ERROR"
;
return
"ERROR"
;
...
@@ -879,9 +879,9 @@ SelectVersion(int argc, char **argv, char **main_class)
...
@@ -879,9 +879,9 @@ SelectVersion(int argc, char **argv, char **main_class)
if
(
jarflag
&&
operand
)
{
if
(
jarflag
&&
operand
)
{
if
((
res
=
JLI_ParseManifest
(
operand
,
&
info
))
!=
0
)
{
if
((
res
=
JLI_ParseManifest
(
operand
,
&
info
))
!=
0
)
{
if
(
res
==
-
1
)
if
(
res
==
-
1
)
ReportErrorMessage
(
JAR_ERROR2
,
operand
);
JLI_
ReportErrorMessage
(
JAR_ERROR2
,
operand
);
else
else
ReportErrorMessage
(
JAR_ERROR3
,
operand
);
JLI_
ReportErrorMessage
(
JAR_ERROR3
,
operand
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -948,7 +948,7 @@ SelectVersion(int argc, char **argv, char **main_class)
...
@@ -948,7 +948,7 @@ SelectVersion(int argc, char **argv, char **main_class)
* Check for correct syntax of the version specification (JSR 56).
* Check for correct syntax of the version specification (JSR 56).
*/
*/
if
(
!
JLI_ValidVersionString
(
info
.
jre_version
))
{
if
(
!
JLI_ValidVersionString
(
info
.
jre_version
))
{
ReportErrorMessage
(
SPC_ERROR1
,
info
.
jre_version
);
JLI_
ReportErrorMessage
(
SPC_ERROR1
,
info
.
jre_version
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -970,7 +970,7 @@ SelectVersion(int argc, char **argv, char **main_class)
...
@@ -970,7 +970,7 @@ SelectVersion(int argc, char **argv, char **main_class)
JLI_MemFree
(
new_argv
);
JLI_MemFree
(
new_argv
);
return
;
return
;
}
else
{
}
else
{
ReportErrorMessage
(
CFG_ERROR4
,
info
.
jre_version
);
JLI_
ReportErrorMessage
(
CFG_ERROR4
,
info
.
jre_version
);
exit
(
1
);
exit
(
1
);
}
}
}
}
...
@@ -1040,7 +1040,7 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
...
@@ -1040,7 +1040,7 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
* command line options.
* command line options.
*/
*/
}
else
if
(
JLI_StrCmp
(
arg
,
"-fullversion"
)
==
0
)
{
}
else
if
(
JLI_StrCmp
(
arg
,
"-fullversion"
)
==
0
)
{
ReportMessage
(
"%s full version
\"
%s
\"
"
,
_launcher_name
,
GetFullVersion
());
JLI_
ReportMessage
(
"%s full version
\"
%s
\"
"
,
_launcher_name
,
GetFullVersion
());
return
JNI_FALSE
;
return
JNI_FALSE
;
}
else
if
(
JLI_StrCmp
(
arg
,
"-verbosegc"
)
==
0
)
{
}
else
if
(
JLI_StrCmp
(
arg
,
"-verbosegc"
)
==
0
)
{
AddOption
(
"-verbose:gc"
,
NULL
);
AddOption
(
"-verbose:gc"
,
NULL
);
...
@@ -1080,7 +1080,7 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
...
@@ -1080,7 +1080,7 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
JLI_StrCmp
(
arg
,
"-cs"
)
==
0
||
JLI_StrCmp
(
arg
,
"-cs"
)
==
0
||
JLI_StrCmp
(
arg
,
"-noasyncgc"
)
==
0
)
{
JLI_StrCmp
(
arg
,
"-noasyncgc"
)
==
0
)
{
/* No longer supported */
/* No longer supported */
ReportErrorMessage
(
ARG_WARN
,
arg
);
JLI_
ReportErrorMessage
(
ARG_WARN
,
arg
);
}
else
if
(
JLI_StrCCmp
(
arg
,
"-version:"
)
==
0
||
}
else
if
(
JLI_StrCCmp
(
arg
,
"-version:"
)
==
0
||
JLI_StrCmp
(
arg
,
"-no-jre-restrict-search"
)
==
0
||
JLI_StrCmp
(
arg
,
"-no-jre-restrict-search"
)
==
0
||
JLI_StrCmp
(
arg
,
"-jre-restrict-search"
)
==
0
||
JLI_StrCmp
(
arg
,
"-jre-restrict-search"
)
==
0
||
...
@@ -1143,12 +1143,12 @@ InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
...
@@ -1143,12 +1143,12 @@ InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
#define NULL_CHECK0(e) if ((e) == 0) { \
#define NULL_CHECK0(e) if ((e) == 0) { \
ReportErrorMessage(JNI_ERROR); \
JLI_
ReportErrorMessage(JNI_ERROR); \
return 0; \
return 0; \
}
}
#define NULL_CHECK(e) if ((e) == 0) { \
#define NULL_CHECK(e) if ((e) == 0) { \
ReportErrorMessage(JNI_ERROR); \
JLI_
ReportErrorMessage(JNI_ERROR); \
return; \
return; \
}
}
...
@@ -1351,7 +1351,7 @@ TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***parg
...
@@ -1351,7 +1351,7 @@ TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***parg
char
*
arg
=
argv
[
i
];
char
*
arg
=
argv
[
i
];
if
(
arg
[
0
]
==
'-'
&&
arg
[
1
]
==
'J'
)
{
if
(
arg
[
0
]
==
'-'
&&
arg
[
1
]
==
'J'
)
{
if
(
arg
[
2
]
==
'\0'
)
{
if
(
arg
[
2
]
==
'\0'
)
{
ReportErrorMessage
(
ARG_ERROR3
);
JLI_
ReportErrorMessage
(
ARG_ERROR3
);
exit
(
1
);
exit
(
1
);
}
}
*
nargv
++
=
arg
+
2
;
*
nargv
++
=
arg
+
2
;
...
@@ -1418,7 +1418,7 @@ AddApplicationOptions(int cpathc, const char **cpathv)
...
@@ -1418,7 +1418,7 @@ AddApplicationOptions(int cpathc, const char **cpathv)
}
}
if
(
!
GetApplicationHome
(
home
,
sizeof
(
home
)))
{
if
(
!
GetApplicationHome
(
home
,
sizeof
(
home
)))
{
ReportErrorMessage
(
CFG_ERROR5
);
JLI_
ReportErrorMessage
(
CFG_ERROR5
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
...
@@ -1691,7 +1691,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
...
@@ -1691,7 +1691,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
jvmCfg
=
fopen
(
jvmCfgName
,
"r"
);
jvmCfg
=
fopen
(
jvmCfgName
,
"r"
);
if
(
jvmCfg
==
NULL
)
{
if
(
jvmCfg
==
NULL
)
{
if
(
!
speculative
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR6
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_ERROR6
,
jvmCfgName
);
exit
(
1
);
exit
(
1
);
}
else
{
}
else
{
return
-
1
;
return
-
1
;
...
@@ -1703,7 +1703,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
...
@@ -1703,7 +1703,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
if
(
line
[
0
]
==
'#'
)
if
(
line
[
0
]
==
'#'
)
continue
;
continue
;
if
(
line
[
0
]
!=
'-'
)
{
if
(
line
[
0
]
!=
'-'
)
{
ReportErrorMessage
(
CFG_WARN2
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN2
,
lineno
,
jvmCfgName
);
}
}
if
(
cnt
>=
knownVMsLimit
)
{
if
(
cnt
>=
knownVMsLimit
)
{
GrowKnownVMs
(
cnt
);
GrowKnownVMs
(
cnt
);
...
@@ -1711,13 +1711,13 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
...
@@ -1711,13 +1711,13 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
line
[
JLI_StrLen
(
line
)
-
1
]
=
'\0'
;
/* remove trailing newline */
line
[
JLI_StrLen
(
line
)
-
1
]
=
'\0'
;
/* remove trailing newline */
tmpPtr
=
line
+
JLI_StrCSpn
(
line
,
whiteSpace
);
tmpPtr
=
line
+
JLI_StrCSpn
(
line
,
whiteSpace
);
if
(
*
tmpPtr
==
0
)
{
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
}
else
{
}
else
{
/* Null-terminate this string for JLI_StringDup below */
/* Null-terminate this string for JLI_StringDup below */
*
tmpPtr
++
=
0
;
*
tmpPtr
++
=
0
;
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
if
(
*
tmpPtr
==
0
)
{
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
}
else
{
}
else
{
if
(
!
JLI_StrCCmp
(
tmpPtr
,
"KNOWN"
))
{
if
(
!
JLI_StrCCmp
(
tmpPtr
,
"KNOWN"
))
{
vmType
=
VM_KNOWN
;
vmType
=
VM_KNOWN
;
...
@@ -1727,7 +1727,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
...
@@ -1727,7 +1727,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
}
}
if
(
*
tmpPtr
==
0
)
{
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
}
else
{
}
else
{
/* Null terminate altVMName */
/* Null terminate altVMName */
altVMName
=
tmpPtr
;
altVMName
=
tmpPtr
;
...
@@ -1747,7 +1747,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
...
@@ -1747,7 +1747,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
}
}
if
(
*
tmpPtr
==
0
)
{
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN4
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN4
,
lineno
,
jvmCfgName
);
}
else
{
}
else
{
/* Null terminate server class VM name */
/* Null terminate server class VM name */
serverClassVMName
=
tmpPtr
;
serverClassVMName
=
tmpPtr
;
...
@@ -1756,7 +1756,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
...
@@ -1756,7 +1756,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
vmType
=
VM_IF_SERVER_CLASS
;
vmType
=
VM_IF_SERVER_CLASS
;
}
}
}
else
{
}
else
{
ReportErrorMessage
(
CFG_WARN5
,
lineno
,
&
jvmCfgName
[
0
]);
JLI_
ReportErrorMessage
(
CFG_WARN5
,
lineno
,
&
jvmCfgName
[
0
]);
vmType
=
VM_KNOWN
;
vmType
=
VM_KNOWN
;
}
}
}
}
...
@@ -2019,7 +2019,7 @@ RemovableOption(char * option)
...
@@ -2019,7 +2019,7 @@ RemovableOption(char * option)
* A utility procedure to always print to stderr
* A utility procedure to always print to stderr
*/
*/
void
void
ReportMessage
(
const
char
*
fmt
,
...)
JLI_
ReportMessage
(
const
char
*
fmt
,
...)
{
{
va_list
vl
;
va_list
vl
;
va_start
(
vl
,
fmt
);
va_start
(
vl
,
fmt
);
...
...
src/share/bin/java.h
浏览文件 @
a86a5927
...
@@ -121,24 +121,20 @@ void CreateExecutionEnvironment(int *_argc,
...
@@ -121,24 +121,20 @@ void CreateExecutionEnvironment(int *_argc,
char
jvmpath
[],
char
jvmpath
[],
jint
so_jvmpath
,
jint
so_jvmpath
,
char
**
original_argv
);
char
**
original_argv
);
/* Reports an error message to stderr or a window as appropriate. */
void
JLI_ReportErrorMessage
(
const
char
*
message
,
...);
/*
/* Reports a system error message to stderr or a window */
* Report an error message to stderr or a window as appropriate.
void
JLI_ReportErrorMessageSys
(
const
char
*
message
,
...);
*/
void
ReportErrorMessage
(
const
char
*
message
,
...);
void
ReportErrorMessageSys
(
const
char
*
format
,
...);
/*
/* Reports an error message only to stderr. */
* Report an error message only to stderr.
void
JLI_ReportMessage
(
const
char
*
message
,
...);
*/
void
ReportMessage
(
const
char
*
message
,
...);
/*
/*
* Report an exception which terminates the vm to stderr or a window
* Report
s
an exception which terminates the vm to stderr or a window
* as appropriate.
* as appropriate.
*/
*/
void
ReportExceptionDescription
(
JNIEnv
*
env
);
void
JLI_ReportExceptionDescription
(
JNIEnv
*
env
);
void
PrintMachineDependentOptions
();
void
PrintMachineDependentOptions
();
const
char
*
jlong_format_specifier
();
const
char
*
jlong_format_specifier
();
...
...
src/share/classes/java/lang/management/PlatformComponent.java
浏览文件 @
a86a5927
...
@@ -32,6 +32,7 @@ import java.util.HashSet;
...
@@ -32,6 +32,7 @@ import java.util.HashSet;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.logging.LoggingMXBean
;
import
java.util.logging.LoggingMXBean
;
import
java.util.logging.LogManager
;
import
java.util.logging.LogManager
;
import
java.nio.BufferPoolMXBean
;
import
javax.management.MBeanServerConnection
;
import
javax.management.MBeanServerConnection
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.ObjectName
;
import
javax.management.ObjectName
;
...
@@ -188,6 +189,23 @@ enum PlatformComponent {
...
@@ -188,6 +189,23 @@ enum PlatformComponent {
}
}
}),
}),
/**
* Buffer pools.
*/
BUFFER_POOL
(
"java.nio.BufferPoolMXBean"
,
"java.nio"
,
"BufferPool"
,
keyProperties
(
"name"
),
new
MXBeanFetcher
<
BufferPoolMXBean
>()
{
public
List
<
BufferPoolMXBean
>
getMXBeans
()
{
List
<
BufferPoolMXBean
>
pools
=
new
ArrayList
<
BufferPoolMXBean
>(
2
);
pools
.
add
(
sun
.
misc
.
SharedSecrets
.
getJavaNioAccess
().
getDirectBufferPoolMXBean
()
);
pools
.
add
(
sun
.
nio
.
ch
.
FileChannelImpl
.
getMappedBufferPoolMXBean
()
);
return
pools
;
}
}),
// Sun Platform Extension
// Sun Platform Extension
/**
/**
...
...
src/share/classes/java/net/NetworkInterface.java
浏览文件 @
a86a5927
...
@@ -203,11 +203,17 @@ public final class NetworkInterface {
...
@@ -203,11 +203,17 @@ public final class NetworkInterface {
}
}
/**
/**
* Get the index of this network interface.
* Returns the index of this network interface. The index is an integer greater
* or equal to zero, or {@code -1} for unknown. This is a system specific value
* and interfaces with the same name can have different indexes on different
* machines.
*
*
* @return the index of this network interface
* @return the index of this network interface or {@code -1} if the index is
* unknown
* @see #getByIndex(int)
* @since 1.7
*/
*/
int
getIndex
()
{
public
int
getIndex
()
{
return
index
;
return
index
;
}
}
...
@@ -249,11 +255,18 @@ public final class NetworkInterface {
...
@@ -249,11 +255,18 @@ public final class NetworkInterface {
* Get a network interface given its index.
* Get a network interface given its index.
*
*
* @param index an integer, the index of the interface
* @param index an integer, the index of the interface
* @return the NetworkInterface obtained from its index
* @return the NetworkInterface obtained from its index, or {@code null} if
* @exception SocketException if an I/O error occurs.
* there is no interface with such an index on the system
* @throws SocketException if an I/O error occurs.
* @throws IllegalArgumentException if index has a negative value
* @see #getIndex()
* @since 1.7
*/
*/
native
static
NetworkInterface
getByIndex
(
int
index
)
public
static
NetworkInterface
getByIndex
(
int
index
)
throws
SocketException
{
throws
SocketException
;
if
(
index
<
0
)
throw
new
IllegalArgumentException
(
"Interface index can't be negative"
);
return
getByIndex0
(
index
);
}
/**
/**
* Convenience method to search for a network interface that
* Convenience method to search for a network interface that
...
@@ -325,6 +338,9 @@ public final class NetworkInterface {
...
@@ -325,6 +338,9 @@ public final class NetworkInterface {
private
native
static
NetworkInterface
getByName0
(
String
name
)
private
native
static
NetworkInterface
getByName0
(
String
name
)
throws
SocketException
;
throws
SocketException
;
private
native
static
NetworkInterface
getByIndex0
(
int
index
)
throws
SocketException
;
private
native
static
NetworkInterface
getByInetAddress0
(
InetAddress
addr
)
private
native
static
NetworkInterface
getByInetAddress0
(
InetAddress
addr
)
throws
SocketException
;
throws
SocketException
;
...
...
src/share/classes/java/net/ServerSocket.java
浏览文件 @
a86a5927
...
@@ -142,14 +142,18 @@ class ServerSocket implements java.io.Closeable {
...
@@ -142,14 +142,18 @@ class ServerSocket implements java.io.Closeable {
* as its argument to ensure the operation is allowed.
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
* This could result in a SecurityException.
*
*
* <P>The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed is equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
*
*
* @param port the port number, or <code>0</code> to use a port
* @param port the port number, or <code>0</code> to use a port
* number that is automatically allocated.
* number that is automatically allocated.
* @param backlog the maximum length of the queue.
* @param backlog requested maximum length of the queue of incoming
* connections.
*
*
* @exception IOException if an I/O error occurs when opening the socket.
* @exception IOException if an I/O error occurs when opening the socket.
* @exception SecurityException
* @exception SecurityException
...
@@ -187,13 +191,17 @@ class ServerSocket implements java.io.Closeable {
...
@@ -187,13 +191,17 @@ class ServerSocket implements java.io.Closeable {
* as its argument to ensure the operation is allowed.
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
* This could result in a SecurityException.
*
*
* <P>The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed is equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
* @param port the port number, or <code>0</code> to use a port
* @param port the port number, or <code>0</code> to use a port
* number that is automatically allocated.
* number that is automatically allocated.
* @param backlog the listen backlog
* @param backlog requested maximum length of the queue of incoming
* connections.
* @param bindAddr the local InetAddress the server will bind to
* @param bindAddr the local InetAddress the server will bind to
*
*
* @throws SecurityException if a security manager exists and
* @throws SecurityException if a security manager exists and
...
@@ -321,11 +329,15 @@ class ServerSocket implements java.io.Closeable {
...
@@ -321,11 +329,15 @@ class ServerSocket implements java.io.Closeable {
* If the address is <code>null</code>, then the system will pick up
* If the address is <code>null</code>, then the system will pick up
* an ephemeral port and a valid local address to bind the socket.
* an ephemeral port and a valid local address to bind the socket.
* <P>
* <P>
* The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed is equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* @param endpoint The IP address & port number to bind to.
* @param endpoint The IP address & port number to bind to.
* @param backlog The listen backlog length.
* @param backlog requested maximum length of the queue of
* incoming connections.
* @throws IOException if the bind operation fails, or if the socket
* @throws IOException if the bind operation fails, or if the socket
* is already bound.
* is already bound.
* @throws SecurityException if a <code>SecurityManager</code> is present and
* @throws SecurityException if a <code>SecurityManager</code> is present and
...
...
src/share/classes/java/nio/Bits.java
浏览文件 @
a86a5927
...
@@ -29,6 +29,8 @@ import java.security.AccessController;
...
@@ -29,6 +29,8 @@ import java.security.AccessController;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedAction
;
import
sun.misc.Unsafe
;
import
sun.misc.Unsafe
;
import
sun.misc.VM
;
import
sun.misc.VM
;
import
javax.management.ObjectName
;
import
javax.management.MalformedObjectNameException
;
/**
/**
* Access to bits, native and otherwise.
* Access to bits, native and otherwise.
...
@@ -625,13 +627,15 @@ class Bits { // package-private
...
@@ -625,13 +627,15 @@ class Bits { // package-private
// direct buffer memory. This value may be changed during VM
// direct buffer memory. This value may be changed during VM
// initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
// initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
private
static
volatile
long
maxMemory
=
VM
.
maxDirectMemory
();
private
static
volatile
long
maxMemory
=
VM
.
maxDirectMemory
();
private
static
volatile
long
reservedMemory
=
0
;
private
static
volatile
long
reservedMemory
;
private
static
volatile
long
usedMemory
;
private
static
volatile
long
count
;
private
static
boolean
memoryLimitSet
=
false
;
private
static
boolean
memoryLimitSet
=
false
;
// These methods should be called whenever direct memory is allocated or
// These methods should be called whenever direct memory is allocated or
// freed. They allow the user to control the amount of direct memory
// freed. They allow the user to control the amount of direct memory
// which a process may access. All sizes are specified in bytes.
// which a process may access. All sizes are specified in bytes.
static
void
reserveMemory
(
long
size
)
{
static
void
reserveMemory
(
long
size
,
int
cap
)
{
synchronized
(
Bits
.
class
)
{
synchronized
(
Bits
.
class
)
{
if
(!
memoryLimitSet
&&
VM
.
isBooted
())
{
if
(!
memoryLimitSet
&&
VM
.
isBooted
())
{
...
@@ -640,6 +644,8 @@ class Bits { // package-private
...
@@ -640,6 +644,8 @@ class Bits { // package-private
}
}
if
(
size
<=
maxMemory
-
reservedMemory
)
{
if
(
size
<=
maxMemory
-
reservedMemory
)
{
reservedMemory
+=
size
;
reservedMemory
+=
size
;
usedMemory
+=
cap
;
count
++;
return
;
return
;
}
}
}
}
...
@@ -655,17 +661,71 @@ class Bits { // package-private
...
@@ -655,17 +661,71 @@ class Bits { // package-private
if
(
reservedMemory
+
size
>
maxMemory
)
if
(
reservedMemory
+
size
>
maxMemory
)
throw
new
OutOfMemoryError
(
"Direct buffer memory"
);
throw
new
OutOfMemoryError
(
"Direct buffer memory"
);
reservedMemory
+=
size
;
reservedMemory
+=
size
;
usedMemory
+=
cap
;
count
++;
}
}
}
}
static
synchronized
void
unreserveMemory
(
long
size
)
{
static
synchronized
void
unreserveMemory
(
long
size
,
int
cap
)
{
if
(
reservedMemory
>
0
)
{
if
(
reservedMemory
>
0
)
{
reservedMemory
-=
size
;
reservedMemory
-=
size
;
usedMemory
-=
cap
;
count
--;
assert
(
reservedMemory
>
-
1
);
assert
(
reservedMemory
>
-
1
);
}
}
}
}
// -- Management interface for monitoring of direct buffer usage --
static
{
// setup access to this package in SharedSecrets
sun
.
misc
.
SharedSecrets
.
setJavaNioAccess
(
new
sun
.
misc
.
JavaNioAccess
()
{
@Override
public
BufferPoolMXBean
getDirectBufferPoolMXBean
()
{
return
LazyInitialization
.
directBufferPoolMXBean
;
}
}
);
}
// Lazy initialization of management interface
private
static
class
LazyInitialization
{
static
final
BufferPoolMXBean
directBufferPoolMXBean
=
directBufferPoolMXBean
();
private
static
BufferPoolMXBean
directBufferPoolMXBean
()
{
final
String
pool
=
"direct"
;
final
ObjectName
obj
;
try
{
obj
=
new
ObjectName
(
"java.nio:type=BufferPool,name="
+
pool
);
}
catch
(
MalformedObjectNameException
x
)
{
throw
new
AssertionError
(
x
);
}
return
new
BufferPoolMXBean
()
{
@Override
public
ObjectName
getObjectName
()
{
return
obj
;
}
@Override
public
String
getName
()
{
return
pool
;
}
@Override
public
long
getCount
()
{
return
Bits
.
count
;
}
@Override
public
long
getTotalCapacity
()
{
return
Bits
.
usedMemory
;
}
@Override
public
long
getMemoryUsed
()
{
return
Bits
.
reservedMemory
;
}
};
}
}
// -- Bulk get/put acceleration --
// -- Bulk get/put acceleration --
...
...
src/share/classes/java/nio/BufferPoolMXBean.java
0 → 100644
浏览文件 @
a86a5927
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
java.nio
;
import
java.lang.management.PlatformManagedObject
;
/**
* The management interface for a buffer pool.
*
* <p> A class implementing this interface is an <a href=
* "java.lang.management.ManagementFactory.html#MXBean">MXBean</a>. A Java
* virtual machine has one or more implementations of this interface. The {@link
* java.lang.management.ManagementFactory#getPlatformMXBeans getPlatformMXBeans}
* method can be used to obtain the list of {@code BufferPoolMXBean} objects
* representing the management interfaces for pools of buffers as follows:
* <pre>
* List<BufferPoolMXBean> pools = ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class);
* </pre>
*
* <p> The management interfaces are also registered with the platform {@link
* javax.management.MBeanServer MBeanServer}. The {@link
* javax.management.ObjectName ObjectName} that uniquely identifies the
* management interface within the {@code MBeanServer} takes the form:
* <blockquote>
* <tt>java.nio:type=BufferPool</tt><tt>,name=</tt><i>pool name</i>
* </blockquote>
* where <em>pool name</em> is the {@link #getName name} of the buffer pool.
*
* @since 1.7
*/
public
interface
BufferPoolMXBean
extends
PlatformManagedObject
{
/**
* Returns the name representing this buffer pool.
*
* @return The name of this buffer pool.
*/
String
getName
();
/**
* Returns an estimate of the number of buffers in the pool.
*
* @return An estimate of the number of buffers in this pool
*/
long
getCount
();
/**
* Returns an estimate of the total capacity of the buffers in this pool.
* A buffer's capacity is the number of elements it contains and the value
* returned by this method is an estimate of the total capacity of buffers
* in the pool in bytes.
*
* @return An estimate of the total capacity of the buffers in this pool
* in bytes
*/
long
getTotalCapacity
();
/**
* Returns an estimate of the memory that the Java virtual machine is using
* for this buffer pool. The value returned by this method may differ
* from the estimate of the total {@link #getTotalCapacity capacity} of
* the buffers in this pool. This difference is explained by alignment,
* memory allocator, and other implementation specific reasons.
*
* @return An estimate of the memory that the Java virtual machine is using
* for this buffer pool in bytes, or {@code -1L} if an estimate of
* the memory usage is not available
*/
long
getMemoryUsed
();
}
src/share/classes/java/nio/Direct-X-Buffer.java
浏览文件 @
a86a5927
...
@@ -71,11 +71,13 @@ class Direct$Type$Buffer$RW$$BO$
...
@@ -71,11 +71,13 @@ class Direct$Type$Buffer$RW$$BO$
private
static
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
static
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
long
address
;
private
long
address
;
private
long
size
;
private
int
capacity
;
private
int
capacity
;
private
Deallocator
(
long
address
,
int
capacity
)
{
private
Deallocator
(
long
address
,
long
size
,
int
capacity
)
{
assert
(
address
!=
0
);
assert
(
address
!=
0
);
this
.
address
=
address
;
this
.
address
=
address
;
this
.
size
=
size
;
this
.
capacity
=
capacity
;
this
.
capacity
=
capacity
;
}
}
...
@@ -86,7 +88,7 @@ class Direct$Type$Buffer$RW$$BO$
...
@@ -86,7 +88,7 @@ class Direct$Type$Buffer$RW$$BO$
}
}
unsafe
.
freeMemory
(
address
);
unsafe
.
freeMemory
(
address
);
address
=
0
;
address
=
0
;
Bits
.
unreserveMemory
(
capacity
);
Bits
.
unreserveMemory
(
size
,
capacity
);
}
}
}
}
...
@@ -110,23 +112,25 @@ class Direct$Type$Buffer$RW$$BO$
...
@@ -110,23 +112,25 @@ class Direct$Type$Buffer$RW$$BO$
Direct
$Type$Buffer$RW
$
(
int
cap
)
{
// package-private
Direct
$Type$Buffer$RW
$
(
int
cap
)
{
// package-private
#
if
[
rw
]
#
if
[
rw
]
super
(-
1
,
0
,
cap
,
cap
,
false
);
super
(-
1
,
0
,
cap
,
cap
,
false
);
Bits
.
reserveMemory
(
cap
);
int
ps
=
Bits
.
pageSize
();
int
ps
=
Bits
.
pageSize
();
int
size
=
cap
+
ps
;
Bits
.
reserveMemory
(
size
,
cap
);
long
base
=
0
;
long
base
=
0
;
try
{
try
{
base
=
unsafe
.
allocateMemory
(
cap
+
ps
);
base
=
unsafe
.
allocateMemory
(
size
);
}
catch
(
OutOfMemoryError
x
)
{
}
catch
(
OutOfMemoryError
x
)
{
Bits
.
unreserveMemory
(
cap
);
Bits
.
unreserveMemory
(
size
,
cap
);
throw
x
;
throw
x
;
}
}
unsafe
.
setMemory
(
base
,
cap
+
ps
,
(
byte
)
0
);
unsafe
.
setMemory
(
base
,
size
,
(
byte
)
0
);
if
(
base
%
ps
!=
0
)
{
if
(
base
%
ps
!=
0
)
{
// Round up to page boundary
// Round up to page boundary
address
=
base
+
ps
-
(
base
&
(
ps
-
1
));
address
=
base
+
ps
-
(
base
&
(
ps
-
1
));
}
else
{
}
else
{
address
=
base
;
address
=
base
;
}
}
cleaner
=
Cleaner
.
create
(
this
,
new
Deallocator
(
base
,
cap
));
cleaner
=
Cleaner
.
create
(
this
,
new
Deallocator
(
base
,
size
,
cap
));
#
else
[
rw
]
#
else
[
rw
]
super
(
cap
);
super
(
cap
);
#
end
[
rw
]
#
end
[
rw
]
...
...
src/share/classes/javax/net/ssl/SSLServerSocket.java
浏览文件 @
a86a5927
...
@@ -108,9 +108,12 @@ public abstract class SSLServerSocket extends ServerSocket
...
@@ -108,9 +108,12 @@ public abstract class SSLServerSocket extends ServerSocket
* <P>
* <P>
* A port number of <code>0</code> creates a socket on any free port.
* A port number of <code>0</code> creates a socket on any free port.
* <P>
* <P>
* The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed if equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
* If there is a security manager, its <code>checkListen</code>
* If there is a security manager, its <code>checkListen</code>
* method is called with the <code>port</code> argument as its
* method is called with the <code>port</code> argument as its
...
@@ -118,8 +121,8 @@ public abstract class SSLServerSocket extends ServerSocket
...
@@ -118,8 +121,8 @@ public abstract class SSLServerSocket extends ServerSocket
* in a SecurityException.
* in a SecurityException.
*
*
* @param port the port on which to listen
* @param port the port on which to listen
* @param backlog
how many connections may be pending before
* @param backlog
requested maximum length of the queue of incoming
*
the system should start rejecting new requests
*
connections.
* @throws IOException if an I/O error occurs when creating the socket
* @throws IOException if an I/O error occurs when creating the socket
* @throws SecurityException if a security manager exists and its
* @throws SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation.
* <code>checkListen</code> method doesn't allow the operation.
...
@@ -150,16 +153,19 @@ public abstract class SSLServerSocket extends ServerSocket
...
@@ -150,16 +153,19 @@ public abstract class SSLServerSocket extends ServerSocket
* <P>
* <P>
* A port number of <code>0</code> creates a socket on any free port.
* A port number of <code>0</code> creates a socket on any free port.
* <P>
* <P>
* <P>The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed if equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
* If <i>address</i> is null, it will default accepting connections
* If <i>address</i> is null, it will default accepting connections
* on any/all local addresses.
* on any/all local addresses.
*
*
* @param port the port on which to listen
* @param port the port on which to listen
* @param backlog
how many connections may be pending before
* @param backlog
requested maximum length of the queue of incoming
*
the system should start rejecting new requests
*
connections.
* @param address the address of the network interface through
* @param address the address of the network interface through
* which connections will be accepted
* which connections will be accepted
* @throws IOException if an I/O error occurs when creating the socket
* @throws IOException if an I/O error occurs when creating the socket
...
...
src/share/classes/sun/misc/JavaNioAccess.java
0 → 100644
浏览文件 @
a86a5927
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package
sun.misc
;
import
java.nio.BufferPoolMXBean
;
public
interface
JavaNioAccess
{
BufferPoolMXBean
getDirectBufferPoolMXBean
();
}
src/share/classes/sun/misc/SharedSecrets.java
浏览文件 @
a86a5927
...
@@ -46,6 +46,7 @@ public class SharedSecrets {
...
@@ -46,6 +46,7 @@ public class SharedSecrets {
private
static
JavaIOAccess
javaIOAccess
;
private
static
JavaIOAccess
javaIOAccess
;
private
static
JavaIODeleteOnExitAccess
javaIODeleteOnExitAccess
;
private
static
JavaIODeleteOnExitAccess
javaIODeleteOnExitAccess
;
private
static
JavaNetAccess
javaNetAccess
;
private
static
JavaNetAccess
javaNetAccess
;
private
static
JavaNioAccess
javaNioAccess
;
private
static
JavaIOFileDescriptorAccess
javaIOFileDescriptorAccess
;
private
static
JavaIOFileDescriptorAccess
javaIOFileDescriptorAccess
;
public
static
JavaUtilJarAccess
javaUtilJarAccess
()
{
public
static
JavaUtilJarAccess
javaUtilJarAccess
()
{
...
@@ -77,6 +78,20 @@ public class SharedSecrets {
...
@@ -77,6 +78,20 @@ public class SharedSecrets {
return
javaNetAccess
;
return
javaNetAccess
;
}
}
public
static
void
setJavaNioAccess
(
JavaNioAccess
jna
)
{
javaNioAccess
=
jna
;
}
public
static
JavaNioAccess
getJavaNioAccess
()
{
if
(
javaNioAccess
==
null
)
{
// Ensure java.nio.ByteOrder is initialized; we know that
// this class initializes java.nio.Bits that provides the
// shared secret.
unsafe
.
ensureClassInitialized
(
java
.
nio
.
ByteOrder
.
class
);
}
return
javaNioAccess
;
}
public
static
void
setJavaIOAccess
(
JavaIOAccess
jia
)
{
public
static
void
setJavaIOAccess
(
JavaIOAccess
jia
)
{
javaIOAccess
=
jia
;
javaIOAccess
=
jia
;
}
}
...
...
src/share/classes/sun/nio/ch/FileChannelImpl.java
浏览文件 @
a86a5927
...
@@ -32,6 +32,7 @@ import java.io.RandomAccessFile;
...
@@ -32,6 +32,7 @@ import java.io.RandomAccessFile;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.BufferPoolMXBean
;
import
java.nio.channels.*
;
import
java.nio.channels.*
;
import
java.nio.channels.spi.*
;
import
java.nio.channels.spi.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -43,10 +44,12 @@ import java.lang.ref.ReferenceQueue;
...
@@ -43,10 +44,12 @@ import java.lang.ref.ReferenceQueue;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.security.AccessController
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.security.PrivilegedAction
;
import
javax.management.ObjectName
;
import
javax.management.MalformedObjectNameException
;
import
sun.misc.Cleaner
;
import
sun.misc.Cleaner
;
import
sun.security.action.GetPropertyAction
;
import
sun.security.action.GetPropertyAction
;
public
class
FileChannelImpl
public
class
FileChannelImpl
extends
FileChannel
extends
FileChannel
{
{
...
@@ -681,14 +684,26 @@ public class FileChannelImpl
...
@@ -681,14 +684,26 @@ public class FileChannelImpl
private
static
class
Unmapper
private
static
class
Unmapper
implements
Runnable
implements
Runnable
{
{
// keep track of mapped buffer usage
static
volatile
int
count
;
static
volatile
long
totalSize
;
static
volatile
long
totalCapacity
;
private
long
address
;
private
long
address
;
private
long
size
;
private
long
size
;
private
int
cap
;
private
Unmapper
(
long
address
,
long
size
)
{
private
Unmapper
(
long
address
,
long
size
,
int
cap
)
{
assert
(
address
!=
0
);
assert
(
address
!=
0
);
this
.
address
=
address
;
this
.
address
=
address
;
this
.
size
=
size
;
this
.
size
=
size
;
this
.
cap
=
cap
;
synchronized
(
Unmapper
.
class
)
{
count
++;
totalSize
+=
size
;
totalCapacity
+=
cap
;
}
}
}
public
void
run
()
{
public
void
run
()
{
...
@@ -696,8 +711,13 @@ public class FileChannelImpl
...
@@ -696,8 +711,13 @@ public class FileChannelImpl
return
;
return
;
unmap0
(
address
,
size
);
unmap0
(
address
,
size
);
address
=
0
;
address
=
0
;
}
synchronized
(
Unmapper
.
class
)
{
count
--;
totalSize
-=
size
;
totalCapacity
-=
cap
;
}
}
}
}
private
static
void
unmap
(
MappedByteBuffer
bb
)
{
private
static
void
unmap
(
MappedByteBuffer
bb
)
{
...
@@ -786,7 +806,7 @@ public class FileChannelImpl
...
@@ -786,7 +806,7 @@ public class FileChannelImpl
assert
(
IOStatus
.
checkAll
(
addr
));
assert
(
IOStatus
.
checkAll
(
addr
));
assert
(
addr
%
allocationGranularity
==
0
);
assert
(
addr
%
allocationGranularity
==
0
);
int
isize
=
(
int
)
size
;
int
isize
=
(
int
)
size
;
Unmapper
um
=
new
Unmapper
(
addr
,
size
+
pagePosition
);
Unmapper
um
=
new
Unmapper
(
addr
,
size
+
pagePosition
,
isize
);
if
((!
writable
)
||
(
imode
==
MAP_RO
))
if
((!
writable
)
||
(
imode
==
MAP_RO
))
return
Util
.
newMappedByteBufferR
(
isize
,
addr
+
pagePosition
,
um
);
return
Util
.
newMappedByteBufferR
(
isize
,
addr
+
pagePosition
,
um
);
else
else
...
@@ -797,6 +817,49 @@ public class FileChannelImpl
...
@@ -797,6 +817,49 @@ public class FileChannelImpl
}
}
}
}
/**
* Returns the management interface for mapped buffers
*/
public
static
BufferPoolMXBean
getMappedBufferPoolMXBean
()
{
return
LazyInitialization
.
mappedBufferPoolMXBean
;
}
// Lazy initialization of management interface
private
static
class
LazyInitialization
{
static
final
BufferPoolMXBean
mappedBufferPoolMXBean
=
mappedBufferPoolMXBean
();
private
static
BufferPoolMXBean
mappedBufferPoolMXBean
()
{
final
String
pool
=
"mapped"
;
final
ObjectName
obj
;
try
{
obj
=
new
ObjectName
(
"java.nio:type=BufferPool,name="
+
pool
);
}
catch
(
MalformedObjectNameException
x
)
{
throw
new
AssertionError
(
x
);
}
return
new
BufferPoolMXBean
()
{
@Override
public
ObjectName
getObjectName
()
{
return
obj
;
}
@Override
public
String
getName
()
{
return
pool
;
}
@Override
public
long
getCount
()
{
return
Unmapper
.
count
;
}
@Override
public
long
getTotalCapacity
()
{
return
Unmapper
.
totalCapacity
;
}
@Override
public
long
getMemoryUsed
()
{
return
Unmapper
.
totalSize
;
}
};
}
}
// -- Locks --
// -- Locks --
...
...
src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
浏览文件 @
a86a5927
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
package
sun.reflect.generics.factory
;
package
sun.reflect.generics.factory
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.GenericDeclaration
;
import
java.lang.reflect.GenericDeclaration
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
...
@@ -118,7 +119,10 @@ public class CoreReflectionFactory implements GenericsFactory {
...
@@ -118,7 +119,10 @@ public class CoreReflectionFactory implements GenericsFactory {
}
}
public
Type
makeArrayType
(
Type
componentType
){
public
Type
makeArrayType
(
Type
componentType
){
return
GenericArrayTypeImpl
.
make
(
componentType
);
if
(
componentType
instanceof
Class
<?>)
return
Array
.
newInstance
((
Class
<?>)
componentType
,
0
).
getClass
();
else
return
GenericArrayTypeImpl
.
make
(
componentType
);
}
}
public
Type
makeByte
(){
return
byte
.
class
;}
public
Type
makeByte
(){
return
byte
.
class
;}
...
...
src/share/classes/sun/security/util/DerIndefLenConverter.java
浏览文件 @
a86a5927
/*
/*
* Copyright 1998-200
6
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-200
8
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,6 +50,7 @@ class DerIndefLenConverter {
...
@@ -50,6 +50,7 @@ class DerIndefLenConverter {
private
byte
[]
data
,
newData
;
private
byte
[]
data
,
newData
;
private
int
newDataPos
,
dataPos
,
dataSize
,
index
;
private
int
newDataPos
,
dataPos
,
dataSize
,
index
;
private
int
unresolved
=
0
;
private
ArrayList
<
Object
>
ndefsList
=
new
ArrayList
<
Object
>();
private
ArrayList
<
Object
>
ndefsList
=
new
ArrayList
<
Object
>();
...
@@ -113,6 +114,7 @@ class DerIndefLenConverter {
...
@@ -113,6 +114,7 @@ class DerIndefLenConverter {
numOfEncapsulatedLenBytes
;
numOfEncapsulatedLenBytes
;
byte
[]
sectionLenBytes
=
getLengthBytes
(
sectionLen
);
byte
[]
sectionLenBytes
=
getLengthBytes
(
sectionLen
);
ndefsList
.
set
(
index
,
sectionLenBytes
);
ndefsList
.
set
(
index
,
sectionLenBytes
);
unresolved
--;
// Add the number of bytes required to represent this section
// Add the number of bytes required to represent this section
// to the total number of length bytes,
// to the total number of length bytes,
...
@@ -149,6 +151,7 @@ class DerIndefLenConverter {
...
@@ -149,6 +151,7 @@ class DerIndefLenConverter {
int
lenByte
=
data
[
dataPos
++]
&
0xff
;
int
lenByte
=
data
[
dataPos
++]
&
0xff
;
if
(
isIndefinite
(
lenByte
))
{
if
(
isIndefinite
(
lenByte
))
{
ndefsList
.
add
(
new
Integer
(
dataPos
));
ndefsList
.
add
(
new
Integer
(
dataPos
));
unresolved
++;
return
curLen
;
return
curLen
;
}
}
if
(
isLongForm
(
lenByte
))
{
if
(
isLongForm
(
lenByte
))
{
...
@@ -308,15 +311,21 @@ class DerIndefLenConverter {
...
@@ -308,15 +311,21 @@ class DerIndefLenConverter {
dataPos
=
0
;
index
=
0
;
dataPos
=
0
;
index
=
0
;
dataSize
=
data
.
length
;
dataSize
=
data
.
length
;
int
len
=
0
;
int
len
=
0
;
int
unused
=
0
;
// parse and set up the vectors of all the indefinite-lengths
// parse and set up the vectors of all the indefinite-lengths
while
(
dataPos
<
dataSize
)
{
while
(
dataPos
<
dataSize
)
{
parseTag
();
parseTag
();
len
=
parseLength
();
len
=
parseLength
();
parseValue
(
len
);
parseValue
(
len
);
if
(
unresolved
==
0
)
{
unused
=
dataSize
-
dataPos
;
dataSize
=
dataPos
;
break
;
}
}
}
newData
=
new
byte
[
dataSize
+
numOfTotalLenBytes
];
newData
=
new
byte
[
dataSize
+
numOfTotalLenBytes
+
unused
];
dataPos
=
0
;
newDataPos
=
0
;
index
=
0
;
dataPos
=
0
;
newDataPos
=
0
;
index
=
0
;
// write out the new byte array replacing all the indefinite-lengths
// write out the new byte array replacing all the indefinite-lengths
...
@@ -325,6 +334,8 @@ class DerIndefLenConverter {
...
@@ -325,6 +334,8 @@ class DerIndefLenConverter {
writeTag
();
writeTag
();
writeLengthAndValue
();
writeLengthAndValue
();
}
}
System
.
arraycopy
(
indefData
,
dataSize
,
newData
,
dataSize
+
numOfTotalLenBytes
,
unused
);
return
newData
;
return
newData
;
}
}
...
...
src/solaris/bin/java_md.c
浏览文件 @
a86a5927
...
@@ -289,13 +289,13 @@ CreateExecutionEnvironment(int *_argcp,
...
@@ -289,13 +289,13 @@ CreateExecutionEnvironment(int *_argcp,
if
(
wanted
==
running
)
{
if
(
wanted
==
running
)
{
/* Find out where the JRE is that we will be using. */
/* Find out where the JRE is that we will be using. */
if
(
!
GetJREPath
(
jrepath
,
so_jrepath
,
arch
,
JNI_FALSE
)
)
{
if
(
!
GetJREPath
(
jrepath
,
so_jrepath
,
arch
,
JNI_FALSE
)
)
{
ReportErrorMessage
(
JRE_ERROR1
);
JLI_
ReportErrorMessage
(
JRE_ERROR1
);
exit
(
2
);
exit
(
2
);
}
}
/* Find the specified JVM type */
/* Find the specified JVM type */
if
(
ReadKnownVMs
(
jrepath
,
arch
,
JNI_FALSE
)
<
1
)
{
if
(
ReadKnownVMs
(
jrepath
,
arch
,
JNI_FALSE
)
<
1
)
{
ReportErrorMessage
(
CFG_ERROR7
);
JLI_
ReportErrorMessage
(
CFG_ERROR7
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -303,7 +303,7 @@ CreateExecutionEnvironment(int *_argcp,
...
@@ -303,7 +303,7 @@ CreateExecutionEnvironment(int *_argcp,
jvmtype
=
CheckJvmType
(
_argcp
,
_argvp
,
JNI_FALSE
);
jvmtype
=
CheckJvmType
(
_argcp
,
_argvp
,
JNI_FALSE
);
if
(
!
GetJVMPath
(
jrepath
,
jvmtype
,
jvmpath
,
so_jvmpath
,
arch
))
{
if
(
!
GetJVMPath
(
jrepath
,
jvmtype
,
jvmpath
,
so_jvmpath
,
arch
))
{
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
JLI_
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
exit
(
4
);
exit
(
4
);
}
}
}
else
{
/* do the same speculatively or exit */
}
else
{
/* do the same speculatively or exit */
...
@@ -330,7 +330,7 @@ CreateExecutionEnvironment(int *_argcp,
...
@@ -330,7 +330,7 @@ CreateExecutionEnvironment(int *_argcp,
EndDataModelSpeculate:
/* give up and let other code report error message */
EndDataModelSpeculate:
/* give up and let other code report error message */
;
;
#else
#else
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
JLI_
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
exit
(
1
);
exit
(
1
);
#endif
#endif
}
}
...
@@ -391,7 +391,7 @@ CreateExecutionEnvironment(int *_argcp,
...
@@ -391,7 +391,7 @@ CreateExecutionEnvironment(int *_argcp,
break
;
break
;
default:
default:
ReportErrorMessage
(
JRE_ERROR3
,
__LINE__
);
JLI_
ReportErrorMessage
(
JRE_ERROR3
,
__LINE__
);
exit
(
1
);
/* unknown value in wanted */
exit
(
1
);
/* unknown value in wanted */
break
;
break
;
}
}
...
@@ -553,17 +553,17 @@ CreateExecutionEnvironment(int *_argcp,
...
@@ -553,17 +553,17 @@ CreateExecutionEnvironment(int *_argcp,
(
void
)
fflush
(
stdout
);
(
void
)
fflush
(
stdout
);
(
void
)
fflush
(
stderr
);
(
void
)
fflush
(
stderr
);
execve
(
newexec
,
argv
,
newenvp
);
execve
(
newexec
,
argv
,
newenvp
);
ReportErrorMessageSys
(
JRE_ERROR4
,
newexec
);
JLI_
ReportErrorMessageSys
(
JRE_ERROR4
,
newexec
);
#ifdef DUAL_MODE
#ifdef DUAL_MODE
if
(
running
!=
wanted
)
{
if
(
running
!=
wanted
)
{
ReportErrorMessage
(
JRE_ERROR5
,
wanted
,
running
);
JLI_
ReportErrorMessage
(
JRE_ERROR5
,
wanted
,
running
);
# ifdef __solaris__
# ifdef __solaris__
# ifdef __sparc
# ifdef __sparc
ReportErrorMessage
(
JRE_ERROR6
);
JLI_
ReportErrorMessage
(
JRE_ERROR6
);
# else
# else
ReportErrorMessage
(
JRE_ERROR7
);
JLI_
ReportErrorMessage
(
JRE_ERROR7
);
# endif
# endif
}
}
# endif
# endif
...
@@ -627,7 +627,7 @@ GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative)
...
@@ -627,7 +627,7 @@ GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative)
}
}
if
(
!
speculative
)
if
(
!
speculative
)
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
JLI_
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
return
JNI_FALSE
;
return
JNI_FALSE
;
found:
found:
...
@@ -680,13 +680,13 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
...
@@ -680,13 +680,13 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
if
(
length
>
0
)
{
if
(
length
>
0
)
{
location
=
JLI_StrStr
(
buf
,
"sparcv8plus "
);
location
=
JLI_StrStr
(
buf
,
"sparcv8plus "
);
if
(
location
==
NULL
)
{
if
(
location
==
NULL
)
{
ReportErrorMessage
(
JVM_ERROR3
);
JLI_
ReportErrorMessage
(
JVM_ERROR3
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
}
}
}
}
#endif
#endif
ReportErrorMessage
(
DLL_ERROR1
,
__LINE__
);
JLI_
ReportErrorMessage
(
DLL_ERROR1
,
__LINE__
);
goto
error
;
goto
error
;
}
}
...
@@ -703,7 +703,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
...
@@ -703,7 +703,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
return
JNI_TRUE
;
return
JNI_TRUE
;
error:
error:
ReportErrorMessage
(
DLL_ERROR2
,
jvmpath
,
dlerror
());
JLI_
ReportErrorMessage
(
DLL_ERROR2
,
jvmpath
,
dlerror
());
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
...
@@ -848,7 +848,7 @@ SetExecname(char **argv)
...
@@ -848,7 +848,7 @@ SetExecname(char **argv)
fptr
=
(
int
(
*
)())
dlsym
(
RTLD_DEFAULT
,
"main"
);
fptr
=
(
int
(
*
)())
dlsym
(
RTLD_DEFAULT
,
"main"
);
if
(
fptr
==
NULL
)
{
if
(
fptr
==
NULL
)
{
ReportErrorMessage
(
DLL_ERROR3
,
dlerror
());
JLI_
ReportErrorMessage
(
DLL_ERROR3
,
dlerror
());
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
...
@@ -885,7 +885,7 @@ SetExecname(char **argv)
...
@@ -885,7 +885,7 @@ SetExecname(char **argv)
return
exec_path
;
return
exec_path
;
}
}
void
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
void
JLI_
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
va_list
vl
;
va_list
vl
;
va_start
(
vl
,
fmt
);
va_start
(
vl
,
fmt
);
vfprintf
(
stderr
,
fmt
,
vl
);
vfprintf
(
stderr
,
fmt
,
vl
);
...
@@ -893,7 +893,7 @@ void ReportErrorMessage(const char* fmt, ...) {
...
@@ -893,7 +893,7 @@ void ReportErrorMessage(const char* fmt, ...) {
va_end
(
vl
);
va_end
(
vl
);
}
}
void
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
{
void
JLI_
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
{
va_list
vl
;
va_list
vl
;
char
*
emsg
;
char
*
emsg
;
...
@@ -912,7 +912,7 @@ void ReportErrorMessageSys(const char* fmt, ...) {
...
@@ -912,7 +912,7 @@ void ReportErrorMessageSys(const char* fmt, ...) {
va_end
(
vl
);
va_end
(
vl
);
}
}
void
ReportExceptionDescription
(
JNIEnv
*
env
)
{
void
JLI_
ReportExceptionDescription
(
JNIEnv
*
env
)
{
(
*
env
)
->
ExceptionDescribe
(
env
);
(
*
env
)
->
ExceptionDescribe
(
env
);
}
}
...
@@ -1078,7 +1078,7 @@ ExecJRE(char *jre, char **argv)
...
@@ -1078,7 +1078,7 @@ ExecJRE(char *jre, char **argv)
* Resolve the real path to the directory containing the selected JRE.
* Resolve the real path to the directory containing the selected JRE.
*/
*/
if
(
realpath
(
jre
,
wanted
)
==
NULL
)
{
if
(
realpath
(
jre
,
wanted
)
==
NULL
)
{
ReportErrorMessage
(
JRE_ERROR9
,
jre
);
JLI_
ReportErrorMessage
(
JRE_ERROR9
,
jre
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -1087,7 +1087,7 @@ ExecJRE(char *jre, char **argv)
...
@@ -1087,7 +1087,7 @@ ExecJRE(char *jre, char **argv)
*/
*/
SetExecname
(
argv
);
SetExecname
(
argv
);
if
(
execname
==
NULL
)
{
if
(
execname
==
NULL
)
{
ReportErrorMessage
(
JRE_ERROR10
);
JLI_
ReportErrorMessage
(
JRE_ERROR10
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -1106,7 +1106,7 @@ ExecJRE(char *jre, char **argv)
...
@@ -1106,7 +1106,7 @@ ExecJRE(char *jre, char **argv)
* can be so deadly.
* can be so deadly.
*/
*/
if
(
JLI_StrLen
(
wanted
)
+
JLI_StrLen
(
progname
)
+
6
>
PATH_MAX
)
{
if
(
JLI_StrLen
(
wanted
)
+
JLI_StrLen
(
progname
)
+
6
>
PATH_MAX
)
{
ReportErrorMessage
(
JRE_ERROR11
);
JLI_
ReportErrorMessage
(
JRE_ERROR11
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -1126,7 +1126,7 @@ ExecJRE(char *jre, char **argv)
...
@@ -1126,7 +1126,7 @@ ExecJRE(char *jre, char **argv)
(
void
)
fflush
(
stdout
);
(
void
)
fflush
(
stdout
);
(
void
)
fflush
(
stderr
);
(
void
)
fflush
(
stderr
);
execv
(
wanted
,
argv
);
execv
(
wanted
,
argv
);
ReportErrorMessageSys
(
JRE_ERROR12
,
wanted
);
JLI_
ReportErrorMessageSys
(
JRE_ERROR12
,
wanted
);
exit
(
1
);
exit
(
1
);
}
}
...
...
src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
浏览文件 @
a86a5927
...
@@ -69,11 +69,11 @@ class EPollArrayWrapper {
...
@@ -69,11 +69,11 @@ class EPollArrayWrapper {
static
final
int
EPOLL_CTL_MOD
=
3
;
static
final
int
EPOLL_CTL_MOD
=
3
;
// Miscellaneous constants
// Miscellaneous constants
static
final
short
SIZE_EPOLLEVENT
=
12
;
static
final
int
SIZE_EPOLLEVENT
=
sizeofEPollEvent
()
;
static
final
shor
t
EVENT_OFFSET
=
0
;
static
final
in
t
EVENT_OFFSET
=
0
;
static
final
short
DATA_OFFSET
=
4
;
static
final
int
DATA_OFFSET
=
offsetofData
()
;
static
final
short
FD_OFFSET
=
4
;
static
final
int
FD_OFFSET
=
DATA_OFFSET
;
static
final
int
NUM_EPOLLEVENTS
=
Math
.
min
(
fdLimit
(),
8192
);
static
final
int
NUM_EPOLLEVENTS
=
Math
.
min
(
fdLimit
(),
8192
);
// Base address of the native pollArray
// Base address of the native pollArray
private
final
long
pollArrayAddress
;
private
final
long
pollArrayAddress
;
...
@@ -280,6 +280,8 @@ class EPollArrayWrapper {
...
@@ -280,6 +280,8 @@ class EPollArrayWrapper {
private
native
void
epollCtl
(
int
epfd
,
int
opcode
,
int
fd
,
int
events
);
private
native
void
epollCtl
(
int
epfd
,
int
opcode
,
int
fd
,
int
events
);
private
native
int
epollWait
(
long
pollAddress
,
int
numfds
,
long
timeout
,
private
native
int
epollWait
(
long
pollAddress
,
int
numfds
,
long
timeout
,
int
epfd
)
throws
IOException
;
int
epfd
)
throws
IOException
;
private
static
native
int
sizeofEPollEvent
();
private
static
native
int
offsetofData
();
private
static
native
int
fdLimit
();
private
static
native
int
fdLimit
();
private
static
native
void
interrupt
(
int
fd
);
private
static
native
void
interrupt
(
int
fd
);
private
static
native
void
init
();
private
static
native
void
init
();
...
...
src/solaris/native/java/net/NetworkInterface.c
浏览文件 @
a86a5927
...
@@ -206,10 +206,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
...
@@ -206,10 +206,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
/*
/*
* Class: java_net_NetworkInterface
* Class: java_net_NetworkInterface
* Method: getByIndex
* Method: getByIndex
0
* Signature: (Ljava/lang/String;)Ljava/net/NetworkInterface;
* Signature: (Ljava/lang/String;)Ljava/net/NetworkInterface;
*/
*/
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
netif
*
ifs
,
*
curr
;
netif
*
ifs
,
*
curr
;
...
...
src/solaris/native/java/net/PlainDatagramSocketImpl.c
浏览文件 @
a86a5927
...
@@ -1741,7 +1741,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
...
@@ -1741,7 +1741,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
* (for IF).
* (for IF).
*/
*/
if
(
index
>
0
)
{
if
(
index
>
0
)
{
ni
=
Java_java_net_NetworkInterface_getByIndex
(
env
,
ni_class
,
ni
=
Java_java_net_NetworkInterface_getByIndex
0
(
env
,
ni_class
,
index
);
index
);
if
(
ni
==
NULL
)
{
if
(
ni
==
NULL
)
{
char
errmsg
[
255
];
char
errmsg
[
255
];
...
...
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
浏览文件 @
a86a5927
...
@@ -48,10 +48,18 @@ typedef union epoll_data {
...
@@ -48,10 +48,18 @@ typedef union epoll_data {
__uint64_t
u64
;
__uint64_t
u64
;
}
epoll_data_t
;
}
epoll_data_t
;
/* x86-64 has same alignment as 32-bit */
#ifdef __x86_64__
#define EPOLL_PACKED __attribute__((packed))
#else
#define EPOLL_PACKED
#endif
struct
epoll_event
{
struct
epoll_event
{
__uint32_t
events
;
/* Epoll events */
__uint32_t
events
;
/* Epoll events */
epoll_data_t
data
;
/* User data variable */
epoll_data_t
data
;
/* User data variable */
}
__attribute__
((
__packed__
))
;
}
EPOLL_PACKED
;
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
@@ -143,6 +151,18 @@ Java_sun_nio_ch_EPollArrayWrapper_fdLimit(JNIEnv *env, jclass this)
...
@@ -143,6 +151,18 @@ Java_sun_nio_ch_EPollArrayWrapper_fdLimit(JNIEnv *env, jclass this)
return
(
jint
)
rlp
.
rlim_max
;
return
(
jint
)
rlp
.
rlim_max
;
}
}
JNIEXPORT
jint
JNICALL
Java_sun_nio_ch_EPollArrayWrapper_sizeofEPollEvent
(
JNIEnv
*
env
,
jclass
this
)
{
return
sizeof
(
struct
epoll_event
);
}
JNIEXPORT
jint
JNICALL
Java_sun_nio_ch_EPollArrayWrapper_offsetofData
(
JNIEnv
*
env
,
jclass
this
)
{
return
offsetof
(
struct
epoll_event
,
data
);
}
JNIEXPORT
void
JNICALL
JNIEXPORT
void
JNICALL
Java_sun_nio_ch_EPollArrayWrapper_epollCtl
(
JNIEnv
*
env
,
jobject
this
,
jint
epfd
,
Java_sun_nio_ch_EPollArrayWrapper_epollCtl
(
JNIEnv
*
env
,
jobject
this
,
jint
epfd
,
jint
opcode
,
jint
fd
,
jint
events
)
jint
opcode
,
jint
fd
,
jint
events
)
...
...
src/windows/bin/java_md.c
浏览文件 @
a86a5927
...
@@ -105,26 +105,26 @@ CreateExecutionEnvironment(int *_argc,
...
@@ -105,26 +105,26 @@ CreateExecutionEnvironment(int *_argc,
}
}
}
}
if
(
running
!=
wanted
)
{
if
(
running
!=
wanted
)
{
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
JLI_
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
exit
(
1
);
exit
(
1
);
}
}
/* Find out where the JRE is that we will be using. */
/* Find out where the JRE is that we will be using. */
if
(
!
GetJREPath
(
jrepath
,
so_jrepath
))
{
if
(
!
GetJREPath
(
jrepath
,
so_jrepath
))
{
ReportErrorMessage
(
JRE_ERROR1
);
JLI_
ReportErrorMessage
(
JRE_ERROR1
);
exit
(
2
);
exit
(
2
);
}
}
/* Find the specified JVM type */
/* Find the specified JVM type */
if
(
ReadKnownVMs
(
jrepath
,
(
char
*
)
GetArch
(),
JNI_FALSE
)
<
1
)
{
if
(
ReadKnownVMs
(
jrepath
,
(
char
*
)
GetArch
(),
JNI_FALSE
)
<
1
)
{
ReportErrorMessage
(
CFG_ERROR7
);
JLI_
ReportErrorMessage
(
CFG_ERROR7
);
exit
(
1
);
exit
(
1
);
}
}
jvmtype
=
CheckJvmType
(
_argc
,
_argv
,
JNI_FALSE
);
jvmtype
=
CheckJvmType
(
_argc
,
_argv
,
JNI_FALSE
);
jvmpath
[
0
]
=
'\0'
;
jvmpath
[
0
]
=
'\0'
;
if
(
!
GetJVMPath
(
jrepath
,
jvmtype
,
jvmpath
,
so_jvmpath
))
{
if
(
!
GetJVMPath
(
jrepath
,
jvmtype
,
jvmpath
,
so_jvmpath
))
{
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
JLI_
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
exit
(
4
);
exit
(
4
);
}
}
/* If we got here, jvmpath has been correctly initialized. */
/* If we got here, jvmpath has been correctly initialized. */
...
@@ -160,7 +160,7 @@ GetJREPath(char *path, jint pathsize)
...
@@ -160,7 +160,7 @@ GetJREPath(char *path, jint pathsize)
goto
found
;
goto
found
;
}
}
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
JLI_
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
return
JNI_FALSE
;
return
JNI_FALSE
;
found:
found:
...
@@ -212,7 +212,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
...
@@ -212,7 +212,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
JLI_TraceLauncher
(
"CRT path is %s
\n
"
,
crtpath
);
JLI_TraceLauncher
(
"CRT path is %s
\n
"
,
crtpath
);
if
(
_access
(
crtpath
,
0
)
==
0
)
{
if
(
_access
(
crtpath
,
0
)
==
0
)
{
if
(
LoadLibrary
(
crtpath
)
==
0
)
{
if
(
LoadLibrary
(
crtpath
)
==
0
)
{
ReportErrorMessage
(
DLL_ERROR4
,
crtpath
);
JLI_
ReportErrorMessage
(
DLL_ERROR4
,
crtpath
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
}
}
...
@@ -220,7 +220,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
...
@@ -220,7 +220,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
/* Load the Java VM DLL */
/* Load the Java VM DLL */
if
((
handle
=
LoadLibrary
(
jvmpath
))
==
0
)
{
if
((
handle
=
LoadLibrary
(
jvmpath
))
==
0
)
{
ReportErrorMessage
(
DLL_ERROR4
,
(
char
*
)
jvmpath
);
JLI_
ReportErrorMessage
(
DLL_ERROR4
,
(
char
*
)
jvmpath
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
...
@@ -230,7 +230,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
...
@@ -230,7 +230,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
ifn
->
GetDefaultJavaVMInitArgs
=
ifn
->
GetDefaultJavaVMInitArgs
=
(
void
*
)
GetProcAddress
(
handle
,
"JNI_GetDefaultJavaVMInitArgs"
);
(
void
*
)
GetProcAddress
(
handle
,
"JNI_GetDefaultJavaVMInitArgs"
);
if
(
ifn
->
CreateJavaVM
==
0
||
ifn
->
GetDefaultJavaVMInitArgs
==
0
)
{
if
(
ifn
->
CreateJavaVM
==
0
||
ifn
->
GetDefaultJavaVMInitArgs
==
0
)
{
ReportErrorMessage
(
JNI_ERROR1
,
(
char
*
)
jvmpath
);
JLI_
ReportErrorMessage
(
JNI_ERROR1
,
(
char
*
)
jvmpath
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
...
@@ -292,19 +292,19 @@ GetPublicJREHome(char *buf, jint bufsize)
...
@@ -292,19 +292,19 @@ GetPublicJREHome(char *buf, jint bufsize)
/* Find the current version of the JRE */
/* Find the current version of the JRE */
if
(
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
JRE_KEY
,
0
,
KEY_READ
,
&
key
)
!=
0
)
{
if
(
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
JRE_KEY
,
0
,
KEY_READ
,
&
key
)
!=
0
)
{
ReportErrorMessage
(
REG_ERROR1
,
JRE_KEY
);
JLI_
ReportErrorMessage
(
REG_ERROR1
,
JRE_KEY
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
if
(
!
GetStringFromRegistry
(
key
,
"CurrentVersion"
,
if
(
!
GetStringFromRegistry
(
key
,
"CurrentVersion"
,
version
,
sizeof
(
version
)))
{
version
,
sizeof
(
version
)))
{
ReportErrorMessage
(
REG_ERROR2
,
JRE_KEY
);
JLI_
ReportErrorMessage
(
REG_ERROR2
,
JRE_KEY
);
RegCloseKey
(
key
);
RegCloseKey
(
key
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
if
(
JLI_StrCmp
(
version
,
GetDotVersion
())
!=
0
)
{
if
(
JLI_StrCmp
(
version
,
GetDotVersion
())
!=
0
)
{
ReportErrorMessage
(
REG_ERROR3
,
JRE_KEY
,
version
,
GetDotVersion
()
JLI_
ReportErrorMessage
(
REG_ERROR3
,
JRE_KEY
,
version
,
GetDotVersion
()
);
);
RegCloseKey
(
key
);
RegCloseKey
(
key
);
return
JNI_FALSE
;
return
JNI_FALSE
;
...
@@ -312,13 +312,13 @@ GetPublicJREHome(char *buf, jint bufsize)
...
@@ -312,13 +312,13 @@ GetPublicJREHome(char *buf, jint bufsize)
/* Find directory where the current version is installed. */
/* Find directory where the current version is installed. */
if
(
RegOpenKeyEx
(
key
,
version
,
0
,
KEY_READ
,
&
subkey
)
!=
0
)
{
if
(
RegOpenKeyEx
(
key
,
version
,
0
,
KEY_READ
,
&
subkey
)
!=
0
)
{
ReportErrorMessage
(
REG_ERROR1
,
JRE_KEY
,
version
);
JLI_
ReportErrorMessage
(
REG_ERROR1
,
JRE_KEY
,
version
);
RegCloseKey
(
key
);
RegCloseKey
(
key
);
return
JNI_FALSE
;
return
JNI_FALSE
;
}
}
if
(
!
GetStringFromRegistry
(
subkey
,
"JavaHome"
,
buf
,
bufsize
))
{
if
(
!
GetStringFromRegistry
(
subkey
,
"JavaHome"
,
buf
,
bufsize
))
{
ReportErrorMessage
(
REG_ERROR4
,
JRE_KEY
,
version
);
JLI_
ReportErrorMessage
(
REG_ERROR4
,
JRE_KEY
,
version
);
RegCloseKey
(
key
);
RegCloseKey
(
key
);
RegCloseKey
(
subkey
);
RegCloseKey
(
subkey
);
return
JNI_FALSE
;
return
JNI_FALSE
;
...
@@ -370,7 +370,7 @@ jlong Counter2Micros(jlong counts)
...
@@ -370,7 +370,7 @@ jlong Counter2Micros(jlong counts)
}
}
void
void
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
JLI_
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
va_list
vl
;
va_list
vl
;
va_start
(
vl
,
fmt
);
va_start
(
vl
,
fmt
);
...
@@ -394,12 +394,12 @@ ReportErrorMessage(const char* fmt, ...) {
...
@@ -394,12 +394,12 @@ ReportErrorMessage(const char* fmt, ...) {
}
}
/*
/*
* Just like ReportErrorMessage, except that it concatenates the system
* Just like
JLI_
ReportErrorMessage, except that it concatenates the system
* error message if any, its upto the calling routine to correctly
* error message if any, its upto the calling routine to correctly
* format the separation of the messages.
* format the separation of the messages.
*/
*/
void
void
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
JLI_
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
{
{
va_list
vl
;
va_list
vl
;
...
@@ -462,7 +462,7 @@ ReportErrorMessageSys(const char *fmt, ...)
...
@@ -462,7 +462,7 @@ ReportErrorMessageSys(const char *fmt, ...)
va_end
(
vl
);
va_end
(
vl
);
}
}
void
ReportExceptionDescription
(
JNIEnv
*
env
)
{
void
JLI_
ReportExceptionDescription
(
JNIEnv
*
env
)
{
if
(
IsJavaw
())
{
if
(
IsJavaw
())
{
/*
/*
* This code should be replaced by code which opens a window with
* This code should be replaced by code which opens a window with
...
@@ -733,7 +733,7 @@ ExecJRE(char *jre, char **argv) {
...
@@ -733,7 +733,7 @@ ExecJRE(char *jre, char **argv) {
*/
*/
len
=
GetModuleFileName
(
NULL
,
path
,
MAXPATHLEN
+
1
);
len
=
GetModuleFileName
(
NULL
,
path
,
MAXPATHLEN
+
1
);
if
(
len
==
0
||
len
>
MAXPATHLEN
)
{
if
(
len
==
0
||
len
>
MAXPATHLEN
)
{
ReportErrorMessageSys
(
JRE_ERROR9
,
progname
);
JLI_
ReportErrorMessageSys
(
JRE_ERROR9
,
progname
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -766,7 +766,7 @@ ExecJRE(char *jre, char **argv) {
...
@@ -766,7 +766,7 @@ ExecJRE(char *jre, char **argv) {
* If it weren't for this semantic flaw, the code below would be ...
* If it weren't for this semantic flaw, the code below would be ...
*
*
* execv(path, argv);
* execv(path, argv);
* ReportErrorMessage("Error: Exec of %s failed\n", path);
*
JLI_
ReportErrorMessage("Error: Exec of %s failed\n", path);
* exit(1);
* exit(1);
*
*
* The incorrect exec semantics could be addressed by:
* The incorrect exec semantics could be addressed by:
...
@@ -876,7 +876,7 @@ ExecJRE(char *jre, char **argv) {
...
@@ -876,7 +876,7 @@ ExecJRE(char *jre, char **argv) {
(
LPCTSTR
)
NULL
,
/* current directory */
(
LPCTSTR
)
NULL
,
/* current directory */
(
LPSTARTUPINFO
)
&
si
,
/* (in) startup information */
(
LPSTARTUPINFO
)
&
si
,
/* (in) startup information */
(
LPPROCESS_INFORMATION
)
&
pi
))
{
/* (out) process information */
(
LPPROCESS_INFORMATION
)
&
pi
))
{
/* (out) process information */
ReportErrorMessageSys
(
SYS_ERROR1
,
path
);
JLI_
ReportErrorMessageSys
(
SYS_ERROR1
,
path
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -884,7 +884,7 @@ ExecJRE(char *jre, char **argv) {
...
@@ -884,7 +884,7 @@ ExecJRE(char *jre, char **argv) {
if
(
GetExitCodeProcess
(
pi
.
hProcess
,
&
exitCode
)
==
FALSE
)
if
(
GetExitCodeProcess
(
pi
.
hProcess
,
&
exitCode
)
==
FALSE
)
exitCode
=
1
;
exitCode
=
1
;
}
else
{
}
else
{
ReportErrorMessage
(
SYS_ERROR2
);
JLI_
ReportErrorMessage
(
SYS_ERROR2
);
exitCode
=
1
;
exitCode
=
1
;
}
}
...
...
src/windows/native/java/net/NetworkInterface.c
浏览文件 @
a86a5927
...
@@ -554,11 +554,11 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
...
@@ -554,11 +554,11 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
ni_childsID
=
(
*
env
)
->
GetFieldID
(
env
,
ni_class
,
"childs"
,
"[Ljava/net/NetworkInterface;"
);
ni_childsID
=
(
*
env
)
->
GetFieldID
(
env
,
ni_class
,
"childs"
,
"[Ljava/net/NetworkInterface;"
);
ni_ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_class
,
"<init>"
,
"()V"
);
ni_ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_class
,
"<init>"
,
"()V"
);
ni_iacls
=
(
*
env
)
->
FindClass
(
env
,
"
Ljava/net/InetAddress;
"
);
ni_iacls
=
(
*
env
)
->
FindClass
(
env
,
"
java/net/InetAddress
"
);
ni_iacls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_iacls
);
ni_iacls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_iacls
);
ni_iaAddr
=
(
*
env
)
->
GetFieldID
(
env
,
ni_iacls
,
"address"
,
"I"
);
ni_iaAddr
=
(
*
env
)
->
GetFieldID
(
env
,
ni_iacls
,
"address"
,
"I"
);
ni_ia4cls
=
(
*
env
)
->
FindClass
(
env
,
"
Ljava/net/Inet4Address;
"
);
ni_ia4cls
=
(
*
env
)
->
FindClass
(
env
,
"
java/net/Inet4Address
"
);
ni_ia4cls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_ia4cls
);
ni_ia4cls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_ia4cls
);
ni_ia4Ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_ia4cls
,
"<init>"
,
"()V"
);
ni_ia4Ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_ia4cls
,
"<init>"
,
"()V"
);
...
@@ -762,17 +762,17 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
...
@@ -762,17 +762,17 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
/*
/*
* Class: NetworkInterface
* Class: NetworkInterface
* Method: getByIndex
* Method: getByIndex
0
* Signature: (I)LNetworkInterface;
* Signature: (I)LNetworkInterface;
*/
*/
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
{
netif
*
ifList
,
*
curr
;
netif
*
ifList
,
*
curr
;
jobject
netifObj
=
NULL
;
jobject
netifObj
=
NULL
;
if
(
os_supports_ipv6
&&
ipv6_available
())
{
if
(
os_supports_ipv6
&&
ipv6_available
())
{
return
Java_java_net_NetworkInterface_getByIndex_XP
(
env
,
cls
,
index
);
return
Java_java_net_NetworkInterface_getByIndex
0
_XP
(
env
,
cls
,
index
);
}
}
/* get the list of interfaces */
/* get the list of interfaces */
...
...
src/windows/native/java/net/NetworkInterface_winXP.c
浏览文件 @
a86a5927
...
@@ -576,10 +576,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
...
@@ -576,10 +576,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
/*
/*
* Class: NetworkInterface
* Class: NetworkInterface
* Method: getByIndex
* Method: getByIndex
0_XP
* Signature: (I)LNetworkInterface;
* Signature: (I)LNetworkInterface;
*/
*/
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
_XP
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
{
netif
*
ifList
,
*
curr
;
netif
*
ifList
,
*
curr
;
...
...
src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
浏览文件 @
a86a5927
...
@@ -2090,7 +2090,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1, jint o
...
@@ -2090,7 +2090,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1, jint o
* (for IF).
* (for IF).
*/
*/
if
(
index
>
0
)
{
if
(
index
>
0
)
{
ni
=
Java_java_net_NetworkInterface_getByIndex
(
env
,
ni_class
,
ni
=
Java_java_net_NetworkInterface_getByIndex
0
(
env
,
ni_class
,
index
);
index
);
if
(
ni
==
NULL
)
{
if
(
ni
==
NULL
)
{
char
errmsg
[
255
];
char
errmsg
[
255
];
...
...
src/windows/native/java/net/net_util_md.h
浏览文件 @
a86a5927
...
@@ -329,7 +329,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
...
@@ -329,7 +329,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByName0_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByName0_XP
(
JNIEnv
*
env
,
jclass
cls
,
jstring
name
);
(
JNIEnv
*
env
,
jclass
cls
,
jstring
name
);
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
_XP
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
);
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
);
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByInetAddress0_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByInetAddress0_XP
...
...
test/java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
0 → 100644
浏览文件 @
a86a5927
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 5041784
* @summary Check that plain arrays like String[] are never represented as
* GenericArrayType.
* @author Eamonn McManus
*/
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.GenericArrayType
;
import
java.lang.reflect.GenericDeclaration
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.ParameterizedType
;
import
java.lang.reflect.Type
;
import
java.lang.reflect.TypeVariable
;
import
java.lang.reflect.WildcardType
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
public
class
TestPlainArrayNotGeneric
{
public
String
[]
m1
(
List
<
String
>
p1
)
{
return
null
;}
public
List
<
String
>
m2
(
String
[]
p1
)
{
return
null
;}
public
void
m3
(
List
<
String
>
p1
,
String
[]
p2
)
{}
public
void
m4
(
List
<
String
[]>
p1
)
{}
public
TestPlainArrayNotGeneric
(
List
<
String
[]>
p1
)
{}
public
TestPlainArrayNotGeneric
(
List
<
String
>
p1
,
String
[]
p2
)
{}
public
<
T
extends
List
<
String
[]>>
T
m5
(
T
p1
)
{
return
null
;}
public
<
T
extends
Object
>
T
[]
m6
(
T
[]
p1
,
List
<
T
[]>
p2
)
{
return
null
;}
public
List
<?
extends
Object
[]>
m6
(
List
<?
extends
Object
[]>
p1
)
{
return
null
;}
public
<
T
extends
List
<?
extends
Object
[]>>
T
m7
(
T
[]
p1
)
{
return
null
;}
public
List
<?
super
Object
[]>
m8
(
List
<?
super
Object
[]>
p1
)
{
return
null
;}
public
<
T
extends
List
<?
super
Object
[]>>
T
[]
m9
(
T
[]
p1
)
{
return
null
;}
public
static
interface
XMap
extends
Map
<
List
<
String
[]>,
String
[]>
{}
public
static
interface
YMap
<
K
extends
List
<
String
[]>,
V
>
extends
Map
<
K
[],
V
[]>
{}
private
static
String
lastFailure
;
private
static
int
failureCount
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
checkClass
(
TestPlainArrayNotGeneric
.
class
);
if
(
failureCount
==
0
)
System
.
out
.
println
(
"TEST PASSED"
);
else
throw
new
Exception
(
"TEST FAILED: Last failure: "
+
lastFailure
);
}
private
static
void
checkClass
(
Class
<?>
c
)
throws
Exception
{
Method
[]
methods
=
c
.
getMethods
();
for
(
Method
m
:
methods
)
{
check
(
m
.
getGenericReturnType
(),
"return type of method "
+
m
);
check
(
m
.
getGenericParameterTypes
(),
"parameter"
,
"method "
+
m
);
check
(
m
.
getTypeParameters
(),
"type parameter"
,
"method "
+
m
);
}
Constructor
[]
constructors
=
c
.
getConstructors
();
for
(
Constructor
constr
:
constructors
)
{
check
(
constr
.
getGenericParameterTypes
(),
"parameter"
,
"constructor "
+
constr
);
check
(
constr
.
getTypeParameters
(),
"type parameter"
,
"constructor "
+
constr
);
}
Class
<?>[]
inners
=
c
.
getDeclaredClasses
();
for
(
Class
inner
:
inners
)
checkClass
(
inner
);
}
private
static
void
check
(
Type
[]
types
,
String
elementKind
,
String
what
)
{
for
(
int
i
=
0
;
i
<
types
.
length
;
i
++)
{
Type
t
=
types
[
i
];
check
(
t
,
elementKind
+
" "
+
(
i
+
1
)
+
" of "
+
what
);
}
}
private
static
final
Set
<
Type
>
checking
=
new
HashSet
<
Type
>();
private
static
void
check
(
Type
t
,
String
what
)
{
if
(
t
==
null
||
!
checking
.
add
(
t
))
return
;
// Avoid infinite recursion. t can be null e.g. for superclass of Object.
try
{
check2
(
t
,
what
);
}
finally
{
checking
.
remove
(
t
);
}
}
private
static
void
check2
(
Type
t
,
String
what
)
{
if
(
t
instanceof
ParameterizedType
)
{
ParameterizedType
pt
=
(
ParameterizedType
)
t
;
check
(
pt
.
getActualTypeArguments
(),
"type argument"
,
what
);
}
else
if
(
t
instanceof
TypeVariable
)
{
TypeVariable
<?>
tv
=
(
TypeVariable
<?>)
t
;
check
(
tv
.
getBounds
(),
"bound"
,
what
);
GenericDeclaration
gd
=
tv
.
getGenericDeclaration
();
if
(
gd
instanceof
Type
)
check
((
Type
)
gd
,
"declaration containing "
+
what
);
}
else
if
(
t
instanceof
WildcardType
)
{
WildcardType
wt
=
(
WildcardType
)
t
;
check
(
wt
.
getLowerBounds
(),
"lower bound"
,
"wildcard type in "
+
what
);
check
(
wt
.
getUpperBounds
(),
"upper bound"
,
"wildcard type in "
+
what
);
}
else
if
(
t
instanceof
Class
<?>)
{
Class
<?>
c
=
(
Class
<?>)
t
;
check
(
c
.
getGenericInterfaces
(),
"superinterface"
,
c
.
toString
());
check
(
c
.
getGenericSuperclass
(),
"superclass of "
+
c
);
check
(
c
.
getTypeParameters
(),
"type parameter"
,
c
.
toString
());
}
else
if
(
t
instanceof
GenericArrayType
)
{
GenericArrayType
gat
=
(
GenericArrayType
)
t
;
Type
comp
=
gat
.
getGenericComponentType
();
if
(
comp
instanceof
Class
)
{
fail
(
"Type "
+
t
+
" uses GenericArrayType when plain "
+
"array would do, in "
+
what
);
}
else
check
(
comp
,
"component type of "
+
what
);
}
else
{
fail
(
"TEST BUG: mutant Type "
+
t
+
" (a "
+
t
.
getClass
().
getName
()
+
")"
);
}
}
private
static
void
fail
(
String
why
)
{
System
.
out
.
println
(
"FAIL: "
+
why
);
lastFailure
=
why
;
failureCount
++;
}
}
test/java/net/NetworkInterface/IndexTest.java
0 → 100644
浏览文件 @
a86a5927
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6717876
* @summary Make java.net.NetworkInterface.getIndex() public
*/
import
java.net.*
;
import
java.util.Enumeration
;
public
class
IndexTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Enumeration
<
NetworkInterface
>
netifs
=
NetworkInterface
.
getNetworkInterfaces
();
NetworkInterface
nif
=
null
;
while
(
netifs
.
hasMoreElements
())
{
nif
=
netifs
.
nextElement
();
int
index
=
nif
.
getIndex
();
if
(
index
>=
0
)
{
NetworkInterface
nif2
=
NetworkInterface
.
getByIndex
(
index
);
if
(!
nif
.
equals
(
nif2
))
{
throw
new
RuntimeException
(
"both interfaces should be equal"
);
}
}
}
try
{
nif
=
NetworkInterface
.
getByIndex
(-
1
);
throw
new
RuntimeException
(
"Should have thrown IllegalArgumentException"
);
}
catch
(
IllegalArgumentException
e
)
{
// OK
}
// In all likelyhood, this interface should not exist.
nif
=
NetworkInterface
.
getByIndex
(
Integer
.
MAX_VALUE
-
1
);
if
(
nif
!=
null
)
{
throw
new
RuntimeException
(
"getByIndex() should have returned null"
);
}
}
}
test/java/nio/BufferPoolMXBean/Basic.java
0 → 100644
浏览文件 @
a86a5927
/*
* Copyright 2007-2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/* @test
* @bug 6606598
* @summary Unit test for java.nio.BufferPoolMXBean
*/
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.BufferPoolMXBean
;
import
java.nio.channels.FileChannel
;
import
java.io.File
;
import
java.io.RandomAccessFile
;
import
java.lang.management.ManagementFactory
;
import
javax.management.MBeanServer
;
import
javax.management.ObjectName
;
import
java.util.*
;
public
class
Basic
{
// static fields to ensure buffers aren't GC'ed
static
List
<
ByteBuffer
>
buffers
;
static
MappedByteBuffer
mbb
;
// check counters
static
void
check
(
List
<
BufferPoolMXBean
>
pools
,
int
minBufferCount
,
long
minTotalCapacity
)
{
int
bufferCount
=
0
;
long
totalCap
=
0
;
long
totalMem
=
0
;
for
(
BufferPoolMXBean
pool:
pools
)
{
bufferCount
+=
pool
.
getCount
();
totalCap
+=
pool
.
getTotalCapacity
();
totalMem
+=
pool
.
getMemoryUsed
();
}
if
(
bufferCount
<
minBufferCount
)
throw
new
RuntimeException
(
"Count less than expected"
);
if
(
totalMem
<
minTotalCapacity
)
throw
new
RuntimeException
(
"Memory usage less than expected"
);
if
(
totalCap
<
minTotalCapacity
)
throw
new
RuntimeException
(
"Total capacity less than expected"
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Random
rand
=
new
Random
();
// allocate a few direct buffers
int
bufferCount
=
5
+
rand
.
nextInt
(
20
);
buffers
=
new
ArrayList
<
ByteBuffer
>(
bufferCount
);
long
totalCapacity
=
0L
;
for
(
int
i
=
0
;
i
<
bufferCount
;
i
++)
{
int
cap
=
1024
+
rand
.
nextInt
(
4096
);
buffers
.
add
(
ByteBuffer
.
allocateDirect
(
cap
)
);
totalCapacity
+=
cap
;
}
// map a file
File
f
=
File
.
createTempFile
(
"blah"
,
null
);
f
.
deleteOnExit
();
RandomAccessFile
raf
=
new
RandomAccessFile
(
f
,
"rw"
);
FileChannel
fc
=
raf
.
getChannel
();
mbb
=
fc
.
map
(
FileChannel
.
MapMode
.
READ_WRITE
,
10
,
100
);
bufferCount
++;
totalCapacity
+=
mbb
.
capacity
();
// direct
List
<
BufferPoolMXBean
>
pools
=
ManagementFactory
.
getPlatformMXBeans
(
BufferPoolMXBean
.
class
);
check
(
pools
,
bufferCount
,
totalCapacity
);
// using MBeanServer
MBeanServer
server
=
ManagementFactory
.
getPlatformMBeanServer
();
Set
<
ObjectName
>
mbeans
=
server
.
queryNames
(
new
ObjectName
(
"java.nio:type=BufferPool,*"
),
null
);
pools
=
new
ArrayList
<
BufferPoolMXBean
>();
for
(
ObjectName
name:
mbeans
)
{
BufferPoolMXBean
pool
=
ManagementFactory
.
newPlatformMXBeanProxy
(
server
,
name
.
toString
(),
BufferPoolMXBean
.
class
);
pools
.
add
(
pool
);
}
check
(
pools
,
bufferCount
,
totalCapacity
);
}
}
test/sun/security/util/DerValue/Indefinite.java
0 → 100644
浏览文件 @
a86a5927
/*
* Copyright 2008 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6731685
* @summary CertificateFactory.generateCertificates throws IOException on PKCS7 cert chain
*/
import
java.io.*
;
import
sun.security.util.*
;
public
class
Indefinite
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
byte
[]
input
=
{
// An OCTET-STRING in 2 parts
4
,
(
byte
)
0x80
,
4
,
2
,
'a'
,
'b'
,
4
,
2
,
'c'
,
'd'
,
0
,
0
,
// Garbage follows, may be falsely recognized as EOC
0
,
0
,
0
,
0
};
new
DerValue
(
new
ByteArrayInputStream
(
input
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录