加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
src-openeuler-openjdk-11-resolve-code-inconsistencies.patch 28.92 KB
一键复制 编辑 原始数据 按行查看 历史
kuen 提交于 2022-07-26 20:58 . I5J14Z: upgrade to jdk11.0.16-ga
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp
index 211c2acda..86cc0108b 100644
--- a/src/hotspot/share/c1/c1_GraphBuilder.cpp
+++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3783,6 +3783,23 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign
INLINE_BAILOUT("mdo allocation failed");
}
+ const bool is_invokedynamic = (bc == Bytecodes::_invokedynamic);
+ const bool has_receiver = (bc != Bytecodes::_invokestatic && !is_invokedynamic);
+
+ const int args_base = state()->stack_size() - callee->arg_size();
+ assert(args_base >= 0, "stack underflow during inlining");
+
+ Value recv = NULL;
+ if (has_receiver) {
+ assert(!callee->is_static(), "callee must not be static");
+ assert(callee->arg_size() > 0, "must have at least a receiver");
+
+ recv = state()->stack_at(args_base);
+ if (recv->is_null_obj()) {
+ INLINE_BAILOUT("receiver is always null");
+ }
+ }
+
// now perform tests that are based on flag settings
bool inlinee_by_directive = compilation()->directive()->should_inline(callee);
if (callee->force_inline() || inlinee_by_directive) {
@@ -3825,21 +3842,11 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, bool ign
BlockBegin* orig_block = block();
- const bool is_invokedynamic = bc == Bytecodes::_invokedynamic;
- const bool has_receiver = (bc != Bytecodes::_invokestatic && !is_invokedynamic);
-
- const int args_base = state()->stack_size() - callee->arg_size();
- assert(args_base >= 0, "stack underflow during inlining");
-
// Insert null check if necessary
- Value recv = NULL;
if (has_receiver) {
// note: null check must happen even if first instruction of callee does
// an implicit null check since the callee is in a different scope
// and we must make sure exception handling does the right thing
- assert(!callee->is_static(), "callee must not be static");
- assert(callee->arg_size() > 0, "must have at least a receiver");
- recv = state()->stack_at(args_base);
null_check(recv);
}
diff --git a/src/hotspot/share/c1/c1_Instruction.hpp b/src/hotspot/share/c1/c1_Instruction.hpp
index a94a21e42..61d3cc8cc 100644
--- a/src/hotspot/share/c1/c1_Instruction.hpp
+++ b/src/hotspot/share/c1/c1_Instruction.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -268,7 +268,7 @@ class InstructionVisitor: public StackObj {
#define HASHING3(class_name, enabled, f1, f2, f3) \
- virtual intx hash() const { \
+ virtual intx hash() const { \
return (enabled) ? HASH4(name(), f1, f2, f3) : 0; \
} \
virtual bool is_equal(Value v) const { \
@@ -452,6 +452,8 @@ class Instruction: public CompilationResourceObj {
bool is_linked() const { return check_flag(IsLinkedInBlockFlag); }
bool can_be_linked() { return as_Local() == NULL && as_Phi() == NULL; }
+ bool is_null_obj() { return as_Constant() != NULL && type()->as_ObjectType()->constant_value()->is_null_object(); }
+
bool has_uses() const { return use_count() > 0; }
ValueStack* state_before() const { return _state_before; }
ValueStack* exception_state() const { return _exception_state; }
@@ -832,8 +834,8 @@ LEAF(LoadField, AccessField)
ciType* declared_type() const;
- // generic
- HASHING2(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset()) // cannot be eliminated if needs patching or if volatile
+ // generic; cannot be eliminated if needs patching or if volatile.
+ HASHING3(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset(), declared_type())
};
@@ -962,8 +964,8 @@ LEAF(LoadIndexed, AccessIndexed)
ciType* exact_type() const;
ciType* declared_type() const;
- // generic
- HASHING2(LoadIndexed, true, array()->subst(), index()->subst())
+ // generic;
+ HASHING3(LoadIndexed, true, type()->tag(), array()->subst(), index()->subst())
};
diff --git a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp
index 8b4be7d11..1b9dd5ada 100644
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp
@@ -217,7 +217,7 @@ public:
// Allow barrier sets to have shared state that is preserved across a compilation unit.
// This could for example comprise macro nodes to be expanded during macro expansion.
virtual void* create_barrier_state(Arena* comp_arena) const { return NULL; }
- virtual void optimize_loops(PhaseIdealLoop* phase, VectorSet& visited, Node_Stack& nstack, Node_List& worklist) const { }
+ virtual bool optimize_loops(PhaseIdealLoop* phase, LoopOptsMode mode, VectorSet& visited, Node_Stack& nstack, Node_List& worklist) const { return false; }
// If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
// expanded later, then now is the time to do so.
virtual bool expand_macro_nodes(PhaseMacroExpand* macro) const { return false; }
diff --git a/src/hotspot/share/gc/shared/taskqueue.hpp b/src/hotspot/share/gc/shared/taskqueue.hpp
index 246e82be6..110757684 100644
--- a/src/hotspot/share/gc/shared/taskqueue.hpp
+++ b/src/hotspot/share/gc/shared/taskqueue.hpp
@@ -515,7 +515,7 @@ public:
// As above, but it also terminates if the should_exit_termination()
// method of the terminator parameter returns true. If terminator is
// NULL, then it is ignored.
- SHENANDOAHGC_ONLY(virtual) virtual bool offer_termination(TerminatorTerminator* terminator);
+ virtual bool offer_termination(TerminatorTerminator* terminator);
// Reset the terminator, so that it may be reused again.
// The caller is responsible for ensuring that this is done
diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp
index 0f3c429ed..82fde2c94 100644
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp
@@ -889,7 +889,6 @@ void ShenandoahConcurrentMark::mark_loop_prework(uint w, ShenandoahTaskTerminato
template <class T, bool CANCELLABLE>
void ShenandoahConcurrentMark::mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, ShenandoahTaskTerminator *terminator) {
- int seed = 17;
uintx stride = ShenandoahMarkLoopStride;
ShenandoahHeap* heap = ShenandoahHeap::heap();
@@ -943,7 +942,7 @@ void ShenandoahConcurrentMark::mark_loop_work(T* cl, ShenandoahLiveData* live_da
uint work = 0;
for (uint i = 0; i < stride; i++) {
if (q->pop(t) ||
- queues->steal(worker_id, &seed, t)) {
+ queues->steal(worker_id, t)) {
do_task<T>(q, cl, live_data, &t);
work++;
} else {
diff --git a/src/hotspot/share/opto/graphKit.cpp b/src/hotspot/share/opto/graphKit.cpp
index 22222efbc..5849e8f86 100644
--- a/src/hotspot/share/opto/graphKit.cpp
+++ b/src/hotspot/share/opto/graphKit.cpp
@@ -44,6 +44,7 @@
#include "runtime/sharedRuntime.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/macros.hpp"
+#include "utilities/bitMap.inline.hpp"
#if INCLUDE_SHENANDOAHGC
#include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
#endif
diff --git a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java
index 1cbbf9cfc..ef384e609 100644
--- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java
+++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -112,7 +112,7 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory
try {
return SSLContext.getDefault().getServerSocketFactory();
- } catch (NoSuchAlgorithmException e) {
+ } catch (NoSuchAlgorithmException | UnsupportedOperationException e) {
return new DefaultSSLServerSocketFactory(e);
}
}
diff --git a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java
index 39a9918d4..1115c48d8 100644
--- a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java
+++ b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@ public abstract class SSLSocketFactory extends SocketFactory
try {
return SSLContext.getDefault().getSocketFactory();
- } catch (NoSuchAlgorithmException e) {
+ } catch (NoSuchAlgorithmException | UnsupportedOperationException e) {
return new DefaultSSLSocketFactory(e);
}
}
diff --git a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java
index de7da5c33..e8852f6bd 100644
--- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java
+++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java
@@ -207,6 +207,10 @@ public abstract class SSLContextImpl extends SSLContextSpi {
if (!isInitialized) {
throw new IllegalStateException("SSLContext is not initialized");
}
+ if (isDTLS()) {
+ throw new UnsupportedOperationException(
+ "DTLS not supported with SSLSocket");
+ }
return new SSLSocketFactoryImpl(this);
}
@@ -215,6 +219,10 @@ public abstract class SSLContextImpl extends SSLContextSpi {
if (!isInitialized) {
throw new IllegalStateException("SSLContext is not initialized");
}
+ if (isDTLS()) {
+ throw new UnsupportedOperationException(
+ "DTLS not supported with SSLServerSocket");
+ }
return new SSLServerSocketFactoryImpl(this);
}
@@ -1262,6 +1270,25 @@ public abstract class SSLContextImpl extends SSLContextSpi {
serverDefaultProtocols, false);
}
+ @Override
+ protected SSLParameters engineGetDefaultSSLParameters() {
+ SSLEngine engine = createSSLEngineImpl();
+ // Note: The TLSContext defaults to client side SSLParameters.
+ // We can do the same here. Please don't change the behavior
+ // for compatibility.
+ engine.setUseClientMode(true);
+ return engine.getSSLParameters();
+ }
+
+ @Override
+ protected SSLParameters engineGetSupportedSSLParameters() {
+ SSLEngine engine = createSSLEngineImpl();
+ SSLParameters params = new SSLParameters();
+ params.setCipherSuites(engine.getSupportedCipherSuites());
+ params.setProtocols(engine.getSupportedProtocols());
+ return params;
+ }
+
@Override
List<ProtocolVersion> getSupportedProtocolVersions() {
return supportedProtocols;
diff --git a/test/hotspot/jtreg/compiler/c1/TestValueNumberingNullObject.java b/test/hotspot/jtreg/compiler/c1/TestValueNumberingNullObject.java
new file mode 100644
index 000000000..66d5581f5
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/c1/TestValueNumberingNullObject.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8237894
+ * @summary CTW: C1 compilation fails with assert(x->type()->tag() == f->type()->tag()) failed: should have same type
+ *
+ * @run main/othervm
+ * -Xcomp -Xbatch -XX:CompileCommand=compileonly,compiler.c1.T*::*
+ * -XX:CompileCommand=exclude,compiler.c1.TestValueNumberingNullObject::main
+ * -XX:CompileCommand=inline,*.*
+ * -XX:TieredStopAtLevel=3
+ * compiler.c1.TestValueNumberingNullObject
+ */
+
+package compiler.c1;
+
+class T1 {
+
+ public T2 f1;
+
+ public int za() {
+ return 0;
+ }
+
+ public int zb() {
+ return 0;
+ }
+
+ public int zc() {
+ return 0;
+ }
+
+ public int zd() {
+ return 0;
+ }
+
+ public int ze() {
+ return 0;
+ }
+
+ public int zf() {
+ return 0;
+ }
+
+ public int zg() {
+ return 0;
+ }
+
+ public int zh() {
+ return 0;
+ }
+}
+
+class T2 {
+
+ public T1 f1;
+
+ public int zh() {
+ return 0;
+ }
+}
+
+public class TestValueNumberingNullObject {
+
+ public static void main(String args[]) {
+ new T1(); // Load
+ new T2(); // Load
+ try {
+ // case 1
+ // Null based field access.
+ // Value Numbering null based field access causes instructions to be eliminated across type/subtypes.
+ // declared type of these instructions are field type, so it being receiver causes problems to Type System.
+ // to mitigate this issue, we hash declared type in addition to existing hashing.
+ testFieldAccess();
+ } catch (Exception e) {
+ }
+ try {
+ // case 2
+ // Null based indexed access.
+ // Value Numbering null based indexed access causes instructions to be eliminated across type/subtypes.
+ // element basic type in encoded in the access instruction, this causes problems to Type system.
+ // declared type of these instructions are null, so it being receiver doesn't cause any problem to Type System.
+ // to mitigate this issue, we hash basic type in addition to existing hashing
+ basicTypeAccess();
+ } catch (Exception e) {
+ }
+ }
+
+ static long testFieldAccess() {
+ T1 t1 = null;
+ T2 t2 = null;
+ T1[] t3 = null;
+ T2[] t4 = null;
+
+ long value = t1.f1.zh() + t2.f1.zh();
+ // null array object based field access.
+ value += t3[2].f1.zh() + t4[2].f1.zh();
+ return value;
+ }
+
+ static long basicTypeAccess() {
+ long[] f1 = null;
+ int[] f2 = null;
+ T2[] t2 = null;
+ T1[] t1 = null;
+ return f1[5] + f2[5] + t2[5].zh() + t1[5].zh();
+ }
+}
+
diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSDefaultProtocols.java b/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSDefaultProtocols.java
index 0dc0ffac2..e4e9434f9 100644
--- a/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSDefaultProtocols.java
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSDefaultProtocols.java
@@ -192,33 +192,13 @@ public class CustomizedDTLSDefaultProtocols {
// Check SSLParameters of SSLSocket
System.out.println();
System.out.println("\tChecking SSLSocket of this SSLContext");
- System.out.println("\tChecking SSLSocket.getSSLParameters()");
- SocketFactory fac = context.getSocketFactory();
- SSLSocket socket = (SSLSocket)fac.createSocket();
- parameters = socket.getSSLParameters();
-
- protocols = parameters.getProtocols();
- failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
- ciphers = parameters.getCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
- protocols = socket.getEnabledProtocols();
- failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
- System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
- ciphers = socket.getEnabledCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
- protocols = socket.getSupportedProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- System.out.println(
- "\tChecking SSLEngine.getSupportedCipherSuites()");
- ciphers = socket.getSupportedCipherSuites();
- failed |= !checkCipherSuites(ciphers);
+ try {
+ context.getSocketFactory();
+ failed = true;
+ System.out.println("SSLSocket returned a socket for DTLS");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("\t " + e.getMessage());
+ }
//
// Check SSLServerSocket
@@ -226,33 +206,13 @@ public class CustomizedDTLSDefaultProtocols {
// Check SSLParameters of SSLServerSocket
System.out.println();
System.out.println("\tChecking SSLServerSocket of this SSLContext");
- System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
- SSLServerSocketFactory sf = context.getServerSocketFactory();
- SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
- parameters = ssocket.getSSLParameters();
-
- protocols = parameters.getProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- ciphers = parameters.getCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
- protocols = ssocket.getEnabledProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
- ciphers = ssocket.getEnabledCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
- protocols = ssocket.getSupportedProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- System.out.println(
- "\tChecking SSLEngine.getSupportedCipherSuites()");
- ciphers = ssocket.getSupportedCipherSuites();
- failed |= !checkCipherSuites(ciphers);
+ try {
+ context.getServerSocketFactory();
+ failed = true;
+ System.out.println("SSLServerSocket returned a socket for DTLS");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("\t " + e.getMessage());
+ }
}
if (failed) {
diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSServerDefaultProtocols.java b/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSServerDefaultProtocols.java
index b0e805c06..ea0bd8ccf 100644
--- a/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSServerDefaultProtocols.java
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSServerDefaultProtocols.java
@@ -32,6 +32,7 @@
* CustomizedDTLSServerDefaultProtocols
*/
+import java.lang.UnsupportedOperationException;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Arrays;
@@ -212,33 +213,13 @@ public class CustomizedDTLSServerDefaultProtocols {
// Check SSLParameters of SSLSocket
System.out.println();
System.out.println("\tChecking SSLSocket of this SSLContext");
- System.out.println("\tChecking SSLSocket.getSSLParameters()");
- SocketFactory fac = context.getSocketFactory();
- SSLSocket socket = (SSLSocket) fac.createSocket();
- parameters = socket.getSSLParameters();
-
- protocols = parameters.getProtocols();
- failed |= !checkProtocols(protocols, cv.clientEnabledProtocols);
-
- ciphers = parameters.getCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLSocket.getEnabledProtocols()");
- protocols = socket.getEnabledProtocols();
- failed |= !checkProtocols(protocols, cv.clientEnabledProtocols);
-
- System.out.println("\tChecking SSLSocket.getEnabledCipherSuites()");
- ciphers = socket.getEnabledCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLSocket.getSupportedProtocols()");
- protocols = socket.getSupportedProtocols();
- failed |= !checkProtocols(protocols, supportedProtocols);
-
- System.out.println(
- "\tChecking SSLSocket.getSupportedCipherSuites()");
- ciphers = socket.getSupportedCipherSuites();
- failed |= !checkCipherSuites(ciphers);
+ try {
+ context.getSocketFactory();
+ failed = true;
+ System.out.println("SSLSocket returned a socket for DTLS");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("\t " + e.getMessage());
+ }
//
// Check SSLServerSocket
@@ -246,33 +227,13 @@ public class CustomizedDTLSServerDefaultProtocols {
// Check SSLParameters of SSLServerSocket
System.out.println();
System.out.println("\tChecking SSLServerSocket of this SSLContext");
- System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
- SSLServerSocketFactory sf = context.getServerSocketFactory();
- SSLServerSocket ssocket = (SSLServerSocket) sf.createServerSocket();
- parameters = ssocket.getSSLParameters();
-
- protocols = parameters.getProtocols();
- failed |= !checkProtocols(protocols, cv.serverEnabledProtocols);
-
- ciphers = parameters.getCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
- protocols = ssocket.getEnabledProtocols();
- failed |= !checkProtocols(protocols, cv.serverEnabledProtocols);
-
- System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
- ciphers = ssocket.getEnabledCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
- protocols = ssocket.getSupportedProtocols();
- failed |= !checkProtocols(protocols, supportedProtocols);
-
- System.out.println(
- "\tChecking SSLEngine.getSupportedCipherSuites()");
- ciphers = ssocket.getSupportedCipherSuites();
- failed |= !checkCipherSuites(ciphers);
+ try {
+ context.getServerSocketFactory();
+ failed = true;
+ System.out.println("SSLServerSocket returned a socket for DTLS");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("\t " + e.getMessage());
+ }
if (failed) {
throw new Exception("Run into problems, see log for more details");
diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/DefaultDTLSEnabledProtocols.java b/test/jdk/sun/security/ssl/SSLContextImpl/DefaultDTLSEnabledProtocols.java
index ccfff01b6..029771541 100644
--- a/test/jdk/sun/security/ssl/SSLContextImpl/DefaultDTLSEnabledProtocols.java
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/DefaultDTLSEnabledProtocols.java
@@ -189,33 +189,13 @@ public class DefaultDTLSEnabledProtocols {
// Check SSLParameters of SSLSocket
System.out.println();
System.out.println("\tChecking SSLSocket of this SSLContext");
- System.out.println("\tChecking SSLSocket.getSSLParameters()");
- SocketFactory fac = context.getSocketFactory();
- SSLSocket socket = (SSLSocket)fac.createSocket();
- parameters = socket.getSSLParameters();
-
- protocols = parameters.getProtocols();
- failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
- ciphers = parameters.getCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
- protocols = socket.getEnabledProtocols();
- failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
- System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
- ciphers = socket.getEnabledCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
- protocols = socket.getSupportedProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- System.out.println(
- "\tChecking SSLEngine.getSupportedCipherSuites()");
- ciphers = socket.getSupportedCipherSuites();
- failed |= !checkCipherSuites(ciphers);
+ try {
+ context.getSocketFactory();
+ failed = true;
+ System.out.println("SSLSocket returned a socket for DTLS");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("\t " + e.getMessage());
+ }
//
// Check SSLServerSocket
@@ -223,33 +203,13 @@ public class DefaultDTLSEnabledProtocols {
// Check SSLParameters of SSLServerSocket
System.out.println();
System.out.println("\tChecking SSLServerSocket of this SSLContext");
- System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
- SSLServerSocketFactory sf = context.getServerSocketFactory();
- SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
- parameters = ssocket.getSSLParameters();
-
- protocols = parameters.getProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- ciphers = parameters.getCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
- protocols = ssocket.getEnabledProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
- ciphers = ssocket.getEnabledCipherSuites();
- failed |= !checkCipherSuites(ciphers);
-
- System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
- protocols = ssocket.getSupportedProtocols();
- failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
- System.out.println(
- "\tChecking SSLEngine.getSupportedCipherSuites()");
- ciphers = ssocket.getSupportedCipherSuites();
- failed |= !checkCipherSuites(ciphers);
+ try {
+ context.getServerSocketFactory();
+ failed = true;
+ System.out.println("SSLServerSocket returned a socket for DTLS");
+ } catch (UnsupportedOperationException e) {
+ System.out.println("\t " + e.getMessage());
+ }
}
if (failed) {
--
2.19.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化