Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
731c5844
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看板
提交
731c5844
编写于
8月 31, 2008
作者:
T
tbell
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
d8da1f94
1b95ba6d
变更
29
展开全部
隐藏空白更改
内联
并排
Showing
29 changed file
with
1064 addition
and
295 deletion
+1064
-295
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/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/com/sun/tools/hat/internal/parser/HprofReader.java
...lasses/com/sun/tools/hat/internal/parser/HprofReader.java
+8
-6
src/share/classes/java/lang/Thread.java
src/share/classes/java/lang/Thread.java
+183
-146
src/share/classes/java/lang/management/PlatformComponent.java
...share/classes/java/lang/management/PlatformComponent.java
+18
-0
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/java/nio/charset/Charset.java
src/share/classes/java/nio/charset/Charset.java
+4
-0
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/nio/cs/ext/ExtendedCharsets.java
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
+12
-12
src/share/classes/sun/nio/cs/standard-charsets
src/share/classes/sun/nio/cs/standard-charsets
+1
-0
src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
...s/sun/reflect/generics/factory/CoreReflectionFactory.java
+5
-1
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/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
test/java/lang/ThreadGroup/NullThreadName.java
test/java/lang/ThreadGroup/NullThreadName.java
+85
-0
test/java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
.../java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
+156
-0
test/java/nio/BufferPoolMXBean/Basic.java
test/java/nio/BufferPoolMXBean/Basic.java
+106
-0
test/sun/nio/cs/CheckICNE.java
test/sun/nio/cs/CheckICNE.java
+58
-0
未找到文件。
make/java/java/FILES_java.gmk
浏览文件 @
731c5844
...
...
@@ -449,6 +449,7 @@ JAVA_JAVA_java = \
sun/misc/JavaLangAccess.java \
sun/misc/JavaIOAccess.java \
sun/misc/JavaIODeleteOnExitAccess.java \
sun/misc/JavaIOFileDescriptorAccess.java
sun/misc/JavaIOFileDescriptorAccess.java \
sun/misc/JavaNioAccess.java
FILES_java = $(JAVA_JAVA_java)
make/java/jli/Makefile
浏览文件 @
731c5844
...
...
@@ -113,7 +113,11 @@ ifeq ($(PLATFORM), windows)
JAVALIB
=
OTHER_LCF
=
-export
:JLI_Launch
\
-export
:JLI_ManifestIterate
\
-export
:JLI_SetTraceLauncher
-export
:JLI_SetTraceLauncher
\
-export
:JLI_ReportErrorMessage
\
-export
:JLI_ReportErrorMessageSys
\
-export
:JLI_ReportMessage
\
-export
:JLI_ReportExceptionDescription
endif
...
...
make/java/jli/mapfile-vers
浏览文件 @
731c5844
#
# 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.
#
# This code is free software; you can redistribute it and/or modify it
...
...
@@ -30,6 +30,10 @@ SUNWprivate_1.1 {
JLI_Launch;
JLI_ManifestIterate;
JLI_SetTraceLauncher;
JLI_ReportErrorMessage;
JLI_ReportErrorMessageSys;
JLI_ReportMessage;
JLI_ReportExceptionDescription;
local:
*;
};
make/java/nio/FILES_java.gmk
浏览文件 @
731c5844
...
...
@@ -26,6 +26,7 @@
FILES_src = \
java/nio/Bits.java \
java/nio/Buffer.java \
java/nio/BufferPoolMXBean.java \
java/nio/ByteOrder.java \
java/nio/MappedByteBuffer.java \
java/nio/StringCharBuffer.java \
...
...
make/java/nio/mapfile-linux
浏览文件 @
731c5844
...
...
@@ -18,6 +18,8 @@ SUNWprivate_1.1 {
Java_sun_nio_ch_EPollArrayWrapper_fdLimit;
Java_sun_nio_ch_EPollArrayWrapper_init;
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_force0;
Java_sun_nio_ch_FileChannelImpl_initIDs;
...
...
src/share/bin/emessages.h
浏览文件 @
731c5844
...
...
@@ -25,8 +25,8 @@
/*
* This file primarily consists of all the error and warning messages, that
* are used in
ReportErrorMessage. All message must be defined here, in order
*
to help in I18N/L10N
the messages.
* are used in
JLI_ReportErrorMessage. All message must be defined here, in
*
order to help with localizing
the messages.
*/
#ifndef _EMESSAGES_H
...
...
src/share/bin/java.c
浏览文件 @
731c5844
...
...
@@ -148,7 +148,7 @@ static void ShowSplashScreen();
static
jboolean
IsWildCardEnabled
();
#define ARG_CHECK(n, f, a) if (n < 1) { \
ReportErrorMessage(f, a); \
JLI_
ReportErrorMessage(f, a); \
printUsage = JNI_TRUE; \
*pret = 1; \
return JNI_TRUE; \
...
...
@@ -326,15 +326,15 @@ JavaMain(void * _args)
start
=
CounterGet
();
if
(
!
InitializeJVM
(
&
vm
,
&
env
,
&
ifn
))
{
ReportErrorMessage
(
JVM_ERROR1
);
JLI_
ReportErrorMessage
(
JVM_ERROR1
);
exit
(
1
);
}
if
(
printVersion
||
showVersion
)
{
PrintJavaVersion
(
env
,
showVersion
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
if
(
printVersion
)
{
...
...
@@ -347,8 +347,8 @@ JavaMain(void * _args)
if
(
printXUsage
||
printUsage
||
(
jarfile
==
0
&&
classname
==
0
))
{
PrintUsage
(
env
,
printXUsage
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
ret
=
1
;
}
goto
leave
;
...
...
@@ -397,43 +397,43 @@ JavaMain(void * _args)
if
(
jarfile
!=
0
)
{
mainClassName
=
GetMainClassName
(
env
,
jarfile
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
if
(
mainClassName
==
NULL
)
{
ReportErrorMessage
(
JAR_ERROR1
,
jarfile
,
GEN_ERROR
);
JLI_
ReportErrorMessage
(
JAR_ERROR1
,
jarfile
,
GEN_ERROR
);
goto
leave
;
}
classname
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
mainClassName
,
0
);
if
(
classname
==
NULL
)
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
mainClass
=
LoadClass
(
env
,
classname
);
if
(
mainClass
==
NULL
)
{
/* exception occured */
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
goto
leave
;
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
mainClassName
,
classname
);
}
else
{
mainClassName
=
NewPlatformString
(
env
,
classname
);
if
(
mainClassName
==
NULL
)
{
ReportErrorMessage
(
CLS_ERROR2
,
classname
,
GEN_ERROR
);
JLI_
ReportErrorMessage
(
CLS_ERROR2
,
classname
,
GEN_ERROR
);
goto
leave
;
}
classname
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
mainClassName
,
0
);
if
(
classname
==
NULL
)
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
mainClass
=
LoadClass
(
env
,
classname
);
if
(
mainClass
==
NULL
)
{
/* exception occured */
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
CLS_ERROR1
,
classname
);
goto
leave
;
}
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
mainClassName
,
classname
);
...
...
@@ -444,10 +444,10 @@ JavaMain(void * _args)
"([Ljava/lang/String;)V"
);
if
(
mainID
==
NULL
)
{
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
}
else
{
ReportErrorMessage
(
CLS_ERROR3
);
JLI_
ReportErrorMessage
(
CLS_ERROR3
);
}
goto
leave
;
}
...
...
@@ -459,8 +459,8 @@ JavaMain(void * _args)
mainID
,
JNI_TRUE
);
if
(
obj
==
NULL
)
{
/* exception occurred */
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
...
...
@@ -469,14 +469,14 @@ JavaMain(void * _args)
(
*
env
)
->
GetObjectClass
(
env
,
obj
),
"getModifiers"
,
"()I"
);
if
((
*
env
)
->
ExceptionOccurred
(
env
))
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
mods
=
(
*
env
)
->
CallIntMethod
(
env
,
obj
,
mid
);
if
((
mods
&
1
)
==
0
)
{
/* if (!Modifier.isPublic(mods)) ... */
ReportErrorMessage
(
CLS_ERROR4
);
JLI_
ReportErrorMessage
(
CLS_ERROR4
);
goto
leave
;
}
}
...
...
@@ -484,8 +484,8 @@ JavaMain(void * _args)
/* Build argument array */
mainArgs
=
NewPlatformStringArray
(
env
,
argv
,
argc
);
if
(
mainArgs
==
NULL
)
{
ReportExceptionDescription
(
env
);
ReportErrorMessage
(
JNI_ERROR
);
JLI_
ReportExceptionDescription
(
env
);
JLI_
ReportErrorMessage
(
JNI_ERROR
);
goto
leave
;
}
...
...
@@ -506,7 +506,7 @@ JavaMain(void * _args)
* launcher's return code except by calling System.exit.
*/
if
((
*
vm
)
->
DetachCurrentThread
(
vm
)
!=
0
)
{
ReportErrorMessage
(
JVM_ERROR2
);
JLI_
ReportErrorMessage
(
JVM_ERROR2
);
ret
=
1
;
goto
leave
;
}
...
...
@@ -635,7 +635,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
if
(
loopCount
>
knownVMsCount
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR1
);
JLI_
ReportErrorMessage
(
CFG_ERROR1
);
exit
(
1
);
}
else
{
return
"ERROR"
;
...
...
@@ -645,7 +645,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
if
(
nextIdx
<
0
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR2
,
knownVMs
[
jvmidx
].
alias
);
JLI_
ReportErrorMessage
(
CFG_ERROR2
,
knownVMs
[
jvmidx
].
alias
);
exit
(
1
);
}
else
{
return
"ERROR"
;
...
...
@@ -660,7 +660,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
switch
(
knownVMs
[
jvmidx
].
flag
)
{
case
VM_WARN
:
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_WARN1
,
jvmtype
,
knownVMs
[
0
].
name
+
1
);
JLI_
ReportErrorMessage
(
CFG_WARN1
,
jvmtype
,
knownVMs
[
0
].
name
+
1
);
}
/* fall through */
case
VM_IGNORE
:
...
...
@@ -670,7 +670,7 @@ CheckJvmType(int *pargc, char ***argv, jboolean speculative) {
break
;
case
VM_ERROR
:
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR3
,
jvmtype
);
JLI_
ReportErrorMessage
(
CFG_ERROR3
,
jvmtype
);
exit
(
1
);
}
else
{
return
"ERROR"
;
...
...
@@ -879,9 +879,9 @@ SelectVersion(int argc, char **argv, char **main_class)
if
(
jarflag
&&
operand
)
{
if
((
res
=
JLI_ParseManifest
(
operand
,
&
info
))
!=
0
)
{
if
(
res
==
-
1
)
ReportErrorMessage
(
JAR_ERROR2
,
operand
);
JLI_
ReportErrorMessage
(
JAR_ERROR2
,
operand
);
else
ReportErrorMessage
(
JAR_ERROR3
,
operand
);
JLI_
ReportErrorMessage
(
JAR_ERROR3
,
operand
);
exit
(
1
);
}
...
...
@@ -948,7 +948,7 @@ SelectVersion(int argc, char **argv, char **main_class)
* Check for correct syntax of the version specification (JSR 56).
*/
if
(
!
JLI_ValidVersionString
(
info
.
jre_version
))
{
ReportErrorMessage
(
SPC_ERROR1
,
info
.
jre_version
);
JLI_
ReportErrorMessage
(
SPC_ERROR1
,
info
.
jre_version
);
exit
(
1
);
}
...
...
@@ -970,7 +970,7 @@ SelectVersion(int argc, char **argv, char **main_class)
JLI_MemFree
(
new_argv
);
return
;
}
else
{
ReportErrorMessage
(
CFG_ERROR4
,
info
.
jre_version
);
JLI_
ReportErrorMessage
(
CFG_ERROR4
,
info
.
jre_version
);
exit
(
1
);
}
}
...
...
@@ -1040,7 +1040,7 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
* command line options.
*/
}
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
;
}
else
if
(
JLI_StrCmp
(
arg
,
"-verbosegc"
)
==
0
)
{
AddOption
(
"-verbose:gc"
,
NULL
);
...
...
@@ -1080,7 +1080,7 @@ ParseArguments(int *pargc, char ***pargv, char **pjarfile,
JLI_StrCmp
(
arg
,
"-cs"
)
==
0
||
JLI_StrCmp
(
arg
,
"-noasyncgc"
)
==
0
)
{
/* No longer supported */
ReportErrorMessage
(
ARG_WARN
,
arg
);
JLI_
ReportErrorMessage
(
ARG_WARN
,
arg
);
}
else
if
(
JLI_StrCCmp
(
arg
,
"-version:"
)
==
0
||
JLI_StrCmp
(
arg
,
"-no-jre-restrict-search"
)
==
0
||
JLI_StrCmp
(
arg
,
"-jre-restrict-search"
)
==
0
||
...
...
@@ -1143,12 +1143,12 @@ InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
#define NULL_CHECK0(e) if ((e) == 0) { \
ReportErrorMessage(JNI_ERROR); \
JLI_
ReportErrorMessage(JNI_ERROR); \
return 0; \
}
#define NULL_CHECK(e) if ((e) == 0) { \
ReportErrorMessage(JNI_ERROR); \
JLI_
ReportErrorMessage(JNI_ERROR); \
return; \
}
...
...
@@ -1351,7 +1351,7 @@ TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***parg
char
*
arg
=
argv
[
i
];
if
(
arg
[
0
]
==
'-'
&&
arg
[
1
]
==
'J'
)
{
if
(
arg
[
2
]
==
'\0'
)
{
ReportErrorMessage
(
ARG_ERROR3
);
JLI_
ReportErrorMessage
(
ARG_ERROR3
);
exit
(
1
);
}
*
nargv
++
=
arg
+
2
;
...
...
@@ -1418,7 +1418,7 @@ AddApplicationOptions(int cpathc, const char **cpathv)
}
if
(
!
GetApplicationHome
(
home
,
sizeof
(
home
)))
{
ReportErrorMessage
(
CFG_ERROR5
);
JLI_
ReportErrorMessage
(
CFG_ERROR5
);
return
JNI_FALSE
;
}
...
...
@@ -1691,7 +1691,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
jvmCfg
=
fopen
(
jvmCfgName
,
"r"
);
if
(
jvmCfg
==
NULL
)
{
if
(
!
speculative
)
{
ReportErrorMessage
(
CFG_ERROR6
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_ERROR6
,
jvmCfgName
);
exit
(
1
);
}
else
{
return
-
1
;
...
...
@@ -1703,7 +1703,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
if
(
line
[
0
]
==
'#'
)
continue
;
if
(
line
[
0
]
!=
'-'
)
{
ReportErrorMessage
(
CFG_WARN2
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN2
,
lineno
,
jvmCfgName
);
}
if
(
cnt
>=
knownVMsLimit
)
{
GrowKnownVMs
(
cnt
);
...
...
@@ -1711,13 +1711,13 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
line
[
JLI_StrLen
(
line
)
-
1
]
=
'\0'
;
/* remove trailing newline */
tmpPtr
=
line
+
JLI_StrCSpn
(
line
,
whiteSpace
);
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
}
else
{
/* Null-terminate this string for JLI_StringDup below */
*
tmpPtr
++
=
0
;
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
}
else
{
if
(
!
JLI_StrCCmp
(
tmpPtr
,
"KNOWN"
))
{
vmType
=
VM_KNOWN
;
...
...
@@ -1727,7 +1727,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
}
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN3
,
lineno
,
jvmCfgName
);
}
else
{
/* Null terminate altVMName */
altVMName
=
tmpPtr
;
...
...
@@ -1747,7 +1747,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
tmpPtr
+=
JLI_StrSpn
(
tmpPtr
,
whiteSpace
);
}
if
(
*
tmpPtr
==
0
)
{
ReportErrorMessage
(
CFG_WARN4
,
lineno
,
jvmCfgName
);
JLI_
ReportErrorMessage
(
CFG_WARN4
,
lineno
,
jvmCfgName
);
}
else
{
/* Null terminate server class VM name */
serverClassVMName
=
tmpPtr
;
...
...
@@ -1756,7 +1756,7 @@ ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative)
vmType
=
VM_IF_SERVER_CLASS
;
}
}
else
{
ReportErrorMessage
(
CFG_WARN5
,
lineno
,
&
jvmCfgName
[
0
]);
JLI_
ReportErrorMessage
(
CFG_WARN5
,
lineno
,
&
jvmCfgName
[
0
]);
vmType
=
VM_KNOWN
;
}
}
...
...
@@ -2019,7 +2019,7 @@ RemovableOption(char * option)
* A utility procedure to always print to stderr
*/
void
ReportMessage
(
const
char
*
fmt
,
...)
JLI_
ReportMessage
(
const
char
*
fmt
,
...)
{
va_list
vl
;
va_start
(
vl
,
fmt
);
...
...
src/share/bin/java.h
浏览文件 @
731c5844
...
...
@@ -121,24 +121,20 @@ void CreateExecutionEnvironment(int *_argc,
char
jvmpath
[],
jint
so_jvmpath
,
char
**
original_argv
);
/* Reports an error message to stderr or a window as appropriate. */
void
JLI_ReportErrorMessage
(
const
char
*
message
,
...);
/*
* Report an error message to stderr or a window as appropriate.
*/
void
ReportErrorMessage
(
const
char
*
message
,
...);
void
ReportErrorMessageSys
(
const
char
*
format
,
...);
/* Reports a system error message to stderr or a window */
void
JLI_ReportErrorMessageSys
(
const
char
*
message
,
...);
/*
* Report an error message only to stderr.
*/
void
ReportMessage
(
const
char
*
message
,
...);
/* Reports an error message only to stderr. */
void
JLI_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.
*/
void
ReportExceptionDescription
(
JNIEnv
*
env
);
void
JLI_ReportExceptionDescription
(
JNIEnv
*
env
);
void
PrintMachineDependentOptions
();
const
char
*
jlong_format_specifier
();
...
...
src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java
浏览文件 @
731c5844
...
...
@@ -120,7 +120,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
private
int
version
;
// The version of .hprof being read
private
int
debugLevel
;
private
int
currPos
;
// Current position in the file
private
long
currPos
;
// Current position in the file
private
int
dumpsToSkip
;
private
boolean
callStack
;
// If true, read the call stack of objects
...
...
@@ -196,7 +196,9 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
break
;
}
in
.
readInt
();
// Timestamp of this record
int
length
=
in
.
readInt
();
// Length of record: readInt() will return negative value for record
// length >2GB. so store 32bit value in long to keep it unsigned.
long
length
=
in
.
readInt
()
&
0xffffffff
L
;
if
(
debugLevel
>
0
)
{
System
.
out
.
println
(
"Read record type "
+
type
+
", length "
+
length
...
...
@@ -211,7 +213,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
switch
(
type
)
{
case
HPROF_UTF8:
{
long
id
=
readID
();
byte
[]
chars
=
new
byte
[
length
-
identifierSize
];
byte
[]
chars
=
new
byte
[
(
int
)
length
-
identifierSize
];
in
.
readFully
(
chars
);
names
.
put
(
new
Long
(
id
),
new
String
(
chars
));
break
;
...
...
@@ -351,8 +353,8 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
return
snapshot
;
}
private
void
skipBytes
(
int
length
)
throws
IOException
{
in
.
skipBytes
(
length
);
private
void
skipBytes
(
long
length
)
throws
IOException
{
in
.
skipBytes
(
(
int
)
length
);
}
private
int
readVersionHeader
()
throws
IOException
{
...
...
@@ -381,7 +383,7 @@ public class HprofReader extends Reader /* imports */ implements ArrayTypeCodes
throw
new
IOException
(
"Version string not recognized at byte "
+
(
pos
+
3
));
}
private
void
readHeapDump
(
int
bytesLeft
,
int
posAtEnd
)
throws
IOException
{
private
void
readHeapDump
(
long
bytesLeft
,
long
posAtEnd
)
throws
IOException
{
while
(
bytesLeft
>
0
)
{
int
type
=
in
.
readUnsignedByte
();
if
(
debugLevel
>
0
)
{
...
...
src/share/classes/java/lang/Thread.java
浏览文件 @
731c5844
此差异已折叠。
点击以展开。
src/share/classes/java/lang/management/PlatformComponent.java
浏览文件 @
731c5844
...
...
@@ -32,6 +32,7 @@ import java.util.HashSet;
import
java.util.Set
;
import
java.util.logging.LoggingMXBean
;
import
java.util.logging.LogManager
;
import
java.nio.BufferPoolMXBean
;
import
javax.management.MBeanServerConnection
;
import
javax.management.MalformedObjectNameException
;
import
javax.management.ObjectName
;
...
...
@@ -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
/**
...
...
src/share/classes/java/nio/Bits.java
浏览文件 @
731c5844
...
...
@@ -29,6 +29,8 @@ import java.security.AccessController;
import
java.security.PrivilegedAction
;
import
sun.misc.Unsafe
;
import
sun.misc.VM
;
import
javax.management.ObjectName
;
import
javax.management.MalformedObjectNameException
;
/**
* Access to bits, native and otherwise.
...
...
@@ -625,13 +627,15 @@ class Bits { // package-private
// direct buffer memory. This value may be changed during VM
// initialization if it is launched with "-XX:MaxDirectMemorySize=<size>".
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
;
// These methods should be called whenever direct memory is allocated or
// freed. They allow the user to control the amount of direct memory
// 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
)
{
if
(!
memoryLimitSet
&&
VM
.
isBooted
())
{
...
...
@@ -640,6 +644,8 @@ class Bits { // package-private
}
if
(
size
<=
maxMemory
-
reservedMemory
)
{
reservedMemory
+=
size
;
usedMemory
+=
cap
;
count
++;
return
;
}
}
...
...
@@ -655,17 +661,71 @@ class Bits { // package-private
if
(
reservedMemory
+
size
>
maxMemory
)
throw
new
OutOfMemoryError
(
"Direct buffer memory"
);
reservedMemory
+=
size
;
usedMemory
+=
cap
;
count
++;
}
}
static
synchronized
void
unreserveMemory
(
long
size
)
{
static
synchronized
void
unreserveMemory
(
long
size
,
int
cap
)
{
if
(
reservedMemory
>
0
)
{
reservedMemory
-=
size
;
usedMemory
-=
cap
;
count
--;
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 --
...
...
src/share/classes/java/nio/BufferPoolMXBean.java
0 → 100644
浏览文件 @
731c5844
/*
* 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
浏览文件 @
731c5844
...
...
@@ -71,11 +71,13 @@ class Direct$Type$Buffer$RW$$BO$
private
static
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
long
address
;
private
long
size
;
private
int
capacity
;
private
Deallocator
(
long
address
,
int
capacity
)
{
private
Deallocator
(
long
address
,
long
size
,
int
capacity
)
{
assert
(
address
!=
0
);
this
.
address
=
address
;
this
.
size
=
size
;
this
.
capacity
=
capacity
;
}
...
...
@@ -86,7 +88,7 @@ class Direct$Type$Buffer$RW$$BO$
}
unsafe
.
freeMemory
(
address
);
address
=
0
;
Bits
.
unreserveMemory
(
capacity
);
Bits
.
unreserveMemory
(
size
,
capacity
);
}
}
...
...
@@ -110,23 +112,25 @@ class Direct$Type$Buffer$RW$$BO$
Direct
$Type$Buffer$RW
$
(
int
cap
)
{
// package-private
#
if
[
rw
]
super
(-
1
,
0
,
cap
,
cap
,
false
);
Bits
.
reserveMemory
(
cap
);
int
ps
=
Bits
.
pageSize
();
int
size
=
cap
+
ps
;
Bits
.
reserveMemory
(
size
,
cap
);
long
base
=
0
;
try
{
base
=
unsafe
.
allocateMemory
(
cap
+
ps
);
base
=
unsafe
.
allocateMemory
(
size
);
}
catch
(
OutOfMemoryError
x
)
{
Bits
.
unreserveMemory
(
cap
);
Bits
.
unreserveMemory
(
size
,
cap
);
throw
x
;
}
unsafe
.
setMemory
(
base
,
cap
+
ps
,
(
byte
)
0
);
unsafe
.
setMemory
(
base
,
size
,
(
byte
)
0
);
if
(
base
%
ps
!=
0
)
{
// Round up to page boundary
address
=
base
+
ps
-
(
base
&
(
ps
-
1
));
}
else
{
address
=
base
;
}
cleaner
=
Cleaner
.
create
(
this
,
new
Deallocator
(
base
,
cap
));
cleaner
=
Cleaner
.
create
(
this
,
new
Deallocator
(
base
,
size
,
cap
));
#
else
[
rw
]
super
(
cap
);
#
end
[
rw
]
...
...
src/share/classes/java/nio/charset/Charset.java
浏览文件 @
731c5844
...
...
@@ -85,6 +85,9 @@ import sun.security.action.GetPropertyAction;
* <li> The dash character <tt>'-'</tt>
* (<tt>'\u002d'</tt>, <small>HYPHEN-MINUS</small>),
*
* <li> The plus character <tt>'+'</tt>
* (<tt>'\u002b'</tt>, <small>PLUS SIGN</small>),
*
* <li> The period character <tt>'.'</tt>
* (<tt>'\u002e'</tt>, <small>FULL STOP</small>),
*
...
...
@@ -307,6 +310,7 @@ public abstract class Charset
if
(
c
>=
'a'
&&
c
<=
'z'
)
continue
;
if
(
c
>=
'0'
&&
c
<=
'9'
)
continue
;
if
(
c
==
'-'
&&
i
!=
0
)
continue
;
if
(
c
==
'+'
&&
i
!=
0
)
continue
;
if
(
c
==
':'
&&
i
!=
0
)
continue
;
if
(
c
==
'_'
&&
i
!=
0
)
continue
;
if
(
c
==
'.'
&&
i
!=
0
)
continue
;
...
...
src/share/classes/sun/misc/JavaNioAccess.java
0 → 100644
浏览文件 @
731c5844
/*
* 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
浏览文件 @
731c5844
...
...
@@ -46,6 +46,7 @@ public class SharedSecrets {
private
static
JavaIOAccess
javaIOAccess
;
private
static
JavaIODeleteOnExitAccess
javaIODeleteOnExitAccess
;
private
static
JavaNetAccess
javaNetAccess
;
private
static
JavaNioAccess
javaNioAccess
;
private
static
JavaIOFileDescriptorAccess
javaIOFileDescriptorAccess
;
public
static
JavaUtilJarAccess
javaUtilJarAccess
()
{
...
...
@@ -77,6 +78,20 @@ public class SharedSecrets {
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
)
{
javaIOAccess
=
jia
;
}
...
...
src/share/classes/sun/nio/ch/FileChannelImpl.java
浏览文件 @
731c5844
...
...
@@ -32,6 +32,7 @@ import java.io.RandomAccessFile;
import
java.io.IOException
;
import
java.nio.ByteBuffer
;
import
java.nio.MappedByteBuffer
;
import
java.nio.BufferPoolMXBean
;
import
java.nio.channels.*
;
import
java.nio.channels.spi.*
;
import
java.util.ArrayList
;
...
...
@@ -43,10 +44,12 @@ import java.lang.ref.ReferenceQueue;
import
java.lang.reflect.Field
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
javax.management.ObjectName
;
import
javax.management.MalformedObjectNameException
;
import
sun.misc.Cleaner
;
import
sun.security.action.GetPropertyAction
;
public
class
FileChannelImpl
extends
FileChannel
{
...
...
@@ -681,14 +684,26 @@ public class FileChannelImpl
private
static
class
Unmapper
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
size
;
private
int
cap
;
private
Unmapper
(
long
address
,
long
size
)
{
private
Unmapper
(
long
address
,
long
size
,
int
cap
)
{
assert
(
address
!=
0
);
this
.
address
=
address
;
this
.
size
=
size
;
this
.
cap
=
cap
;
synchronized
(
Unmapper
.
class
)
{
count
++;
totalSize
+=
size
;
totalCapacity
+=
cap
;
}
}
public
void
run
()
{
...
...
@@ -696,8 +711,13 @@ public class FileChannelImpl
return
;
unmap0
(
address
,
size
);
address
=
0
;
}
synchronized
(
Unmapper
.
class
)
{
count
--;
totalSize
-=
size
;
totalCapacity
-=
cap
;
}
}
}
private
static
void
unmap
(
MappedByteBuffer
bb
)
{
...
...
@@ -786,7 +806,7 @@ public class FileChannelImpl
assert
(
IOStatus
.
checkAll
(
addr
));
assert
(
addr
%
allocationGranularity
==
0
);
int
isize
=
(
int
)
size
;
Unmapper
um
=
new
Unmapper
(
addr
,
size
+
pagePosition
);
Unmapper
um
=
new
Unmapper
(
addr
,
size
+
pagePosition
,
isize
);
if
((!
writable
)
||
(
imode
==
MAP_RO
))
return
Util
.
newMappedByteBufferR
(
isize
,
addr
+
pagePosition
,
um
);
else
...
...
@@ -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 --
...
...
src/share/classes/sun/nio/cs/ext/ExtendedCharsets.java
浏览文件 @
731c5844
...
...
@@ -916,7 +916,7 @@ public class ExtendedCharsets
"ccsid01140"
,
"cp01140"
,
"1140"
,
//
"ebcdic-us-037+euro"
"ebcdic-us-037+euro"
});
charset
(
"IBM01141"
,
"IBM1141"
,
...
...
@@ -925,7 +925,7 @@ public class ExtendedCharsets
"ccsid01141"
,
"cp01141"
,
"1141"
,
//
"ebcdic-de-273+euro"
"ebcdic-de-273+euro"
});
charset
(
"IBM01142"
,
"IBM1142"
,
...
...
@@ -934,8 +934,8 @@ public class ExtendedCharsets
"ccsid01142"
,
"cp01142"
,
"1142"
,
//
"ebcdic-no-277+euro",
//
"ebcdic-dk-277+euro"
"ebcdic-no-277+euro"
,
"ebcdic-dk-277+euro"
});
charset
(
"IBM01143"
,
"IBM1143"
,
...
...
@@ -944,8 +944,8 @@ public class ExtendedCharsets
"ccsid01143"
,
"cp01143"
,
"1143"
,
//
"ebcdic-fi-278+euro",
//
"ebcdic-se-278+euro"
"ebcdic-fi-278+euro"
,
"ebcdic-se-278+euro"
});
charset
(
"IBM01144"
,
"IBM1144"
,
...
...
@@ -954,7 +954,7 @@ public class ExtendedCharsets
"ccsid01144"
,
"cp01144"
,
"1144"
,
//
"ebcdic-it-280+euro"
"ebcdic-it-280+euro"
});
charset
(
"IBM01145"
,
"IBM1145"
,
...
...
@@ -963,7 +963,7 @@ public class ExtendedCharsets
"ccsid01145"
,
"cp01145"
,
"1145"
,
//
"ebcdic-es-284+euro"
"ebcdic-es-284+euro"
});
charset
(
"IBM01146"
,
"IBM1146"
,
...
...
@@ -972,7 +972,7 @@ public class ExtendedCharsets
"ccsid01146"
,
"cp01146"
,
"1146"
,
//
"ebcdic-gb-285+euro"
"ebcdic-gb-285+euro"
});
charset
(
"IBM01147"
,
"IBM1147"
,
...
...
@@ -981,7 +981,7 @@ public class ExtendedCharsets
"ccsid01147"
,
"cp01147"
,
"1147"
,
//
"ebcdic-fr-277+euro"
"ebcdic-fr-277+euro"
});
charset
(
"IBM01148"
,
"IBM1148"
,
...
...
@@ -990,7 +990,7 @@ public class ExtendedCharsets
"ccsid01148"
,
"cp01148"
,
"1148"
,
//
"ebcdic-international-500+euro"
"ebcdic-international-500+euro"
});
charset
(
"IBM01149"
,
"IBM1149"
,
...
...
@@ -999,7 +999,7 @@ public class ExtendedCharsets
"ccsid01149"
,
"cp01149"
,
"1149"
,
//
"ebcdic-s-871+euro"
"ebcdic-s-871+euro"
});
// Macintosh MacOS/Apple char encodingd
...
...
src/share/classes/sun/nio/cs/standard-charsets
浏览文件 @
731c5844
...
...
@@ -314,6 +314,7 @@ charset IBM00858 IBM858
alias
ccsid00858
alias
cp00858
alias
858
alias
PC
-
Multilingual
-
850
+
euro
charset
IBM862
IBM862
alias
cp862
#
JDK
historical
...
...
src/share/classes/sun/reflect/generics/factory/CoreReflectionFactory.java
浏览文件 @
731c5844
...
...
@@ -25,6 +25,7 @@
package
sun.reflect.generics.factory
;
import
java.lang.reflect.Array
;
import
java.lang.reflect.Constructor
;
import
java.lang.reflect.GenericDeclaration
;
import
java.lang.reflect.Method
;
...
...
@@ -118,7 +119,10 @@ public class CoreReflectionFactory implements GenericsFactory {
}
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
;}
...
...
src/solaris/bin/java_md.c
浏览文件 @
731c5844
...
...
@@ -289,13 +289,13 @@ CreateExecutionEnvironment(int *_argcp,
if
(
wanted
==
running
)
{
/* Find out where the JRE is that we will be using. */
if
(
!
GetJREPath
(
jrepath
,
so_jrepath
,
arch
,
JNI_FALSE
)
)
{
ReportErrorMessage
(
JRE_ERROR1
);
JLI_
ReportErrorMessage
(
JRE_ERROR1
);
exit
(
2
);
}
/* Find the specified JVM type */
if
(
ReadKnownVMs
(
jrepath
,
arch
,
JNI_FALSE
)
<
1
)
{
ReportErrorMessage
(
CFG_ERROR7
);
JLI_
ReportErrorMessage
(
CFG_ERROR7
);
exit
(
1
);
}
...
...
@@ -303,7 +303,7 @@ CreateExecutionEnvironment(int *_argcp,
jvmtype
=
CheckJvmType
(
_argcp
,
_argvp
,
JNI_FALSE
);
if
(
!
GetJVMPath
(
jrepath
,
jvmtype
,
jvmpath
,
so_jvmpath
,
arch
))
{
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
JLI_
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
exit
(
4
);
}
}
else
{
/* do the same speculatively or exit */
...
...
@@ -330,7 +330,7 @@ CreateExecutionEnvironment(int *_argcp,
EndDataModelSpeculate:
/* give up and let other code report error message */
;
#else
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
JLI_
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
exit
(
1
);
#endif
}
...
...
@@ -391,7 +391,7 @@ CreateExecutionEnvironment(int *_argcp,
break
;
default:
ReportErrorMessage
(
JRE_ERROR3
,
__LINE__
);
JLI_
ReportErrorMessage
(
JRE_ERROR3
,
__LINE__
);
exit
(
1
);
/* unknown value in wanted */
break
;
}
...
...
@@ -553,17 +553,17 @@ CreateExecutionEnvironment(int *_argcp,
(
void
)
fflush
(
stdout
);
(
void
)
fflush
(
stderr
);
execve
(
newexec
,
argv
,
newenvp
);
ReportErrorMessageSys
(
JRE_ERROR4
,
newexec
);
JLI_
ReportErrorMessageSys
(
JRE_ERROR4
,
newexec
);
#ifdef DUAL_MODE
if
(
running
!=
wanted
)
{
ReportErrorMessage
(
JRE_ERROR5
,
wanted
,
running
);
JLI_
ReportErrorMessage
(
JRE_ERROR5
,
wanted
,
running
);
# ifdef __solaris__
# ifdef __sparc
ReportErrorMessage
(
JRE_ERROR6
);
JLI_
ReportErrorMessage
(
JRE_ERROR6
);
# else
ReportErrorMessage
(
JRE_ERROR7
);
JLI_
ReportErrorMessage
(
JRE_ERROR7
);
# endif
}
# endif
...
...
@@ -627,7 +627,7 @@ GetJREPath(char *path, jint pathsize, const char * arch, jboolean speculative)
}
if
(
!
speculative
)
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
JLI_
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
return
JNI_FALSE
;
found:
...
...
@@ -680,13 +680,13 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
if
(
length
>
0
)
{
location
=
JLI_StrStr
(
buf
,
"sparcv8plus "
);
if
(
location
==
NULL
)
{
ReportErrorMessage
(
JVM_ERROR3
);
JLI_
ReportErrorMessage
(
JVM_ERROR3
);
return
JNI_FALSE
;
}
}
}
#endif
ReportErrorMessage
(
DLL_ERROR1
,
__LINE__
);
JLI_
ReportErrorMessage
(
DLL_ERROR1
,
__LINE__
);
goto
error
;
}
...
...
@@ -703,7 +703,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
return
JNI_TRUE
;
error:
ReportErrorMessage
(
DLL_ERROR2
,
jvmpath
,
dlerror
());
JLI_
ReportErrorMessage
(
DLL_ERROR2
,
jvmpath
,
dlerror
());
return
JNI_FALSE
;
}
...
...
@@ -848,7 +848,7 @@ SetExecname(char **argv)
fptr
=
(
int
(
*
)())
dlsym
(
RTLD_DEFAULT
,
"main"
);
if
(
fptr
==
NULL
)
{
ReportErrorMessage
(
DLL_ERROR3
,
dlerror
());
JLI_
ReportErrorMessage
(
DLL_ERROR3
,
dlerror
());
return
JNI_FALSE
;
}
...
...
@@ -885,7 +885,7 @@ SetExecname(char **argv)
return
exec_path
;
}
void
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
void
JLI_
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
va_list
vl
;
va_start
(
vl
,
fmt
);
vfprintf
(
stderr
,
fmt
,
vl
);
...
...
@@ -893,7 +893,7 @@ void ReportErrorMessage(const char* fmt, ...) {
va_end
(
vl
);
}
void
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
{
void
JLI_
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
{
va_list
vl
;
char
*
emsg
;
...
...
@@ -912,7 +912,7 @@ void ReportErrorMessageSys(const char* fmt, ...) {
va_end
(
vl
);
}
void
ReportExceptionDescription
(
JNIEnv
*
env
)
{
void
JLI_
ReportExceptionDescription
(
JNIEnv
*
env
)
{
(
*
env
)
->
ExceptionDescribe
(
env
);
}
...
...
@@ -1078,7 +1078,7 @@ ExecJRE(char *jre, char **argv)
* Resolve the real path to the directory containing the selected JRE.
*/
if
(
realpath
(
jre
,
wanted
)
==
NULL
)
{
ReportErrorMessage
(
JRE_ERROR9
,
jre
);
JLI_
ReportErrorMessage
(
JRE_ERROR9
,
jre
);
exit
(
1
);
}
...
...
@@ -1087,7 +1087,7 @@ ExecJRE(char *jre, char **argv)
*/
SetExecname
(
argv
);
if
(
execname
==
NULL
)
{
ReportErrorMessage
(
JRE_ERROR10
);
JLI_
ReportErrorMessage
(
JRE_ERROR10
);
exit
(
1
);
}
...
...
@@ -1106,7 +1106,7 @@ ExecJRE(char *jre, char **argv)
* can be so deadly.
*/
if
(
JLI_StrLen
(
wanted
)
+
JLI_StrLen
(
progname
)
+
6
>
PATH_MAX
)
{
ReportErrorMessage
(
JRE_ERROR11
);
JLI_
ReportErrorMessage
(
JRE_ERROR11
);
exit
(
1
);
}
...
...
@@ -1126,7 +1126,7 @@ ExecJRE(char *jre, char **argv)
(
void
)
fflush
(
stdout
);
(
void
)
fflush
(
stderr
);
execv
(
wanted
,
argv
);
ReportErrorMessageSys
(
JRE_ERROR12
,
wanted
);
JLI_
ReportErrorMessageSys
(
JRE_ERROR12
,
wanted
);
exit
(
1
);
}
...
...
src/solaris/classes/sun/nio/ch/EPollArrayWrapper.java
浏览文件 @
731c5844
...
...
@@ -69,11 +69,11 @@ class EPollArrayWrapper {
static
final
int
EPOLL_CTL_MOD
=
3
;
// Miscellaneous constants
static
final
short
SIZE_EPOLLEVENT
=
12
;
static
final
shor
t
EVENT_OFFSET
=
0
;
static
final
short
DATA_OFFSET
=
4
;
static
final
short
FD_OFFSET
=
4
;
static
final
int
NUM_EPOLLEVENTS
=
Math
.
min
(
fdLimit
(),
8192
);
static
final
int
SIZE_EPOLLEVENT
=
sizeofEPollEvent
()
;
static
final
in
t
EVENT_OFFSET
=
0
;
static
final
int
DATA_OFFSET
=
offsetofData
()
;
static
final
int
FD_OFFSET
=
DATA_OFFSET
;
static
final
int
NUM_EPOLLEVENTS
=
Math
.
min
(
fdLimit
(),
8192
);
// Base address of the native pollArray
private
final
long
pollArrayAddress
;
...
...
@@ -280,6 +280,8 @@ class EPollArrayWrapper {
private
native
void
epollCtl
(
int
epfd
,
int
opcode
,
int
fd
,
int
events
);
private
native
int
epollWait
(
long
pollAddress
,
int
numfds
,
long
timeout
,
int
epfd
)
throws
IOException
;
private
static
native
int
sizeofEPollEvent
();
private
static
native
int
offsetofData
();
private
static
native
int
fdLimit
();
private
static
native
void
interrupt
(
int
fd
);
private
static
native
void
init
();
...
...
src/solaris/native/sun/nio/ch/EPollArrayWrapper.c
浏览文件 @
731c5844
...
...
@@ -48,10 +48,18 @@ typedef union epoll_data {
__uint64_t
u64
;
}
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
{
__uint32_t
events
;
/* Epoll events */
epoll_data_t
data
;
/* User data variable */
}
__attribute__
((
__packed__
))
;
}
EPOLL_PACKED
;
#ifdef __cplusplus
}
...
...
@@ -143,6 +151,18 @@ Java_sun_nio_ch_EPollArrayWrapper_fdLimit(JNIEnv *env, jclass this)
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
Java_sun_nio_ch_EPollArrayWrapper_epollCtl
(
JNIEnv
*
env
,
jobject
this
,
jint
epfd
,
jint
opcode
,
jint
fd
,
jint
events
)
...
...
src/windows/bin/java_md.c
浏览文件 @
731c5844
...
...
@@ -105,26 +105,26 @@ CreateExecutionEnvironment(int *_argc,
}
}
if
(
running
!=
wanted
)
{
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
JLI_
ReportErrorMessage
(
JRE_ERROR2
,
wanted
);
exit
(
1
);
}
/* Find out where the JRE is that we will be using. */
if
(
!
GetJREPath
(
jrepath
,
so_jrepath
))
{
ReportErrorMessage
(
JRE_ERROR1
);
JLI_
ReportErrorMessage
(
JRE_ERROR1
);
exit
(
2
);
}
/* Find the specified JVM type */
if
(
ReadKnownVMs
(
jrepath
,
(
char
*
)
GetArch
(),
JNI_FALSE
)
<
1
)
{
ReportErrorMessage
(
CFG_ERROR7
);
JLI_
ReportErrorMessage
(
CFG_ERROR7
);
exit
(
1
);
}
jvmtype
=
CheckJvmType
(
_argc
,
_argv
,
JNI_FALSE
);
jvmpath
[
0
]
=
'\0'
;
if
(
!
GetJVMPath
(
jrepath
,
jvmtype
,
jvmpath
,
so_jvmpath
))
{
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
JLI_
ReportErrorMessage
(
CFG_ERROR8
,
jvmtype
,
jvmpath
);
exit
(
4
);
}
/* If we got here, jvmpath has been correctly initialized. */
...
...
@@ -160,7 +160,7 @@ GetJREPath(char *path, jint pathsize)
goto
found
;
}
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
JLI_
ReportErrorMessage
(
JRE_ERROR8
JAVA_DLL
);
return
JNI_FALSE
;
found:
...
...
@@ -212,7 +212,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
JLI_TraceLauncher
(
"CRT path is %s
\n
"
,
crtpath
);
if
(
_access
(
crtpath
,
0
)
==
0
)
{
if
(
LoadLibrary
(
crtpath
)
==
0
)
{
ReportErrorMessage
(
DLL_ERROR4
,
crtpath
);
JLI_
ReportErrorMessage
(
DLL_ERROR4
,
crtpath
);
return
JNI_FALSE
;
}
}
...
...
@@ -220,7 +220,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
/* Load the Java VM DLL */
if
((
handle
=
LoadLibrary
(
jvmpath
))
==
0
)
{
ReportErrorMessage
(
DLL_ERROR4
,
(
char
*
)
jvmpath
);
JLI_
ReportErrorMessage
(
DLL_ERROR4
,
(
char
*
)
jvmpath
);
return
JNI_FALSE
;
}
...
...
@@ -230,7 +230,7 @@ LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
ifn
->
GetDefaultJavaVMInitArgs
=
(
void
*
)
GetProcAddress
(
handle
,
"JNI_GetDefaultJavaVMInitArgs"
);
if
(
ifn
->
CreateJavaVM
==
0
||
ifn
->
GetDefaultJavaVMInitArgs
==
0
)
{
ReportErrorMessage
(
JNI_ERROR1
,
(
char
*
)
jvmpath
);
JLI_
ReportErrorMessage
(
JNI_ERROR1
,
(
char
*
)
jvmpath
);
return
JNI_FALSE
;
}
...
...
@@ -292,19 +292,19 @@ GetPublicJREHome(char *buf, jint bufsize)
/* Find the current version of the JRE */
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
;
}
if
(
!
GetStringFromRegistry
(
key
,
"CurrentVersion"
,
version
,
sizeof
(
version
)))
{
ReportErrorMessage
(
REG_ERROR2
,
JRE_KEY
);
JLI_
ReportErrorMessage
(
REG_ERROR2
,
JRE_KEY
);
RegCloseKey
(
key
);
return
JNI_FALSE
;
}
if
(
JLI_StrCmp
(
version
,
GetDotVersion
())
!=
0
)
{
ReportErrorMessage
(
REG_ERROR3
,
JRE_KEY
,
version
,
GetDotVersion
()
JLI_
ReportErrorMessage
(
REG_ERROR3
,
JRE_KEY
,
version
,
GetDotVersion
()
);
RegCloseKey
(
key
);
return
JNI_FALSE
;
...
...
@@ -312,13 +312,13 @@ GetPublicJREHome(char *buf, jint bufsize)
/* Find directory where the current version is installed. */
if
(
RegOpenKeyEx
(
key
,
version
,
0
,
KEY_READ
,
&
subkey
)
!=
0
)
{
ReportErrorMessage
(
REG_ERROR1
,
JRE_KEY
,
version
);
JLI_
ReportErrorMessage
(
REG_ERROR1
,
JRE_KEY
,
version
);
RegCloseKey
(
key
);
return
JNI_FALSE
;
}
if
(
!
GetStringFromRegistry
(
subkey
,
"JavaHome"
,
buf
,
bufsize
))
{
ReportErrorMessage
(
REG_ERROR4
,
JRE_KEY
,
version
);
JLI_
ReportErrorMessage
(
REG_ERROR4
,
JRE_KEY
,
version
);
RegCloseKey
(
key
);
RegCloseKey
(
subkey
);
return
JNI_FALSE
;
...
...
@@ -370,7 +370,7 @@ jlong Counter2Micros(jlong counts)
}
void
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
JLI_
ReportErrorMessage
(
const
char
*
fmt
,
...)
{
va_list
vl
;
va_start
(
vl
,
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
* format the separation of the messages.
*/
void
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
JLI_
ReportErrorMessageSys
(
const
char
*
fmt
,
...)
{
va_list
vl
;
...
...
@@ -462,7 +462,7 @@ ReportErrorMessageSys(const char *fmt, ...)
va_end
(
vl
);
}
void
ReportExceptionDescription
(
JNIEnv
*
env
)
{
void
JLI_
ReportExceptionDescription
(
JNIEnv
*
env
)
{
if
(
IsJavaw
())
{
/*
* This code should be replaced by code which opens a window with
...
...
@@ -733,7 +733,7 @@ ExecJRE(char *jre, char **argv) {
*/
len
=
GetModuleFileName
(
NULL
,
path
,
MAXPATHLEN
+
1
);
if
(
len
==
0
||
len
>
MAXPATHLEN
)
{
ReportErrorMessageSys
(
JRE_ERROR9
,
progname
);
JLI_
ReportErrorMessageSys
(
JRE_ERROR9
,
progname
);
exit
(
1
);
}
...
...
@@ -766,7 +766,7 @@ ExecJRE(char *jre, char **argv) {
* If it weren't for this semantic flaw, the code below would be ...
*
* execv(path, argv);
* ReportErrorMessage("Error: Exec of %s failed\n", path);
*
JLI_
ReportErrorMessage("Error: Exec of %s failed\n", path);
* exit(1);
*
* The incorrect exec semantics could be addressed by:
...
...
@@ -876,7 +876,7 @@ ExecJRE(char *jre, char **argv) {
(
LPCTSTR
)
NULL
,
/* current directory */
(
LPSTARTUPINFO
)
&
si
,
/* (in) startup information */
(
LPPROCESS_INFORMATION
)
&
pi
))
{
/* (out) process information */
ReportErrorMessageSys
(
SYS_ERROR1
,
path
);
JLI_
ReportErrorMessageSys
(
SYS_ERROR1
,
path
);
exit
(
1
);
}
...
...
@@ -884,7 +884,7 @@ ExecJRE(char *jre, char **argv) {
if
(
GetExitCodeProcess
(
pi
.
hProcess
,
&
exitCode
)
==
FALSE
)
exitCode
=
1
;
}
else
{
ReportErrorMessage
(
SYS_ERROR2
);
JLI_
ReportErrorMessage
(
SYS_ERROR2
);
exitCode
=
1
;
}
...
...
test/java/lang/ThreadGroup/NullThreadName.java
0 → 100644
浏览文件 @
731c5844
/*
* 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 6576763
* @summary (thread) Thread constructors throw undocumented NPE for null name
*/
/*
* Verify that threads constructed with a null thread name do not get added
* to the list of unstarted thread for a thread group. We can do this by
* checking that a daemon threadGroup is desroyed after its final valid thread
* has completed.
*/
import
java.util.concurrent.CountDownLatch
;
import
static
java
.
lang
.
System
.
out
;
public
class
NullThreadName
{
static
CountDownLatch
done
=
new
CountDownLatch
(
1
);
public
static
void
main
(
String
args
[])
throws
Exception
{
ThreadGroup
tg
=
new
ThreadGroup
(
"chegar-threads"
);
Thread
goodThread
=
new
Thread
(
tg
,
new
GoodThread
(),
"goodThread"
);
try
{
Thread
badThread
=
new
Thread
(
tg
,
new
Runnable
(){
@Override
public
void
run
()
{}
},
null
);
}
catch
(
NullPointerException
npe
)
{
out
.
println
(
"OK, caught expected "
+
npe
);
}
tg
.
setDaemon
(
true
);
goodThread
.
start
();
done
.
await
();
int
count
=
0
;
while
(
goodThread
.
isAlive
())
{
/* Hold off a little to allow the thread to complete */
out
.
println
(
"GoodThread still alive, sleeping..."
);
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
unused
)
{}
/* do not wait forever */
if
(
count
++
>
5
)
throw
new
AssertionError
(
"GoodThread is still alive!"
);
}
if
(!
tg
.
isDestroyed
())
{
throw
new
AssertionError
(
"Failed: Thread group is not destroyed."
);
}
}
static
class
GoodThread
implements
Runnable
{
@Override
public
void
run
()
{
out
.
println
(
"Good Thread started..."
);
out
.
println
(
"Good Thread finishing"
);
done
.
countDown
();
}
}
}
test/java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
0 → 100644
浏览文件 @
731c5844
/*
* 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/nio/BufferPoolMXBean/Basic.java
0 → 100644
浏览文件 @
731c5844
/*
* 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/nio/cs/CheckICNE.java
0 → 100644
浏览文件 @
731c5844
/*
* 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 4849617
@summary Checks "+" is a legal character for charset name
*/
import
java.nio.charset.*
;
public
class
CheckICNE
{
static
int
failed
=
0
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
Charset
.
forName
(
"abc+"
);
}
catch
(
UnsupportedCharsetException
uce
)
{}
try
{
java
.
nio
.
charset
.
Charset
.
forName
(
"+abc"
);
}
catch
(
IllegalCharsetNameException
icne
)
{}
String
[]
euros
=
{
"PC-Multilingual-850+euro"
,
"ebcdic-us-037+euro"
,
"ebcdic-de-273+euro"
,
"ebcdic-no-277+euro"
,
"ebcdic-dk-277+euro"
,
"ebcdic-fi-278+euro"
,
"ebcdic-se-278+euro"
,
"ebcdic-it-280+euro"
,
"ebcdic-es-284+euro"
,
"ebcdic-gb-285+euro"
,
"ebcdic-fr-277+euro"
,
"ebcdic-international-500+euro"
,
"ebcdic-s-871+euro"
};
System
.
out
.
println
(
"Test Passed!"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录