Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
dea63d31
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看板
提交
dea63d31
编写于
5月 10, 2012
作者:
V
valeriep
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
b61df498
0b209f50
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
100 addition
and
44 deletion
+100
-44
make/com/oracle/security/ucrypto/Makefile
make/com/oracle/security/ucrypto/Makefile
+1
-1
make/common/shared/Defs-java.gmk
make/common/shared/Defs-java.gmk
+4
-4
make/sun/security/ec/Makefile
make/sun/security/ec/Makefile
+2
-2
make/sun/security/mscapi/Makefile
make/sun/security/mscapi/Makefile
+1
-1
make/sun/security/pkcs11/Makefile
make/sun/security/pkcs11/Makefile
+1
-1
makefiles/com/oracle/security/ucrypto/Makefile
makefiles/com/oracle/security/ucrypto/Makefile
+1
-1
makefiles/common/shared/Defs-java.gmk
makefiles/common/shared/Defs-java.gmk
+4
-4
makefiles/sun/security/ec/Makefile
makefiles/sun/security/ec/Makefile
+3
-2
makefiles/sun/security/mscapi/Makefile
makefiles/sun/security/mscapi/Makefile
+3
-2
makefiles/sun/security/pkcs11/Makefile
makefiles/sun/security/pkcs11/Makefile
+2
-1
src/share/classes/java/util/prefs/AbstractPreferences.java
src/share/classes/java/util/prefs/AbstractPreferences.java
+2
-0
src/share/classes/sun/nio/ch/SocketChannelImpl.java
src/share/classes/sun/nio/ch/SocketChannelImpl.java
+4
-11
src/share/classes/sun/security/provider/SecureRandom.java
src/share/classes/sun/security/provider/SecureRandom.java
+2
-2
src/share/demo/management/MemoryMonitor/README.txt
src/share/demo/management/MemoryMonitor/README.txt
+1
-1
src/share/native/com/sun/java/util/jar/pack/jni.cpp
src/share/native/com/sun/java/util/jar/pack/jni.cpp
+6
-2
test/java/util/prefs/RemoveNullKeyCheck.java
test/java/util/prefs/RemoveNullKeyCheck.java
+63
-9
未找到文件。
make/com/oracle/security/ucrypto/Makefile
浏览文件 @
dea63d31
...
@@ -139,7 +139,7 @@ ifndef OPENJDK
...
@@ -139,7 +139,7 @@ ifndef OPENJDK
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
=
-bootclasspath
\
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
"
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
$(JCE_PATH)
"
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Library.gmk
include
$(BUILDDIR)/common/Library.gmk
...
...
make/common/shared/Defs-java.gmk
浏览文件 @
dea63d31
#
#
# Copyright (c) 2007, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 201
2
, Oracle and/or its affiliates. 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
...
@@ -139,7 +139,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
...
@@ -139,7 +139,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
# built implicitly/explicitly.
# built implicitly/explicitly.
#
#
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
JCE
FLAGS
= $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
JCE
_PATH
= $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
endif
endif
# Add the source level
# Add the source level
...
@@ -152,11 +152,11 @@ TARGET_CLASS_VERSION = 7
...
@@ -152,11 +152,11 @@ TARGET_CLASS_VERSION = 7
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
JAVACFLAGS += $(CLASS_VERSION)
JAVACFLAGS += $(CLASS_VERSION)
JAVACFLAGS += -encoding ascii
JAVACFLAGS += -encoding ascii
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE
FLAGS
)"
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE
_PATH
)"
JAVACFLAGS += $(OTHER_JAVACFLAGS)
JAVACFLAGS += $(OTHER_JAVACFLAGS)
# Needed for javah
# Needed for javah
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE
FLAGS
)"
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE
_PATH
)"
# Needed for javadoc to ensure it builds documentation
# Needed for javadoc to ensure it builds documentation
# against the newly built classes
# against the newly built classes
...
...
make/sun/security/ec/Makefile
浏览文件 @
dea63d31
#
#
# Copyright (c) 2009, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 201
2
, Oracle and/or its affiliates. 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
...
@@ -160,7 +160,7 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
...
@@ -160,7 +160,7 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
$(PKGDIR)
/ECKeyPairGenerator.java
$(PKGDIR)
/ECKeyPairGenerator.java
JAVAHFLAGS
=
-bootclasspath
\
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
"
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
$(JCE_PATH)
"
#
#
...
...
make/sun/security/mscapi/Makefile
浏览文件 @
dea63d31
...
@@ -150,7 +150,7 @@ OTHER_INCLUDES += \
...
@@ -150,7 +150,7 @@ OTHER_INCLUDES += \
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
=
-bootclasspath
\
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
"
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
$(JCE_PATH)
"
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
...
...
make/sun/security/pkcs11/Makefile
浏览文件 @
dea63d31
...
@@ -151,7 +151,7 @@ OTHER_INCLUDES += \
...
@@ -151,7 +151,7 @@ OTHER_INCLUDES += \
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
=
-bootclasspath
\
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
"
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
$(JCE_PATH)
"
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
...
...
makefiles/com/oracle/security/ucrypto/Makefile
浏览文件 @
dea63d31
...
@@ -139,7 +139,7 @@ ifndef OPENJDK
...
@@ -139,7 +139,7 @@ ifndef OPENJDK
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
=
-bootclasspath
\
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
"
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
$(JCE_PATH)
"
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Library.gmk
include
$(BUILDDIR)/common/Library.gmk
...
...
makefiles/common/shared/Defs-java.gmk
浏览文件 @
dea63d31
#
#
# Copyright (c) 2007, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2007, 201
2
, Oracle and/or its affiliates. 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
...
@@ -141,7 +141,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
...
@@ -141,7 +141,7 @@ JAVACFLAGS += $(JAVAC_LINT_OPTIONS)
# built implicitly/explicitly.
# built implicitly/explicitly.
#
#
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
JCE
FLAGS
= $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
JCE
_PATH
= $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
endif
endif
# Add the source level
# Add the source level
...
@@ -154,11 +154,11 @@ TARGET_CLASS_VERSION = 7
...
@@ -154,11 +154,11 @@ TARGET_CLASS_VERSION = 7
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
JAVACFLAGS += $(CLASS_VERSION)
JAVACFLAGS += $(CLASS_VERSION)
JAVACFLAGS += -encoding ascii
JAVACFLAGS += -encoding ascii
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE
FLAGS
)"
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCE
_PATH
)"
JAVACFLAGS += $(OTHER_JAVACFLAGS)
JAVACFLAGS += $(OTHER_JAVACFLAGS)
# Needed for javah
# Needed for javah
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE
FLAGS
)"
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCE
_PATH
)"
# Needed for javadoc to ensure it builds documentation
# Needed for javadoc to ensure it builds documentation
# against the newly built classes
# against the newly built classes
...
...
makefiles/sun/security/ec/Makefile
浏览文件 @
dea63d31
#
#
# Copyright (c) 2009, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 201
2
, Oracle and/or its affiliates. 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
...
@@ -159,7 +159,8 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
...
@@ -159,7 +159,8 @@ ifeq ($(NATIVE_ECC_AVAILABLE), true)
$(PKGDIR)
/ECDSASignature.java
\
$(PKGDIR)
/ECDSASignature.java
\
$(PKGDIR)
/ECKeyPairGenerator.java
$(PKGDIR)
/ECKeyPairGenerator.java
JAVAHFLAGS
+=
-Xbootclasspath
/p:
$(CLASSDESTDIR)
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)
"
#
#
# C and C++ files
# C and C++ files
...
...
makefiles/sun/security/mscapi/Makefile
浏览文件 @
dea63d31
#
#
# Copyright (c) 2005, 201
1
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2005, 201
2
, Oracle and/or its affiliates. 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
...
@@ -149,7 +149,8 @@ OTHER_INCLUDES += \
...
@@ -149,7 +149,8 @@ OTHER_INCLUDES += \
# Rules
# Rules
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
+=
-Xbootclasspath
/p:
$(CLASSDESTDIR)
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)
"
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
...
...
makefiles/sun/security/pkcs11/Makefile
浏览文件 @
dea63d31
...
@@ -150,7 +150,8 @@ OTHER_INCLUDES += \
...
@@ -150,7 +150,8 @@ OTHER_INCLUDES += \
# Rules
# Rules
#
#
CLASSDESTDIR
=
$(TEMPDIR)
/classes
CLASSDESTDIR
=
$(TEMPDIR)
/classes
JAVAHFLAGS
=
-bootclasspath
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)
"
JAVAHFLAGS
=
-bootclasspath
\
"
$(CLASSDESTDIR)$(CLASSPATH_SEPARATOR)$(CLASSBINDIR)$(JCE_PATH)
"
include
$(BUILDDIR)/common/Mapfile-vers.gmk
include
$(BUILDDIR)/common/Mapfile-vers.gmk
...
...
src/share/classes/java/util/prefs/AbstractPreferences.java
浏览文件 @
dea63d31
...
@@ -305,8 +305,10 @@ public abstract class AbstractPreferences extends Preferences {
...
@@ -305,8 +305,10 @@ public abstract class AbstractPreferences extends Preferences {
* @param key key whose mapping is to be removed from the preference node.
* @param key key whose mapping is to be removed from the preference node.
* @throws IllegalStateException if this node (or an ancestor) has been
* @throws IllegalStateException if this node (or an ancestor) has been
* removed with the {@link #removeNode()} method.
* removed with the {@link #removeNode()} method.
* @throws NullPointerException {@inheritDoc}.
*/
*/
public
void
remove
(
String
key
)
{
public
void
remove
(
String
key
)
{
Objects
.
requireNonNull
(
key
,
"Specified key cannot be null"
);
synchronized
(
lock
)
{
synchronized
(
lock
)
{
if
(
removed
)
if
(
removed
)
throw
new
IllegalStateException
(
"Node has been removed."
);
throw
new
IllegalStateException
(
"Node has been removed."
);
...
...
src/share/classes/sun/nio/ch/SocketChannelImpl.java
浏览文件 @
dea63d31
...
@@ -629,17 +629,6 @@ class SocketChannelImpl
...
@@ -629,17 +629,6 @@ class SocketChannelImpl
break
;
break
;
}
}
synchronized
(
stateLock
)
{
if
(
isOpen
()
&&
(
localAddress
==
null
)
||
((
InetSocketAddress
)
localAddress
)
.
getAddress
().
isAnyLocalAddress
())
{
// Socket was not bound before connecting or
// Socket was bound with an "anyLocalAddress"
localAddress
=
Net
.
localAddress
(
fd
);
}
}
}
finally
{
}
finally
{
readerCleanup
();
readerCleanup
();
end
((
n
>
0
)
||
(
n
==
IOStatus
.
UNAVAILABLE
));
end
((
n
>
0
)
||
(
n
==
IOStatus
.
UNAVAILABLE
));
...
@@ -659,6 +648,8 @@ class SocketChannelImpl
...
@@ -659,6 +648,8 @@ class SocketChannelImpl
// Connection succeeded; disallow further
// Connection succeeded; disallow further
// invocation
// invocation
state
=
ST_CONNECTED
;
state
=
ST_CONNECTED
;
if
(
isOpen
())
localAddress
=
Net
.
localAddress
(
fd
);
return
true
;
return
true
;
}
}
// If nonblocking and no exception then connection
// If nonblocking and no exception then connection
...
@@ -747,6 +738,8 @@ class SocketChannelImpl
...
@@ -747,6 +738,8 @@ class SocketChannelImpl
if
(
n
>
0
)
{
if
(
n
>
0
)
{
synchronized
(
stateLock
)
{
synchronized
(
stateLock
)
{
state
=
ST_CONNECTED
;
state
=
ST_CONNECTED
;
if
(
isOpen
())
localAddress
=
Net
.
localAddress
(
fd
);
}
}
return
true
;
return
true
;
}
}
...
...
src/share/classes/sun/security/provider/SecureRandom.java
浏览文件 @
dea63d31
/*
/*
* Copyright (c) 1998, 20
03
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
12
, Oracle and/or its affiliates. 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
...
@@ -102,7 +102,7 @@ implements java.io.Serializable {
...
@@ -102,7 +102,7 @@ implements java.io.Serializable {
try
{
try
{
digest
=
MessageDigest
.
getInstance
(
"SHA"
);
digest
=
MessageDigest
.
getInstance
(
"SHA"
);
}
catch
(
NoSuchAlgorithmException
e
)
{
}
catch
(
NoSuchAlgorithmException
e
)
{
throw
new
InternalError
(
"internal error: SHA-1 not available."
);
throw
new
InternalError
(
"internal error: SHA-1 not available."
,
e
);
}
}
if
(
seed
!=
null
)
{
if
(
seed
!=
null
)
{
...
...
src/share/demo/management/MemoryMonitor/README.txt
浏览文件 @
dea63d31
...
@@ -38,7 +38,7 @@ and plots the memory usage history graph.
...
@@ -38,7 +38,7 @@ and plots the memory usage history graph.
To run the MemoryMonitor demo
To run the MemoryMonitor demo
java -jar <JDK_HOME>/demo/management/MemoryMonitor.jar
java -jar <JDK_HOME>/demo/management/MemoryMonitor
/MemoryMonitor
.jar
These instructions assume that this installation's version of the java
These instructions assume that this installation's version of the java
command is in your path. If it isn't, then you should either
command is in your path. If it isn't, then you should either
...
...
src/share/native/com/sun/java/util/jar/pack/jni.cpp
浏览文件 @
dea63d31
/*
/*
* Copyright (c) 2003, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
12
, Oracle and/or its affiliates. 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
...
@@ -82,7 +82,11 @@ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
...
@@ -82,7 +82,11 @@ static unpacker* get_unpacker(JNIEnv *env, jobject pObj, bool noCreate=false) {
static
unpacker
*
get_unpacker
()
{
static
unpacker
*
get_unpacker
()
{
//fprintf(stderr, "get_unpacker()\n");
//fprintf(stderr, "get_unpacker()\n");
JavaVM
*
vm
=
null
;
JavaVM
*
vm
=
null
;
JNI_GetCreatedJavaVMs
(
&
vm
,
1
,
null
);
jsize
nVM
=
0
;
jint
retval
=
JNI_GetCreatedJavaVMs
(
&
vm
,
1
,
&
nVM
);
// other VM implements may differ, thus for correctness, we need these checks
if
(
retval
!=
JNI_OK
||
nVM
!=
1
)
return
null
;
void
*
envRaw
=
null
;
void
*
envRaw
=
null
;
vm
->
GetEnv
(
&
envRaw
,
JNI_VERSION_1_1
);
vm
->
GetEnv
(
&
envRaw
,
JNI_VERSION_1_1
);
JNIEnv
*
env
=
(
JNIEnv
*
)
envRaw
;
JNIEnv
*
env
=
(
JNIEnv
*
)
envRaw
;
...
...
test/java/util/prefs/RemoveNullKeyCheck.java
浏览文件 @
dea63d31
...
@@ -22,23 +22,77 @@
...
@@ -22,23 +22,77 @@
*/
*/
/* @test
/* @test
* @bug 7160242
* @bug 7160242
7165118
* @summary Check if NullPointerException is thrown if the key passed
* @summary Check if NullPointerException is thrown if the key passed
* to remove() is null.
* to remove() is null.
*/
*/
import
java.util.prefs.Preferences
;
import
java.util.prefs.Preferences
;
import
java.util.prefs.AbstractPreferences
;
import
java.util.prefs.BackingStoreException
;
public
class
RemoveNullKeyCheck
{
public
class
RemoveNullKeyCheck
{
private
static
boolean
failed
=
false
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
try
{
checkPreferencesRemove
();
Preferences
node
=
Preferences
.
userRoot
().
node
(
"N1"
);
checkAbstractPreferencesRemove
();
node
.
remove
(
null
);
if
(
failed
)
{
throw
new
RuntimeException
(
"Expected NullPointerException "
+
throw
new
RuntimeException
(
"Expected NullPointerException "
+
"not thrown"
);
"not thrown"
);
}
catch
(
NullPointerException
npe
)
{
}
System
.
out
.
println
(
"NullPointerException thrown"
);
}
}
public
static
void
checkPreferencesRemove
()
{
try
{
Preferences
node
=
Preferences
.
userRoot
().
node
(
"N1"
);
node
.
remove
(
null
);
failed
=
true
;
}
catch
(
NullPointerException
npe
)
{
}
}
public
static
void
checkAbstractPreferencesRemove
()
{
Preferences
abstrPrefs
=
new
AbstractPreferences
(
null
,
""
)
{
@Override
protected
void
putSpi
(
String
key
,
String
value
)
{
}
@Override
protected
String
getSpi
(
String
key
)
{
return
null
;
}
@Override
protected
void
removeSpi
(
String
key
)
{
}
@Override
protected
void
removeNodeSpi
()
throws
BackingStoreException
{
}
@Override
protected
String
[]
keysSpi
()
throws
BackingStoreException
{
return
new
String
[
0
];
}
@Override
protected
String
[]
childrenNamesSpi
()
throws
BackingStoreException
{
return
new
String
[
0
];
}
@Override
protected
AbstractPreferences
childSpi
(
String
name
)
{
return
null
;
}
@Override
protected
void
syncSpi
()
throws
BackingStoreException
{
}
@Override
protected
void
flushSpi
()
throws
BackingStoreException
{
}
};
try
{
abstrPrefs
.
remove
(
null
);
failed
=
true
;
}
catch
(
NullPointerException
npe
)
{
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录