From 784a04c29bfc573b6aca9a1fe3bf2623e69ea8ba Mon Sep 17 00:00:00 2001 From: Thomas Stuefe Date: Fri, 28 Apr 2023 06:08:24 +0000 Subject: [PATCH 001/459] 8306696: Remove MetaspaceReclaimPolicy=aggressive and obsolete MetaspaceReclaimPolicy Reviewed-by: dholmes, rkennke, coleenp --- test/hotspot/jtreg/gtest/MetaspaceGtests.java | 33 +---------------- .../runtime/Metaspace/PrintMetaspaceDcmd.java | 10 ------ .../MetaspaceTestManyArenasManyThreads.java | 2 +- .../elastic/MetaspaceTestWithThreads.java | 6 ++-- .../runtime/Metaspace/elastic/Settings.java | 5 --- .../elastic/TestMetaspaceAllocation.java | 2 -- .../elastic/TestMetaspaceAllocationMT1.java | 35 ------------------- .../elastic/TestMetaspaceAllocationMT2.java | 35 ------------------- 8 files changed, 4 insertions(+), 124 deletions(-) diff --git a/test/hotspot/jtreg/gtest/MetaspaceGtests.java b/test/hotspot/jtreg/gtest/MetaspaceGtests.java index 102b3122c01..3e816fa4ff5 100644 --- a/test/hotspot/jtreg/gtest/MetaspaceGtests.java +++ b/test/hotspot/jtreg/gtest/MetaspaceGtests.java @@ -40,34 +40,6 @@ * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:+UnlockDiagnosticVMOptions -XX:VerifyMetaspaceInterval=3 */ - - - -/* @test id=reclaim-aggressive-debug - * @bug 8251158 - * @summary Run metaspace-related gtests for reclaim policy aggressive (with verifications) - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.xml - * @requires vm.debug - * @requires vm.flagless - * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:+UnlockDiagnosticVMOptions -XX:MetaspaceReclaimPolicy=aggressive -XX:VerifyMetaspaceInterval=3 - */ - -/* @test id=reclaim-aggressive-ndebug - * @bug 8251158 - * @summary Run metaspace-related gtests for reclaim policy aggressive - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.xml - * @requires vm.debug == false - * @requires vm.flagless - * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:+UnlockDiagnosticVMOptions -XX:MetaspaceReclaimPolicy=aggressive - */ - - - - /* @test id=balanced-with-guards * @summary Run metaspace-related gtests with allocation guards enabled * @library /test/lib @@ -78,9 +50,6 @@ * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:VerifyMetaspaceInterval=3 -XX:+MetaspaceGuardAllocations */ - - - /* @test id=balanced-no-ccs * @summary Run metaspace-related gtests with compressed class pointers off * @library /test/lib @@ -88,5 +57,5 @@ * java.xml * @requires vm.bits == 64 * @requires vm.flagless - * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:+UnlockDiagnosticVMOptions -XX:MetaspaceReclaimPolicy=balanced -XX:-UseCompressedClassPointers + * @run main/native GTestWrapper --gtest_filter=metaspace* -XX:+UnlockDiagnosticVMOptions -XX:-UseCompressedClassPointers */ diff --git a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java index 422090d39d7..56d9c2095b2 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java +++ b/test/hotspot/jtreg/runtime/Metaspace/PrintMetaspaceDcmd.java @@ -36,16 +36,6 @@ * @run main/othervm -Dwith-compressed-class-space -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers PrintMetaspaceDcmd */ -/* - * @test id=test-64bit-ccs-aggressivereclaim - * @summary Test the VM.metaspace command - * @requires vm.bits == "64" - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @run main/othervm -Dwith-compressed-class-space -XX:MaxMetaspaceSize=201M -Xmx100M -XX:+UseCompressedOops -XX:+UseCompressedClassPointers -XX:+UnlockDiagnosticVMOptions -XX:MetaspaceReclaimPolicy=aggressive PrintMetaspaceDcmd - */ - /* * @test id=test-64bit-ccs-guarded * @summary Test the VM.metaspace command diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestManyArenasManyThreads.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestManyArenasManyThreads.java index 7e1c2678f4e..912f240a9f4 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestManyArenasManyThreads.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestManyArenasManyThreads.java @@ -93,7 +93,7 @@ public void runTest() throws Exception { // frees their metaspace arenas. All within CLDG::purge(). But since this test isolates the metaspace // context and does test it separately, GC and CLDG are not involved here. We need to purge manually. // - // Purging uncommits all free chunks >= 64K/16K (MetaspaceReclaimPolicy=standard/aggressive). + // Purging uncommits all free chunks >= 64K context.purge(); context.updateTotals(); diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestWithThreads.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestWithThreads.java index 4383f33d890..edf6da387ed 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestWithThreads.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/MetaspaceTestWithThreads.java @@ -77,10 +77,8 @@ void destroyArenasAndPurgeSpace() { context.checkStatistics(); - if (Settings.settings().doesReclaim()) { - if (context.committedWords() > 0) { - throw new RuntimeException("Expected no committed words after purging empty metaspace context (was: " + context.committedWords() + ")"); - } + if (context.committedWords() > 0) { + throw new RuntimeException("Expected no committed words after purging empty metaspace context (was: " + context.committedWords() + ")"); } } diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java index cca5b7f59ed..c6d69f341b9 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/Settings.java @@ -27,13 +27,8 @@ public final class Settings { - public String reclaimPolicy = WhiteBox.getWhiteBox().getStringVMFlag("MetaspaceReclaimPolicy"); public boolean usesAllocationGuards = WhiteBox.getWhiteBox().getBooleanVMFlag("MetaspaceGuardAllocations"); - final public boolean doesReclaim() { - return reclaimPolicy.equals("balanced") || reclaimPolicy.equals("aggessive"); - } - final static long rootChunkWordSize = 2048 * 1024; static Settings theSettings; diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java index e862a15538c..1ecde3f8376 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocation.java @@ -35,7 +35,6 @@ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:VerifyMetaspaceInterval=10 TestMetaspaceAllocation - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:VerifyMetaspaceInterval=10 -XX:MetaspaceReclaimPolicy=aggressive TestMetaspaceAllocation * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:VerifyMetaspaceInterval=10 -XX:+MetaspaceGuardAllocations TestMetaspaceAllocation * */ @@ -52,7 +51,6 @@ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI TestMetaspaceAllocation - * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:MetaspaceReclaimPolicy=aggressive TestMetaspaceAllocation */ public class TestMetaspaceAllocation { diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java index 579d0a9f79a..6aaebe6f4d0 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java @@ -57,24 +57,6 @@ * TestMetaspaceAllocationMT1 */ -/* - * @test id=debug-aggressive - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build jdk.test.whitebox.WhiteBox - * @key randomness - * @requires (vm.debug == true) - * - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * - * @run main/othervm/timeout=400 - * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:VerifyMetaspaceInterval=10 - * -XX:MetaspaceReclaimPolicy=aggressive - * TestMetaspaceAllocationMT1 - */ - /* * @test id=debug-guard * @library /test/lib @@ -109,23 +91,6 @@ * TestMetaspaceAllocationMT1 */ -/* - * @test id=ndebug-aggressive - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build jdk.test.whitebox.WhiteBox - * @key randomness - * @requires (vm.debug == false) - * - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * - * @run main/othervm/timeout=400 - * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:MetaspaceReclaimPolicy=aggressive - * TestMetaspaceAllocationMT1 - */ - public class TestMetaspaceAllocationMT1 { public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java index 564d574fb71..873e2e0269a 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java @@ -57,24 +57,6 @@ * TestMetaspaceAllocationMT2 */ -/* - * @test id=debug-aggressive - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build jdk.test.whitebox.WhiteBox - * @key randomness - * @requires (vm.debug == true) - * - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * - * @run main/othervm/timeout=400 - * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:VerifyMetaspaceInterval=10 - * -XX:MetaspaceReclaimPolicy=aggressive - * TestMetaspaceAllocationMT2 - */ - /* * @test id=debug-guard * @library /test/lib @@ -109,23 +91,6 @@ * TestMetaspaceAllocationMT2 */ -/* - * @test id=ndebug-aggressive - * @library /test/lib - * @modules java.base/jdk.internal.misc - * java.management - * @build jdk.test.whitebox.WhiteBox - * @key randomness - * @requires (vm.debug == false) - * - * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox - * - * @run main/othervm/timeout=400 - * -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:MetaspaceReclaimPolicy=aggressive - * TestMetaspaceAllocationMT2 - */ - public class TestMetaspaceAllocationMT2 { public static void main(String[] args) throws Exception { From 074d5745b6a8ec1b878f28cd71fe81e92d543318 Mon Sep 17 00:00:00 2001 From: Afshin Zafari Date: Fri, 28 Apr 2023 06:32:25 +0000 Subject: [PATCH 002/459] 8305079: Remove finalize() from compiler/c2/Test719030 Reviewed-by: thartmann, coleenp --- test/hotspot/jtreg/compiler/c2/Test7190310.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/hotspot/jtreg/compiler/c2/Test7190310.java b/test/hotspot/jtreg/compiler/c2/Test7190310.java index b175f47e09a..ca3cd9bce19 100644 --- a/test/hotspot/jtreg/compiler/c2/Test7190310.java +++ b/test/hotspot/jtreg/compiler/c2/Test7190310.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2023, 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 @@ -39,17 +39,13 @@ import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; +import java.lang.ref.Cleaner; public class Test7190310 { private static Object str = new Object() { public String toString() { return "The Object"; } - - protected void finalize() throws Throwable { - System.out.println("The Object is being finalized"); - super.finalize(); - } }; private final static ReferenceQueue rq = new ReferenceQueue(); @@ -58,6 +54,7 @@ protected void finalize() throws Throwable { public static void main(String[] args) throws InterruptedException { + Cleaner.create().register(str, () -> System.out.println("The Object is being finalized")); Thread reader = new Thread() { public void run() { while (wr.get() != null) { From f609b86ef19fd18a9306580dc14ca9a5a9237d1b Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Fri, 28 Apr 2023 06:50:06 +0000 Subject: [PATCH 003/459] 8307006: ProblemList gtest/NMTGtest.java on aix Reviewed-by: mdoerr --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 289102d7633..599364d8209 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -133,6 +133,7 @@ serviceability/attach/ConcAttachTest.java 8290043 linux-all ############################################################################# +gtest/NMTGtests.java 8306561 aix-ppc64 ############################################################################# From 2a5046e6b9b3cba6c4aefc8a8952e4229c6ced60 Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Fri, 28 Apr 2023 11:55:59 +0000 Subject: [PATCH 004/459] 8299748: java/util/zip/Deinflate.java failing on s390x Reviewed-by: jpai, lancea, simonis, aturbanov --- test/jdk/java/util/zip/DeInflate.java | 71 +++++++++++++++++++-------- 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/test/jdk/java/util/zip/DeInflate.java b/test/jdk/java/util/zip/DeInflate.java index ff2cb63c6e7..7e7458bbb37 100644 --- a/test/jdk/java/util/zip/DeInflate.java +++ b/test/jdk/java/util/zip/DeInflate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2023, 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 @@ -47,11 +47,12 @@ static void checkStream(Deflater def, byte[] in, int len, Arrays.fill(out1, (byte)0); Arrays.fill(out2, (byte)0); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try (DeflaterOutputStream defos = new DeflaterOutputStream(baos, def)) { - defos.write(in, 0, len); + try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { + try (DeflaterOutputStream defos = new DeflaterOutputStream(baos, def)) { + defos.write(in, 0, len); + } + out1 = baos.toByteArray(); } - out1 = baos.toByteArray(); int m = out1.length; Inflater inf = new Inflater(nowrap); @@ -118,27 +119,55 @@ static void checkByteBufferReadonly(Deflater def, Inflater inf, } catch (ReadOnlyBufferException robe) {} } - static void check(Deflater def, byte[] in, int len, - byte[] out1, byte[] out2, boolean nowrap) + /** + * Uses the {@code def} deflater to deflate the input data {@code in} of length {@code len}. + * A new {@link Inflater} is then created within this method to inflate the deflated data. The + * inflated data is then compared with the {@code in} to assert that it matches the original + * input data. + * This method repeats these checks for the different overloaded methods of + * {@code Deflater.deflate(...)} and {@code Inflater.inflate(...)} + * + * @param def the deflater to use for deflating the contents in {@code in} + * @param in the input content + * @param len the length of the input content to use + * @param nowrap will be passed to the constructor of the {@code Inflater} used in this + * method + * @throws Throwable if any error occurs during the check + */ + static void check(Deflater def, byte[] in, int len, boolean nowrap) throws Throwable { - Arrays.fill(out1, (byte)0); - Arrays.fill(out2, (byte)0); - + byte[] tempBuffer = new byte[len]; + byte[] out1, out2; + int m = 0, n = 0; + Inflater inf = new Inflater(nowrap); def.setInput(in, 0, len); def.finish(); - int m = def.deflate(out1); - Inflater inf = new Inflater(nowrap); - inf.setInput(out1, 0, m); - int n = inf.inflate(out2); + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(len)) { + while (!def.finished()) { + int temp_counter = def.deflate(tempBuffer); + m += temp_counter; + baos.write(tempBuffer, 0, temp_counter); + } + out1 = baos.toByteArray(); + baos.reset(); - if (n != len || - !Arrays.equals(Arrays.copyOf(in, len), Arrays.copyOf(out2, len)) || - inf.inflate(out2) != 0) { - System.out.printf("m=%d, n=%d, len=%d, eq=%b%n", - m, n, len, Arrays.equals(in, out2)); - throw new RuntimeException("De/inflater failed:" + def); + inf.setInput(out1, 0, m); + + while (!inf.finished()) { + int temp_counter = inf.inflate(tempBuffer); + n += temp_counter; + baos.write(tempBuffer, 0, temp_counter); + } + out2 = baos.toByteArray(); + if (n != len || + !Arrays.equals(in, 0, len, out2, 0, len) || + inf.inflate(out2) != 0) { + System.out.printf("m=%d, n=%d, len=%d, eq=%b%n", + m, n, len, Arrays.equals(in, out2)); + throw new RuntimeException("De/inflater failed:" + def); + } } // readable @@ -287,7 +316,7 @@ public static void main(String[] args) throws Throwable { : new Random().nextInt(dataIn.length); // use a new deflater Deflater def = newDeflater(level, strategy, dowrap, dataOut2); - check(def, dataIn, len, dataOut1, dataOut2, dowrap); + check(def, dataIn, len, dowrap); def.end(); // reuse the deflater (with reset) and test on stream, which From d352190cd2c37cf5ff8cdbf266129e1bfbcf2560 Mon Sep 17 00:00:00 2001 From: Jie Fu Date: Fri, 28 Apr 2023 12:27:16 +0000 Subject: [PATCH 005/459] 8307103: Two TestMetaspaceAllocationMT tests fail after JDK-8306696 Reviewed-by: dholmes --- .../runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java | 1 - .../runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java | 1 - 2 files changed, 2 deletions(-) diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java index 6aaebe6f4d0..22cc4f6b22d 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT1.java @@ -113,7 +113,6 @@ public static void main(String[] args) throws Exception { System.out.println("#### seconds: " + seconds); System.out.println("#### commitLimit: " + commitLimit); System.out.println("#### reserveLimit: " + reserveLimit); - System.out.println("#### ReclaimPolicy: " + Settings.settings().reclaimPolicy); System.out.println("#### guards: " + Settings.settings().usesAllocationGuards); MetaspaceTestContext context = new MetaspaceTestContext(commitLimit, reserveLimit); diff --git a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java index 873e2e0269a..a2e9748478d 100644 --- a/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java +++ b/test/hotspot/jtreg/runtime/Metaspace/elastic/TestMetaspaceAllocationMT2.java @@ -112,7 +112,6 @@ public static void main(String[] args) throws Exception { System.out.println("#### seconds: " + seconds); System.out.println("#### commitLimit: " + commitLimit); System.out.println("#### reserveLimit: " + reserveLimit); - System.out.println("#### ReclaimPolicy: " + Settings.settings().reclaimPolicy); System.out.println("#### guards: " + Settings.settings().usesAllocationGuards); MetaspaceTestContext context = new MetaspaceTestContext(commitLimit, reserveLimit); From c3c32478e88d0c65a6bf44612b0d40c928170d7d Mon Sep 17 00:00:00 2001 From: Antonios Printezis Date: Fri, 28 Apr 2023 12:31:48 +0000 Subject: [PATCH 006/459] 8307063: When cross-compiling with hsdis/binutils, buildjdk creation fails Reviewed-by: erikj --- make/autoconf/buildjdk-spec.gmk.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/make/autoconf/buildjdk-spec.gmk.in b/make/autoconf/buildjdk-spec.gmk.in index 524f35f417c..3e7c4a39f60 100644 --- a/make/autoconf/buildjdk-spec.gmk.in +++ b/make/autoconf/buildjdk-spec.gmk.in @@ -103,3 +103,7 @@ JVM_FEATURES_server := cds compiler1 compiler2 g1gc serialgc override EXTRA_CFLAGS := override EXTRA_CXXFLAGS := override EXTRA_LDFLAGS := + +# hsdis is not needed +HSDIS_BACKEND := none +ENABLE_HSDIS_BUNDLING := false From d7ae1ac1484f862cf0f756c45a0da92027ea85b1 Mon Sep 17 00:00:00 2001 From: Tejesh R Date: Fri, 28 Apr 2023 14:27:38 +0000 Subject: [PATCH 007/459] 8306640: Open source several AWT TextArea related tests Reviewed-by: prr, serb --- .../java/awt/TextArea/ReplaceRangeTest.java | 81 +++++++++ .../TextArea/TextAreaCRLFAutoDetectTest.java | 155 ++++++++++++++++++ .../jdk/java/awt/TextArea/TextLengthTest.java | 116 +++++++++++++ test/jdk/java/awt/TextArea/TextLimitTest.java | 85 ++++++++++ 4 files changed, 437 insertions(+) create mode 100644 test/jdk/java/awt/TextArea/ReplaceRangeTest.java create mode 100644 test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectTest.java create mode 100644 test/jdk/java/awt/TextArea/TextLengthTest.java create mode 100644 test/jdk/java/awt/TextArea/TextLimitTest.java diff --git a/test/jdk/java/awt/TextArea/ReplaceRangeTest.java b/test/jdk/java/awt/TextArea/ReplaceRangeTest.java new file mode 100644 index 00000000000..03355aa166c --- /dev/null +++ b/test/jdk/java/awt/TextArea/ReplaceRangeTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2004, 2023, 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 5025532 + @requires (os.family == "windows") + @summary Tests that textarea replaces text correctly if the text contains + line separators + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.TextArea; + +import java.lang.reflect.InvocationTargetException; + +public class ReplaceRangeTest { + static Frame f; + + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + try { + EventQueue.invokeAndWait(() -> { + f = new Frame("Test frame"); + f.setSize(400, 400); + f.setLayout(new GridLayout(3, 1)); + + TextArea textArea1 = new TextArea(5, 80); + TextArea textArea2 = new TextArea(5, 80); + TextArea textArea3 = new TextArea(5, 80); + f.add(textArea1); + f.add(textArea2); + f.add(textArea3); + f.setVisible(true); + + textArea1.setText("01234"); + textArea1.replaceRange("X", 3, 4); + textArea2.setText("0\r\n234"); + textArea2.replaceRange("X", 3, 4); + textArea3.setText("0\n\n34"); + textArea3.replaceRange("X", 3, 4); + + if (textArea1.getText().equals("012X4") && + textArea2.getText().equals("0\r\n2X4") && + textArea3.getText().equals("0\n\nX4")) { + System.out.println("Test Pass"); + return; + } else { + throw new RuntimeException("Test FAILED"); + } + }); + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectTest.java b/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectTest.java new file mode 100644 index 00000000000..8ac438aeb49 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextAreaCRLFAutoDetectTest.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2003, 2023, 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 4800187 + @requires (os.family == "windows") + @summary REGRESSION:show the wrong selection when there are \r characters in the text + @key headful +*/ + +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.IllegalComponentStateException; +import java.awt.Point; +import java.awt.Robot; +import java.awt.TextArea; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; + +import java.lang.reflect.InvocationTargetException; + +public class TextAreaCRLFAutoDetectTest { + Frame f; + TextArea ta1; + TextArea ta2; + Button b; + boolean passed = true; + boolean crlf = true; + + public static void main(String[] args) throws Exception { + TextAreaCRLFAutoDetectTest crlfAutoDetectTest = new TextAreaCRLFAutoDetectTest(); + crlfAutoDetectTest.init(); + crlfAutoDetectTest.start(); + } + + public void init() throws InterruptedException, InvocationTargetException { + EventQueue.invokeAndWait(() -> { + f = new Frame("TextAreaCRLFAutoDetectTest"); + ta1 = new TextArea(5, 20); + ta2 = new TextArea(5, 20); + b = new Button("Click Me"); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent evt) { + ta1.setText(""); + ta2.setText(""); + System.out.println("--------------------------------"); + + String eoln = (crlf) ? "\r\n" : "\n"; + String s = eoln + "123" + eoln + "567" + eoln + "90" + eoln; + printString(" s=", s); + ta1.setText(s); + printString("ta1.getText()=", ta1.getText()); + + s = "67" + eoln + "9"; + ta1.select(6, 10); + + String s1 = ta1.getSelectedText(); + printString("ta1.getSelectedText()=", s1); + passed = passed && s.equals(s1); + + ta2.setText(s1); + printString(" ta2.getText()=", s1); + passed = passed && s1.equals(ta2.getText()); + + crlf = false; + } + }); + + f.setLayout(new FlowLayout()); + f.add(ta1); + f.add(ta2); + f.add(b); + f.setLocation(300, 50); + f.pack(); + f.setVisible(true); + }); + } + + public void start() throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(50); + robot.waitForIdle(); + + Point pt = new Point(0, 0); + + boolean drawn = false; + while (!drawn) { + try { + pt = b.getLocationOnScreen(); + } catch (IllegalComponentStateException icse) { + Thread.sleep(50); + continue; + } + drawn = true; + } + + for (int i = 0; i < 2; i++) { + pt = b.getLocationOnScreen(); + robot.mouseMove(pt.x + b.getWidth() / 2, + pt.y + b.getHeight() / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + Thread.sleep(250); + } + if (!passed) { + throw new RuntimeException("TextAreaCRLFAutoDetectTest FAILED."); + } else { + System.out.println("TextAreaCRLFAutoDetectTest PASSED"); + } + } catch (Exception e) { + throw new RuntimeException("The test was not completed.\n\n" + e); + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + void printString(String t, String s) { + byte b[] = s.getBytes(); + String o = t; + for (int i = 0; i < b.length; i++) { + o += Byte.toString(b[i]) + " "; + } + System.out.println(o); + } +} diff --git a/test/jdk/java/awt/TextArea/TextLengthTest.java b/test/jdk/java/awt/TextArea/TextLengthTest.java new file mode 100644 index 00000000000..fa5b231378f --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextLengthTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 1998, 2023, 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 4072264 + @summary REGRESSION:Test to verify getSelectedText, + getSelectedStart/End in TextArea class + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.TextArea; + +public class TextLengthTest { + static final int MY_SIZE = 100; + static final int MY_START = 13; + static final int MY_END = 47; + TextArea ta; + Frame f; + int mySize; + int myStart; + int myEnd; + + public static void main(String[] args) throws Exception { + TextLengthTest textLengthTest = new TextLengthTest(); + textLengthTest.init(); + textLengthTest.start(); + } + + public void init() throws Exception { + EventQueue.invokeAndWait(() -> { + f = new Frame("TextLengthTest"); + ta = new TextArea(15, 30); + f.add(ta); + f.setSize(400, 400); + f.setVisible(true); + }); + } + + public void start() throws Exception { + try { + Robot r = new Robot(); + r.delay(1000); + r.waitForIdle(); + EventQueue.invokeAndWait(() -> { + StringBuffer bigStringBuffer = new StringBuffer(); + + for (int i = 1; i <= 10; i++) { + bigStringBuffer.append("abcdefghi\n"); + } + + ta.setText(bigStringBuffer.toString()); + + mySize = bigStringBuffer.toString().length(); + System.out.println("String size = " + mySize); + + if (mySize != MY_SIZE) { + throw new Error("The string size is " + + mySize + "but it should be " + MY_SIZE); + } + + ta.select(MY_START, MY_END); + + String str = new String(ta.getSelectedText()); + str = str.toUpperCase(); + + myStart = ta.getSelectionStart(); + myEnd = ta.getSelectionEnd(); + System.out.println("Selected string start = " + myStart); + System.out.println("Selected string end = " + myEnd); + + if (myStart != MY_START) { + throw new Error("The selected text starts at " + + mySize + "but it should start at " + MY_START); + } + + if (myEnd != MY_END) { + throw new Error("The selected text ends at " + + myEnd + "but it should end at " + MY_END); + } + + ta.replaceRange(str, myStart, myEnd); + }); + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + System.out.println("Test Pass"); + } +} diff --git a/test/jdk/java/awt/TextArea/TextLimitTest.java b/test/jdk/java/awt/TextArea/TextLimitTest.java new file mode 100644 index 00000000000..ef6a3a08587 --- /dev/null +++ b/test/jdk/java/awt/TextArea/TextLimitTest.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2001, 2023, 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 4260109 + @summary tests that the text limit is set to the maximum possible value + @key headful +*/ + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.TextArea; + +public class TextLimitTest { + static Frame frame; + static TextArea textarea; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + StringBuffer buffer = new StringBuffer(); + frame = new Frame("Text Limit Test"); + textarea = new TextArea(3, 10); + frame.setLayout(new BorderLayout()); + frame.add(textarea); + frame.setSize(200, 200); + frame.pack(); + frame.setVisible(true); + + /* + * The magic number 0xF700 was choosen because of the two reasons: + * - it shouldn't be greater since on win95 (even in native win32 apps) + * adding more than 0xF800 symbols to a textarea doesn't always work, + * - it shouldn't be less since in this case we won't run in the stack + * overflow on Win95 even if we use W2A allocating memory on the stack. + */ + for (int i = 0; i < 0xF700; i += 0x10) { + buffer.append("0123456789abcdef"); + } + + textarea.setText(buffer.toString()); + System.out.println("Text length before append: " + + Integer.toString(textarea.getText().length(), 16)); + + textarea.append("0123456789abcdef"); + + int len = textarea.getText().length(); + System.out.println("Text length after append: " + + Integer.toString(len, 16)); + if (len != 0xF710) { + throw new RuntimeException("Test failed: textarea has " + + "wrong text limit!"); + } + }); + System.out.println("Test pass"); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} From 45f1b94a06b16e1f3d09077c12b4eff4ae4ceeba Mon Sep 17 00:00:00 2001 From: Tejesh R Date: Fri, 28 Apr 2023 14:35:16 +0000 Subject: [PATCH 008/459] 8306432: Open source several AWT Text Component related tests Reviewed-by: prr --- ...ectSetCaretPositionDuringInitPeerTest.java | 60 ++++++++++ ...ectionDuringDoSelectionNonVisibleTest.java | 105 ++++++++++++++++ .../GetCaretPosOutOfBoundsTest.java | 49 ++++++++ .../InitialInsertionCaretPositionTest.java | 68 +++++++++++ .../MiddleMouseClickPasteTest.java | 112 ++++++++++++++++++ 5 files changed, 394 insertions(+) create mode 100644 test/jdk/java/awt/TextComponent/CorrectSetCaretPositionDuringInitPeerTest.java create mode 100644 test/jdk/java/awt/TextComponent/DeselectionDuringDoSelectionNonVisibleTest.java create mode 100644 test/jdk/java/awt/TextComponent/GetCaretPosOutOfBoundsTest.java create mode 100644 test/jdk/java/awt/TextComponent/InitialInsertionCaretPositionTest.java create mode 100644 test/jdk/java/awt/TextComponent/MiddleMouseClickPasteTest.java diff --git a/test/jdk/java/awt/TextComponent/CorrectSetCaretPositionDuringInitPeerTest.java b/test/jdk/java/awt/TextComponent/CorrectSetCaretPositionDuringInitPeerTest.java new file mode 100644 index 00000000000..6c288245df6 --- /dev/null +++ b/test/jdk/java/awt/TextComponent/CorrectSetCaretPositionDuringInitPeerTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2005, 2023, 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 5100200 + @summary IAE in X11 text field peer code + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.TextField; + +public class CorrectSetCaretPositionDuringInitPeerTest +{ + static TextField tf; + static Frame frame; + + public static void main(String[] args) throws Exception { + try{ + EventQueue.invokeAndWait(() -> { + frame = new Frame("Caret Position test"); + tf = new TextField("Very very very long string"); + tf.setSelectionStart(10); + tf.setText("Short"); // now TextField.length() less than 10 + frame.add(tf); + + frame.pack(); + frame.setVisible(true); + }); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/TextComponent/DeselectionDuringDoSelectionNonVisibleTest.java b/test/jdk/java/awt/TextComponent/DeselectionDuringDoSelectionNonVisibleTest.java new file mode 100644 index 00000000000..bcd04e1bbfa --- /dev/null +++ b/test/jdk/java/awt/TextComponent/DeselectionDuringDoSelectionNonVisibleTest.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2005, 2023, 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 5100950 8199723 + @summary textarea.getSelectedText() returns the de-selected text, on XToolkit + @key headful + @requires (os.family == "mac") | (os.family == "windows") +*/ + +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.TextField; + +public class DeselectionDuringDoSelectionNonVisibleTest { + static TextField tf1; + static TextField tf2; + static Frame frame; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + frame = new Frame("Deselection test"); + tf1 = new TextField("Text Field 1"); + tf2 = new TextField("Text Field 2"); + frame.add(tf1); + frame.add(tf2); + frame.setLayout(new FlowLayout()); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.pack(); + frame.setVisible(true); + }); + + boolean isWin = System.getProperty("os.name").startsWith("Win"); + System.out.println("is Windows OS? " + isWin); + + Thread.sleep(500); + tf1.requestFocus(); + + Thread.sleep(500); + if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != tf1) { + throw new RuntimeException("Test failed (TextField1 isn't focus owner)."); + } + tf1.selectAll(); + Thread.sleep(500); + + tf2.requestFocus(); + Thread.sleep(500); + + if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() != tf2) { + throw new RuntimeException("Test failed (TextField2 isn't focus owner)."); + } + tf2.selectAll(); + Thread.sleep(500); + + String selectedText = tf1.getSelectedText(); + String text = tf1.getText(); + + System.out.println("tf1.getText()=" + text); + System.out.println("tf1.getSelectedText()=" + selectedText); + + // Motif behaviour: After the selection of the second text, the first selected + // text is unselected + if (!selectedText.equals("") && !isWin) { + throw new RuntimeException("Test failed (TextField1 isn't deselected)."); + } + + // Windows behaviour: After the selection of the second text, the first selected + // text is only not highlighted + if (!selectedText.equals(text) && isWin) { + throw new RuntimeException("Test failed (TextField1 is deselected)."); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/TextComponent/GetCaretPosOutOfBoundsTest.java b/test/jdk/java/awt/TextComponent/GetCaretPosOutOfBoundsTest.java new file mode 100644 index 00000000000..01ba3fd1ba7 --- /dev/null +++ b/test/jdk/java/awt/TextComponent/GetCaretPosOutOfBoundsTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2006, 2023, 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 4995931 + @summary java.awt.TextComponent caret position should be within the text bounds + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.TextField; + +public class GetCaretPosOutOfBoundsTest { + static TextField tf; + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + tf = new TextField("1234567890"); + tf.setCaretPosition(100); + int pos = tf.getCaretPosition(); + if (pos > 10) { + throw new RuntimeException("Wrong caret position:" + pos + " instead of 10"); + } + tf.setText("12345"); + if (tf.getCaretPosition() > 5) { + throw new RuntimeException("Wrong caret position:" + pos + " instead of 5"); + } + }); + } +} diff --git a/test/jdk/java/awt/TextComponent/InitialInsertionCaretPositionTest.java b/test/jdk/java/awt/TextComponent/InitialInsertionCaretPositionTest.java new file mode 100644 index 00000000000..c5c27f3519b --- /dev/null +++ b/test/jdk/java/awt/TextComponent/InitialInsertionCaretPositionTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1999, 2023, 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 4185654 + @summary tests that the text insertion caret is positioned before the first character + @key headful +*/ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.TextField; +import java.awt.TextArea; + +public class InitialInsertionCaretPositionTest { + static TextField textField; + static TextArea textArea; + static String failureMessage = ""; + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + textArea = new TextArea("abcdefghij\nabcdefghij"); + textField = new TextField("abcdefghij"); + + boolean textFieldPassed = (textField.getCaretPosition() == 0); + boolean textAreaPassed = (textArea.getCaretPosition() == 0); + + if (!textFieldPassed) { + failureMessage += " The text insertion caret for the text field is not\n"; + failureMessage += " initially set before the first character.\n"; + } + if (!textAreaPassed) { + failureMessage += " The text insertion caret for the text area is not\n"; + failureMessage += " initially set before the first character.\n"; + } + if (textAreaPassed && textFieldPassed) { + System.out.println("The test passed."); + } else { + System.out.println("The test failed:"); + System.out.println(failureMessage); + } + if (!textAreaPassed || !textFieldPassed) { + throw new RuntimeException(failureMessage); + } + }); + } +} diff --git a/test/jdk/java/awt/TextComponent/MiddleMouseClickPasteTest.java b/test/jdk/java/awt/TextComponent/MiddleMouseClickPasteTest.java new file mode 100644 index 00000000000..f317c023bb1 --- /dev/null +++ b/test/jdk/java/awt/TextComponent/MiddleMouseClickPasteTest.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2001, 2023, 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 4426750 + @requires (os.family == "linux") + @key headful + @summary tests that middle mouse button click pastes primary selection +*/ + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.TextArea; +import java.awt.TextComponent; +import java.awt.TextField; + +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.StringSelection; +import java.awt.event.InputEvent; +import java.awt.Toolkit; + +public class MiddleMouseClickPasteTest { + static final int FRAME_ACTIVATION_TIMEOUT = 1000; + static final int SELECTION_PASTE_TIMEOUT = 1000; + static final int CLICK_INTERVAL = 50; + static final String TEST_TEXT = "TEST TEXT"; + static Frame frame; + static TextField tf; + static TextArea ta; + static final Clipboard systemSelection = Toolkit.getDefaultToolkit().getSystemSelection(); + + + public static void main(String[] args) throws Exception { + if (systemSelection != null) { + try { + EventQueue.invokeAndWait(MiddleMouseClickPasteTest::createAndShowGui); + Thread.sleep(FRAME_ACTIVATION_TIMEOUT); + + checkPaste(tf); + checkPaste(ta); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + EventQueue.invokeAndWait(()-> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + } + + public static void createAndShowGui() { + frame = new Frame(); + tf = new TextField(); + ta = new TextArea(); + + frame.setLayout(new BorderLayout()); + frame.add(tf, BorderLayout.NORTH); + frame.add(ta, BorderLayout.CENTER); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void checkPaste(TextComponent textComponent) throws Exception { + + final Point sourcePoint = textComponent.getLocationOnScreen(); + final Dimension d = textComponent.getSize(); + sourcePoint.translate(d.width / 2, d.height / 2); + final Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(CLICK_INTERVAL); + + textComponent.setText(""); + systemSelection.setContents(new StringSelection(TEST_TEXT), null); + + robot.mouseMove(sourcePoint.x, sourcePoint.y); + robot.mousePress(InputEvent.BUTTON2_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON2_DOWN_MASK); + robot.delay(SELECTION_PASTE_TIMEOUT); + + if (!TEST_TEXT.equals(textComponent.getText())) { + throw new RuntimeException("Primary selection not pasted" + + " into: " + textComponent); + } + } +} From 6d4ab9c362791604dc5a755a6f5744dd4dcfb237 Mon Sep 17 00:00:00 2001 From: Rajan Halade Date: Fri, 28 Apr 2023 16:18:02 +0000 Subject: [PATCH 009/459] 8305975: Add TWCA Global Root CA Reviewed-by: mullan --- .../share/data/cacerts/twcaglobalrootca | 38 ++++ .../certification/TWCAGlobalCA.java | 206 ++++++++++++++++++ .../security/lib/cacerts/VerifyCACerts.java | 7 +- 3 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 src/java.base/share/data/cacerts/twcaglobalrootca create mode 100644 test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java diff --git a/src/java.base/share/data/cacerts/twcaglobalrootca b/src/java.base/share/data/cacerts/twcaglobalrootca new file mode 100644 index 00000000000..0c7552e2c8b --- /dev/null +++ b/src/java.base/share/data/cacerts/twcaglobalrootca @@ -0,0 +1,38 @@ +Owner: CN=TWCA Global Root CA, OU=Root CA, O=TAIWAN-CA, C=TW +Issuer: CN=TWCA Global Root CA, OU=Root CA, O=TAIWAN-CA, C=TW +Serial number: cbe +Valid from: Wed Jun 27 06:28:33 GMT 2012 until: Tue Dec 31 15:59:59 GMT 2030 +Signature algorithm name: SHA256withRSA +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 +-----BEGIN CERTIFICATE----- +MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcx +EjAQBgNVBAoTCVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMT +VFdDQSBHbG9iYWwgUm9vdCBDQTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5 +NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQKEwlUQUlXQU4tQ0ExEDAOBgNVBAsT +B1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3QgQ0EwggIiMA0GCSqG +SIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2CnJfF +10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz +0ALfUPZVr2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfCh +MBwqoJimFb3u/Rk28OKRQ4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbH +zIh1HrtsBv+baz4X7GGqcXzGHaL3SekVtTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc +46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1WKKD+u4ZqyPpcC1jcxkt2 +yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99sy2sbZCi +laLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYP +oA/pyJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQA +BDzfuBSO6N+pjWxnkjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcE +qYSjMq+u7msXi7Kx/mzhkIyIqJdIzshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm +4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB +/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6gcFGn90xHNcgL +1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn +LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WF +H6vPNOw/KP4M8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNo +RI2T9GRwoD2dKAXDOXC4Ynsg/eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+ +nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlglPx4mI88k1HtQJAH32RjJMtOcQWh +15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryPA9gK8kxkRr05YuWW +6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3mi4TW +nsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5j +wa19hAM8EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWz +aGHQRiapIVJpLesux+t3zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmy +KwbQBM0= +-----END CERTIFICATE----- diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java new file mode 100644 index 00000000000..48c4d77a6ba --- /dev/null +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/TWCAGlobalCA.java @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2023, 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 8305975 + * @summary Interoperability tests with TWCA Global Root CA from TAIWAN-CA + * @build ValidatePathWithParams + * @run main/othervm -Djava.security.debug=certpath TWCAGlobalCA OCSP + * @run main/othervm -Djava.security.debug=certpath TWCAGlobalCA CRL + */ + +/* + * Obtain TLS test artifacts for TWCA Global Root CA from: + * + * Valid TLS Certificates: + * https://evssldemo6.twca.com.tw + * + * Revoked TLS Certificates: + * https://evssldemo7.twca.com.tw + */ +public class TWCAGlobalCA { + + // Owner: CN=TWCA Global EVSSL Certification Authority, OU=Global EVSSL Sub-CA, O=TAIWAN-CA, C=TW + // Issuer: CN=TWCA Global Root CA, OU=Root CA, O=TAIWAN-CA, C=TW + // Serial number: 40013304f70000000000000cc042cd6d + // Valid from: Thu Aug 23 02:53:30 PDT 2012 until: Fri Aug 23 08:59:59 PDT 2030 + private static final String INT = "-----BEGIN CERTIFICATE-----\n" + + "MIIFdzCCA1+gAwIBAgIQQAEzBPcAAAAAAAAMwELNbTANBgkqhkiG9w0BAQsFADBR\n" + + "MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRAwDgYDVQQLEwdSb290\n" + + "IENBMRwwGgYDVQQDExNUV0NBIEdsb2JhbCBSb290IENBMB4XDTEyMDgyMzA5NTMz\n" + + "MFoXDTMwMDgyMzE1NTk1OVowczELMAkGA1UEBhMCVFcxEjAQBgNVBAoTCVRBSVdB\n" + + "Ti1DQTEcMBoGA1UECxMTR2xvYmFsIEVWU1NMIFN1Yi1DQTEyMDAGA1UEAxMpVFdD\n" + + "QSBHbG9iYWwgRVZTU0wgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqG\n" + + "SIb3DQEBAQUAA4IBDwAwggEKAoIBAQC7MIaeq4wMnTjA5C2LsR6HJUj6rZbs8Nmq\n" + + "sSqFoqu6LwjrMbzkAg274EL6913MQ6eOy6VUDRzqAfgBEYcwFofe/w8nC7Q6Nrzz\n" + + "xTkl9lovXLJIm0CI44Qk2IhiCkoYaPlIoqexqnm3Fc2QRdRNeLk2pU/s86DpGrwT\n" + + "BqRRRkziBlhcgo7K5Z9ihf+c82DT31iIUIi2nr0ES1eaRR7zpKrzJPZ8foNxRPwT\n" + + "2D0tJWQJ4hNzbFGSKsSzshdwQ/p4JP9AEjK2eeXXbEePt0/JarwBjO2Lwign38/g\n" + + "0ZiP3uE47bItxZhgXlnR5L/0bhJitE6U1xgVFbbrQnG2B2kZxVKxAgMBAAGjggEn\n" + + "MIIBIzAfBgNVHSMEGDAWgBRI283ejulJclqI6LHYPQezuWtmUDAdBgNVHQ4EFgQU\n" + + "br2hK87kwtUodFy92YxvBHIqBt4wDgYDVR0PAQH/BAQDAgEGMDgGA1UdIAQxMC8w\n" + + "LQYEVR0gADAlMCMGCCsGAQUFBwIBFhdodHRwOi8vd3d3LnR3Y2EuY29tLnR3LzBJ\n" + + "BgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vUm9vdENBLnR3Y2EuY29tLnR3L1RXQ0FS\n" + + "Q0EvZ2xvYmFsX3Jldm9rZV80MDk2LmNybDASBgNVHRMBAf8ECDAGAQH/AgEAMDgG\n" + + "CCsGAQUFBwEBBCwwKjAoBggrBgEFBQcwAYYcaHR0cDovL1Jvb3RPY3NwLnR3Y2Eu\n" + + "Y29tLnR3LzANBgkqhkiG9w0BAQsFAAOCAgEAaOmLaZ2+WN2EtB6feuSV5KnL88ck\n" + + "I9jsUTB4YtKsv0ViORkeBMCQur5OoAgRE9VYdRVlWHN0zJAX232fdoZmnajl8gtj\n" + + "u0AOOyDDJ7Vlh38rDMRlX/u+MS2DFcsq5Vd3EMwJsWWFR9D3Dcey+Tu9uEmEdqeB\n" + + "+Erd4YjCeV9PyOW3SzPQ47RdW6XYmHArPh65/LcmSxTn/lxQy/NEBGGWqhm6s6n1\n" + + "49mPq4MtQcMLo/NBI+8jv7BVjnThbbEh2edHHxMNiAd5kLZFDCyJuFkoezjWL4AH\n" + + "ratXdoHtqvqtPoy97LyGrLrJeh+0hkO9u8QOt2gF7BEhNfid7o5dnsPRk+8l77Hn\n" + + "T1dvBs++M0r0QG4AWMSMj9uUn6rhl4FGTvAsyB1fA8p/xCLoIEetIpKRP3BD+ve2\n" + + "eYjWPorR/0W77iMTeoQEeuxDIxi2J/U9QLKKvzzqBy1TYrqqPe5YxqHLNAcfHZvo\n" + + "BTPPbtP0WAiXrJiELTYcqFXETvQcGw0XjoUZNvJE8RD7vssSNT17RKU8iBRX7CbL\n" + + "AB3T8gYykPMJTUqQSmdgEdVRBcqRMMdU+XRAEoU/Mz5oHAkm3ZNTDNwsEp2Dg1/b\n" + + "qzfPMhg4/3/YyWzGrzNeCSWZkjYImAzLCvN0D5rbdVHEmFIrEJt+igocGozroq5x\n" + + "DT5KhixlrqexzWE=\n" + + "-----END CERTIFICATE-----"; + + // Owner: OID.2.5.4.17=100, STREET="10F.,NO.85,Yanping S. Rd.,Taipei City 100,Taiwan (R.O.C)", + // SERIALNUMBER=70759028, OID.1.3.6.1.4.1.311.60.2.1.3=TW, OID.1.3.6.1.4.1.311.60.2.1.2=Taiwan, + // OID.1.3.6.1.4.1.311.60.2.1.1=Taipei, OID.2.5.4.15=Private Organization, + // CN=evssldemo6.twca.com.tw, O=TAIWAN-CA INC., L=Taipei, ST=Taiwan, C=TW + // Issuer: CN=TWCA Global EVSSL Certification Authority, OU=Global EVSSL Sub-CA, + // O=TAIWAN-CA, C=TW + // Serial number: 47e70000001258ff71d89af7f0353fef + // Valid from: Thu Mar 02 00:49:56 PST 2023 until: Sun Mar 31 08:59:59 PDT 2024 + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIH7zCCBtegAwIBAgIQR+cAAAASWP9x2Jr38DU/7zANBgkqhkiG9w0BAQsFADBz\n" + + "MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRwwGgYDVQQLExNHbG9i\n" + + "YWwgRVZTU0wgU3ViLUNBMTIwMAYDVQQDEylUV0NBIEdsb2JhbCBFVlNTTCBDZXJ0\n" + + "aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0yMzAzMDIwODQ5NTZaFw0yNDAzMzExNTU5\n" + + "NTlaMIIBMzELMAkGA1UEBhMCVFcxDzANBgNVBAgTBlRhaXdhbjEPMA0GA1UEBxMG\n" + + "VGFpcGVpMRcwFQYDVQQKEw5UQUlXQU4tQ0EgSU5DLjEfMB0GA1UEAxMWZXZzc2xk\n" + + "ZW1vNi50d2NhLmNvbS50dzEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + + "FzAVBgsrBgEEAYI3PAIBARMGVGFpcGVpMRcwFQYLKwYBBAGCNzwCAQITBlRhaXdh\n" + + "bjETMBEGCysGAQQBgjc8AgEDEwJUVzERMA8GA1UEBRMINzA3NTkwMjgxQTA/BgNV\n" + + "BAkTODEwRi4sTk8uODUsWWFucGluZyBTLiBSZC4sVGFpcGVpIENpdHkgMTAwLFRh\n" + + "aXdhbiAoUi5PLkMpMQwwCgYDVQQREwMxMDAwggEiMA0GCSqGSIb3DQEBAQUAA4IB\n" + + "DwAwggEKAoIBAQDEgj/jtcAtGPkiBilLajzHIqfiAxpwwnKhdHwyOnqfcqur1p2R\n" + + "Cxl0Q8jYGmY8ZUq7716XnIGN3bn3Wu10BvmHi07h8f54/G/K7xBKjkasAh44zW1P\n" + + "hgdaxH0huRvoQOoSRCitew8YpMN4B++uOQ8yu2pWDGDdQHW4VaWt/e+QtZbQtp/b\n" + + "7vUWgcuhxDStj97B8Dcb5PY+sbLy6dfDiXnTaSpuWhjKmEcpknagGyn4uCFBSppZ\n" + + "/PYcTsg+Nk8Ae/SDMpc7XWBCjmxMG2GI0IVW4un9UOuElYgWVjMWnBAiGMDkVMEQ\n" + + "jLRxEYOh+NJ3izMyD/ufLrA/YwJMI1LgFcOJAgMBAAGjggO7MIIDtzAfBgNVHSME\n" + + "GDAWgBRuvaErzuTC1Sh0XL3ZjG8EcioG3jAdBgNVHQ4EFgQUg4msPcTFvDjwluRf\n" + + "inEn9qMC7OYwUwYDVR0fBEwwSjBIoEagRIZCaHR0cDovL3NzbHNlcnZlci50d2Nh\n" + + "LmNvbS50dy9zc2xzZXJ2ZXIvR2xvYmFsRVZTU0xfUmV2b2tlXzIwMTIuY3JsMCEG\n" + + "A1UdEQQaMBiCFmV2c3NsZGVtbzYudHdjYS5jb20udHcwfwYIKwYBBQUHAQEEczBx\n" + + "MEQGCCsGAQUFBzAChjhodHRwOi8vc3Nsc2VydmVyLnR3Y2EuY29tLnR3L2NhY2Vy\n" + + "dC9HbG9iYWxFdnNzbF8yMDEyLnA3YjApBggrBgEFBQcwAYYdaHR0cDovL2V2c3Ns\n" + + "b2NzcC50d2NhLmNvbS50dy8wSAYDVR0gBEEwPzA0BgwrBgEEAYK/JQEBFgMwJDAi\n" + + "BggrBgEFBQcCARYWaHR0cDovL3d3dy50d2NhLmNvbS50dzAHBgVngQwBATAJBgNV\n" + + "HRMEAjAAMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYB\n" + + "BQUHAwIwggH2BgorBgEEAdZ5AgQCBIIB5gSCAeIB4AB2AEiw42vapkc0D+VqAvqd\n" + + "MOscUgHLVt0sgdm7v6s52IRzAAABhqGDiCYAAAQDAEcwRQIgd7uqvHdSTSXqNPWs\n" + + "OQeCeT2vuKY3vj8jRcoJ9IIohqgCIQCtQfZ0lfZ1Y1GmwCTDc5NM++5mgp+ZpNWu\n" + + "F9OKsWoCPQB2AFWB1MIWkDYBSuoLm1c8U/DA5Dh4cCUIFy+jqh0HE9MMAAABhqGD\n" + + "iJYAAAQDAEcwRQIgIHKa+XeYyDURUq9AVYEntGS5oJitKyWZjSOlpD+udZgCIQC/\n" + + "oVPtjJpcXP4OScYFsNWMPKUtZOO5mY5y7V65S84DrQB2ADtTd3U+LbmAToswWwb+\n" + + "QDtn2E/D9Me9AA0tcm/h+tQXAAABhqGDh8YAAAQDAEcwRQIgYT7aPr9YCtF5TCTp\n" + + "NICK9c5eiL6Ku/y9wM6ARgG2k1UCIQDomqlwGur+AMI4YIc1SNqyNVCyxgP1DxXP\n" + + "FYkX6BX17gB2AO7N0GTV2xrOxVy3nbTNE6Iyh0Z8vOzew1FIWUZxH7WbAAABhqGD\n" + + "iKkAAAQDAEcwRQIhAKTMliyTn48vvP9hN8jucD6rGZwRCqQI6suE6ADpN7bNAiB3\n" + + "zFZFdH8eJRn3RXjD/mzbmF201sNLitp9SOYAazubljANBgkqhkiG9w0BAQsFAAOC\n" + + "AQEAOOtzqtRFvxlJro61O0dEkDottToFh88vib3N3AofS5uW0nDpoS0L27XR8IDd\n" + + "2NfN+2XKAQXdz2BqHnjW1nAMXUx4TAMi4jG8XpOkvpSDXbjghD5EB10FyAzCuGmv\n" + + "mKxkVOU1DzL0kSLLQjLaJ57WUYsoE97f5O6rY9jlJpid32o1WgM1oZsBjPhO8Kiy\n" + + "KJ5zZHppolGPtuFYMUcatiqv//pH/5piwtlYSkbwMj5nYidSrSBciBzO53HFk1pE\n" + + "TABXFcoK3gmhWM04lysmJMwAzRUbNQVizpGDICbRjCOVnwCbutnSnka8pDHkq4Zy\n" + + "BrUeZe2xJe8jWvukwqvNzIIvwg==\n" + + "-----END CERTIFICATE-----"; + + // Owner: OID.2.5.4.17=100, STREET="10F.,NO.85,Yanping S. Rd.,Taipei City 100,Taiwan (R.O.C)", + // SERIALNUMBER=70759028, OID.1.3.6.1.4.1.311.60.2.1.3=TW, OID.1.3.6.1.4.1.311.60.2.1.2=Taiwan, + // OID.1.3.6.1.4.1.311.60.2.1.1=Taipei, OID.2.5.4.15=Private Organization, + // CN=evssldemo7.twca.com.tw, O=TAIWAN-CA INC., L=Taipei, ST=Taiwan, C=TW + // Issuer: CN=TWCA Global EVSSL Certification Authority, OU=Global EVSSL Sub-CA, + // O=TAIWAN-CA, C=TW + // Serial number: 47e70000001258f036a5b513091ccb2e + // Valid from: Tue Feb 07 02:03:08 PST 2023 until: Thu Mar 07 07:59:59 PST 2024 + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIHdjCCBl6gAwIBAgIQR+cAAAASWPA2pbUTCRzLLjANBgkqhkiG9w0BAQsFADBz\n" + + "MQswCQYDVQQGEwJUVzESMBAGA1UEChMJVEFJV0FOLUNBMRwwGgYDVQQLExNHbG9i\n" + + "YWwgRVZTU0wgU3ViLUNBMTIwMAYDVQQDEylUV0NBIEdsb2JhbCBFVlNTTCBDZXJ0\n" + + "aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0yMzAyMDcxMDAzMDhaFw0yNDAzMDcxNTU5\n" + + "NTlaMIIBMzELMAkGA1UEBhMCVFcxDzANBgNVBAgTBlRhaXdhbjEPMA0GA1UEBxMG\n" + + "VGFpcGVpMRcwFQYDVQQKEw5UQUlXQU4tQ0EgSU5DLjEfMB0GA1UEAxMWZXZzc2xk\n" + + "ZW1vNy50d2NhLmNvbS50dzEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + + "FzAVBgsrBgEEAYI3PAIBARMGVGFpcGVpMRcwFQYLKwYBBAGCNzwCAQITBlRhaXdh\n" + + "bjETMBEGCysGAQQBgjc8AgEDEwJUVzERMA8GA1UEBRMINzA3NTkwMjgxQTA/BgNV\n" + + "BAkTODEwRi4sTk8uODUsWWFucGluZyBTLiBSZC4sVGFpcGVpIENpdHkgMTAwLFRh\n" + + "aXdhbiAoUi5PLkMpMQwwCgYDVQQREwMxMDAwggEiMA0GCSqGSIb3DQEBAQUAA4IB\n" + + "DwAwggEKAoIBAQDSX3co7XUdwxv8OEj7Mipq0Ot+1w+VYTFlPvdnryrv9st7ERLb\n" + + "+xJPJo7swgqbHeHKWlwYu4lkzJq6s3nAOkuYIP/O3uVmGDiilLSAVkukz9MooyjB\n" + + "466eArXY1VT9vpXVNmSLunAp5RU8H+2WWOUMmtJx/oYojqEbtWqnltlErvEjb2TM\n" + + "vR16d/vXI6QtMc+IV3nZ0SVdetH2E7ZvpP5mZqVSHNnOnVjqdd69hAJ4SJgG9lCM\n" + + "87ysm6UaJxQbEGxc6YkwrUNVet1tx2hBWltTyRw3oOBCBUwrPUTx7/pFh7yhci6p\n" + + "AhHp1j0OzAmZHOFTM+qO1L1vlmguO8zW0zWtAgMBAAGjggNCMIIDPjAfBgNVHSME\n" + + "GDAWgBRuvaErzuTC1Sh0XL3ZjG8EcioG3jAdBgNVHQ4EFgQUvvbgZHRNPdmGlxQS\n" + + "fcTzM2A14EkwUwYDVR0fBEwwSjBIoEagRIZCaHR0cDovL3NzbHNlcnZlci50d2Nh\n" + + "LmNvbS50dy9zc2xzZXJ2ZXIvR2xvYmFsRVZTU0xfUmV2b2tlXzIwMTIuY3JsMCEG\n" + + "A1UdEQQaMBiCFmV2c3NsZGVtbzcudHdjYS5jb20udHcwfwYIKwYBBQUHAQEEczBx\n" + + "MEQGCCsGAQUFBzAChjhodHRwOi8vc3Nsc2VydmVyLnR3Y2EuY29tLnR3L2NhY2Vy\n" + + "dC9HbG9iYWxFdnNzbF8yMDEyLnA3YjApBggrBgEFBQcwAYYdaHR0cDovL2V2c3Ns\n" + + "b2NzcC50d2NhLmNvbS50dy8wSAYDVR0gBEEwPzA0BgwrBgEEAYK/JQEBFgMwJDAi\n" + + "BggrBgEFBQcCARYWaHR0cDovL3d3dy50d2NhLmNvbS50dzAHBgVngQwBATAJBgNV\n" + + "HRMEAjAAMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYB\n" + + "BQUHAwIwggF9BgorBgEEAdZ5AgQCBIIBbQSCAWkBZwB2AFWB1MIWkDYBSuoLm1c8\n" + + "U/DA5Dh4cCUIFy+jqh0HE9MMAAABhitUR1YAAAQDAEcwRQIhANv7DhQm67R1Ilmg\n" + + "k5StrFQ1dqyELzZTAT3on84g0G/vAiAttP+EWWmztK2luQ7SxvQsmExDh/qGiZHq\n" + + "NAd2a8dUIgB1AO7N0GTV2xrOxVy3nbTNE6Iyh0Z8vOzew1FIWUZxH7WbAAABhitU\n" + + "RycAAAQDAEYwRAIgcU5n4DJaGWvTr3wZug59ItynMgCZ5z0ZVrZr2KwV70wCIHEv\n" + + "DAwNBLGsdj5IX/4E5hnzJvS7WroSLnRB6OW931JbAHYAdv+IPwq2+5VRwmHM9Ye6\n" + + "NLSkzbsp3GhCCp/mZ0xaOnQAAAGGK1RKDwAABAMARzBFAiBvlIvOnE8PhYJQueMh\n" + + "AOCwgREvnAsk3Edt59lcuqPrrQIhAOSRb3UmBYkHQ6k5pUJva0Mgk0GmnLR0de0s\n" + + "VxW3TTASMA0GCSqGSIb3DQEBCwUAA4IBAQAQB7oaouXBI6VpLzL+kzOZXSTbSClv\n" + + "LS33DTEBI3A8LTXHbFq6c4/ZdqieUzy42Kd0i9e3hI1hwQYPgEwxpROOcldX72r0\n" + + "EUTh0L+XrxN3YEgod6aCsjIiJlWYy6J2ZXVURnk/iWYAwYLa0JmmBGuWFjEnq4lO\n" + + "xL1C3M2mYAEC+Beb7Xyq1rcu97p4P8igJYM+VfwXNwYYRCXUr9f4ESD7t5vXlYoE\n" + + "c4m5KiBQD9XtZS77QRon9JCQklxTvMkxuLwWvSdzicEUzWeFp+kN/fcXL2SVsb17\n" + + "xDPMMsMMh7L/f+uMWDYZ+wH17LYQxOLi7VXT3fv8nl2X2iD3d4CCh0Tu\n" + + "-----END CERTIFICATE-----"; + + public static void main(String[] args) throws Exception { + + ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); + + if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { + pathValidator.enableCRLCheck(); + } else { + // OCSP check by default + pathValidator.enableOCSPCheck(); + } + + // Validate valid + pathValidator.validate(new String[]{VALID, INT}, + ValidatePathWithParams.Status.GOOD, null, System.out); + + // Validate Revoked + pathValidator.validate(new String[]{REVOKED, INT}, + ValidatePathWithParams.Status.REVOKED, + "Thu Mar 23 17:30:19 PDT 2023", System.out); + } +} diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index a968ee76c9a..55036fc0436 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -28,6 +28,7 @@ * 8209452 8209506 8210432 8195793 8216577 8222089 8222133 8222137 8222136 * 8223499 8225392 8232019 8234245 8233223 8225068 8225069 8243321 8243320 * 8243559 8225072 8258630 8259312 8256421 8225081 8225082 8225083 8245654 + * 8305975 * @summary Check root CA entries in cacerts file */ import java.io.ByteArrayInputStream; @@ -46,12 +47,12 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 90; + private static final int COUNT = 91; // SHA-256 of cacerts, can be generated with // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95 private static final String CHECKSUM - = "A3:57:D9:69:62:ED:00:ED:72:83:1E:15:46:02:93:F3:12:0F:49:83:E3:E6:D0:9F:96:34:05:9C:43:EB:D6:05"; + = "5E:38:7A:3A:3A:4D:08:B5:4F:26:16:93:BA:2B:85:8E:54:86:9F:39:10:FA:A5:A2:F7:E6:2F:52:E1:3C:53:DA"; // Hex formatter to upper case with ":" delimiter private static final HexFormat HEX = HexFormat.ofDelimiter(":").withUpperCase(); @@ -240,6 +241,8 @@ public class VerifyCACerts { "44:B5:45:AA:8A:25:E6:5A:73:CA:15:DC:27:FC:36:D2:4C:1C:B9:95:3A:06:65:39:B1:15:82:DC:48:7B:48:33"); put("certignaca [jdk]", "E3:B6:A2:DB:2E:D7:CE:48:84:2F:7A:C5:32:41:C7:B7:1D:54:14:4B:FB:40:C1:1F:3F:1D:0B:42:F5:EE:A1:2D"); + put("twcaglobalrootca [jdk]", + "59:76:90:07:F7:68:5D:0F:CD:50:87:2F:9F:95:D5:75:5A:5B:2B:45:7D:81:F3:69:2B:61:0A:98:67:2F:0E:1B"); } }; From f4e0121a9855a9ee7b9d5c0f43a8909c90d1d078 Mon Sep 17 00:00:00 2001 From: Madjosz <28844868+Madjosz@users.noreply.github.com> Date: Fri, 28 Apr 2023 16:23:13 +0000 Subject: [PATCH 010/459] 8302983: ZoneRulesProvider.registerProvider() twice will remove provider Reviewed-by: naoto --- .../java/time/zone/ZoneRulesProvider.java | 9 +- .../java/time/zone/TestZoneRulesProvider.java | 85 ++++++++++++++----- 2 files changed, 70 insertions(+), 24 deletions(-) diff --git a/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java b/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java index 496f70f1117..375be682c0c 100644 --- a/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java +++ b/src/java.base/share/classes/java/time/zone/ZoneRulesProvider.java @@ -316,10 +316,11 @@ private static synchronized void registerProvider0(ZoneRulesProvider provider) { Objects.requireNonNull(zoneId, "zoneId"); ZoneRulesProvider old = ZONES.putIfAbsent(zoneId, provider); if (old != null) { - // restore old state - ZONES.put(zoneId, old); - provider.provideZoneIds().stream() - .forEach(id -> ZONES.remove(id, provider)); + if (!old.equals(provider)) { + // restore old state + ZONES.put(zoneId, old); + provider.provideZoneIds().forEach(id -> ZONES.remove(id, provider)); + } throw new ZoneRulesException( "Unable to register zone as one already registered with that ID: " + zoneId + ", currently loading from provider: " + provider); diff --git a/test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java b/test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java index 71f816842ce..3a20dc2b864 100644 --- a/test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java +++ b/test/jdk/java/time/test/java/time/zone/TestZoneRulesProvider.java @@ -34,46 +34,33 @@ import org.testng.annotations.Test; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; /** * @summary Tests for ZoneRulesProvider class. - * @bug 8299571 + * @bug 8299571 8302983 */ @Test public class TestZoneRulesProvider { - private static final Set MY_ZONE_IDS = - new LinkedHashSet(Arrays.asList(new String[] {"MyID_1", "MyID_2", "CET", "MyID_3"})); /** * Tests whether partially registered zones are cleaned on a provider registration * failure, in case a duplicated zone is detected. + * @bug 8299571 */ @Test public void test_registerDuplicatedZone() { + Set myZoneIds = new LinkedHashSet<>(Arrays.asList(new String[] {"MyID_1", "MyID_2", "CET", "MyID_3"})); try { - ZoneRulesProvider.registerProvider(new ZoneRulesProvider() { - @Override - protected Set provideZoneIds() { - return MY_ZONE_IDS; - } - - @Override - protected ZoneRules provideRules(String zoneId, boolean forCaching) { - return null; - } - - @Override - protected NavigableMap provideVersions(String zoneId) { - return null; - } - }); + ZoneRulesProvider.registerProvider(new IdsOnlyZoneRulesProvider(myZoneIds)); throw new RuntimeException("Registering a provider that duplicates a zone should throw an exception"); } catch (ZoneRulesException e) { // Ignore. Failure on registration is expected. } - MY_ZONE_IDS.stream().forEach(id -> { + myZoneIds.stream().forEach(id -> { var isCET = id.equals("CET"); // availability check @@ -91,4 +78,62 @@ protected NavigableMap provideVersions(String zoneId) { } }); } + + /** + * Tests whether registering a provider twice will still leave it registered. + * @bug 8302983 + */ + @Test + public void test_registerTwice() { + String zone = "MyID"; + var provider = new IdsOnlyZoneRulesProvider(Set.of(zone)); + assertFalse(ZoneId.getAvailableZoneIds().contains(zone), "Unexpected availability for " + zone); + ZoneRulesProvider.registerProvider(provider); + assertTrue(ZoneId.getAvailableZoneIds().contains(zone), "Unexpected non-availability for " + zone); + try { + ZoneId.of(zone); + } catch (ZoneRulesException e) { + fail("ZoneId instance for " + zone + " should be obtainable"); + } + + try { + ZoneRulesProvider.registerProvider(provider); + fail("Registering an already registered provider should throw an exception"); + } catch (ZoneRulesException e) { + // Ignore. Failure on duplicate registration is expected. + } + + // availability check + assertTrue(ZoneId.getAvailableZoneIds().contains(zone), "Unexpected non-availability for " + zone); + // instantiation check + try { + ZoneId.of(zone); + } catch (ZoneRulesException e) { + fail("ZoneId instance for " + zone + " should still be obtainable", e); + } + } + + private static class IdsOnlyZoneRulesProvider extends ZoneRulesProvider { + + private final Set zones; + + IdsOnlyZoneRulesProvider(Set zones) { + this.zones = zones; + } + + @Override + protected Set provideZoneIds() { + return zones; + } + + @Override + protected ZoneRules provideRules(String zoneId, boolean forCaching) { + return null; + } + + @Override + protected NavigableMap provideVersions(String zoneId) { + return null; + } + } } From 90c236ddcf1157bc2ba27eccef23dcceeb1feb1b Mon Sep 17 00:00:00 2001 From: Weijun Wang Date: Fri, 28 Apr 2023 16:24:50 +0000 Subject: [PATCH 011/459] 8307077: Convert CRLF to LF in java.xml.crypto Reviewed-by: mullan --- .../xml/internal/security/resource/config.dtd | 146 +- .../xml/internal/security/resource/config.xml | 1364 ++++++++--------- .../resource/xmlsecurity_de.properties | 396 ++--- .../resource/xmlsecurity_en.properties | 400 ++--- 4 files changed, 1153 insertions(+), 1153 deletions(-) diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.dtd b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.dtd index f57b9fabe4d..1e886bf1776 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.dtd +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.dtd @@ -1,73 +1,73 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml index bbd26a399ca..ed87c833c1e 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/config.xml @@ -1,682 +1,682 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties index 03a2369566c..47b867889f5 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties @@ -1,199 +1,199 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -algorithm.alreadyRegistered = URI {0} wurde bereits an die Klasse {1} gebunden -algorithm.classDoesNotExist = Kann URI {0} nicht f\u00fcr Klasse {1} registrieren weil sie nicht existiert -algorithm.ClassDoesNotExist = Klasse {0} existiert nicht -algorithm.extendsWrongClass = Kann URI {0} nicht f\u00fcr Klasse {1} registrieren weil sie nicht von {2} abgeleitet ist -algorithms.CannotUseAlgorithmParameterSpecOnDSA = AlgorithmParameterSpec kann nicht f\u00fcr DSA Signaturen benutzt werden. -algorithms.CannotUseAlgorithmParameterSpecOnRSA = AlgorithmParameterSpec kann nicht f\u00fcr RSA Signaturen benutzt werden. -algorithms.CannotUseSecureRandomOnMAC = SecureRandom kann nicht f\u00fcr MAC's angewandt werden. -algorithms.HMACOutputLengthMax = HMACOutputLength darf nicht grosser als {0} sein -algorithms.HMACOutputLengthMin = HMACOutputLength darf nicht kleiner als {0} sein -algorithms.HMACOutputLengthOnlyForHMAC = Die HMACOutputLength kann nur bei HMAC integrit\u00e4ts Algorithmen angegeben werden -algorithms.MissingRSAPSSParams = RSAPSSParams is a required Element for http://www.w3.org/2007/05/xmldsig-more#rsa-pss -algorithms.NoSuchAlgorithm = Der Algorithmus {0} ist nicht verf\u00fcgbar. -algorithms.NoSuchAlgorithm = Der Algorithmus {0} ist nicht verf\u00fcgbar. Original Nachricht war\: {1} -algorithms.NoSuchMap = Algorithmus URI "{0}" konnte auf keinen JCE Algorithmus gemappt werden -algorithms.NoSuchProvider = Der angegebene Provider {0} existiert nicht. Original Nachricht war\: {1} -algorithms.operationOnlyVerification = Ein \u00f6ffentlicher Schl\u00fcssel (public key) kann nur zur Verifizierung einer Signatur verwendet werden. -algorithms.WrongKeyForThisOperation = Der angegebene Schl\u00fcssel-Typ kann nicht f\u00fcr diese Operation verwendet werden. Angegeben wurde {0} aber ein {1} wird ben\u00f6tigt. -attributeValueIllegal = Das Attribut {0} hat den Wert {1} muss aber {2} sein. -c14n.Canonicalizer.Exception = Fehler w\u00e4hrend der Kanonisierung\: Original Nachricht war {0} -c14n.Canonicalizer.IllegalNode = Unzul\u00e4ssiger NodeType {0}, NodeName lautete {1} -c14n.Canonicalizer.NoSuchCanonicalizer = Kein Kanonisierer mit dem URI {0} gefunden -c14n.Canonicalizer.ParserConfigurationException = ParserConfigurationException w\u00e4hrend der Kanonisierung\: Original Nachricht war {0} -c14n.Canonicalizer.RelativeNamespace = Das Element {0} hat einen relativen Namespace: {1}="{2}" -c14n.Canonicalizer.SAXException = SAXException w\u00e4hrend der Kanonisierung\: Original Nachricht war {0} -c14n.Canonicalizer.TraversalNotSupported = Das DOM Dokument unterst\u00fctzt keine Traversal {0} -c14n.Canonicalizer.UnsupportedEncoding = Nicht unterst\u00fctzte Kodierung {0} -c14n.Canonicalizer.UnsupportedOperation = Der Kanonisierer unterst\u00fctzt diese Operation nicht -c14n.XMLUtils.circumventBug2650forgotten = Die Baumstruktur wurde nicht vorbereitet f\u00fcr die Kanonisierung mit XMLUtils\#circumventBug2650(Document) -certificate.noSki.lowVersion = Das Zertifikat dard kein SubjectKeyIdentifier enthalten da es nur ein X509v{0} ist -certificate.noSki.notOctetString = Der SubjectKeyIdentifier des Zertifikates ist kein "OctetString" -certificate.noSki.null = Das Zertifikat enth\u00e4lt kein SubjectKeyIdentifier -defaultNamespaceCannotBeSetHere = Standard Namespace kann hier nicht gesetzt werden -ElementProxy.nullElement = Kann keinen ElementProxy aus einem null Argument erzeugen -empty = {0} -encryption.algorithmCannotBeUsedForEncryptedData = encryption.algorithmCannotBeUsedForEncryptedData {0} -encryption.algorithmCannotEatInitParams = encryption.algorithmCannotEatInitParams -encryption.algorithmCannotEncryptDecrypt = encryption.algorithmCannotEncryptDecrypt -encryption.algorithmCannotWrapUnWrap = encryption.algorithmCannotWrapUnWrap -encryption.ExplicitKeySizeMismatch = Das xenc\:KeySize Element fordert eine Schl\u00fcssel-L\u00e4nge von {0} bits aber der Algorithmus besitzt {1} bits -encryption.nonceLongerThanDecryptedPlaintext = Das angegebene "Nonce" ist l\u00e4nger als der verf\u00fcgbare Plaintext. -encryption.RSAOAEP.dataHashWrong = Falscher Hash-Wert -encryption.RSAOAEP.dataStartWrong = Falscher Start Input {0} -encryption.RSAOAEP.dataTooShort = Zu wenig Input -encryption.RSAPKCS15.blockTruncated = Block abgeschnitten -encryption.RSAPKCS15.noDataInBlock = Im Block sind keine Daten enthalten -encryption.RSAPKCS15.unknownBlockType = Unbekannter Block Typ -encryption.nokey = Es ist kein verschl\u00fcsselungs Schl\u00fcssel geladen und es konnte kein Schl\u00fcssel mit Hilfe der "key resolvers" gefunden werden. -endorsed.jdk1.4.0 = Leider scheint niemand unsere Installations-Anleitung zu lesen, deshalb m\u00fcssen wir es \u00fcber die Exception machen\: Du hast den "endorsing" Mechanismus vom JDK 1.4 nicht richtig angewandt. Schaue unter nach wie man das Problem l\u00f6st. -errorMessages.InvalidDigestValueException = Ung\u00fcltige Signatur\: Referen-Validierung fehlgeschlagen. -errorMessages.InvalidSignatureValueException = Ung\u00fcltige Signatur\: Core Validierung fehlgeschlagen. -errorMessages.IOException = Datei oder Resource kann nicht gelesen werden. -errorMessages.MissingKeyFailureException = Verifizierung fehlgeschlagen, weil der \u00f6ffentliche Schl\u00fcssel (public key) nicht verf\u00fcgbar ist. Resourcen via addResource() hinzuf\u00fcgen und erneut versuchen. -errorMessages.MissingResourceFailureException = Verifizierung fehlgeschlagen, weil Resourcen nicht verf\u00fcgbar sind. Resourcen via addResource() hinzuf\u00fcgen und erneut versuchen. -errorMessages.NoSuchAlgorithmException = Unbekannter Algorithmus {0} -errorMessages.NotYetImplementedException = Funktionalit\u00e4t noch nicht implementiert. -errorMessages.XMLSignatureException = Verifizierung aus unbekanntem Grund fehlgeschlagen. -decoding.divisible.four = It should be divisible by four -decoding.general = Fehler beim Decodieren -FileKeyStorageImpl.addToDefaultFromRemoteNotImplemented = Methode addToDefaultFromRemote() wurde noch nicht implementiert. -FileKeyStorageImpl.NoCert.Context = Kein X509-Zertifikat mit Kontext {0} gefunden -FileKeyStorageImpl.NoCert.IssNameSerNo = Kein X509-Zertifikat mit IssuerName {0} und serial number {1} gefunden -FileKeyStorageImpl.NoCert.SubjName = Kein X509-Zertifikat mit SubjectName {0} gefunden -generic.dontHaveConstructionElement = Konstruktions-Element fehlt -generic.EmptyMessage = {0} -generic.NotYetImplemented = {0} Leider noch nicht implementiert ;-(( -java.security.InvalidKeyException = Ung\u00fcltiger Schl\u00fcssel -java.security.NoSuchProviderException = Unbekannter oder nicht unterst\u00fctzter Provider -java.security.UnknownKeyType = Unbekannter oder nicht unterst\u00fctzter Schl\u00fcssel-Typ {0} -KeyInfo.error = Error loading Key Info -KeyInfo.needKeyResolver = Es m\u00fcssen mehrere KeyResolver registriert sein -KeyInfo.nokey = Kann keinen Schl\u00fcssel aus {0} gewinnen -KeyInfo.noKey = Kann keinen \u00f6ffentlichen Schl\u00fcssel finden -KeyInfo.wrongNumberOfObject = Ben\u00f6tige {0} keyObjects -KeyInfo.wrongUse = Dieses Objekt wird verwendet, um {0} zu gewinnen -keyResolver.alreadyRegistered = Die Klasse {1} wurde bereits registriert f\u00fcr {0} -KeyResolver.needStorageResolver = Es wird ein StorageResolver ben\u00f6tigt um ein Zertifikat aus {0} zu holen -KeyResoverSpiImpl.cannotGetCert = Cannot get the Certificate that include or in {1} in implement class {0} -KeyResoverSpiImpl.elementGeneration = Cannot make {1} element in implement class {0} -KeyResoverSpiImpl.getPoublicKey = Cannot get the public key from implement class {0} -KeyResoverSpiImpl.InvalidElement = Cannot set (2) Element in implement class {0} -KeyResoverSpiImpl.keyStore = KeyStorage Fehler in der implementierenden Klasse {0} -KeyResoverSpiImpl.need.Element = Es wird der Typ {1} ben\u00f6tigt in der implementierenden Klasse {0} -KeyResoverSpiImpl.wrongCRLElement = Cannot make CRL from {1} in implement class {0} -KeyResoverSpiImpl.wrongKeyObject = Need {1} type of KeyObject for generation Element in implement class{0} -KeyResoverSpiImpl.wrongNumberOfObject = Need {1} keyObject in implement class {0} -KeyStore.alreadyRegistered = Klasse {0} bereits registriert f\u00fcr {1} -KeyStore.register = {1} type class register error in class {0} -KeyStore.registerStore.register = Registrierungsfehler f\u00fcr Typ {0} -KeyValue.IllegalArgument = Kann kein {0} aus {1} erzeugen -namespacePrefixAlreadyUsedByOtherURI = Namespace {0} wird bereits von einer anderen URI {1} gebraucht -notYetInitialized = Das Modul {0} ist noch nicht initialisiert -prefix.AlreadyAssigned = Sie binden den Prefix {0} an den Namespace {1} aber er ist bereits an {2} zugewiesen -signature.Canonicalizer.UnknownCanonicalizer = Unbekannter Kanonisierer. Kein Handler installiert f\u00fcr URI {0} -signature.DSA.invalidFormat = Ung\u00fcltige ASN.1 Kodierung der DSA Signatur -signature.Generation.signBeforeGetValue = Es muss zuerst XMLSignature.sign(java.security.PrivateKey) aufgerufen werden -signature.Reference.ForbiddenResolver = Der "Resolver" {0} ist bei aktivierter "secure validation" nicht erlaubt -signature.Reference.NoDigestMethod = A Signature Reference Element must contain a DigestMethod child -signature.Reference.NoDigestValue = A Signature Reference Element must contain a DigestValue child -signature.signatureAlgorithm = Der Algorithmus {0} ist bei aktivierter "secure validation" nicht erlaubt -signature.signaturePropertyHasNoTarget = Das Target Attribut der SignatureProperty muss gesetzt sein -signature.tooManyReferences = Das Manifest enth\u00e4lt {0} Referenzen, bei aktivierter "secure validation" sind aber maximal {1} erlaubt -signature.tooManyTransforms = Die Referenz enth\u00e4lt {0} Transformationen, bei aktivierter "secure validation" sind aber maximal {1} erlaubt -signature.Transform.ErrorDuringTransform = W\u00e4hrend der Transformation {0} trat eine {1} auf. -signature.Transform.ForbiddenTransform = Die Transformation {0} ist bei aktivierter "secure validation" nicht erlaubt -signature.Transform.NotYetImplemented = Transform {0} noch nicht implementiert -signature.Transform.NullPointerTransform = Null pointer als URI \u00fcbergeben. Programmierfehler? -signature.Transform.UnknownTransform = Unbekannte Transformation. Kein Handler installiert f\u00fcr URI {0} -signature.Util.BignumNonPositive = bigInteger.signum() muss positiv sein -signature.Util.NonTextNode = Keine Text Node -signature.Util.TooManyChilds = Zu viele Kind-Elemente vom Typ {0} in {1} -signature.Verification.certificateError = Zertifikatsfehler -signature.Verification.IndexOutOfBounds = Index {0} illegal. Es sind nur {1} Referenzen vorhanden -signature.Verification.internalError = Interner Fehler -signature.Verification.InvalidDigestOrReference = Ung\u00fcltiger Digest Wert der Referenz {0} -signature.Verification.InvalidElement = Current Node {0} is not permitted in this location in the Signature -signature.Verification.keyStore = \u00d6ffnen des KeyStore fehlgeschlagen -signature.Verification.MissingID = Element mit der ID {0} nicht gefunden -signature.Verification.MissingResources = Kann die externe Resource {0} nicht aufl\u00f6sen -signature.Verification.MultipleIDs = Mehrere Elemente mit der ID {0} gefunden -signature.Verification.NoSignatureElement = Input Dokument enth\u00e4lt kein {0} Element mit dem Namespace {1} -signature.Verification.Reference.NoInput = Die Referenz f\u00fcr den URI {0} hat keinen XMLSignatureInput erhalten. -signature.Verification.SignatureError = Signatur Fehler -signature.XMLSignatureInput.MissingConstuctor = Kann aus der Klasse {0} keinen XMLSignatureInput erzeugen -signature.XMLSignatureInput.SerializeDOM = Input mit einem DOM Dokument initialisiert. Muss mit C14N serialisiert werden -transform.Init.IllegalContextArgument = Unzul\u00e4ssiges Kontext Argument der Klasse {0}. Muss String, org.w3c.dom.NodeList oder java.io.InputStream sein. -transform.init.NotInitialized = -transform.init.wrongURI = Initialisiert mit dem falschen URI. Das sollte nie passieren. Die Transformation implementiert {0} aber {1} wurde bei der Instantiierung verwendet. -utils.Base64.IllegalBitlength = Ung\u00fcltige Byte-L\u00e4nge; Muss ein vielfaches von 4 sein -utils.resolver.noClass = Keinen Resolver f\u00fcr URI {0} und Base {1} gefunden -xml.WrongContent = Kann {0} nicht finden in {1} -xml.WrongElement = Kann kein {0} aus einem {1} Element erzeugen -xpath.funcHere.documentsDiffer = Der XPath ist nicht im selben Dokument wie der Kontext Node -xpath.funcHere.noXPathContext = Versuch einer XPath-Evaluierung welcher die Funktion here() benutzt aber der XPath ist nicht innerhalb eines ds\:XPath Elements. XPath \: {0} -signature.Transform.node = Aktuelle Node\: {0} -signature.Transform.nodeAndType = Aktuelle Node\: {0}, Typ\: {1} -signature.XMLSignatureInput.nodesetReference = Das Node-Set der Referenz konnte nicht konvertieren werden -transform.envelopedSignatureTransformNotInSignatureElement = Enveloped Transform konnte kein Signatur Element finden -Base64Decoding = Fehler bei der Decodierung -secureProcessing.MaximumAllowedTransformsPerReference = Die Referenz enth\u00e4lt {0} Transformationen. Es sind aber maximal {1} erlaubt. Die Limite kann \u00fcber das Konfigurations-Property "MaximumAllowedTransformsPerReference" erh\u00f6ht werden. -secureProcessing.MaximumAllowedReferencesPerManifest = Das Manifest enh\u00e4lt {0} Referenzen. Es sind aber maximal {1} erlaubt. Die Limite kann \u00fcber das Konfigurations-Property "MaximumAllowedReferencesPerManifest" erh\u00f6ht werden. -secureProcessing.DoNotThrowExceptionForManifests = Signatur-Manifests werden nicht unterst\u00fctzt. Das werfen dieser Exception kann durch das Konfigurations-Property "DoNotThrowExceptionForManifests" verhindert werden. -secureProcessing.AllowMD5Algorithm = Vom Einsatz des MD5 Algorithmus wird strengstens abgeraten. Trotzdem kann er \u00fcber das Konfigurations-Property "AllowMD5Algorithm" erlaubt werden. -secureProcessing.AllowNotSameDocumentReferences = Externe Referenzen gefunden. Die Verarbeitung von externen Referenzen ist standardm\u00e4ssig ausgeschaltet. Es kann \u00fcber das Konfigurations-Property "AllowNotSameDocumentReferences" aktiviert werden. -secureProcessing.MaximumAllowedXMLStructureDepth = Die Maximum erlaubte Dokumenten-Tiefe von ({0}) wurde erreicht. Die Limite kann \u00fcber das Konfigurations-Property "MaximumAllowedXMLStructureDepth" erh\u00f6ht werden. -secureProcessing.inputStreamLimitReached = Maximal erlaubte Anzahl bytes ({0}) erreicht. -stax.duplicateActions=Doppelte Actions sind nicht erlaubt. -stax.missingSecurityProperties = SecurityProperties darf nicht null sein\! -stax.noOutputAction = Keine ausgehenden "Actions" definiert. -stax.noKey = Kein Schl\u00fcssel geladen und es konnte kein Schl\u00fcssel gefunden werden f\u00fcr {0} -stax.keyNotFound = Schl\u00fcssel nicht gefunden. -stax.unsupportedKeyValue = Kein oder ung\u00fcltiger KeyValue. -stax.emptyReferenceURI = Referenz enth\u00e4lt kein URI Attribut. -stax.encryption.unprocessedReferences = Es wurden nicht alle Verschl\u00fcsselungs-Referenzen verarbeitet... -stax.signature.unprocessedReferences = Es wurden nicht alle Signatur-Referenzen verarbeitet... -stax.unsupportedToken = {0} nicht unterst\u00fctzt. -stax.xmlStructureSizeExceeded = Maximal erlaubte ({0}) XML-Struktur Tiefe erreicht. -stax.unexpectedXMLEvent = Unerwarteter StAX-Event\: {0} -stax.encryption.noEncAlgo = xenc\:EncryptedKey enth\u00e4lt kein xenc\:EncryptionMethod/@Algorithm. -stax.encryption.noCipherValue = EncryptedKey enth\u00e4lt kein xenc\:CipherData/xenc\:CipherValue. -stax.unsecuredMessage = Ungesicherte Nachricht. Weder ein Signatur- noch ein EncryptedData- Element wurde gefunden. -stax.signature.signedInfoMissing = SignedInfo Element fehlt. -stax.signature.signatureMethodMissing = Signature method fehlt. -stax.signature.canonicalizationMethodMissing = Signature canonicalization method fehlt. -stax.signature.signatureValueMissing = Signature value fehlt. -stax.signature.publicKeyOrCertificateMissing = Weder ein Zertifikat noch ein public-key wurde konfiguriert. -stax.encryption.encryptionKeyMissing = Kein Schl\u00fcssel f\u00fcr die Verschl\u00fcsselung wurde konfiguriert. -stax.unsupportedKeyTransp = Der public-key Algorithmus ist zu kurz um den symmetrischen Schl\u00fcssel zu verschl\u00fcsseln. -stax.recursiveKeyReference = Rekursive Schl\u00fcssel referenzierung detektiert. -stax.ecParametersNotSupported = ECParameters werden nicht unterst\u00fctzt. -stax.namedCurveMissing = NamedCurve fehlt. -stax.encryption.securePartNotFound = Part zum Verschl\u00fcsseln nicht gefunden: {0} -stax.signature.securePartNotFound = Part zum Signieren nicht gefunden: {0} -stax.multipleSignaturesNotSupported = Mehrere Signaturen werden nicht unterstützt. -stax.signature.keyNameMissing = KeyName nicht konfiguriert. -stax.keyNotFoundForName = Kein Schl\u00fcssel für Schl\u00fcsselname konfiguriert: {0} -stax.keyTypeNotSupported = Key vom Typ {0} nicht f\u00fcr einen Key-Namenssuche unterst\u00fctzt -stax.idsetbutnotgenerated = An Id attribute is specified, but Id generation is disabled +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +algorithm.alreadyRegistered = URI {0} wurde bereits an die Klasse {1} gebunden +algorithm.classDoesNotExist = Kann URI {0} nicht f\u00fcr Klasse {1} registrieren weil sie nicht existiert +algorithm.ClassDoesNotExist = Klasse {0} existiert nicht +algorithm.extendsWrongClass = Kann URI {0} nicht f\u00fcr Klasse {1} registrieren weil sie nicht von {2} abgeleitet ist +algorithms.CannotUseAlgorithmParameterSpecOnDSA = AlgorithmParameterSpec kann nicht f\u00fcr DSA Signaturen benutzt werden. +algorithms.CannotUseAlgorithmParameterSpecOnRSA = AlgorithmParameterSpec kann nicht f\u00fcr RSA Signaturen benutzt werden. +algorithms.CannotUseSecureRandomOnMAC = SecureRandom kann nicht f\u00fcr MAC's angewandt werden. +algorithms.HMACOutputLengthMax = HMACOutputLength darf nicht grosser als {0} sein +algorithms.HMACOutputLengthMin = HMACOutputLength darf nicht kleiner als {0} sein +algorithms.HMACOutputLengthOnlyForHMAC = Die HMACOutputLength kann nur bei HMAC integrit\u00e4ts Algorithmen angegeben werden +algorithms.MissingRSAPSSParams = RSAPSSParams is a required Element for http://www.w3.org/2007/05/xmldsig-more#rsa-pss +algorithms.NoSuchAlgorithm = Der Algorithmus {0} ist nicht verf\u00fcgbar. +algorithms.NoSuchAlgorithm = Der Algorithmus {0} ist nicht verf\u00fcgbar. Original Nachricht war\: {1} +algorithms.NoSuchMap = Algorithmus URI "{0}" konnte auf keinen JCE Algorithmus gemappt werden +algorithms.NoSuchProvider = Der angegebene Provider {0} existiert nicht. Original Nachricht war\: {1} +algorithms.operationOnlyVerification = Ein \u00f6ffentlicher Schl\u00fcssel (public key) kann nur zur Verifizierung einer Signatur verwendet werden. +algorithms.WrongKeyForThisOperation = Der angegebene Schl\u00fcssel-Typ kann nicht f\u00fcr diese Operation verwendet werden. Angegeben wurde {0} aber ein {1} wird ben\u00f6tigt. +attributeValueIllegal = Das Attribut {0} hat den Wert {1} muss aber {2} sein. +c14n.Canonicalizer.Exception = Fehler w\u00e4hrend der Kanonisierung\: Original Nachricht war {0} +c14n.Canonicalizer.IllegalNode = Unzul\u00e4ssiger NodeType {0}, NodeName lautete {1} +c14n.Canonicalizer.NoSuchCanonicalizer = Kein Kanonisierer mit dem URI {0} gefunden +c14n.Canonicalizer.ParserConfigurationException = ParserConfigurationException w\u00e4hrend der Kanonisierung\: Original Nachricht war {0} +c14n.Canonicalizer.RelativeNamespace = Das Element {0} hat einen relativen Namespace: {1}="{2}" +c14n.Canonicalizer.SAXException = SAXException w\u00e4hrend der Kanonisierung\: Original Nachricht war {0} +c14n.Canonicalizer.TraversalNotSupported = Das DOM Dokument unterst\u00fctzt keine Traversal {0} +c14n.Canonicalizer.UnsupportedEncoding = Nicht unterst\u00fctzte Kodierung {0} +c14n.Canonicalizer.UnsupportedOperation = Der Kanonisierer unterst\u00fctzt diese Operation nicht +c14n.XMLUtils.circumventBug2650forgotten = Die Baumstruktur wurde nicht vorbereitet f\u00fcr die Kanonisierung mit XMLUtils\#circumventBug2650(Document) +certificate.noSki.lowVersion = Das Zertifikat dard kein SubjectKeyIdentifier enthalten da es nur ein X509v{0} ist +certificate.noSki.notOctetString = Der SubjectKeyIdentifier des Zertifikates ist kein "OctetString" +certificate.noSki.null = Das Zertifikat enth\u00e4lt kein SubjectKeyIdentifier +defaultNamespaceCannotBeSetHere = Standard Namespace kann hier nicht gesetzt werden +ElementProxy.nullElement = Kann keinen ElementProxy aus einem null Argument erzeugen +empty = {0} +encryption.algorithmCannotBeUsedForEncryptedData = encryption.algorithmCannotBeUsedForEncryptedData {0} +encryption.algorithmCannotEatInitParams = encryption.algorithmCannotEatInitParams +encryption.algorithmCannotEncryptDecrypt = encryption.algorithmCannotEncryptDecrypt +encryption.algorithmCannotWrapUnWrap = encryption.algorithmCannotWrapUnWrap +encryption.ExplicitKeySizeMismatch = Das xenc\:KeySize Element fordert eine Schl\u00fcssel-L\u00e4nge von {0} bits aber der Algorithmus besitzt {1} bits +encryption.nonceLongerThanDecryptedPlaintext = Das angegebene "Nonce" ist l\u00e4nger als der verf\u00fcgbare Plaintext. +encryption.RSAOAEP.dataHashWrong = Falscher Hash-Wert +encryption.RSAOAEP.dataStartWrong = Falscher Start Input {0} +encryption.RSAOAEP.dataTooShort = Zu wenig Input +encryption.RSAPKCS15.blockTruncated = Block abgeschnitten +encryption.RSAPKCS15.noDataInBlock = Im Block sind keine Daten enthalten +encryption.RSAPKCS15.unknownBlockType = Unbekannter Block Typ +encryption.nokey = Es ist kein verschl\u00fcsselungs Schl\u00fcssel geladen und es konnte kein Schl\u00fcssel mit Hilfe der "key resolvers" gefunden werden. +endorsed.jdk1.4.0 = Leider scheint niemand unsere Installations-Anleitung zu lesen, deshalb m\u00fcssen wir es \u00fcber die Exception machen\: Du hast den "endorsing" Mechanismus vom JDK 1.4 nicht richtig angewandt. Schaue unter nach wie man das Problem l\u00f6st. +errorMessages.InvalidDigestValueException = Ung\u00fcltige Signatur\: Referen-Validierung fehlgeschlagen. +errorMessages.InvalidSignatureValueException = Ung\u00fcltige Signatur\: Core Validierung fehlgeschlagen. +errorMessages.IOException = Datei oder Resource kann nicht gelesen werden. +errorMessages.MissingKeyFailureException = Verifizierung fehlgeschlagen, weil der \u00f6ffentliche Schl\u00fcssel (public key) nicht verf\u00fcgbar ist. Resourcen via addResource() hinzuf\u00fcgen und erneut versuchen. +errorMessages.MissingResourceFailureException = Verifizierung fehlgeschlagen, weil Resourcen nicht verf\u00fcgbar sind. Resourcen via addResource() hinzuf\u00fcgen und erneut versuchen. +errorMessages.NoSuchAlgorithmException = Unbekannter Algorithmus {0} +errorMessages.NotYetImplementedException = Funktionalit\u00e4t noch nicht implementiert. +errorMessages.XMLSignatureException = Verifizierung aus unbekanntem Grund fehlgeschlagen. +decoding.divisible.four = It should be divisible by four +decoding.general = Fehler beim Decodieren +FileKeyStorageImpl.addToDefaultFromRemoteNotImplemented = Methode addToDefaultFromRemote() wurde noch nicht implementiert. +FileKeyStorageImpl.NoCert.Context = Kein X509-Zertifikat mit Kontext {0} gefunden +FileKeyStorageImpl.NoCert.IssNameSerNo = Kein X509-Zertifikat mit IssuerName {0} und serial number {1} gefunden +FileKeyStorageImpl.NoCert.SubjName = Kein X509-Zertifikat mit SubjectName {0} gefunden +generic.dontHaveConstructionElement = Konstruktions-Element fehlt +generic.EmptyMessage = {0} +generic.NotYetImplemented = {0} Leider noch nicht implementiert ;-(( +java.security.InvalidKeyException = Ung\u00fcltiger Schl\u00fcssel +java.security.NoSuchProviderException = Unbekannter oder nicht unterst\u00fctzter Provider +java.security.UnknownKeyType = Unbekannter oder nicht unterst\u00fctzter Schl\u00fcssel-Typ {0} +KeyInfo.error = Error loading Key Info +KeyInfo.needKeyResolver = Es m\u00fcssen mehrere KeyResolver registriert sein +KeyInfo.nokey = Kann keinen Schl\u00fcssel aus {0} gewinnen +KeyInfo.noKey = Kann keinen \u00f6ffentlichen Schl\u00fcssel finden +KeyInfo.wrongNumberOfObject = Ben\u00f6tige {0} keyObjects +KeyInfo.wrongUse = Dieses Objekt wird verwendet, um {0} zu gewinnen +keyResolver.alreadyRegistered = Die Klasse {1} wurde bereits registriert f\u00fcr {0} +KeyResolver.needStorageResolver = Es wird ein StorageResolver ben\u00f6tigt um ein Zertifikat aus {0} zu holen +KeyResoverSpiImpl.cannotGetCert = Cannot get the Certificate that include or in {1} in implement class {0} +KeyResoverSpiImpl.elementGeneration = Cannot make {1} element in implement class {0} +KeyResoverSpiImpl.getPoublicKey = Cannot get the public key from implement class {0} +KeyResoverSpiImpl.InvalidElement = Cannot set (2) Element in implement class {0} +KeyResoverSpiImpl.keyStore = KeyStorage Fehler in der implementierenden Klasse {0} +KeyResoverSpiImpl.need.Element = Es wird der Typ {1} ben\u00f6tigt in der implementierenden Klasse {0} +KeyResoverSpiImpl.wrongCRLElement = Cannot make CRL from {1} in implement class {0} +KeyResoverSpiImpl.wrongKeyObject = Need {1} type of KeyObject for generation Element in implement class{0} +KeyResoverSpiImpl.wrongNumberOfObject = Need {1} keyObject in implement class {0} +KeyStore.alreadyRegistered = Klasse {0} bereits registriert f\u00fcr {1} +KeyStore.register = {1} type class register error in class {0} +KeyStore.registerStore.register = Registrierungsfehler f\u00fcr Typ {0} +KeyValue.IllegalArgument = Kann kein {0} aus {1} erzeugen +namespacePrefixAlreadyUsedByOtherURI = Namespace {0} wird bereits von einer anderen URI {1} gebraucht +notYetInitialized = Das Modul {0} ist noch nicht initialisiert +prefix.AlreadyAssigned = Sie binden den Prefix {0} an den Namespace {1} aber er ist bereits an {2} zugewiesen +signature.Canonicalizer.UnknownCanonicalizer = Unbekannter Kanonisierer. Kein Handler installiert f\u00fcr URI {0} +signature.DSA.invalidFormat = Ung\u00fcltige ASN.1 Kodierung der DSA Signatur +signature.Generation.signBeforeGetValue = Es muss zuerst XMLSignature.sign(java.security.PrivateKey) aufgerufen werden +signature.Reference.ForbiddenResolver = Der "Resolver" {0} ist bei aktivierter "secure validation" nicht erlaubt +signature.Reference.NoDigestMethod = A Signature Reference Element must contain a DigestMethod child +signature.Reference.NoDigestValue = A Signature Reference Element must contain a DigestValue child +signature.signatureAlgorithm = Der Algorithmus {0} ist bei aktivierter "secure validation" nicht erlaubt +signature.signaturePropertyHasNoTarget = Das Target Attribut der SignatureProperty muss gesetzt sein +signature.tooManyReferences = Das Manifest enth\u00e4lt {0} Referenzen, bei aktivierter "secure validation" sind aber maximal {1} erlaubt +signature.tooManyTransforms = Die Referenz enth\u00e4lt {0} Transformationen, bei aktivierter "secure validation" sind aber maximal {1} erlaubt +signature.Transform.ErrorDuringTransform = W\u00e4hrend der Transformation {0} trat eine {1} auf. +signature.Transform.ForbiddenTransform = Die Transformation {0} ist bei aktivierter "secure validation" nicht erlaubt +signature.Transform.NotYetImplemented = Transform {0} noch nicht implementiert +signature.Transform.NullPointerTransform = Null pointer als URI \u00fcbergeben. Programmierfehler? +signature.Transform.UnknownTransform = Unbekannte Transformation. Kein Handler installiert f\u00fcr URI {0} +signature.Util.BignumNonPositive = bigInteger.signum() muss positiv sein +signature.Util.NonTextNode = Keine Text Node +signature.Util.TooManyChilds = Zu viele Kind-Elemente vom Typ {0} in {1} +signature.Verification.certificateError = Zertifikatsfehler +signature.Verification.IndexOutOfBounds = Index {0} illegal. Es sind nur {1} Referenzen vorhanden +signature.Verification.internalError = Interner Fehler +signature.Verification.InvalidDigestOrReference = Ung\u00fcltiger Digest Wert der Referenz {0} +signature.Verification.InvalidElement = Current Node {0} is not permitted in this location in the Signature +signature.Verification.keyStore = \u00d6ffnen des KeyStore fehlgeschlagen +signature.Verification.MissingID = Element mit der ID {0} nicht gefunden +signature.Verification.MissingResources = Kann die externe Resource {0} nicht aufl\u00f6sen +signature.Verification.MultipleIDs = Mehrere Elemente mit der ID {0} gefunden +signature.Verification.NoSignatureElement = Input Dokument enth\u00e4lt kein {0} Element mit dem Namespace {1} +signature.Verification.Reference.NoInput = Die Referenz f\u00fcr den URI {0} hat keinen XMLSignatureInput erhalten. +signature.Verification.SignatureError = Signatur Fehler +signature.XMLSignatureInput.MissingConstuctor = Kann aus der Klasse {0} keinen XMLSignatureInput erzeugen +signature.XMLSignatureInput.SerializeDOM = Input mit einem DOM Dokument initialisiert. Muss mit C14N serialisiert werden +transform.Init.IllegalContextArgument = Unzul\u00e4ssiges Kontext Argument der Klasse {0}. Muss String, org.w3c.dom.NodeList oder java.io.InputStream sein. +transform.init.NotInitialized = +transform.init.wrongURI = Initialisiert mit dem falschen URI. Das sollte nie passieren. Die Transformation implementiert {0} aber {1} wurde bei der Instantiierung verwendet. +utils.Base64.IllegalBitlength = Ung\u00fcltige Byte-L\u00e4nge; Muss ein vielfaches von 4 sein +utils.resolver.noClass = Keinen Resolver f\u00fcr URI {0} und Base {1} gefunden +xml.WrongContent = Kann {0} nicht finden in {1} +xml.WrongElement = Kann kein {0} aus einem {1} Element erzeugen +xpath.funcHere.documentsDiffer = Der XPath ist nicht im selben Dokument wie der Kontext Node +xpath.funcHere.noXPathContext = Versuch einer XPath-Evaluierung welcher die Funktion here() benutzt aber der XPath ist nicht innerhalb eines ds\:XPath Elements. XPath \: {0} +signature.Transform.node = Aktuelle Node\: {0} +signature.Transform.nodeAndType = Aktuelle Node\: {0}, Typ\: {1} +signature.XMLSignatureInput.nodesetReference = Das Node-Set der Referenz konnte nicht konvertieren werden +transform.envelopedSignatureTransformNotInSignatureElement = Enveloped Transform konnte kein Signatur Element finden +Base64Decoding = Fehler bei der Decodierung +secureProcessing.MaximumAllowedTransformsPerReference = Die Referenz enth\u00e4lt {0} Transformationen. Es sind aber maximal {1} erlaubt. Die Limite kann \u00fcber das Konfigurations-Property "MaximumAllowedTransformsPerReference" erh\u00f6ht werden. +secureProcessing.MaximumAllowedReferencesPerManifest = Das Manifest enh\u00e4lt {0} Referenzen. Es sind aber maximal {1} erlaubt. Die Limite kann \u00fcber das Konfigurations-Property "MaximumAllowedReferencesPerManifest" erh\u00f6ht werden. +secureProcessing.DoNotThrowExceptionForManifests = Signatur-Manifests werden nicht unterst\u00fctzt. Das werfen dieser Exception kann durch das Konfigurations-Property "DoNotThrowExceptionForManifests" verhindert werden. +secureProcessing.AllowMD5Algorithm = Vom Einsatz des MD5 Algorithmus wird strengstens abgeraten. Trotzdem kann er \u00fcber das Konfigurations-Property "AllowMD5Algorithm" erlaubt werden. +secureProcessing.AllowNotSameDocumentReferences = Externe Referenzen gefunden. Die Verarbeitung von externen Referenzen ist standardm\u00e4ssig ausgeschaltet. Es kann \u00fcber das Konfigurations-Property "AllowNotSameDocumentReferences" aktiviert werden. +secureProcessing.MaximumAllowedXMLStructureDepth = Die Maximum erlaubte Dokumenten-Tiefe von ({0}) wurde erreicht. Die Limite kann \u00fcber das Konfigurations-Property "MaximumAllowedXMLStructureDepth" erh\u00f6ht werden. +secureProcessing.inputStreamLimitReached = Maximal erlaubte Anzahl bytes ({0}) erreicht. +stax.duplicateActions=Doppelte Actions sind nicht erlaubt. +stax.missingSecurityProperties = SecurityProperties darf nicht null sein\! +stax.noOutputAction = Keine ausgehenden "Actions" definiert. +stax.noKey = Kein Schl\u00fcssel geladen und es konnte kein Schl\u00fcssel gefunden werden f\u00fcr {0} +stax.keyNotFound = Schl\u00fcssel nicht gefunden. +stax.unsupportedKeyValue = Kein oder ung\u00fcltiger KeyValue. +stax.emptyReferenceURI = Referenz enth\u00e4lt kein URI Attribut. +stax.encryption.unprocessedReferences = Es wurden nicht alle Verschl\u00fcsselungs-Referenzen verarbeitet... +stax.signature.unprocessedReferences = Es wurden nicht alle Signatur-Referenzen verarbeitet... +stax.unsupportedToken = {0} nicht unterst\u00fctzt. +stax.xmlStructureSizeExceeded = Maximal erlaubte ({0}) XML-Struktur Tiefe erreicht. +stax.unexpectedXMLEvent = Unerwarteter StAX-Event\: {0} +stax.encryption.noEncAlgo = xenc\:EncryptedKey enth\u00e4lt kein xenc\:EncryptionMethod/@Algorithm. +stax.encryption.noCipherValue = EncryptedKey enth\u00e4lt kein xenc\:CipherData/xenc\:CipherValue. +stax.unsecuredMessage = Ungesicherte Nachricht. Weder ein Signatur- noch ein EncryptedData- Element wurde gefunden. +stax.signature.signedInfoMissing = SignedInfo Element fehlt. +stax.signature.signatureMethodMissing = Signature method fehlt. +stax.signature.canonicalizationMethodMissing = Signature canonicalization method fehlt. +stax.signature.signatureValueMissing = Signature value fehlt. +stax.signature.publicKeyOrCertificateMissing = Weder ein Zertifikat noch ein public-key wurde konfiguriert. +stax.encryption.encryptionKeyMissing = Kein Schl\u00fcssel f\u00fcr die Verschl\u00fcsselung wurde konfiguriert. +stax.unsupportedKeyTransp = Der public-key Algorithmus ist zu kurz um den symmetrischen Schl\u00fcssel zu verschl\u00fcsseln. +stax.recursiveKeyReference = Rekursive Schl\u00fcssel referenzierung detektiert. +stax.ecParametersNotSupported = ECParameters werden nicht unterst\u00fctzt. +stax.namedCurveMissing = NamedCurve fehlt. +stax.encryption.securePartNotFound = Part zum Verschl\u00fcsseln nicht gefunden: {0} +stax.signature.securePartNotFound = Part zum Signieren nicht gefunden: {0} +stax.multipleSignaturesNotSupported = Mehrere Signaturen werden nicht unterstützt. +stax.signature.keyNameMissing = KeyName nicht konfiguriert. +stax.keyNotFoundForName = Kein Schl\u00fcssel für Schl\u00fcsselname konfiguriert: {0} +stax.keyTypeNotSupported = Key vom Typ {0} nicht f\u00fcr einen Key-Namenssuche unterst\u00fctzt +stax.idsetbutnotgenerated = An Id attribute is specified, but Id generation is disabled stax.idgenerationdisablewithmultipleparts = Id generation must not be disabled when multiple parts need signing \ No newline at end of file diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties index 054372004be..db9c2d54463 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties @@ -1,200 +1,200 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# - -algorithm.alreadyRegistered = URI {0} already assigned to class {1} -algorithm.classDoesNotExist = Cannot register URI {0} to class {1} because this class does not exist in CLASSPATH -algorithm.ClassDoesNotExist = Class {0} does not exist -algorithm.extendsWrongClass = Cannot register URI {0} to class {1} because it does not extend {2} -algorithms.CannotUseAlgorithmParameterSpecOnDSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating DSA signatures. -algorithms.CannotUseAlgorithmParameterSpecOnRSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating RSA signatures. -algorithms.CannotUseSecureRandomOnMAC = Sorry, but you cannot use a SecureRandom object for creating MACs. -algorithms.HMACOutputLengthMax = HMACOutputLength must not be more than {0} -algorithms.HMACOutputLengthMin = HMACOutputLength must not be less than {0} -algorithms.HMACOutputLengthOnlyForHMAC = A HMACOutputLength can only be specified for HMAC integrity algorithms -algorithms.MissingRSAPSSParams = RSAPSSParams is a required Element for http://www.w3.org/2007/05/xmldsig-more#rsa-pss -algorithms.NoSuchAlgorithmNoEx = The requested algorithm {0} does not exist. -algorithms.NoSuchAlgorithm = The requested algorithm {0} does not exist. Original Message was: {1} -algorithms.NoSuchMap = The algorithm URI "{0}" could not be mapped to a JCE algorithm -algorithms.NoSuchProvider = The specified Provider {0} does not exist. Original Message was: {1} -algorithms.operationOnlyVerification = A public key can only used for verification of a signature. -algorithms.WrongKeyForThisOperation = Sorry, you supplied the wrong key type for this operation! You supplied a {0} but a {1} is needed. -attributeValueIllegal = The attribute {0} has value {1} but must be {2} -c14n.Canonicalizer.Exception = Exception during Canonicalization: Original Message was {0} -c14n.Canonicalizer.IllegalNode = Illegal node type {0}, node name was {1} -c14n.Canonicalizer.NoSuchCanonicalizer = No canonicalizer found with URI {0} -c14n.Canonicalizer.ParserConfigurationException = ParserConfigurationException during Canonicalization: Original Message was {0} -c14n.Canonicalizer.RelativeNamespace = Element {0} has a relative namespace: {1}="{2}" -c14n.Canonicalizer.SAXException = SAXException during Canonicalization: Original Message was {0} -c14n.Canonicalizer.TraversalNotSupported = This DOM document does not support Traversal {0} -c14n.Canonicalizer.UnsupportedEncoding = Unsupported encoding {0} -c14n.Canonicalizer.UnsupportedOperation = This canonicalizer does not support this operation -c14n.XMLUtils.circumventBug2650forgotten = The tree has not been prepared for canonicalization using XMLUtils#circumventBug2650(Document) -certificate.noSki.lowVersion = Certificate cannot contain a SubjectKeyIdentifier because it is only X509v{0} -certificate.noSki.notOctetString = Certificates SubjectKeyIdentifier is not a OctetString -certificate.noSki.null = Certificate does not contain a SubjectKeyIdentifier -defaultNamespaceCannotBeSetHere = Default namespace cannot be set here -ElementProxy.nullElement = Cannot create an ElementProxy from a null argument -empty = {0} -encryption.algorithmCannotBeUsedForEncryptedData = encryption.algorithmCannotBeUsedForEncryptedData {0} -encryption.algorithmCannotEatInitParams = encryption.algorithmCannotEatInitParams -encryption.algorithmCannotEncryptDecrypt = encryption.algorithmCannotEncryptDecrypt -encryption.algorithmCannotWrapUnWrap = encryption.algorithmCannotWrapUnWrap -encryption.ExplicitKeySizeMismatch = The xenc:KeySize element requests a key size of {0} bit but the algorithm implements {1} bit -encryption.nonceLongerThanDecryptedPlaintext = The given nonce is longer than the available plaintext. I Cannot strip away this. -encryption.RSAOAEP.dataHashWrong = data hash wrong -encryption.RSAOAEP.dataStartWrong = data wrong start {0} -encryption.RSAOAEP.dataTooShort = data too short -encryption.RSAPKCS15.blockTruncated = block truncated -encryption.RSAPKCS15.noDataInBlock = no data in block -encryption.RSAPKCS15.unknownBlockType = unknown block type -encryption.nokey = No Key Encryption Key loaded and cannot determine using key resolvers -endorsed.jdk1.4.0 = Since it seems that nobody reads our installation notes, we must do it in the exception messages. Hope you read them. You did NOT use the endorsed mechanism from JDK 1.4 properly; look at how to solve this problem. -errorMessages.InvalidDigestValueException = INVALID signature -- check reference resolution. -errorMessages.InvalidSignatureValueException = INVALID signature -- core validation failed. -errorMessages.IOException = Other file I/O and similar exceptions. -errorMessages.MissingKeyFailureException = Cannot verify because of missing public key. Provide it via addResource and try again. -errorMessages.MissingResourceFailureException = Cannot verify because of unresolved references. Provide it via addResource and try again. -errorMessages.NoSuchAlgorithmException = Unknown Algorithm {0} -errorMessages.NotYetImplementedException = Functionality not yet there. -errorMessages.XMLSignatureException = Verification failed for some other reason. -decoding.divisible.four = It should be divisible by four -decoding.general = Error while decoding -FileKeyStorageImpl.addToDefaultFromRemoteNotImplemented = Method addToDefaultFromRemote() not yet implemented. -FileKeyStorageImpl.NoCert.Context = Not found such a X509Certificate including context {0} -FileKeyStorageImpl.NoCert.IssNameSerNo = Not found such a X509Certificate with IssuerName {0} and serial number {1} -FileKeyStorageImpl.NoCert.SubjName = Not found such a X509Certificate including SubjectName {0} -generic.dontHaveConstructionElement = I do not have a construction Element -generic.EmptyMessage = {0} -generic.NotYetImplemented = {0} Not YET implemented ;-(( -java.security.InvalidKeyException = Invalid key -java.security.NoSuchProviderException = Unknown or unsupported provider -java.security.UnknownKeyType = Unknown or unsupported key type {0} -KeyInfo.error = Error loading Key Info -KeyInfo.needKeyResolver = More than one keyResolver have to be registered -KeyInfo.nokey = Cannot get key from {0} -KeyInfo.noKey = Cannot get the public key -KeyInfo.wrongNumberOfObject = Need {0} keyObjects -KeyInfo.wrongUse = This object was made for getting {0} -keyResolver.alreadyRegistered = {1} class has already been registered for {0} -KeyResolver.needStorageResolver = Need a StorageResolver to retrieve a Certificate from a {0} -KeyResoverSpiImpl.cannotGetCert = Cannot get the Certificate that include or in {1} in implement class {0} -KeyResoverSpiImpl.elementGeneration = Cannot make {1} element in implement class {0} -KeyResoverSpiImpl.getPoublicKey = Cannot get the public key from implement class {0} -KeyResoverSpiImpl.InvalidElement = Cannot set (2) Element in implement class {0} -KeyResoverSpiImpl.keyStore = KeyStorage error in implement class {0} -KeyResoverSpiImpl.need.Element = {1} type of Element is needed in implement class {0} -KeyResoverSpiImpl.wrongCRLElement = Cannot make CRL from {1} in implement class {0} -KeyResoverSpiImpl.wrongKeyObject = Need {1} type of KeyObject for generation Element in implement class{0} -KeyResoverSpiImpl.wrongNumberOfObject = Need {1} keyObject in implement class {0} -KeyStore.alreadyRegistered = {0} Class has already been registered for {1} -KeyStore.register = {1} type class register error in class {0} -KeyStore.registerStore.register = Registration error for type {0} -KeyValue.IllegalArgument = Cannot create a {0} from {1} -namespacePrefixAlreadyUsedByOtherURI = Namespace prefix {0} already used by other URI {1} -notYetInitialized = The module {0} is not yet initialized -prefix.AlreadyAssigned = You want to assign {0} as prefix for namespace {1} but it is already assigned for {2} -signature.Canonicalizer.UnknownCanonicalizer = Unknown canonicalizer. No handler installed for URI {0} -signature.DSA.invalidFormat = Invalid ASN.1 encoding of the DSA signature -signature.Generation.signBeforeGetValue = You have to XMLSignature.sign(java.security.PrivateKey) first -signature.Reference.ForbiddenResolver = It is forbidden to access resolver {0} when secure validation is enabled -signature.Reference.NoDigestMethod = A Signature Reference Element must contain a DigestMethod child -signature.Reference.NoDigestValue = A Signature Reference Element must contain a DigestValue child -signature.signatureAlgorithm = It is forbidden to use algorithm {0} when secure validation is enabled -signature.signaturePropertyHasNoTarget = The Target attribute of the SignatureProperty must be set -signature.tooManyReferences = {0} references are contained in the Manifest, maximum {1} are allowed with secure validation -signature.tooManyTransforms = {0} transforms are contained in the Reference, maximum {1} are allowed with secure validation -signature.Transform.ErrorDuringTransform = A {1} was thrown during the {0} transform -signature.Transform.ForbiddenTransform = Transform {0} is forbidden when secure validation is enabled -signature.Transform.NotYetImplemented = Transform {0} not yet implemented -signature.Transform.NullPointerTransform = Null pointer as URI. Programming bug? -signature.Transform.UnknownTransform = Unknown transformation. No handler installed for URI {0} -signature.Transform.XPathError = Error evaluating XPath expression -signature.Transform.node = Current Node: {0} -signature.Transform.nodeAndType = Current Node: {0}, type: {1} -signature.Util.BignumNonPositive = bigInteger.signum() must be positive -signature.Util.NonTextNode = Not a text node -signature.Util.TooManyChilds = Too many childs of Type {0} in {1} -signature.Verification.certificateError = Certificate error -signature.Verification.IndexOutOfBounds = Index {0} illegal. We only have {1} References -signature.Verification.internalError = Internal error -signature.Verification.InvalidDigestOrReference = Invalid digest of reference {0} -signature.Verification.InvalidElement = Current Node {0} is not permitted in this location in the Signature -signature.Verification.keyStore = KeyStore error -signature.Verification.MissingID = Cannot resolve element with ID {0} -signature.Verification.MissingResources = Cannot resolve external resource {0} -signature.Verification.MultipleIDs = Multiple Elements with the same ID {0} were detected -signature.Verification.NoSignatureElement = Input document contains no {0} Element in namespace {1} -signature.Verification.Reference.NoInput = The Reference for URI {0} has no XMLSignatureInput -signature.Verification.SignatureError = Signature error -signature.XMLSignatureInput.MissingConstuctor = Cannot construct a XMLSignatureInput from class {0} -signature.XMLSignatureInput.SerializeDOM = Input initialized with DOM Element. Use Canonicalization to serialize it -signature.XMLSignatureInput.nodesetReference = Unable to convert to nodeset the reference -transform.Init.IllegalContextArgument = Invalid context argument of class {0}. Must be String, org.w3c.dom.NodeList or java.io.InputStream. -transform.init.NotInitialized = -transform.init.wrongURI = Initialized with wrong URI. How could this happen? We implement {0} but {1} was used during initialization -transform.envelopedSignatureTransformNotInSignatureElement = Enveloped Transform cannot find Signature element -utils.Base64.IllegalBitlength = Illegal byte length; Data to be decoded must be a multiple of 4 -Base64Decoding = Error while decoding -utils.resolver.noClass = Could not find a resolver for URI {0} and Base {1} -xml.WrongContent = Cannot find {0} in {1} -xml.WrongElement = Cannot create a {0} from a {1} element -xpath.funcHere.documentsDiffer = The XPath is not in the same document as the context node -xpath.funcHere.noXPathContext = Try to evaluate an XPath which uses the here() function but XPath is not inside an ds:XPath Element. XPath was : {0} -secureProcessing.MaximumAllowedTransformsPerReference = {0} transforms are contained in the Reference, maximum {1} are allowed. You can raise the maximum via the \"MaximumAllowedTransformsPerReference\" property in the configuration. -secureProcessing.MaximumAllowedReferencesPerManifest = {0} references are contained in the Manifest, maximum {1} are allowed. You can raise the maximum via the \"MaximumAllowedReferencesPerManifest\" property in the configuration. -secureProcessing.DoNotThrowExceptionForManifests = Signature Manifests are not supported. You can disable throwing of an exception via the \"DoNotThrowExceptionForManifests\" property in the configuration. -secureProcessing.AllowMD5Algorithm = The use of MD5 algorithm is strongly discouraged. Nonetheless can it be enabled via the \"AllowMD5Algorithm\" property in the configuration. -secureProcessing.AllowNotSameDocumentReferences = External references found. Processing of external references is disabled by default. You can enable it via the \"AllowNotSameDocumentReferences\" property in the configuration. -secureProcessing.MaximumAllowedXMLStructureDepth = Maximum depth ({0}) of the XML structure reached. You can raise the maximum via the \"MaximumAllowedXMLStructureDepth\" property in the configuration. -secureProcessing.inputStreamLimitReached = Maximum byte count ({0}) reached. -stax.duplicateActions = Duplicate Actions are not allowed. -stax.missingSecurityProperties = SecurityProperties must not be null! -stax.noOutputAction = No outgoing actions specified. -stax.noKey = Key could not be resolved and no key was loaded for {0} -stax.keyNotFound = Key not found. -stax.unsupportedKeyValue = No or unsupported key in KeyValue. -stax.emptyReferenceURI = Reference is missing an URI attribute. -stax.encryption.unprocessedReferences = Some encryption references were not processed... -stax.signature.unprocessedReferences = Some signature references were not processed... -stax.unsupportedToken = {0} not supported. -stax.xmlStructureSizeExceeded = Maximum ({0}) allowed XML Structure size exceeded. -stax.unexpectedXMLEvent = Unexpected StAX-Event\: {0} -stax.encryption.noEncAlgo = xenc:EncryptedKey does not contain xenc:EncryptionMethod/@Algorithm. -stax.encryption.noCipherValue = EncryptedKey does not contain xenc:CipherData/xenc:CipherValue. -stax.unsecuredMessage = Unsecured message. Neither a Signature nor a EncryptedData element found. -stax.signature.signedInfoMissing = SignedInfo Element is missing. -stax.signature.signatureMethodMissing = Signature method is missing. -stax.signature.canonicalizationMethodMissing = Signature canonicalization method is missing. -stax.signature.signatureValueMissing = Signature value is missing. -stax.signature.publicKeyOrCertificateMissing = Certificate or public key not configured. -stax.encryption.encryptionKeyMissing = Key for encryption not configured. -stax.unsupportedKeyTransp = public key algorithm too weak to encrypt symmetric key. -stax.recursiveKeyReference = Recursive key reference detected. -stax.ecParametersNotSupported = ECParameters not supported. -stax.namedCurveMissing = NamedCurve is missing. -stax.encryption.securePartNotFound = Part to encrypt not found: {0} -stax.signature.securePartNotFound = Part to sign not found: {0} -stax.multipleSignaturesNotSupported = Multiple signatures are not supported. -stax.signature.keyNameMissing = KeyName not configured. -stax.keyNotFoundForName = No key configured for KeyName: {0} -stax.keyTypeNotSupported = Key of type {0} not supported for a KeyName lookup -stax.idsetbutnotgenerated = An Id attribute is specified, but Id generation is disabled -stax.idgenerationdisablewithmultipleparts = Id generation must not be disabled when multiple parts need signing +# +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# + +algorithm.alreadyRegistered = URI {0} already assigned to class {1} +algorithm.classDoesNotExist = Cannot register URI {0} to class {1} because this class does not exist in CLASSPATH +algorithm.ClassDoesNotExist = Class {0} does not exist +algorithm.extendsWrongClass = Cannot register URI {0} to class {1} because it does not extend {2} +algorithms.CannotUseAlgorithmParameterSpecOnDSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating DSA signatures. +algorithms.CannotUseAlgorithmParameterSpecOnRSA = Sorry, but you cannot use a AlgorithmParameterSpec object for creating RSA signatures. +algorithms.CannotUseSecureRandomOnMAC = Sorry, but you cannot use a SecureRandom object for creating MACs. +algorithms.HMACOutputLengthMax = HMACOutputLength must not be more than {0} +algorithms.HMACOutputLengthMin = HMACOutputLength must not be less than {0} +algorithms.HMACOutputLengthOnlyForHMAC = A HMACOutputLength can only be specified for HMAC integrity algorithms +algorithms.MissingRSAPSSParams = RSAPSSParams is a required Element for http://www.w3.org/2007/05/xmldsig-more#rsa-pss +algorithms.NoSuchAlgorithmNoEx = The requested algorithm {0} does not exist. +algorithms.NoSuchAlgorithm = The requested algorithm {0} does not exist. Original Message was: {1} +algorithms.NoSuchMap = The algorithm URI "{0}" could not be mapped to a JCE algorithm +algorithms.NoSuchProvider = The specified Provider {0} does not exist. Original Message was: {1} +algorithms.operationOnlyVerification = A public key can only used for verification of a signature. +algorithms.WrongKeyForThisOperation = Sorry, you supplied the wrong key type for this operation! You supplied a {0} but a {1} is needed. +attributeValueIllegal = The attribute {0} has value {1} but must be {2} +c14n.Canonicalizer.Exception = Exception during Canonicalization: Original Message was {0} +c14n.Canonicalizer.IllegalNode = Illegal node type {0}, node name was {1} +c14n.Canonicalizer.NoSuchCanonicalizer = No canonicalizer found with URI {0} +c14n.Canonicalizer.ParserConfigurationException = ParserConfigurationException during Canonicalization: Original Message was {0} +c14n.Canonicalizer.RelativeNamespace = Element {0} has a relative namespace: {1}="{2}" +c14n.Canonicalizer.SAXException = SAXException during Canonicalization: Original Message was {0} +c14n.Canonicalizer.TraversalNotSupported = This DOM document does not support Traversal {0} +c14n.Canonicalizer.UnsupportedEncoding = Unsupported encoding {0} +c14n.Canonicalizer.UnsupportedOperation = This canonicalizer does not support this operation +c14n.XMLUtils.circumventBug2650forgotten = The tree has not been prepared for canonicalization using XMLUtils#circumventBug2650(Document) +certificate.noSki.lowVersion = Certificate cannot contain a SubjectKeyIdentifier because it is only X509v{0} +certificate.noSki.notOctetString = Certificates SubjectKeyIdentifier is not a OctetString +certificate.noSki.null = Certificate does not contain a SubjectKeyIdentifier +defaultNamespaceCannotBeSetHere = Default namespace cannot be set here +ElementProxy.nullElement = Cannot create an ElementProxy from a null argument +empty = {0} +encryption.algorithmCannotBeUsedForEncryptedData = encryption.algorithmCannotBeUsedForEncryptedData {0} +encryption.algorithmCannotEatInitParams = encryption.algorithmCannotEatInitParams +encryption.algorithmCannotEncryptDecrypt = encryption.algorithmCannotEncryptDecrypt +encryption.algorithmCannotWrapUnWrap = encryption.algorithmCannotWrapUnWrap +encryption.ExplicitKeySizeMismatch = The xenc:KeySize element requests a key size of {0} bit but the algorithm implements {1} bit +encryption.nonceLongerThanDecryptedPlaintext = The given nonce is longer than the available plaintext. I Cannot strip away this. +encryption.RSAOAEP.dataHashWrong = data hash wrong +encryption.RSAOAEP.dataStartWrong = data wrong start {0} +encryption.RSAOAEP.dataTooShort = data too short +encryption.RSAPKCS15.blockTruncated = block truncated +encryption.RSAPKCS15.noDataInBlock = no data in block +encryption.RSAPKCS15.unknownBlockType = unknown block type +encryption.nokey = No Key Encryption Key loaded and cannot determine using key resolvers +endorsed.jdk1.4.0 = Since it seems that nobody reads our installation notes, we must do it in the exception messages. Hope you read them. You did NOT use the endorsed mechanism from JDK 1.4 properly; look at how to solve this problem. +errorMessages.InvalidDigestValueException = INVALID signature -- check reference resolution. +errorMessages.InvalidSignatureValueException = INVALID signature -- core validation failed. +errorMessages.IOException = Other file I/O and similar exceptions. +errorMessages.MissingKeyFailureException = Cannot verify because of missing public key. Provide it via addResource and try again. +errorMessages.MissingResourceFailureException = Cannot verify because of unresolved references. Provide it via addResource and try again. +errorMessages.NoSuchAlgorithmException = Unknown Algorithm {0} +errorMessages.NotYetImplementedException = Functionality not yet there. +errorMessages.XMLSignatureException = Verification failed for some other reason. +decoding.divisible.four = It should be divisible by four +decoding.general = Error while decoding +FileKeyStorageImpl.addToDefaultFromRemoteNotImplemented = Method addToDefaultFromRemote() not yet implemented. +FileKeyStorageImpl.NoCert.Context = Not found such a X509Certificate including context {0} +FileKeyStorageImpl.NoCert.IssNameSerNo = Not found such a X509Certificate with IssuerName {0} and serial number {1} +FileKeyStorageImpl.NoCert.SubjName = Not found such a X509Certificate including SubjectName {0} +generic.dontHaveConstructionElement = I do not have a construction Element +generic.EmptyMessage = {0} +generic.NotYetImplemented = {0} Not YET implemented ;-(( +java.security.InvalidKeyException = Invalid key +java.security.NoSuchProviderException = Unknown or unsupported provider +java.security.UnknownKeyType = Unknown or unsupported key type {0} +KeyInfo.error = Error loading Key Info +KeyInfo.needKeyResolver = More than one keyResolver have to be registered +KeyInfo.nokey = Cannot get key from {0} +KeyInfo.noKey = Cannot get the public key +KeyInfo.wrongNumberOfObject = Need {0} keyObjects +KeyInfo.wrongUse = This object was made for getting {0} +keyResolver.alreadyRegistered = {1} class has already been registered for {0} +KeyResolver.needStorageResolver = Need a StorageResolver to retrieve a Certificate from a {0} +KeyResoverSpiImpl.cannotGetCert = Cannot get the Certificate that include or in {1} in implement class {0} +KeyResoverSpiImpl.elementGeneration = Cannot make {1} element in implement class {0} +KeyResoverSpiImpl.getPoublicKey = Cannot get the public key from implement class {0} +KeyResoverSpiImpl.InvalidElement = Cannot set (2) Element in implement class {0} +KeyResoverSpiImpl.keyStore = KeyStorage error in implement class {0} +KeyResoverSpiImpl.need.Element = {1} type of Element is needed in implement class {0} +KeyResoverSpiImpl.wrongCRLElement = Cannot make CRL from {1} in implement class {0} +KeyResoverSpiImpl.wrongKeyObject = Need {1} type of KeyObject for generation Element in implement class{0} +KeyResoverSpiImpl.wrongNumberOfObject = Need {1} keyObject in implement class {0} +KeyStore.alreadyRegistered = {0} Class has already been registered for {1} +KeyStore.register = {1} type class register error in class {0} +KeyStore.registerStore.register = Registration error for type {0} +KeyValue.IllegalArgument = Cannot create a {0} from {1} +namespacePrefixAlreadyUsedByOtherURI = Namespace prefix {0} already used by other URI {1} +notYetInitialized = The module {0} is not yet initialized +prefix.AlreadyAssigned = You want to assign {0} as prefix for namespace {1} but it is already assigned for {2} +signature.Canonicalizer.UnknownCanonicalizer = Unknown canonicalizer. No handler installed for URI {0} +signature.DSA.invalidFormat = Invalid ASN.1 encoding of the DSA signature +signature.Generation.signBeforeGetValue = You have to XMLSignature.sign(java.security.PrivateKey) first +signature.Reference.ForbiddenResolver = It is forbidden to access resolver {0} when secure validation is enabled +signature.Reference.NoDigestMethod = A Signature Reference Element must contain a DigestMethod child +signature.Reference.NoDigestValue = A Signature Reference Element must contain a DigestValue child +signature.signatureAlgorithm = It is forbidden to use algorithm {0} when secure validation is enabled +signature.signaturePropertyHasNoTarget = The Target attribute of the SignatureProperty must be set +signature.tooManyReferences = {0} references are contained in the Manifest, maximum {1} are allowed with secure validation +signature.tooManyTransforms = {0} transforms are contained in the Reference, maximum {1} are allowed with secure validation +signature.Transform.ErrorDuringTransform = A {1} was thrown during the {0} transform +signature.Transform.ForbiddenTransform = Transform {0} is forbidden when secure validation is enabled +signature.Transform.NotYetImplemented = Transform {0} not yet implemented +signature.Transform.NullPointerTransform = Null pointer as URI. Programming bug? +signature.Transform.UnknownTransform = Unknown transformation. No handler installed for URI {0} +signature.Transform.XPathError = Error evaluating XPath expression +signature.Transform.node = Current Node: {0} +signature.Transform.nodeAndType = Current Node: {0}, type: {1} +signature.Util.BignumNonPositive = bigInteger.signum() must be positive +signature.Util.NonTextNode = Not a text node +signature.Util.TooManyChilds = Too many childs of Type {0} in {1} +signature.Verification.certificateError = Certificate error +signature.Verification.IndexOutOfBounds = Index {0} illegal. We only have {1} References +signature.Verification.internalError = Internal error +signature.Verification.InvalidDigestOrReference = Invalid digest of reference {0} +signature.Verification.InvalidElement = Current Node {0} is not permitted in this location in the Signature +signature.Verification.keyStore = KeyStore error +signature.Verification.MissingID = Cannot resolve element with ID {0} +signature.Verification.MissingResources = Cannot resolve external resource {0} +signature.Verification.MultipleIDs = Multiple Elements with the same ID {0} were detected +signature.Verification.NoSignatureElement = Input document contains no {0} Element in namespace {1} +signature.Verification.Reference.NoInput = The Reference for URI {0} has no XMLSignatureInput +signature.Verification.SignatureError = Signature error +signature.XMLSignatureInput.MissingConstuctor = Cannot construct a XMLSignatureInput from class {0} +signature.XMLSignatureInput.SerializeDOM = Input initialized with DOM Element. Use Canonicalization to serialize it +signature.XMLSignatureInput.nodesetReference = Unable to convert to nodeset the reference +transform.Init.IllegalContextArgument = Invalid context argument of class {0}. Must be String, org.w3c.dom.NodeList or java.io.InputStream. +transform.init.NotInitialized = +transform.init.wrongURI = Initialized with wrong URI. How could this happen? We implement {0} but {1} was used during initialization +transform.envelopedSignatureTransformNotInSignatureElement = Enveloped Transform cannot find Signature element +utils.Base64.IllegalBitlength = Illegal byte length; Data to be decoded must be a multiple of 4 +Base64Decoding = Error while decoding +utils.resolver.noClass = Could not find a resolver for URI {0} and Base {1} +xml.WrongContent = Cannot find {0} in {1} +xml.WrongElement = Cannot create a {0} from a {1} element +xpath.funcHere.documentsDiffer = The XPath is not in the same document as the context node +xpath.funcHere.noXPathContext = Try to evaluate an XPath which uses the here() function but XPath is not inside an ds:XPath Element. XPath was : {0} +secureProcessing.MaximumAllowedTransformsPerReference = {0} transforms are contained in the Reference, maximum {1} are allowed. You can raise the maximum via the \"MaximumAllowedTransformsPerReference\" property in the configuration. +secureProcessing.MaximumAllowedReferencesPerManifest = {0} references are contained in the Manifest, maximum {1} are allowed. You can raise the maximum via the \"MaximumAllowedReferencesPerManifest\" property in the configuration. +secureProcessing.DoNotThrowExceptionForManifests = Signature Manifests are not supported. You can disable throwing of an exception via the \"DoNotThrowExceptionForManifests\" property in the configuration. +secureProcessing.AllowMD5Algorithm = The use of MD5 algorithm is strongly discouraged. Nonetheless can it be enabled via the \"AllowMD5Algorithm\" property in the configuration. +secureProcessing.AllowNotSameDocumentReferences = External references found. Processing of external references is disabled by default. You can enable it via the \"AllowNotSameDocumentReferences\" property in the configuration. +secureProcessing.MaximumAllowedXMLStructureDepth = Maximum depth ({0}) of the XML structure reached. You can raise the maximum via the \"MaximumAllowedXMLStructureDepth\" property in the configuration. +secureProcessing.inputStreamLimitReached = Maximum byte count ({0}) reached. +stax.duplicateActions = Duplicate Actions are not allowed. +stax.missingSecurityProperties = SecurityProperties must not be null! +stax.noOutputAction = No outgoing actions specified. +stax.noKey = Key could not be resolved and no key was loaded for {0} +stax.keyNotFound = Key not found. +stax.unsupportedKeyValue = No or unsupported key in KeyValue. +stax.emptyReferenceURI = Reference is missing an URI attribute. +stax.encryption.unprocessedReferences = Some encryption references were not processed... +stax.signature.unprocessedReferences = Some signature references were not processed... +stax.unsupportedToken = {0} not supported. +stax.xmlStructureSizeExceeded = Maximum ({0}) allowed XML Structure size exceeded. +stax.unexpectedXMLEvent = Unexpected StAX-Event\: {0} +stax.encryption.noEncAlgo = xenc:EncryptedKey does not contain xenc:EncryptionMethod/@Algorithm. +stax.encryption.noCipherValue = EncryptedKey does not contain xenc:CipherData/xenc:CipherValue. +stax.unsecuredMessage = Unsecured message. Neither a Signature nor a EncryptedData element found. +stax.signature.signedInfoMissing = SignedInfo Element is missing. +stax.signature.signatureMethodMissing = Signature method is missing. +stax.signature.canonicalizationMethodMissing = Signature canonicalization method is missing. +stax.signature.signatureValueMissing = Signature value is missing. +stax.signature.publicKeyOrCertificateMissing = Certificate or public key not configured. +stax.encryption.encryptionKeyMissing = Key for encryption not configured. +stax.unsupportedKeyTransp = public key algorithm too weak to encrypt symmetric key. +stax.recursiveKeyReference = Recursive key reference detected. +stax.ecParametersNotSupported = ECParameters not supported. +stax.namedCurveMissing = NamedCurve is missing. +stax.encryption.securePartNotFound = Part to encrypt not found: {0} +stax.signature.securePartNotFound = Part to sign not found: {0} +stax.multipleSignaturesNotSupported = Multiple signatures are not supported. +stax.signature.keyNameMissing = KeyName not configured. +stax.keyNotFoundForName = No key configured for KeyName: {0} +stax.keyTypeNotSupported = Key of type {0} not supported for a KeyName lookup +stax.idsetbutnotgenerated = An Id attribute is specified, but Id generation is disabled +stax.idgenerationdisablewithmultipleparts = Id generation must not be disabled when multiple parts need signing From 859adadf0baf31f75d682dde8d5e9e1bce84dbf6 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 28 Apr 2023 18:17:24 +0000 Subject: [PATCH 012/459] 8307079: Update test java/awt/Choice/DragOffNoSelect.java Reviewed-by: azvegint, serb --- test/jdk/java/awt/Choice/DragOffNoSelectTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/jdk/java/awt/Choice/DragOffNoSelectTest.java b/test/jdk/java/awt/Choice/DragOffNoSelectTest.java index 587fc701e93..a3b808dbcf8 100644 --- a/test/jdk/java/awt/Choice/DragOffNoSelectTest.java +++ b/test/jdk/java/awt/Choice/DragOffNoSelectTest.java @@ -71,7 +71,7 @@ static void createUI() { } frame.add(theChoice); frame.addWindowListener(testInstance); - frame.setSize(400, 400); + frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); From e20269a7fd2793cd109fc77c1fa89a93cfaf4909 Mon Sep 17 00:00:00 2001 From: Alexander Zuev Date: Fri, 28 Apr 2023 18:46:48 +0000 Subject: [PATCH 013/459] 8307078: Opensource and clean up five more AWT Focus related tests Reviewed-by: serb, prr --- .../Focus/FocusForRemovedComponentTest.java | 154 +++++++ .../awt/Focus/FocusTraversalPolicyIAE.java | 73 +++ test/jdk/java/awt/Focus/InitialFocusTest.java | 144 ++++++ .../java/awt/Focus/LabelScrollBarFocus.java | 180 ++++++++ .../Focus/ModalDialogInFocusEventTest.java | 414 ++++++++++++++++++ 5 files changed, 965 insertions(+) create mode 100644 test/jdk/java/awt/Focus/FocusForRemovedComponentTest.java create mode 100644 test/jdk/java/awt/Focus/FocusTraversalPolicyIAE.java create mode 100644 test/jdk/java/awt/Focus/InitialFocusTest.java create mode 100644 test/jdk/java/awt/Focus/LabelScrollBarFocus.java create mode 100644 test/jdk/java/awt/Focus/ModalDialogInFocusEventTest.java diff --git a/test/jdk/java/awt/Focus/FocusForRemovedComponentTest.java b/test/jdk/java/awt/Focus/FocusForRemovedComponentTest.java new file mode 100644 index 00000000000..c53db9c20d6 --- /dev/null +++ b/test/jdk/java/awt/Focus/FocusForRemovedComponentTest.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2004, 2023, 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 4722671 + @summary Accessibility problem in JRE Finder + @key headful + @run main FocusForRemovedComponentTest +*/ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.InputEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.atomic.AtomicBoolean; + +public class FocusForRemovedComponentTest + implements ActionListener { + static int ACTIVATION_TIMEOUT = 2000; + static long WAIT_TIMEOUT = 3000; + volatile Frame frame; + volatile Button btnFirst; + volatile Button btnSecond; + volatile Button btnThird; + + public void start() throws InterruptedException, InvocationTargetException { + try { + EventQueue.invokeAndWait(() -> { + frame = new Frame("FocusForRemovedComponentTest"); + btnFirst = new Button("First Button"); + btnSecond = new Button("Second Button"); + btnThird = new Button("Third Button"); + frame.add(btnFirst, BorderLayout.NORTH); + frame.add(btnSecond, BorderLayout.CENTER); + btnFirst.addActionListener(this); + btnFirst.requestFocusInWindow(); + frame.pack(); + frame.setVisible(true); + }); + + try { + Robot robot = new Robot(); + robot.delay(ACTIVATION_TIMEOUT); + int[] location = new int[2]; + EventQueue.invokeAndWait(() -> { + Point button_location = btnFirst.getLocationOnScreen(); + Dimension button_size = btnFirst.getSize(); + location[0] = button_location.x + button_size.width / 2; + location[1] = button_location.y + button_size.height / 2; + }); + robot.mouseMove(location[0], location[1]); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + Object monitor = new Object(); + final MonitoredFocusListener monitorer = new MonitoredFocusListener(monitor); + AtomicBoolean isFocused = new AtomicBoolean(false); + synchronized (monitor) { + EventQueue.invokeAndWait(() -> { + btnThird.addFocusListener(monitorer); + isFocused.set(btnThird.isFocusOwner()); + }); + + if (!isFocused.get()) { + monitor.wait(WAIT_TIMEOUT); + EventQueue.invokeAndWait(() -> { + isFocused.set(btnThird.isFocusOwner()); + }); + } + } + + if (!isFocused.get()) { + throw new RuntimeException("TEST FAILED. The third button is not focus owner."); + } else { + System.out.println("TEST PASSED."); + } + } catch (AWTException e) { + e.printStackTrace(); + throw new RuntimeException("Some AWTException occurred."); + } catch (InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException("Test was interrupted."); + } + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } + + public void actionPerformed(ActionEvent e) { + if (btnSecond.isVisible()) { + btnFirst.setEnabled(false); + frame.remove(btnSecond); + frame.add(btnThird, BorderLayout.CENTER); + btnThird.requestFocusInWindow(); + btnFirst.setEnabled(true); + frame.validate(); + frame.repaint(); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + FocusForRemovedComponentTest test = new FocusForRemovedComponentTest(); + test.start(); + } +} + +class MonitoredFocusListener extends FocusAdapter { + Object monitor; + + public MonitoredFocusListener(Object monitor) { + this.monitor = monitor; + } + + public void focusGained(FocusEvent fe) { + synchronized (monitor) { + monitor.notify(); + } + } +} diff --git a/test/jdk/java/awt/Focus/FocusTraversalPolicyIAE.java b/test/jdk/java/awt/Focus/FocusTraversalPolicyIAE.java new file mode 100644 index 00000000000..c48fe83d817 --- /dev/null +++ b/test/jdk/java/awt/Focus/FocusTraversalPolicyIAE.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2005, 2023, 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 6225100 + @summary FocusTraversalPolicy.getInitialComponent does not work as expected + @run main FocusTraversalPolicyIAE +*/ + +import java.awt.Component; +import java.awt.Container; +import java.awt.FocusTraversalPolicy; + +public class FocusTraversalPolicyIAE { + public static void main(String[] args) { + CustomFocusTraversalPolicy cftp = new CustomFocusTraversalPolicy(); + try { + cftp.getInitialComponent(null); + throw new RuntimeException("Test failed. No exceptions thrown."); + } catch (IllegalArgumentException iae) { + System.out.println("Test passed."); + } catch (NullPointerException npe) { + throw new RuntimeException("Test failed. Unexpected NPE thrown: " + npe); + } catch (Exception e) { + throw new RuntimeException("Test failed. Unexpected exception thrown: " + e); + } + } +} + +class CustomFocusTraversalPolicy extends FocusTraversalPolicy { + public Component getComponentAfter(Container focusCycleRoot, + Component aComponent) { + return null; + } + + public Component getComponentBefore(Container focusCycleRoot, + Component aComponent) { + return null; + } + + public Component getDefaultComponent(Container focusCycleRoot) { + return null; + } + + public Component getFirstComponent(Container focusCycleRoot) { + return null; + } + + public Component getLastComponent(Container focusCycleRoot) { + return null; + } +} diff --git a/test/jdk/java/awt/Focus/InitialFocusTest.java b/test/jdk/java/awt/Focus/InitialFocusTest.java new file mode 100644 index 00000000000..489cdd7c7f1 --- /dev/null +++ b/test/jdk/java/awt/Focus/InitialFocusTest.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2002, 2023, 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 4150021 + @summary if user requests focus on some component, it must become a focus owner after activation + @key headful + @run main InitialFocusTest +*/ + +import java.awt.AWTException; +import java.awt.Button; +import java.awt.DefaultKeyboardFocusManager; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.atomic.AtomicBoolean; + +public class InitialFocusTest implements PropertyChangeListener { + //Declare things used in the test, like buttons and labels here + final static String FOCUSED_WINDOW_PROP = "focusedWindow"; + final static int ACTION_TIMEOUT = 2000; + + volatile Frame frame; + volatile Button btn1; + volatile Button btn2; + + public void start() throws InterruptedException, InvocationTargetException { + DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager(). + addPropertyChangeListener(FOCUSED_WINDOW_PROP, this); + try { + EventQueue.invokeAndWait(() -> { + frame = new Frame("InitialFocusTest"); + frame.setLayout(new FlowLayout()); + btn1 = new Button("First Button"); + frame.add(btn1); + btn2 = new Button("Second Button"); + frame.add(btn2); + frame.setLocationRelativeTo(null); + frame.pack(); + frame.setVisible(true); + }); + try { + Robot robot = new Robot(); + robot.delay(ACTION_TIMEOUT); + if (!activateFrame(frame, robot, ACTION_TIMEOUT)) { + throw new RuntimeException("Frame was not activated."); + } + robot.delay(ACTION_TIMEOUT); + AtomicBoolean isFocused = new AtomicBoolean(false); + EventQueue.invokeAndWait(() -> { + isFocused.set(frame.isFocused()); + }); + if (!isFocused.get()) { + throw new RuntimeException("Frame didn't become focused."); + } + EventQueue.invokeAndWait(() -> { + isFocused.set(btn2.isFocusOwner()); + }); + if (!isFocused.get()) { + throw new RuntimeException("Btn2 didn't receive focus."); + } + } catch (AWTException e) { + e.printStackTrace(); + } + System.out.printf("Test passed."); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } + + public void propertyChange(PropertyChangeEvent pce) { + if (FOCUSED_WINDOW_PROP.equals(pce.getPropertyName())) { + if (pce.getNewValue() == frame) { + System.out.println("requesting focus on btn2"); + btn2.requestFocusInWindow(); + } + } + } + + boolean activateFrame(Frame frame, Robot robot, int timeout) + throws InterruptedException, InvocationTargetException { + AtomicBoolean isActive = new AtomicBoolean(false); + EventQueue.invokeAndWait(() -> { + isActive.set(frame.isActive()); + }); + if (!isActive.get()) { + int[] point = new int[2]; + EventQueue.invokeAndWait(() -> { + Point origin = frame.getLocationOnScreen(); + Dimension dim = frame.getSize(); + Insets insets = frame.getInsets(); + point[0] = origin.x + dim.width / 2; + point[1] = origin.y + insets.top / 2; + }); + robot.mouseMove(point[0], point[1]); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(timeout); + EventQueue.invokeAndWait(() -> { + isActive.set(frame.isActive()); + }); + } + return frame.isActive(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + InitialFocusTest test = new InitialFocusTest(); + test.start(); + } +} diff --git a/test/jdk/java/awt/Focus/LabelScrollBarFocus.java b/test/jdk/java/awt/Focus/LabelScrollBarFocus.java new file mode 100644 index 00000000000..c69d9406ea9 --- /dev/null +++ b/test/jdk/java/awt/Focus/LabelScrollBarFocus.java @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2002, 2023, 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 4027897 + @summary Test that Label can't be made focused by the mouse, while ScrollBar should become focused. + @key headful + @run main LabelScrollBarFocus +*/ + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Scrollbar; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.InputEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.atomic.AtomicBoolean; + +public class LabelScrollBarFocus extends Panel { + static final Semaphore sema = new Semaphore(); + Label lab; + Scrollbar scr; + static Frame frame; + + public void init() { + this.setLayout(new FlowLayout()); + FocusAdapter fa = new FocusAdapter() { + public void focusGained(FocusEvent e) { + sema.raise(); + } + }; + + lab = new Label("Label"); + scr = new Scrollbar(Scrollbar.HORIZONTAL); + lab.addFocusListener(fa); + scr.addFocusListener(fa); + add(lab); + add(scr); + setSize(200, 200); + validate(); + setVisible(true); + } + + public void start() throws InterruptedException, + InvocationTargetException { + Robot robot = null; + try { + robot = new Robot(); + } catch (Exception e) { + throw new RuntimeException("Can't create robot instance"); + } + int[] point = new int[2]; + EventQueue.invokeAndWait(() -> { + Point labLoc = lab.getLocationOnScreen(); + point[0] = labLoc.x + 5; + point[1] = labLoc.y + 5; + }); + robot.mouseMove(point[0], point[1]); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(1000); + robot.waitForIdle(); + try { + sema.doWait(2000); + } catch (InterruptedException ie) { + throw new RuntimeException("Interrupted"); + } + + AtomicBoolean isFocusOwner = new AtomicBoolean(false); + EventQueue.invokeAndWait(() -> { + isFocusOwner.set(lab.isFocusOwner()); + }); + if (isFocusOwner.get()) { + throw new RuntimeException("Label is focused"); + } + + EventQueue.invokeAndWait(() -> { + Point scrLoc = scr.getLocationOnScreen(); + point[0] = scrLoc.x + 20; + point[1] = scrLoc.y + 5; + }); + robot.mouseMove(point[0], point[1]); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(1000); + robot.waitForIdle(); + try { + sema.doWait(2000); + } catch (InterruptedException ie) { + throw new RuntimeException("Interrupted"); + } + + EventQueue.invokeAndWait(() -> { + isFocusOwner.set(scr.isFocusOwner()); + }); + if (!isFocusOwner.get()) { + throw new RuntimeException("Scroll bar is not focused"); + } + System.out.println("Test passed"); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + try { + LabelScrollBarFocus test = new LabelScrollBarFocus(); + EventQueue.invokeAndWait(() -> { + frame = new Frame("LabelScrollBarFocus"); + test.init(); + frame.setLayout(new BorderLayout()); + frame.add(test, BorderLayout.CENTER); + frame.setLocationRelativeTo(null); + frame.pack(); + frame.setVisible(true); + }); + test.start(); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } +} + +class Semaphore { + boolean state = false; + Object lock = new Object(); + int waiting = 0; + + public Semaphore() { + } + + public void doWait(int timeout) throws InterruptedException { + synchronized (lock) { + waiting++; + synchronized (this) { + wait(timeout); + } + waiting--; + } + } + + public void raise() { + synchronized (lock) { + state = true; + if (waiting > 0) { + synchronized (this) { + notifyAll(); + } + } + } + } +} diff --git a/test/jdk/java/awt/Focus/ModalDialogInFocusEventTest.java b/test/jdk/java/awt/Focus/ModalDialogInFocusEventTest.java new file mode 100644 index 00000000000..d4f0d65f071 --- /dev/null +++ b/test/jdk/java/awt/Focus/ModalDialogInFocusEventTest.java @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2002, 2023, 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 4531693 4636269 4681908 4688142 4691646 4721470 + @summary Showing modal dialog during dispatching SequencedEvent + @key headful + @run main AutomaticAppletTest +*/ + +import java.awt.AWTEvent; +import java.awt.AWTException; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.InputEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.WindowFocusListener; +import java.awt.event.WindowListener; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.atomic.AtomicBoolean; + +public class ModalDialogInFocusEventTest + implements ActionListener, Runnable, WindowListener, + WindowFocusListener, FocusListener { + static final int CLICK_DELAY = 50; + static final int ACTIVATION_TIMEOUT = 2000; + static final long STAGE_TIMEOUT = 3 * ACTIVATION_TIMEOUT; + static final StageInfo[] stages = { + new StageInfo(WindowEvent.WINDOW_ACTIVATED, "Window Activated", false), + new StageInfo(WindowEvent.WINDOW_GAINED_FOCUS, "Window Gained Focus", false), + new StageInfo(FocusEvent.FOCUS_GAINED, "Focus Gained", false), + new StageInfo(FocusEvent.FOCUS_LOST, "Focus Lost", true), + new StageInfo(WindowEvent.WINDOW_LOST_FOCUS, "Window Lost Focus", true), + new StageInfo(WindowEvent.WINDOW_DEACTIVATED, "Window Deactivated", true) + }; + static final int MAX_STAGE_NUM = stages.length; + static final Object stageMonitor = new Object(); + + Robot robot = null; + Frame frame; + Frame oppositeFrame; + Dialog dialog; + Button closeButton; + int nStage = MAX_STAGE_NUM; + + public void start() throws InterruptedException, InvocationTargetException { + try { + FocusListener focusEventTracker = new FocusListener() { + public void focusGained(FocusEvent e) { + System.out.println(e); + } + + public void focusLost(FocusEvent e) { + System.out.println(e); + } + }; + + WindowAdapter windowEventTracker = new WindowAdapter() { + public void windowActivated(WindowEvent e) { + System.out.println(e); + } + + public void windowDeactivated(WindowEvent e) { + System.out.println(e); + } + + public void windowGainedFocus(WindowEvent e) { + System.out.println(e); + } + + public void windowLostFocus(WindowEvent e) { + System.out.println(e); + } + }; + EventQueue.invokeAndWait(() -> { + frame = new Frame("ModalDialogInFocusEventTest Main Frame"); + oppositeFrame = new Frame("ModalDialogInFocusEventTest Opposite Frame"); + dialog = new Dialog(frame, "ModalDialogInFocusEventTest Modal Dialog", true); + closeButton = new Button("Close Button"); + closeButton.addActionListener(this); + dialog.add(closeButton); + dialog.setBounds(10, 200, 300, 100); + + dialog.addFocusListener(focusEventTracker); + dialog.addWindowListener(windowEventTracker); + dialog.addWindowFocusListener(windowEventTracker); + oppositeFrame.addFocusListener(focusEventTracker); + oppositeFrame.addWindowListener(windowEventTracker); + oppositeFrame.addWindowFocusListener(windowEventTracker); + + frame.setName("ModalDialogInFocusEventTest MainFrame"); + frame.addFocusListener(this); + frame.addWindowListener(this); + frame.addWindowFocusListener(this); + frame.setSize(300, 100); + + oppositeFrame.setName("ModalDialogInFocusEventTest OppositeName"); + oppositeFrame.setBounds(350, 200, 300, 100); + }); + + + try { + robot = new Robot(); + robot.setAutoDelay(CLICK_DELAY); + + for (int i = 0; i < MAX_STAGE_NUM; i++) { + StageInfo stage = stages[i]; + if (stage.shouldActivateOpposite()) { + EventQueue.invokeAndWait(() -> { + oppositeFrame.setVisible(true); + frame.setVisible(true); + }); + robot.delay(ACTIVATION_TIMEOUT); + AtomicBoolean isActive = new AtomicBoolean(false); + EventQueue.invokeAndWait(() -> { + isActive.set(frame.isActive()); + }); + if (!isActive.get()) { + clickOnFrameTitle(frame); + robot.delay(ACTIVATION_TIMEOUT); + } + } else { + EventQueue.invokeAndWait(() -> { + frame.setVisible(true); + oppositeFrame.setVisible(true); + }); + robot.delay(ACTIVATION_TIMEOUT); + AtomicBoolean isActive = new AtomicBoolean(false); + EventQueue.invokeAndWait(() -> { + isActive.set(oppositeFrame.isActive()); + }); + if (!isActive.get()) { + clickOnFrameTitle(oppositeFrame); + robot.delay(ACTIVATION_TIMEOUT); + } + } + + nStage = i; + System.out.println("Stage " + i + " started."); + + synchronized (stageMonitor) { + if (stage.shouldActivateOpposite()) { + clickOnFrameTitle(oppositeFrame); + } else { + clickOnFrameTitle(frame); + } + stageMonitor.wait(STAGE_TIMEOUT); + if (!stage.isFinished()) { + throw new RuntimeException(stages[nStage].toString()); + } + } + EventQueue.invokeAndWait(() -> { + oppositeFrame.setVisible(false); + frame.setVisible(false); + }); + robot.delay(ACTIVATION_TIMEOUT); + } + } catch (AWTException e) { + throw new RuntimeException("Some AWT-Robot problem occurred", e); + } catch (InterruptedException ie) { + ie.printStackTrace(); + throw new RuntimeException("Test was interrupted"); + } + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + if (oppositeFrame != null) { + EventQueue.invokeAndWait(oppositeFrame::dispose); + } + if (dialog != null) { + EventQueue.invokeAndWait(dialog::dispose); + } + } + System.out.println("Test passed."); + } + + void clickOnFrameTitle(Frame frame) throws InterruptedException, + InvocationTargetException { + System.out.println("click on title of " + frame.getName()); + int[] point = new int[2]; + EventQueue.invokeAndWait(() -> { + Point location = frame.getLocationOnScreen(); + Insets insets = frame.getInsets(); + int width = frame.getWidth(); + point[0] = location.x + width / 2; + point[1] = location.y + insets.top / 2; + }); + robot.mouseMove(point[0], point[1]); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + EventQueue.invokeAndWait(frame::requestFocusInWindow); + } + + void openAndCloseModalDialog() throws InterruptedException, + InvocationTargetException { + (new Thread(this)).start(); + dialog.setVisible(true); + } + + void performStage(AWTEvent e) throws InterruptedException, + InvocationTargetException { + if (nStage < MAX_STAGE_NUM && + e.getID() == stages[nStage].getEventID() && + !stages[nStage].isStarted()) { + stages[nStage].start(); + openAndCloseModalDialog(); + stages[nStage].finish(); + synchronized (stageMonitor) { + stageMonitor.notifyAll(); + } + } + } + + public void actionPerformed(ActionEvent ae) { + System.out.println(ae); + dialog.setVisible(false); + } + + public void run() { + try { + Thread.sleep(ACTIVATION_TIMEOUT); + int[] point = new int[2]; + EventQueue.invokeAndWait(() -> { + Point location = closeButton.getLocationOnScreen(); + Dimension dim = closeButton.getSize(); + point[0] = location.x + dim.width / 2; + point[1] = location.y + dim.height / 2; + }); + robot.mouseMove(point[0], point[1]); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + System.out.println("click"); + } catch (InterruptedException | InvocationTargetException ie) { + throw new RuntimeException("Test was interrupted", ie); + } + } + + public void windowOpened(WindowEvent e) { + /* Empty. Unneeded for this test */ + } + + public void windowClosing(WindowEvent e) { + /* Empty. Unneeded for this test */ + } + + public void windowClosed(WindowEvent e) { + /* Empty. Unneeded for this test */ + } + + public void windowIconified(WindowEvent e) { + /* Empty. Unneeded for this test */ + } + + public void windowDeiconified(WindowEvent e) { + /* Empty. Unneeded for this test */ + } + + public void windowActivated(WindowEvent e) { + System.out.println(e); + try { + performStage(e); + } catch (InterruptedException | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } + + public void windowDeactivated(WindowEvent e) { + System.out.println(e); + try { + performStage(e); + } catch (InterruptedException | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } + + public void windowGainedFocus(WindowEvent e) { + System.out.println(e); + try { + performStage(e); + } catch (InterruptedException | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } + + public void windowLostFocus(WindowEvent e) { + System.out.println(e); + try { + performStage(e); + } catch (InterruptedException | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } + + public void focusGained(FocusEvent e) { + System.out.println(e); + try { + performStage(e); + } catch (InterruptedException | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } + + public void focusLost(FocusEvent e) { + System.out.println(e); + try { + performStage(e); + } catch (InterruptedException | InvocationTargetException ex) { + throw new RuntimeException(ex); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + ModalDialogInFocusEventTest test = new ModalDialogInFocusEventTest(); + test.start(); + } +} + +class StageInfo { + private String name; + private int eventID; + private boolean started = false; + private boolean finished = false; + + /* + * whether we should activate opposite frame during this stage. + * Note: we need to activate "another" frame BEFORE stage + * i.e. if we should activate frame during stage then we + * need to activate oppositeFrame before it and vice versa. + */ + private boolean activateOpposite; + + StageInfo(int eventID, String name, boolean activateOpposite) { + this.eventID = eventID; + this.name = name; + this.activateOpposite = activateOpposite; + } + + public String toString() { + String str = "Stage [\"" + name + "\""; + if (!started) { + str += " not"; + } + str += " started, "; + if (!finished) { + str += " not"; + } + str += " finished"; + if (activateOpposite) { + str += ", activate opposite"; + } + str += "]"; + return str; + } + + int getEventID() { + return eventID; + } + + boolean isStarted() { + return started; + } + + void start() { + started = true; + System.out.println(this.toString()); + } + + boolean isFinished() { + return finished; + } + + void finish() { + finished = true; + System.out.println(this.toString()); + } + + boolean shouldActivateOpposite() { + return activateOpposite; + } +} From ea1112444c9ec97319663ad331751850b60b468e Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Fri, 28 Apr 2023 19:16:12 +0000 Subject: [PATCH 014/459] 8306133: Open source few AWT Drag & Drop related tests Reviewed-by: prr, psadhukhan --- .../NextDropActionTest.java | 203 ++++++++++++ .../NoFormatsDragEnterTest.java | 225 +++++++++++++ .../NoFormatsDropTest/NoFormatsDropTest.java | 297 ++++++++++++++++++ .../NoTargetNoDragExitTest.java | 217 +++++++++++++ .../NotReallySerializableTest.java | 119 +++++++ 5 files changed, 1061 insertions(+) create mode 100644 test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java create mode 100644 test/jdk/java/awt/dnd/NoFormatsDragEnterTest/NoFormatsDragEnterTest.java create mode 100644 test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java create mode 100644 test/jdk/java/awt/dnd/NoTargetNoDragExitTest/NoTargetNoDragExitTest.java create mode 100644 test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java diff --git a/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java b/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java new file mode 100644 index 00000000000..e4d61a5d166 --- /dev/null +++ b/test/jdk/java/awt/dnd/NextDropActionTest/NextDropActionTest.java @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2003, 2023, 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 4887150 + @summary tests that after performing COPY drop, MOVE drop can be performed too + @key headful + @run main NextDropActionTest +*/ + +import java.awt.AWTException; +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.lang.reflect.InvocationTargetException; + + +public class NextDropActionTest { + private final long WAIT_TIMEOUT = 30000; + private volatile boolean failed; + private volatile boolean firstEnd; + private volatile boolean secondEnd; + private final Object LOCK = new Object(); + private Frame frame; + private Panel panel; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + NextDropActionTest nextDropActionTest = new NextDropActionTest(); + nextDropActionTest.start(); + } + + public void start() throws InterruptedException, + InvocationTargetException, AWTException { + + EventQueue.invokeAndWait(() -> { + panel = new Panel(); + frame = new Frame("NextDropActionTest"); + frame.add(panel); + frame.setBounds(300, 300, 300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + }); + + try { + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + + final DragSourceListener dsl = new DragSourceAdapter() { + boolean firstCall = true; + public void dragDropEnd(DragSourceDropEvent e) { + System.err.println("DragSourseListener.dragDropEnd(): " + + " firstCall=" + firstCall + + " drop action=" + e.getDropAction()); + if (firstCall) { + firstCall = false; + synchronized (LOCK) { + firstEnd = true; + LOCK.notifyAll(); + } + return; + } + if (e.getDropAction() != DnDConstants.ACTION_MOVE) { + System.err.println("FAILURE: wrong drop action:" + + e.getDropAction()); + failed = true; + } + synchronized (LOCK) { + secondEnd = true; + LOCK.notifyAll(); + } + } + }; + + DragGestureListener dgl = dge -> + dge.startDrag(null, new StringSelection("test"), dsl); + + new DragSource().createDefaultDragGestureRecognizer(panel, + DnDConstants.ACTION_COPY_OR_MOVE, dgl); + + DropTargetListener dtl = new DropTargetAdapter() { + public void drop(DropTargetDropEvent e) { + System.err.println("DropTargetListener.drop(): " + + "accepting the user drop action=" + e.getDropAction()); + e.acceptDrop(e.getDropAction()); + e.dropComplete(true); + } + }; + + new DropTarget(frame, DnDConstants.ACTION_COPY_OR_MOVE, dtl); + + Point startPoint = new Point(Util.blockTillDisplayed(panel)); + startPoint.translate(50, 50); + Point endPoint = new Point(startPoint.x + + DragSource.getDragThreshold() + 10, + startPoint.y + DragSource.getDragThreshold() + 10); + + synchronized (LOCK) { + robot.keyPress(KeyEvent.VK_CONTROL); + Util.doDragDrop(robot, startPoint, endPoint); + robot.keyRelease(KeyEvent.VK_CONTROL); + LOCK.wait(WAIT_TIMEOUT); + } + if (!firstEnd) { + System.err.println("DragSourseListener.dragDropEnd() " + + "was not called, returning"); + return; + } + + synchronized (LOCK) { + Util.doDragDrop(robot, startPoint, endPoint); + LOCK.wait(WAIT_TIMEOUT); + } + if (!secondEnd) { + System.err.println("DragSourseListener.dragDropEnd() " + + "was not called, returning"); + return; + } + } finally { + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } + + if (failed) { + throw new RuntimeException("wrong next drop action!"); + } + + System.err.println("test passed!"); + } +} + +class Util { + public static int sign(int n) { + return n < 0 ? -1 : n == 0 ? 0 : 1; + } + + public static void doDragDrop(Robot robot, Point startPoint, Point endPoint) { + robot.mouseMove(startPoint.x, startPoint.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (Point p = new Point(startPoint); !p.equals(endPoint); + p.translate(Util.sign(endPoint.x - p.x), + Util.sign(endPoint.y - p.y))) { + robot.mouseMove(p.x, p.y); + robot.delay(100); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + + public static Point blockTillDisplayed(Component comp) { + Point p = null; + while (p == null) { + try { + p = comp.getLocationOnScreen(); + } catch (IllegalStateException e) { + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + } + } + return p; + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/dnd/NoFormatsDragEnterTest/NoFormatsDragEnterTest.java b/test/jdk/java/awt/dnd/NoFormatsDragEnterTest/NoFormatsDragEnterTest.java new file mode 100644 index 00000000000..9fea9fa55d8 --- /dev/null +++ b/test/jdk/java/awt/dnd/NoFormatsDragEnterTest/NoFormatsDragEnterTest.java @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2002, 2023, 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 4702735 + @summary tests that a dragEnter is called even if the source doesn't + export data in native formats. + @key headful + @run main NoFormatsDragEnterTest +*/ + +import java.awt.AWTException; +import java.awt.Canvas; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + + +public class NoFormatsDragEnterTest { + + Frame frame; + DragSourcePanel dragSourcePanel; + DropTargetPanel dropTargetPanel; + + static final int FRAME_ACTIVATION_TIMEOUT = 1000; + static final int DROP_COMPLETION_TIMEOUT = 1000; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + NoFormatsDragEnterTest noFormatsDragEnterTest = new NoFormatsDragEnterTest(); + EventQueue.invokeAndWait(noFormatsDragEnterTest::init); + noFormatsDragEnterTest.start(); + } + + public void init() { + frame = new Frame(); + dragSourcePanel = new DragSourcePanel(); + dropTargetPanel = new DropTargetPanel(); + + frame.setTitle("NoFormatsDragEnterTest"); + frame.setLayout(new GridLayout(2, 1)); + frame.add(dragSourcePanel); + frame.add(dropTargetPanel); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + } + + public void start() throws AWTException, InterruptedException, + InvocationTargetException { + try { + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(FRAME_ACTIVATION_TIMEOUT); + + final Point srcPoint = dragSourcePanel.getLocationOnScreen(); + Dimension d = dragSourcePanel.getSize(); + srcPoint.translate(d.width / 2, d.height / 2); + + final Point dstPoint = dropTargetPanel.getLocationOnScreen(); + d = dropTargetPanel.getSize(); + dstPoint.translate(d.width / 2, d.height / 2); + + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (Point curPoint = new Point(srcPoint); + !curPoint.equals(dstPoint); + curPoint.translate(sign(dstPoint.x - curPoint.x), + sign(dstPoint.y - curPoint.y))) { + robot.mouseMove(curPoint.x, curPoint.y); + robot.delay(100); + } + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.delay(DROP_COMPLETION_TIMEOUT); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } + + if (!dropTargetPanel.passed()) { + throw new RuntimeException("Drop doesn't happen."); + } + } + + public static int sign(int n) { + return n < 0 ? -1 : n > 0 ? 1 : 0; + } +} + +class DragSourcePanel extends Canvas implements DragGestureListener { + + private final Dimension preferredDimension = new Dimension(200, 100); + private final DragSourceListener listener = new DragSourceAdapter() {}; + + public DragSourcePanel() { + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, + DnDConstants.ACTION_COPY_OR_MOVE, + this); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, new TestTransferable(), listener); + } +} + +class TestTransferable implements Transferable { + + public static DataFlavor dataFlavor = null; + static final Object data = new Object(); + + static { + DataFlavor df = null; + try { + df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + + "; class=java.lang.Object"); + } catch (ClassNotFoundException e) { + throw new ExceptionInInitializerError(e); + } + dataFlavor = df; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { dataFlavor }; + } + + public boolean isDataFlavorSupported(DataFlavor df) { + return dataFlavor.equals(df); + } + + public Object getTransferData(DataFlavor df) + throws UnsupportedFlavorException, IOException { + if (!isDataFlavorSupported(df)) { + throw new UnsupportedFlavorException(df); + } + return data; + } +} + +class DropTargetPanel extends Canvas implements DropTargetListener { + + private final Dimension preferredDimension = new Dimension(200, 100); + private boolean dragEnterTriggered = false; + private boolean dragOverTriggered = false; + + public DropTargetPanel() { + setDropTarget(new DropTarget(this, this)); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragEnter(DropTargetDragEvent dtde) { + dragEnterTriggered = true; + } + + public void dragExit(DropTargetEvent dte) {} + + public void dragOver(DropTargetDragEvent dtde) { + dragOverTriggered = true; + } + + public void dropActionChanged(DropTargetDragEvent dtde) {} + + public void drop(DropTargetDropEvent dtde) { + dtde.rejectDrop(); + } + + public boolean passed() { + // asserts that dragEnter has been called if dragOver has been called. + return !dragOverTriggered || dragEnterTriggered; + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java b/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java new file mode 100644 index 00000000000..fe0346d95ec --- /dev/null +++ b/test/jdk/java/awt/dnd/NoFormatsDropTest/NoFormatsDropTest.java @@ -0,0 +1,297 @@ +/* + * Copyright (c) 2001, 2023, 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 4473062 + @summary tests that a drop happens even if the source doesn't export + data in native formats. + @key headful + @run main NoFormatsDropTest +*/ + +import java.awt.AWTEvent; +import java.awt.AWTException; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.AWTEventListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +public class NoFormatsDropTest implements AWTEventListener { + + Frame frame; + DragSourcePanel dragSourcePanel; + DropTargetPanel dropTargetPanel; + + static final int FRAME_ACTIVATION_TIMEOUT = 1000; + static final int DROP_COMPLETION_TIMEOUT = 1000; + static final int MOUSE_RELEASE_TIMEOUT = 1000; + static final Object SYNC_LOCK = new Object(); + + Component clickedComponent = null; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + NoFormatsDropTest noFormatsDropTest = new NoFormatsDropTest(); + EventQueue.invokeAndWait(noFormatsDropTest::init); + noFormatsDropTest.start(); + } + + public void init() { + frame = new Frame(); + dragSourcePanel = new DragSourcePanel(); + dropTargetPanel = new DropTargetPanel(); + + frame.setTitle("NoFormatsDropTest"); + frame.setLayout(new GridLayout(2, 1)); + frame.add(dragSourcePanel); + frame.add(dropTargetPanel); + + frame.getToolkit().addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + } + + public void start() throws InterruptedException, AWTException, + InvocationTargetException { + try { + Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.delay(FRAME_ACTIVATION_TIMEOUT); + + final Point srcPoint = dragSourcePanel.getLocationOnScreen(); + Dimension d = dragSourcePanel.getSize(); + srcPoint.translate(d.width / 2, d.height / 2); + + if (!pointInComponent(robot, srcPoint, dragSourcePanel)) { + System.err.println("WARNING: Couldn't locate source panel."); + return; + } + + final Point dstPoint = dropTargetPanel.getLocationOnScreen(); + d = dropTargetPanel.getSize(); + dstPoint.translate(d.width / 2, d.height / 2); + + if (!pointInComponent(robot, dstPoint, dropTargetPanel)) { + System.err.println("WARNING: Couldn't locate target panel."); + return; + } + + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (Point curPoint = new Point(srcPoint); + !curPoint.equals(dstPoint); + curPoint.translate(sign(dstPoint.x - curPoint.x), + sign(dstPoint.y - curPoint.y))) { + robot.mouseMove(curPoint.x, curPoint.y); + robot.delay(100); + } + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.delay(DROP_COMPLETION_TIMEOUT); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } + + if (!dropTargetPanel.passed()) { + throw new RuntimeException("Drop doesn't happen."); + } + } + + public static int sign(int n) { + return n < 0 ? -1 : n > 0 ? 1 : 0; + } + + public void reset() { + clickedComponent = null; + } + + public void eventDispatched(AWTEvent e) { + if (e.getID() == MouseEvent.MOUSE_RELEASED) { + clickedComponent = (Component)e.getSource(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + } + + boolean pointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + robot.waitForIdle(); + reset(); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + synchronized (SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT); + } + + Component c = clickedComponent; + + while (c != null && c != comp) { + c = c.getParent(); + } + + return c == comp; + } +} + +class DragSourcePanel extends Panel implements DragGestureListener { + + private final Dimension preferredDimension = new Dimension(200, 100); + private final DragSourceListener listener = new DragSourceAdapter() {}; + + public DragSourcePanel() { + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, + DnDConstants.ACTION_COPY_OR_MOVE, + this); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, new TestTransferable(), listener); + } +} + +class TestTransferable implements Transferable { + + public static DataFlavor dataFlavor = null; + static final Object data = new Object(); + + static { + DataFlavor df = null; + try { + df = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType + + "; class=java.lang.Object"); + } catch (ClassNotFoundException e) { + throw new ExceptionInInitializerError(e); + } + dataFlavor = df; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { dataFlavor }; + } + + public boolean isDataFlavorSupported(DataFlavor df) { + return dataFlavor.equals(df); + } + + public Object getTransferData(DataFlavor df) + throws UnsupportedFlavorException, IOException { + if (!isDataFlavorSupported(df)) { + throw new UnsupportedFlavorException(df); + } + return data; + } +} + +class DropTargetPanel extends Panel implements DropTargetListener { + + final Dimension preferredDimension = new Dimension(200, 100); + boolean passed = false; + + public DropTargetPanel() { + setDropTarget(new DropTarget(this, this)); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragEnter(DropTargetDragEvent dtde) {} + + public void dragExit(DropTargetEvent dte) {} + + public void dragOver(DropTargetDragEvent dtde) {} + + public void dropActionChanged(DropTargetDragEvent dtde) {} + + public void drop(DropTargetDropEvent dtde) { + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + } + + Transferable transfer = dtde.getTransferable(); + + if (transfer.isDataFlavorSupported(TestTransferable.dataFlavor)) { + try { + Object data = + transfer.getTransferData(TestTransferable.dataFlavor); + passed = true; + dtc.dropComplete(true); + } catch (IOException e) { + e.printStackTrace(); + dtc.dropComplete(false); + } catch (UnsupportedFlavorException e) { + e.printStackTrace(); + dtc.dropComplete(false); + } + } else { + dtc.dropComplete(false); + } + } + + boolean passed() { + return passed; + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/dnd/NoTargetNoDragExitTest/NoTargetNoDragExitTest.java b/test/jdk/java/awt/dnd/NoTargetNoDragExitTest/NoTargetNoDragExitTest.java new file mode 100644 index 00000000000..0b1db2dcb5f --- /dev/null +++ b/test/jdk/java/awt/dnd/NoTargetNoDragExitTest/NoTargetNoDragExitTest.java @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2003, 2023, 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 4874092 + @summary tests that DragSourceListener.dragExit() is not called if the mouse + is not dragged over any drop site + @key headful + @run main NoTargetNoDragExitTest +*/ + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.event.AWTEventListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; + + +public class NoTargetNoDragExitTest { + private volatile boolean failed; + private volatile boolean end; + private final Object LOCK = new Object(); + private Frame frame; + private Panel panel; + + public static void main(String[] args) throws Exception { + NoTargetNoDragExitTest noTargetNoDragExitTest = new NoTargetNoDragExitTest(); + EventQueue.invokeAndWait(noTargetNoDragExitTest::init); + noTargetNoDragExitTest.start(); + } + + public void init() { + frame = new Frame("NoTargetNoDragExitTest"); + panel = new Panel(); + frame.add(panel); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + } + + public void start() throws Exception { + try { + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + + final DragSourceListener dsl = new DragSourceAdapter() { + public void dragExit(DragSourceEvent e) { + failed = true; + System.err.println("FAILURE: DragSourceListener.dragExit() called!"); + } + public void dragDropEnd(DragSourceDropEvent e) { + System.err.println("DragSourceListener.dragDropEnd()"); + synchronized (LOCK) { + end = true; + LOCK.notifyAll(); + } + } + }; + + DragGestureListener dgl = dge -> + dge.startDrag(null, new StringSelection("NoTargetNoDragExitTest"), dsl); + + new DragSource().createDefaultDragGestureRecognizer(panel, + DnDConstants.ACTION_COPY_OR_MOVE, dgl); + + Point startPoint = frame.getLocationOnScreen(); + startPoint.translate(50, 50); + Point endPoint = new Point(startPoint.x + 100, startPoint.y + 100); + + Util.waitForInit(); + + if (!Util.pointInComponent(robot, startPoint, frame)) { + System.err.println("WARNING: Could not locate " + frame + + " at point " + startPoint); + return; + } + + robot.mouseMove(startPoint.x, startPoint.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (Point p = new Point(startPoint); !p.equals(endPoint); + p.translate(Util.sign(endPoint.x - p.x), + Util.sign(endPoint.y - p.y))) { + robot.mouseMove(p.x, p.y); + robot.delay(100); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + synchronized (LOCK) { + while (!end) { + LOCK.wait(); + } + } + } finally { + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } + + if (failed) { + throw new RuntimeException("DragSourceListener.dragExit() called!"); + } + + System.err.println("test passed!"); + } +} + + +class Util implements AWTEventListener { + private static final Toolkit tk = Toolkit.getDefaultToolkit(); + private static final Object SYNC_LOCK = new Object(); + private Component clickedComponent = null; + private static final int PAINT_TIMEOUT = 10000; + private static final int MOUSE_RELEASE_TIMEOUT = 10000; + private static final Util util = new Util(); + + static { + tk.addAWTEventListener(util, 0xFFFFFFFF); + } + + private void reset() { + clickedComponent = null; + } + + public void eventDispatched(AWTEvent e) { + if (e.getID() == MouseEvent.MOUSE_RELEASED) { + clickedComponent = (Component)e.getSource(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + } + + public static boolean pointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + return util.isPointInComponent(robot, p, comp); + } + + private boolean isPointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + tk.sync(); + robot.waitForIdle(); + reset(); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + synchronized (SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT); + } + + Component c = clickedComponent; + + while (c != null && c != comp) { + c = c.getParent(); + } + + return c == comp; + } + + public static void waitForInit() throws InterruptedException { + final Frame f = new Frame() { + public void paint(Graphics g) { + dispose(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + }; + f.setBounds(600, 400, 200, 200); + synchronized (SYNC_LOCK) { + f.setVisible(true); + SYNC_LOCK.wait(PAINT_TIMEOUT); + } + tk.sync(); + } + + public static int sign(int n) { + return n < 0 ? -1 : n == 0 ? 0 : 1; + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java b/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java new file mode 100644 index 00000000000..84fd2dfd4f0 --- /dev/null +++ b/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2000, 2023, 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 4187912 + @summary Test that some incorrectly written DnD code cannot hang the app + @run main NotReallySerializableTest +*/ + +import java.awt.Button; +import java.awt.Cursor; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragGestureRecognizer; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceContext; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDropEvent; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.util.ArrayList; + + +public class NotReallySerializableTest { + public static void main(String[] args) throws IOException { + Toolkit tk = Toolkit.getDefaultToolkit(); + + DragGestureRecognizer dgr = tk.createDragGestureRecognizer + (java.awt.dnd.MouseDragGestureRecognizer.class, + DragSource.getDefaultDragSource(), new Button(), + DnDConstants.ACTION_LINK, new TrickDragGestureListener()); + DragGestureEvent dge = new DragGestureEvent + (dgr, DnDConstants.ACTION_LINK, new Point(0, 0), + new TrickList()); + DragSourceContext dsc = new DragSourceContext(dge, + Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR), + null, null, new TrickTransferable(), + new TrickDragSourceListener()); + DropTarget dt = new DropTarget(new Button(), + new TrickDropTargetListener()); + + ObjectOutputStream stream = new ObjectOutputStream + (new OutputStream() { + public void write(int b) {} + }); + + stream.writeObject(dgr); + stream.writeObject(dge); + stream.writeObject(dsc); + stream.writeObject(dt); + + System.out.println("test passed"); + } +} + +class TrickList extends ArrayList implements Serializable { + Object trick = new Object(); + + TrickList() { + add(trick); + } +} + +class TrickDragGestureListener implements DragGestureListener, Serializable { + Object trick = new Object(); + + public void dragGestureRecognized(DragGestureEvent dge) {} +} + +class TrickTransferable extends StringSelection implements Serializable { + Object trick = new Object(); + + TrickTransferable() { + super(""); + } +} + +class TrickDragSourceListener extends DragSourceAdapter + implements Serializable +{ + Object trick = new Object(); +} + +class TrickDropTargetListener extends DropTargetAdapter + implements Serializable +{ + Object trick = new Object(); + + public void drop(DropTargetDropEvent dtde) {} +} \ No newline at end of file From 77c82da098ccd779227bb6c595b19c33958fefcd Mon Sep 17 00:00:00 2001 From: Damon Nguyen Date: Fri, 28 Apr 2023 19:20:16 +0000 Subject: [PATCH 015/459] 8306681: Open source more AWT DnD related tests Reviewed-by: prr, serb --- .../awt/dnd/ZeroFormatTransferableTest.java | 82 +++++++++ .../ComponentEvent/ComponentResizedTest.java | 75 ++++++++ .../ComponentEvent/ObjectSourceTest.java | 58 ++++++ .../ComponentEvent/ResizeDeniedTest.java | 87 +++++++++ .../OppositeSerialization.java | 167 ++++++++++++++++++ .../FocusEvent/OppositeSerialization/old.ser | Bin 0 -> 1195 bytes .../HierarchyEventOnWindowTest.java | 75 ++++++++ 7 files changed, 544 insertions(+) create mode 100644 test/jdk/java/awt/dnd/ZeroFormatTransferableTest.java create mode 100644 test/jdk/java/awt/event/ComponentEvent/ComponentResizedTest.java create mode 100644 test/jdk/java/awt/event/ComponentEvent/ObjectSourceTest.java create mode 100644 test/jdk/java/awt/event/ComponentEvent/ResizeDeniedTest.java create mode 100644 test/jdk/java/awt/event/FocusEvent/OppositeSerialization/OppositeSerialization.java create mode 100644 test/jdk/java/awt/event/FocusEvent/OppositeSerialization/old.ser create mode 100644 test/jdk/java/awt/event/HierarchyEvent/HierarchyEventOnWindowTest.java diff --git a/test/jdk/java/awt/dnd/ZeroFormatTransferableTest.java b/test/jdk/java/awt/dnd/ZeroFormatTransferableTest.java new file mode 100644 index 00000000000..1d8fe462c17 --- /dev/null +++ b/test/jdk/java/awt/dnd/ZeroFormatTransferableTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2001, 2023, 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 4388802 + @summary tests that getting clipboard data doesn't crash when there are no + formats on the clipboard + @key headful + @run main ZeroFormatTransferableTest +*/ + +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + + +public class ZeroFormatTransferableTest { + public static void main(String[] args) throws InterruptedException, IOException { + Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); + clipboard.setContents(new ZeroFormatTransferable(), null); + + String javaPath = System.getProperty("java.home", ""); + + Process process = new ProcessBuilder( + javaPath + File.separator + "bin" + File.separator + "java", + "-cp", + System.getProperty("test.classes", "."), + "ZeroFormatTransferableTest").start(); + process.waitFor(); + + InputStream errorStream = process.getErrorStream(); + int count = errorStream.available(); + if (count > 0) { + byte[] b = new byte[count]; + errorStream.read(b); + System.err.println("========= Child VM System.err ========"); + System.err.print(new String(b)); + System.err.println("======================================"); + } + } +} + +class ZeroFormatTransferable implements Transferable { + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] {}; + } + + public boolean isDataFlavorSupported(DataFlavor df) { + return false; + } + + public Object getTransferData(DataFlavor df) + throws UnsupportedFlavorException { + throw new UnsupportedFlavorException(df); + } +} diff --git a/test/jdk/java/awt/event/ComponentEvent/ComponentResizedTest.java b/test/jdk/java/awt/event/ComponentEvent/ComponentResizedTest.java new file mode 100644 index 00000000000..4aad5fccf8d --- /dev/null +++ b/test/jdk/java/awt/event/ComponentEvent/ComponentResizedTest.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2000, 2023, 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 4267393 + @summary Ensures minimal amount of paints + @key headful + @run main ComponentResizedTest +*/ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.event.ComponentEvent; +import java.lang.reflect.InvocationTargetException; + +public class ComponentResizedTest extends Frame { + volatile int paintCount = 0; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + ComponentResizedTest componentResizedTest = new ComponentResizedTest(); + EventQueue.invokeAndWait(componentResizedTest::init); + componentResizedTest.start(); + if (componentResizedTest != null) EventQueue.invokeAndWait(() + -> componentResizedTest.dispose()); + } + + public void paint(Graphics g) { + System.out.println("Paint called"); + ++paintCount; + } + + public void init() { + setTitle("ComponentResizedTest"); + setSize(100, 100); + setLocationRelativeTo(null); + setVisible(true); + } + + public void start () throws InterruptedException { + Thread.sleep(1000); + + paintCount = 0; + dispatchEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED)); + + Thread.sleep(1000); + + if (paintCount > 0) { + throw new RuntimeException("ComponentResizedTest failed. " + + "Paint called."); + } + } +} diff --git a/test/jdk/java/awt/event/ComponentEvent/ObjectSourceTest.java b/test/jdk/java/awt/event/ComponentEvent/ObjectSourceTest.java new file mode 100644 index 00000000000..2aea6efa4ea --- /dev/null +++ b/test/jdk/java/awt/event/ComponentEvent/ObjectSourceTest.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2001, 2023, 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 4420658 + @summary No ClassCastException should be thrown when getComponent() + is called on an event with a non-Component source. + The result should be null. + @key headful + @run main ObjectSourceTest +*/ + +import java.awt.Component; +import java.awt.Frame; +import java.awt.event.ComponentEvent; + + +public class ObjectSourceTest { + static Frame frame; + + public static void main(String[] args) { + frame = new Frame("ObjectSourceTest"); + + ComponentEvent ce = new ComponentEvent(frame, ComponentEvent.COMPONENT_SHOWN); + Object obj = new Object(); + ce.setSource(obj); + + Component comp = ce.getComponent(); + if (comp != null) { + throw new RuntimeException("ObjectSourceTest failed. comp != null"); + } + + if (frame != null) { + frame.dispose(); + } + } + } diff --git a/test/jdk/java/awt/event/ComponentEvent/ResizeDeniedTest.java b/test/jdk/java/awt/event/ComponentEvent/ResizeDeniedTest.java new file mode 100644 index 00000000000..57a8539edbe --- /dev/null +++ b/test/jdk/java/awt/event/ComponentEvent/ResizeDeniedTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2002, 2023, 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 4523758 + @requires (os.family == "windows") + @summary Checks denied setBounds doesn't generate ComponentEvent + @key headful + @run main ResizeDeniedTest +*/ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.lang.reflect.InvocationTargetException; + +public class ResizeDeniedTest implements ComponentListener { + static int runs = 0; + static Frame frame; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + + ResizeDeniedTest resizeDeniedTest = new ResizeDeniedTest(); + EventQueue.invokeAndWait(() -> { + frame = new Frame("ResizeDeniedTest"); + frame.addComponentListener(resizeDeniedTest); + frame.setSize(1, 1); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + + synchronized(resizeDeniedTest) { + resizeDeniedTest.wait(2000); + } + + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + + if (runs > 10) { + System.out.println("Infinite loop"); + throw new RuntimeException("Infinite loop"); + } + } + + public void componentHidden(ComponentEvent e) {} + + public void componentMoved(ComponentEvent e) {} + + public void componentResized(ComponentEvent e) { + frame.setSize(1, 1); + System.out.println("Size " + frame.getSize()); + ++runs; + if (runs > 10) { + System.out.println("Infinite loop"); + synchronized(this) { + this.notify(); + } + throw new RuntimeException("Infinite loop"); + } + } + + public void componentShown(ComponentEvent e) {} +} diff --git a/test/jdk/java/awt/event/FocusEvent/OppositeSerialization/OppositeSerialization.java b/test/jdk/java/awt/event/FocusEvent/OppositeSerialization/OppositeSerialization.java new file mode 100644 index 00000000000..9c07611b254 --- /dev/null +++ b/test/jdk/java/awt/event/FocusEvent/OppositeSerialization/OppositeSerialization.java @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2002, 2023, 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 4715486 + @summary Tests that FocusEvent.opposite is not serialized + @key headful + @run main OppositeSerialization +*/ + +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.FocusEvent; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.lang.reflect.InvocationTargetException; + +import static java.lang.Integer.valueOf; + +/** + * "This is an AUTOMATIC test", + * "however, that's what it does:", + * "1. It tests that FocusEvent.opposite field is written", + * "to serialized stream as null regardless of whether it", + * "is actually null or not. For this purpose, we serialize", + * "a FocusEvent with really huge opposite, and then check", + * "if serialized object is huge or not.", + * "2. It tests that FocusEvent.opposite deserializes as", + * "null, even if it was serialized in the previous version", + * "of JDK. For this purpose, file old.ser is included into", + * "test. It is FocusEvent serialized with 1.4, with non-null", + * "opposite. We check that after deserialization opposite", + * "field is null" + */ +public class OppositeSerialization { + static Button b1; + static Frame b2; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + EventQueue.invokeAndWait(() -> { + b1 = new Button("OppositeSerialization - Source"); + b2 = new Frame("OppositeSerialization - Opposite"); + b2.setLayout(new FlowLayout()); + + for (int i = 0; i < 10000; i++) { + String s = (valueOf(i)).toString(); + b2.add(new Button("Button" + s)); + } + }); + + FocusEvent evt1 = new FocusEvent(b1, FocusEvent.FOCUS_GAINED, false, b2); + + /* + * Here we test that opposite component isn't serialized. + * We created a really huge opposite component for a focus + * event evt1 and now we'll see if the size of serialized data + * is big. + */ + try { + FileOutputStream fos = new FileOutputStream("new.ser"); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(evt1); + oos.flush(); + } catch (Exception e1) { + System.out.println("Sorry! Couldn't write the stream"); + System.out.println("The test failed, but the reason is " + + "unrelated to the subject"); + throw new RuntimeException("The test couldn't write serialized data"); + } + + File file = new File("new.ser"); + if (file.length() > 50000) { + System.out.println("The test failed: serialized " + + "FocusEvent too huge"); + System.err.println("Serialized FocusEvent is too huge."); + System.err.println("Probably opposite field is " + + "serialized incorrectly."); + throw new RuntimeException("Serialized FocusEvent is too huge"); + } + + /* + * Here we test that opposite is not deserialized even if it is present + * in the stream. old.ser is created with JDK1.4 using the following + * source code: + * + * import java.awt.event.*; + * import java.io.*; + * import java.awt.*; + * + * public class OldFocusSerializer { + * + * public static void main(String[] args) { + * + * Button b1 = new Button("Source"); + * Button b2 = new Button("Opposite"); + * + * FocusEvent evt1 = new FocusEvent(b1, + * FocusEvent.FOCUS_GAINED, + * false, + * b2); + * + * try { + * FileOutputStream fos = new FileOutputStream("old.ser"); + * ObjectOutputStream oos = new ObjectOutputStream(fos); + * oos.writeObject(evt1); + * oos.flush(); + * } catch (IOException e) { + * System.out.println("Sorry! Couldn't write the stream"); + * } + * } + * } + */ + FocusEvent evt2; + String testPath = System.getProperty("test.src", "."); + try { + FileInputStream fis = new FileInputStream(testPath + + File.separator + "old.ser"); + ObjectInputStream ois = new ObjectInputStream(fis); + evt2 = (FocusEvent)ois.readObject(); + } catch (Exception e2) { + System.out.println("The test failed as it couldn't read the stream"); + throw new RuntimeException("The test couldn't read serialized data"); + } + + if (evt2.getOppositeComponent() != null) { + System.out.println("The test failed: opposite component " + + "deserialized to non-null value"); + System.err.println("FocusEvent stored in old.ser should have " + + "null opposite field."); + throw new RuntimeException("Non-null opposite component " + + "after deserialization"); + } + + if (b2 != null) { + EventQueue.invokeAndWait(() -> b2.dispose()); + } + + System.out.println("The test passed"); + } +} diff --git a/test/jdk/java/awt/event/FocusEvent/OppositeSerialization/old.ser b/test/jdk/java/awt/event/FocusEvent/OppositeSerialization/old.ser new file mode 100644 index 0000000000000000000000000000000000000000..514ac8acff3971627a8677818eec4fa20636cf65 GIT binary patch literal 1195 zcmZux&ubGw6n;sXCbg6{L7_$M!HXx8qhP(XO$xEm6jLfDr`g??WZK=?adtM{2zvA& zh^Jme1VO5z|AV05$-Cf1ym%=34|wv;q)nUZ!otkF?|t9AU-SMqWFrL&+pNz@Y*&}C zk3yH$LN|`8W|^yeSikzz`I3fo3#K#%GE__r>W~km3?r^l!`ZrVFOz$DH6(x_zokUM z#Z#;!qh*%CpS{N0Z`CvaVGASd@|{g<|M~99kNNM9Kcyklg1j4wC=Sr8L7IDQ$T}X= zOhdZ8LeA%`bF8^vvaSth8(m$0GIeV{c<{yuNC3$El0dP}j+9nntwZtX+U$PvvH2nc znHrpT>{$~PXFk7=UWH_~P(?fxb(mqUrUk_jFyUz^4g>d@=$4yWanW6>L)K>w`uE@= z$pTawwSNqjv+Q&=lk*i*{PD&@mO-RIE>T zWBxi0qUsPwRkAkYRD;PL@@`MJV1{=^sPHyQ#)YoI1s>TVA5jpxL0pP^9tz4gk2aXQ zgI)^?f(2Mjq|aTh{Xr8Ao4{S0>8K(6K?|~d$`)aBeI9WuoZaP~?$scb&`<4BV6Kai zHLiw2W1=-&w&_dCM<(ubJt!}q22xJXICPn=3S*P?xs&bYhl=boZjWk!&6s*p5%Z-X z#6c#a@`ef}Dm_>|i6N&+H&zkBp>TrG9vMZCyf&HYBGD}z13clCDTosO z!`M!ae>7#svp?$lhT_z}%uLYdgV)uU&s};|QZ<+kj}2BcCuKq^DXAgfIDBPf@)r)J Bksbg5 literal 0 HcmV?d00001 diff --git a/test/jdk/java/awt/event/HierarchyEvent/HierarchyEventOnWindowTest.java b/test/jdk/java/awt/event/HierarchyEvent/HierarchyEventOnWindowTest.java new file mode 100644 index 00000000000..3a5b5ff943f --- /dev/null +++ b/test/jdk/java/awt/event/HierarchyEvent/HierarchyEventOnWindowTest.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2001, 2023, 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 4460376 + @summary HierarchyEvents on Frame should be dispatched correctly + when on its child Window this event type enabled + @key headful + @run main HierarchyEventOnWindowTest +*/ + +import java.awt.AWTEvent; +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Window; +import java.awt.event.HierarchyBoundsAdapter; +import java.lang.reflect.InvocationTargetException; + +public class HierarchyEventOnWindowTest { + static Frame frame; + + public static void main(String args[]) throws InterruptedException, + InvocationTargetException { + EventQueue.invokeAndWait(() -> { + frame = new Frame("HierarchyEventOnWindowTest"); + CustomWindow window = new CustomWindow(frame); + window.enableEvents(); + frame.add(new Button("")); + window.disableEvents(); + window.addHierarchyListener(e -> {}); + window.addHierarchyBoundsListener(new HierarchyBoundsAdapter(){}); + frame.add(new Button("")); + }); + + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } +} + +class CustomWindow extends Window { + public CustomWindow(Frame frame) { + super(frame); + } + public void enableEvents() { + enableEvents(AWTEvent.HIERARCHY_EVENT_MASK | + AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK); + } + public void disableEvents() { + disableEvents(AWTEvent.HIERARCHY_EVENT_MASK | + AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK); + } +} From 7c57189f702fa716aeb42abef339d6d2f557115f Mon Sep 17 00:00:00 2001 From: Stuart Marks Date: Fri, 28 Apr 2023 19:45:29 +0000 Subject: [PATCH 016/459] 8296935: Arrays.asList() can return a List that throws undocumented ArrayStoreException Reviewed-by: rriggs, lancea --- src/java.base/share/classes/java/util/Arrays.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/java.base/share/classes/java/util/Arrays.java b/src/java.base/share/classes/java/util/Arrays.java index 44e78c6a2e8..9d1034e6fef 100644 --- a/src/java.base/share/classes/java/util/Arrays.java +++ b/src/java.base/share/classes/java/util/Arrays.java @@ -4186,6 +4186,10 @@ private static boolean[] copyOfRangeBoolean(boolean[] original, int from, int to * those that would change the size of the returned list. Those methods leave * the list unchanged and throw {@link UnsupportedOperationException}. * + *

If the specified array's actual component type differs from the type + * parameter T, this can result in operations on the returned list throwing an + * {@code ArrayStoreException}. + * * @apiNote * This method acts as bridge between array-based and collection-based * APIs, in combination with {@link Collection#toArray}. From f13ef34c8faff8df8347e9ff76e9b1afb14f778c Mon Sep 17 00:00:00 2001 From: Jorn Vernee Date: Fri, 28 Apr 2023 21:43:33 +0000 Subject: [PATCH 017/459] 8307110: zero build broken after JDK-8304265 Reviewed-by: erikj --- make/conf/jib-profiles.js | 8 +++++--- make/devkit/createLibffiBundle.sh | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 2c6742c94e7..117b5aaf157 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -599,10 +599,11 @@ var getJibProfilesProfiles = function (input, common, data) { "linux-aarch64-zero": { target_os: "linux", target_cpu: "aarch64", - dependencies: ["devkit", "gtest"], + dependencies: ["devkit", "gtest", "libffi"], configure_args: concat(common.configure_args_64bit, [ "--with-zlib=system", "--with-jvm-variants=zero", + "--with-libffi=" + input.get("libffi", "home_path"), "--enable-libffi-bundling" ]) }, @@ -611,10 +612,11 @@ var getJibProfilesProfiles = function (input, common, data) { target_os: "linux", target_cpu: "x86", build_cpu: "x64", - dependencies: ["devkit", "gtest"], + dependencies: ["devkit", "gtest", "libffi"], configure_args: concat(common.configure_args_32bit, [ "--with-zlib=system", "--with-jvm-variants=zero", + "--with-libffi=" + input.get("libffi", "home_path"), "--enable-libffi-bundling" ]) } @@ -1272,7 +1274,7 @@ var getJibProfilesDependencies = function (input, common) { libffi: { organization: common.organization, - module: "libffi-" + input.build_platform, + module: "libffi-" + input.target_platform, ext: "tar.gz", revision: "3.4.2+1.0" }, diff --git a/make/devkit/createLibffiBundle.sh b/make/devkit/createLibffiBundle.sh index 62d714a5148..100dcc1fe0d 100644 --- a/make/devkit/createLibffiBundle.sh +++ b/make/devkit/createLibffiBundle.sh @@ -81,6 +81,7 @@ cd $LIBFFI_DIR if [ ! -e $LIBFFI_DIR/configure ]; then bash ./autogen.sh fi +# For Linux/x86, add --build=i686-pc-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 bash ./configure --prefix=$INSTALL_DIR CC=$DEVKIT_DIR/bin/gcc CXX=$DEVKIT_DIR/bin/g++ # Run with nice to keep system usable during build. @@ -91,6 +92,7 @@ mkdir -p $IMAGE_DIR if [ ! -e $IMAGE_DIR/lib/libffi.so ]; then echo "Copying libffi.so* to image" mkdir -p $IMAGE_DIR/lib + # For Linux/x86 it's under /lib/ instead of /lib64/ cp -a $INSTALL_DIR/lib64/libffi.so* $IMAGE_DIR/lib/ fi if [ ! -e $IMAGE_DIR/include/ ]; then From 7d5944369af67e99a6b961220796e12225f05004 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 28 Apr 2023 22:39:17 +0000 Subject: [PATCH 018/459] 8307080: Open source some more JComboBox jtreg tests Reviewed-by: kizune --- .../jdk/javax/swing/JComboBox/bug4171464.java | 55 +++++++++ .../jdk/javax/swing/JComboBox/bug4244614.java | 58 +++++++++ .../jdk/javax/swing/JComboBox/bug4276920.java | 81 ++++++++++++ .../jdk/javax/swing/JComboBox/bug4924758.java | 115 +++++++++++++++++ .../jdk/javax/swing/JComboBox/bug5029504.java | 116 ++++++++++++++++++ 5 files changed, 425 insertions(+) create mode 100644 test/jdk/javax/swing/JComboBox/bug4171464.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4244614.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4276920.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4924758.java create mode 100644 test/jdk/javax/swing/JComboBox/bug5029504.java diff --git a/test/jdk/javax/swing/JComboBox/bug4171464.java b/test/jdk/javax/swing/JComboBox/bug4171464.java new file mode 100644 index 00000000000..aa7962d97c2 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4171464.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1999, 2023, 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 4171464 + @summary JComboBox should not throw InternalError +*/ + +import javax.swing.ComboBoxModel; +import javax.swing.JComboBox; +import javax.swing.event.ListDataListener; + +public class bug4171464 { + + public static void main(String args[]) { + ComboBoxModel model = new ComboBoxModel() { + public void setSelectedItem(Object anItem) {} + public Object getSelectedItem() {return null;} + public int getSize() {return 0;} + public Object getElementAt(int index) {return null;} + public void addListDataListener(ListDataListener l) {} + public void removeListDataListener(ListDataListener l) {} + }; + JComboBox comboBox = new JComboBox(); + comboBox.setModel(model); + try { + comboBox.addItem(new Object() {}); + } catch (InternalError e) { + // InternalError not suitable if app supplies non-mutable model. + throw new RuntimeException("4171464 TEST FAILED"); + } catch (Exception e) { + // Expected exception due to non-mutable model. + } + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4244614.java b/test/jdk/javax/swing/JComboBox/bug4244614.java new file mode 100644 index 00000000000..56231987ca5 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4244614.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 1999, 2023, 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 4244614 + @summary Tests that JComboBox has setAction(Action) constructor +*/ + +import java.awt.event.ActionEvent; +import java.beans.PropertyChangeListener; +import javax.swing.Action; +import javax.swing.JComboBox; + +public class bug4244614 { + +/** Auxiliary class implementing Action + */ + static class NullAction implements Action { + public void addPropertyChangeListener( + PropertyChangeListener listener) {} + public void removePropertyChangeListener( + PropertyChangeListener listener) {} + public void putValue(String key, Object value) {} + public void setEnabled(boolean b) {} + public void actionPerformed(ActionEvent e) {} + + public Object getValue(String key) { return null; } + public boolean isEnabled() { return false; } + } + + public static void main(String[] argv) { + Object[] comboData = {"First", "Second", "Third"}; + JComboBox combo = new JComboBox(comboData); + Action action = new NullAction(); + combo.setAction(action); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4276920.java b/test/jdk/javax/swing/JComboBox/bug4276920.java new file mode 100644 index 00000000000..f5de26091b3 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4276920.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2001, 2023, 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 4276920 + @summary Tests that BasicComboPopup.hide() doesn't cause unnecessary repaints + @key headful +*/ + +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4276920 { + + static volatile TestComboBox combo; + static volatile JFrame frame; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(bug4276920::createUI); + Thread.sleep(2000); + int before = combo.getRepaintCount(); + SwingUtilities.invokeAndWait(combo::hidePopup); + int after = combo.getRepaintCount(); + if (after > before) { + throw new Error("Failed 4276920: BasicComboPopup.hide() caused unnecessary repaint()"); + } + } finally { + if (frame != null) { + SwingUtilities.invokeAndWait(frame::dispose); + } + } + } + + static void createUI() { + combo = new TestComboBox(new String[] {"Why am I so slow?"}); + frame = new JFrame("bug4276920"); + frame.getContentPane().add(combo); + frame.pack(); + frame.validate(); + frame.setVisible(true); + } + + static class TestComboBox extends JComboBox { + int count = 0; + + TestComboBox(Object[] content) { + super(content); + } + + public void repaint() { + super.repaint(); + count++; + } + + int getRepaintCount() { + return count; + } + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4924758.java b/test/jdk/javax/swing/JComboBox/bug4924758.java new file mode 100644 index 00000000000..d8f77396159 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4924758.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2004, 2023, 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 4924758 + @summary 1.4 REGRESSION: In Motif L&F JComboBox doesn't react when spacebar is pressed + @key headful +*/ + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.event.PopupMenuListener; +import javax.swing.event.PopupMenuEvent; +import java.awt.event.KeyEvent; + +public class bug4924758 { + + static volatile boolean passed = false; + volatile boolean isLafOk = true; + + volatile JFrame mainFrame; + volatile JComboBox comboBox; + + public static void main(String[] args) throws Exception { + bug4924758 test = new bug4924758(); + try { + SwingUtilities.invokeAndWait(test::createUI); + if (!test.isLafOk) { + throw new RuntimeException("Could not create Win L&F"); + } + test.test(); + if (!passed) { + throw new RuntimeException( + "Popup was not closed after VK_SPACE press. Test failed."); + } + } finally { + JFrame f = test.mainFrame; + if (f != null) { + SwingUtilities.invokeAndWait(() -> f.dispose()); + } + } + } + + void createUI() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + } catch (Exception ex) { + System.err.println("Can not initialize Motif L&F. Testing skipped."); + isLafOk = false; + return; + } + + mainFrame = new JFrame("Bug4924758"); + String[] items = {"One", "Two", "Three"}; + comboBox = new JComboBox(items); + comboBox.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + passed = true; + } + + public void popupMenuCanceled(PopupMenuEvent e) {} + }); + mainFrame.setLayout(new BorderLayout()); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.add(comboBox, BorderLayout.CENTER); + mainFrame.pack(); + mainFrame.setLocationRelativeTo(null); + mainFrame.setVisible(true); + } + + void test() throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.delay(2000); + Point p = comboBox.getLocationOnScreen(); + Dimension size = comboBox.getSize(); + p.x += size.width / 2; + p.y += size.height / 2; + robot.mouseMove(p.x, p.y); + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); + robot.delay(2000); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug5029504.java b/test/jdk/javax/swing/JComboBox/bug5029504.java new file mode 100644 index 00000000000..af0bf7db471 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug5029504.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2004, 2023, 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 5029504 + @summary Empty JComboBox drop-down list is unexpectedly high + @key headful +*/ + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.plaf.basic.BasicComboBoxUI; +import javax.swing.plaf.basic.BasicComboPopup; +import javax.swing.event.PopupMenuListener; +import javax.swing.event.PopupMenuEvent; + +public class bug5029504 { + + static volatile boolean passed = true; + static volatile JFrame mainFrame; + static volatile JComboBox comboBox; + static volatile BasicComboPopup ourPopup = null; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(bug5029504::createUI); + runTest(); + if (!passed) { + throw new RuntimeException( + "Popup of empty JComboBox is too high. Test failed."); + } + } finally { + if (mainFrame != null) { + SwingUtilities.invokeAndWait(mainFrame::dispose); + } + } + } + + static void createUI() { + mainFrame = new JFrame("Bug4924758"); + comboBox = new JComboBox(); + comboBox.setUI(new MyComboBoxUI()); + comboBox.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuWillBecomeVisible(PopupMenuEvent e) {} + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + if (ourPopup != null) { + int comboHeight = comboBox.getHeight(); + int popupHeight = ourPopup.getHeight(); + if (popupHeight > comboHeight*2) { + passed = false; + } + } + } + + public void popupMenuCanceled(PopupMenuEvent e) {} + }); + mainFrame.setLayout(new BorderLayout()); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.add(comboBox, BorderLayout.CENTER); + mainFrame.pack(); + mainFrame.setLocationRelativeTo(null); + mainFrame.validate(); + mainFrame.setVisible(true); + } + + static void runTest() throws Exception { + Robot robot = new Robot(); + robot.delay(2000); + Point p = comboBox.getLocationOnScreen(); + Dimension size = comboBox.getSize(); + p.x += size.width / 2; + p.y += size.height / 2; + robot.mouseMove(p.x, p.y); + robot.keyPress(KeyEvent.VK_ENTER); + robot.delay(50); + robot.keyRelease(KeyEvent.VK_ENTER); + robot.delay(2000); + } + + static class MyComboBoxUI extends BasicComboBoxUI { + public void setPopupVisible(JComboBox c, boolean v) { + if (popup instanceof BasicComboPopup) { + ourPopup = (BasicComboPopup) popup; + } + super.setPopupVisible(c, v); + } + } +} From 8eb162dc229346c821b533dc11f9a73c0a701394 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 28 Apr 2023 22:42:11 +0000 Subject: [PATCH 019/459] 8306955: Open source several JComboBox jtreg tests Reviewed-by: kizune --- .../jdk/javax/swing/JComboBox/bug4167850.java | 45 +++++ .../jdk/javax/swing/JComboBox/bug4209474.java | 53 ++++++ .../jdk/javax/swing/JComboBox/bug4234119.java | 46 ++++++ .../jdk/javax/swing/JComboBox/bug4890345.java | 154 ++++++++++++++++++ .../jdk/javax/swing/JComboBox/bug4996503.java | 94 +++++++++++ 5 files changed, 392 insertions(+) create mode 100644 test/jdk/javax/swing/JComboBox/bug4167850.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4209474.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4234119.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4890345.java create mode 100644 test/jdk/javax/swing/JComboBox/bug4996503.java diff --git a/test/jdk/javax/swing/JComboBox/bug4167850.java b/test/jdk/javax/swing/JComboBox/bug4167850.java new file mode 100644 index 00000000000..5d3ed76c8b1 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4167850.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1999, 2023, 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 4167850 + @summary Verify no exception removing items from an empty list. +*/ + +import javax.swing.JComboBox; + +public class bug4167850 { + + public static void main(String[] args) { + JComboBox comboBox = new JComboBox( + new Object[] { + "Coma Berenices", + "Triangulum", + "Camelopardis", + "Cassiopea"}); + + comboBox.removeAllItems(); + comboBox.removeAllItems(); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4209474.java b/test/jdk/javax/swing/JComboBox/bug4209474.java new file mode 100644 index 00000000000..d3f060cbc8f --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4209474.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 1999, 2023, 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 4209474 + @summary setSelectedItem(int) should only fire events if selection changed - avoid recursive calls +*/ + +import javax.swing.JComboBox; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class bug4209474 { + + public static void main(String[] args) { + + JComboBox comboBox = new JComboBox( + new Object[] { + "Coma Berenices", + "Triangulum", + "Camelopardis", + "Cassiopea"}); + + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + comboBox.setSelectedIndex(0); + } + }; + + comboBox.addActionListener(listener); + comboBox.setSelectedIndex(0); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4234119.java b/test/jdk/javax/swing/JComboBox/bug4234119.java new file mode 100644 index 00000000000..b24f3ac5da9 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4234119.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1999, 2023, 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 4234119 + @summary Tests if adding items to ComboBox is slow +*/ + +import javax.swing.JComboBox; + +public class bug4234119 { + + public static void main(String args[]) { + JComboBox jComboBox1 = new JComboBox(); + long startTime = System.currentTimeMillis(); + for (int i = 0 ; i < 500; i++) { + jComboBox1.addItem(Integer.valueOf(i)); + } + long deltaTime = System.currentTimeMillis() - startTime; + if (deltaTime > 20000) { + throw new Error("Test failed: adding items to ComboBox is SLOW! (it took " + deltaTime + " ms"); + } + System.out.println("Elapsed time: " + deltaTime); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4890345.java b/test/jdk/javax/swing/JComboBox/bug4890345.java new file mode 100644 index 00000000000..8a535f4f332 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4890345.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2004, 2023, 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 4890345 + @requires (os.family == "windows") + @summary 1.4.2 REGRESSION: JComboBox has problem in JTable in Windows L&F + @key headful +*/ + +import java.util.Vector; +import java.awt.BorderLayout; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.DefaultCellEditor; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.event.PopupMenuEvent; +import javax.swing.event.PopupMenuListener; + +public class bug4890345 { + + volatile boolean passed = false; + volatile boolean isLafOk = true; + + volatile JFrame mainFrame; + volatile JTable tbl; + + public static void main(String[] args) throws Exception { + bug4890345 test = new bug4890345(); + try { + SwingUtilities.invokeAndWait(test::createUI); + if (!test.isLafOk) { + throw new RuntimeException("Could not create Win L&F"); + } + test.test(); + } finally { + JFrame f = test.mainFrame; + if (f != null) { + SwingUtilities.invokeAndWait(() -> f.dispose()); + } + } + } + + void createUI() { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (Exception ex) { + System.err.println("Can not initialize Windows L&F. Testing skipped."); + isLafOk = false; + } + + if (isLafOk) { + mainFrame = new JFrame("Bug4890345"); + String[] items = {"tt", "aa", "gg", "zz", "dd", "ll" }; + JComboBox comboBox = new JComboBox(items); + + tbl = new JTable(); + JScrollPane panel = new JScrollPane(tbl); + TableModel tm = createTableModel(); + tbl.setModel(tm); + tbl.setRowHeight(20); + tbl.getColumnModel().getColumn(1).setCellEditor( + new DefaultCellEditor(comboBox)); + + comboBox.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + passed = true; + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {} + public void popupMenuCanceled(PopupMenuEvent e) {} + }); + + mainFrame.setLayout(new BorderLayout()); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.add(panel, BorderLayout.CENTER); + mainFrame.pack(); + mainFrame.setLocationRelativeTo(null); + mainFrame.setVisible(true); + } + } + + public void test() throws Exception { + Robot robo = new Robot(); + robo.setAutoDelay(50); + robo.delay(1000); + tbl.editCellAt(0,0); + + robo.keyPress(KeyEvent.VK_TAB); + robo.keyRelease(KeyEvent.VK_TAB); + + robo.keyPress(KeyEvent.VK_TAB); + robo.keyRelease(KeyEvent.VK_TAB); + + robo.keyPress(KeyEvent.VK_F2); + robo.keyRelease(KeyEvent.VK_F2); + + robo.keyPress(KeyEvent.VK_DOWN); + robo.keyRelease(KeyEvent.VK_DOWN); + + robo.keyPress(KeyEvent.VK_ENTER); + robo.keyRelease(KeyEvent.VK_ENTER); + + robo.delay(1000); + + if (!passed) { + throw new RuntimeException("Popup was not shown after VK_DOWN press. Test failed."); + } + } + + private TableModel createTableModel() { + Vector hdr = new Vector(); + hdr.add("One"); + hdr.add("Two"); + Vector data = new Vector(); + Vector row = new Vector(); + row.add("tt"); + row.add("dd"); + data.add(row); + row = new Vector(); + row.add("ll"); + row.add("jj"); + data.add(row); + return new DefaultTableModel(data, hdr); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4996503.java b/test/jdk/javax/swing/JComboBox/bug4996503.java new file mode 100644 index 00000000000..8e12a3e5743 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4996503.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2004, 2023, 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 4996503 + @summary REGRESSION: NotSerializableException: javax.swing.plaf.basic.BasicComboPopup+1 + @key headful +*/ + +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; +import java.io.IOException; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.awt.event.InputEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4996503 { + + static volatile JFrame frame = null; + static volatile JComboBox comboBox = null; + + public static void main(String[] args) throws Exception { + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("bug4996503"); + String[] items = { "item0", "item1", "item2" }; + comboBox = new JComboBox(items); + frame.add(comboBox); + frame.pack(); + frame.validate(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.delay(1000); + Point p = comboBox.getLocationOnScreen(); + Dimension size = comboBox.getSize(); + p.x += size.width / 2; + p.y += size.height / 2; + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + + ObjectOutputStream out = null; + + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + try { + out = new ObjectOutputStream(byteStream); + } catch (IOException e) {} + if (out != null) { + try { + out.writeObject(comboBox); + } catch (Exception e) { + System.out.println(e); + throw new Error("Serialization exception. Test failed."); + } + } + } finally { + if (frame != null) { + SwingUtilities.invokeAndWait(frame::dispose); + } + } + } +} From 6652b5d2dc2a33411d6a8c5f13d90f79771b4ff4 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sat, 29 Apr 2023 01:29:13 +0000 Subject: [PATCH 020/459] 8307135: java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java failed Reviewed-by: jiefu, prr --- .../NotReallySerializableTest/NotReallySerializableTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java b/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java index 84fd2dfd4f0..1c80f479eef 100644 --- a/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java +++ b/test/jdk/java/awt/dnd/NotReallySerializableTest/NotReallySerializableTest.java @@ -23,6 +23,7 @@ /* @test + @key headful @bug 4187912 @summary Test that some incorrectly written DnD code cannot hang the app @run main NotReallySerializableTest @@ -116,4 +117,4 @@ class TrickDropTargetListener extends DropTargetAdapter Object trick = new Object(); public void drop(DropTargetDropEvent dtde) {} -} \ No newline at end of file +} From 82148683fef46d43dafd6739d3f591355ced03b3 Mon Sep 17 00:00:00 2001 From: SirYwell Date: Sat, 29 Apr 2023 07:48:14 +0000 Subject: [PATCH 021/459] 8304837: Classfile API throws IOOBE for MethodParameters attribute without parameter names Reviewed-by: asotona, jwaters, vromero --- .../classfile/impl/BoundAttribute.java | 4 +- .../jdk/jdk/classfile/BoundAttributeTest.java | 71 +++++++++++++++++++ 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 test/jdk/jdk/classfile/BoundAttributeTest.java diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java b/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java index d7243e27345..c7fd1908ca8 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -360,7 +360,7 @@ public List parameters() { int p = payloadStart + 1; int pEnd = p + (cnt * 4); for (int i = 0; p < pEnd; p += 4, i++) { - Utf8Entry name = classReader.readUtf8Entry(p); + Utf8Entry name = classReader.readUtf8EntryOrNull(p); int accessFlags = classReader.readU2(p + 2); elements[i] = MethodParameterInfo.of(Optional.ofNullable(name), accessFlags); } diff --git a/test/jdk/jdk/classfile/BoundAttributeTest.java b/test/jdk/jdk/classfile/BoundAttributeTest.java new file mode 100644 index 00000000000..3dc09a79bc0 --- /dev/null +++ b/test/jdk/jdk/classfile/BoundAttributeTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8304837 + * @summary Testing BoundAttributes + * @run junit BoundAttributeTest + */ +import jdk.internal.classfile.Attributes; +import jdk.internal.classfile.ClassModel; +import jdk.internal.classfile.Classfile; +import jdk.internal.classfile.CodeBuilder; +import jdk.internal.classfile.attribute.MethodParameterInfo; +import jdk.internal.classfile.attribute.MethodParametersAttribute; +import org.junit.jupiter.api.Test; +import org.opentest4j.AssertionFailedError; + +import java.lang.constant.ClassDesc; +import java.lang.constant.ConstantDescs; +import java.lang.constant.MethodTypeDesc; +import java.util.List; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertTrue; + +class BoundAttributeTest { + + @Test + void testReadMethodParametersAttributeWithoutParameterName() { + // build a simple method: void method(int) + MethodTypeDesc methodTypeDesc = MethodTypeDesc.of(ConstantDescs.CD_void, ConstantDescs.CD_int); + byte[] raw = Classfile.build(ClassDesc.of("TestClass"), builder -> { + builder.withMethod("method", methodTypeDesc, 0, mb -> { + mb.withCode(CodeBuilder::return_); + // add a MethodParameters attribute without name for the parameter + mb.with(MethodParametersAttribute.of(MethodParameterInfo.ofParameter(Optional.empty(), 0))); + }); + }); + ClassModel model = Classfile.parse(raw); + MethodParametersAttribute methodParametersAttribute = model.methods().get(0) + .findAttribute(Attributes.METHOD_PARAMETERS) + .orElseThrow(() -> new AssertionFailedError("Attribute not present")); + // MethodParametersAttribute#parameters() materializes the parameters + List parameters = assertDoesNotThrow(methodParametersAttribute::parameters); + assertTrue(parameters.get(0).name().isEmpty()); + } +} From 0a294d909a60a4a2145a9b2fe21b204447502a6b Mon Sep 17 00:00:00 2001 From: Lance Andersen Date: Sat, 29 Apr 2023 14:37:13 +0000 Subject: [PATCH 022/459] 8307088: Allow the jdbc.drivers system property to be searchable Reviewed-by: naoto, joehw --- src/java.sql/share/classes/java/sql/DriverManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java.sql/share/classes/java/sql/DriverManager.java b/src/java.sql/share/classes/java/sql/DriverManager.java index f7733cfb62e..7b171b2e52c 100644 --- a/src/java.sql/share/classes/java/sql/DriverManager.java +++ b/src/java.sql/share/classes/java/sql/DriverManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2023, 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 @@ -52,7 +52,7 @@ * As part of its initialization, the {@code DriverManager} class will * attempt to load available JDBC drivers by using: *