From 450567031ec32846c9a8f157eb56bd099b17b5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Jeli=C5=84ski?= Date: Mon, 20 Mar 2023 09:31:33 +0000 Subject: [PATCH] 8304174: Remove delays from httpserver tests Reviewed-by: jpai, dfuchs --- test/jdk/com/sun/net/httpserver/DateFormatterTest.java | 4 ++-- test/jdk/com/sun/net/httpserver/HttpServerTest.java | 4 ++-- test/jdk/com/sun/net/httpserver/SelCacheTest.java | 7 +++---- test/jdk/com/sun/net/httpserver/Test.java | 8 +------- test/jdk/com/sun/net/httpserver/Test1.java | 7 +++---- test/jdk/com/sun/net/httpserver/Test10.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test11.java | 4 ++-- test/jdk/com/sun/net/httpserver/Test12.java | 7 +++---- test/jdk/com/sun/net/httpserver/Test13.java | 7 +++---- test/jdk/com/sun/net/httpserver/Test14.java | 4 ++-- test/jdk/com/sun/net/httpserver/Test2.java | 4 ++-- test/jdk/com/sun/net/httpserver/Test3.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test4.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test5.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test6.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test6a.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test7.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test7a.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test8.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test8a.java | 5 ++--- test/jdk/com/sun/net/httpserver/Test9.java | 7 +++---- test/jdk/com/sun/net/httpserver/Test9a.java | 5 ++--- test/jdk/com/sun/net/httpserver/TestLogging.java | 5 ++--- .../bugs/8199849/BasicAuthenticatorCharset.java | 4 ++-- .../net/httpserver/bugs/8199849/TestHttpUnicode.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6339483.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6341616.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6361557.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6393710.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6401598.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6431193.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6433018.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6526158.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6526913.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6529200.java | 10 +++++----- test/jdk/com/sun/net/httpserver/bugs/B6744329.java | 4 ++-- test/jdk/com/sun/net/httpserver/bugs/B6886436.java | 6 +++--- test/jdk/com/sun/net/httpserver/bugs/B8211420.java | 4 ++-- .../bugs/HttpExchange/AutoCloseableHttpExchange.java | 4 ++-- test/lib/jdk/test/lib/net/SimpleHttpServer.java | 4 ++-- 40 files changed, 88 insertions(+), 111 deletions(-) diff --git a/test/jdk/com/sun/net/httpserver/DateFormatterTest.java b/test/jdk/com/sun/net/httpserver/DateFormatterTest.java index 47ff79e26e792..bda3421660c04 100644 --- a/test/jdk/com/sun/net/httpserver/DateFormatterTest.java +++ b/test/jdk/com/sun/net/httpserver/DateFormatterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 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 @@ -87,7 +87,7 @@ public void setUp() throws IOException, URISyntaxException { @AfterTest public void cleanUp() { - server.stop(1); + server.stop(0); } @Test diff --git a/test/jdk/com/sun/net/httpserver/HttpServerTest.java b/test/jdk/com/sun/net/httpserver/HttpServerTest.java index f2d604cbdcb5e..b272bafc24139 100644 --- a/test/jdk/com/sun/net/httpserver/HttpServerTest.java +++ b/test/jdk/com/sun/net/httpserver/HttpServerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -60,7 +60,7 @@ public void handle(HttpExchange ex) throws IOException { sendHttpStatusCode(HTTP_STATUS_CODE_OK, ex); System.out.println("Stopping server ..."); - server.stop(1); + server.stop(0); serverStopped.countDown(); } diff --git a/test/jdk/com/sun/net/httpserver/SelCacheTest.java b/test/jdk/com/sun/net/httpserver/SelCacheTest.java index 74b6d09a139c7..644e64419e0e2 100644 --- a/test/jdk/com/sun/net/httpserver/SelCacheTest.java +++ b/test/jdk/com/sun/net/httpserver/SelCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -89,9 +89,8 @@ public static void main(String[] args) throws Exception { test(false, "https", root+"/test1", loopback, httpsport, "largefile.txt", 2730088); System.out.println("OK"); } finally { - delay(); - s1.stop(2); - s2.stop(2); + s1.stop(0); + s2.stop(0); executor.shutdown(); } } diff --git a/test/jdk/com/sun/net/httpserver/Test.java b/test/jdk/com/sun/net/httpserver/Test.java index 6a734a6ad5628..f46e668168f6e 100644 --- a/test/jdk/com/sun/net/httpserver/Test.java +++ b/test/jdk/com/sun/net/httpserver/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -35,10 +35,4 @@ static void enableLogging() { logger.setLevel(Level.ALL); logger.addHandler(h); } - - static void delay () { - try { - Thread.sleep (1000); - } catch (Exception e) {} - } } diff --git a/test/jdk/com/sun/net/httpserver/Test1.java b/test/jdk/com/sun/net/httpserver/Test1.java index 1c5dc5669fca0..bd8cc705e329e 100644 --- a/test/jdk/com/sun/net/httpserver/Test1.java +++ b/test/jdk/com/sun/net/httpserver/Test1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -95,11 +95,10 @@ public static void main (String[] args) throws Exception { test (false, "https", root+"/test1", httpsport, "largefile.txt", 2730088); System.out.println ("OK"); } finally { - delay(); if (s1 != null) - s1.stop(2); + s1.stop(0); if (s2 != null) - s2.stop(2); + s2.stop(0); if (executor != null) executor.shutdown (); } diff --git a/test/jdk/com/sun/net/httpserver/Test10.java b/test/jdk/com/sun/net/httpserver/Test10.java index c15ddc48d6fe0..d43480e8b8df4 100644 --- a/test/jdk/com/sun/net/httpserver/Test10.java +++ b/test/jdk/com/sun/net/httpserver/Test10.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 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 @@ -57,9 +57,8 @@ public static void main (String[] args) throws Exception { doClient(port); System.out.println ("OK"); } finally { - delay(); if (server != null) - server.stop(2); + server.stop(0); if (exec != null) exec.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/Test11.java b/test/jdk/com/sun/net/httpserver/Test11.java index d8a58bb36b09c..9d9036d034857 100644 --- a/test/jdk/com/sun/net/httpserver/Test11.java +++ b/test/jdk/com/sun/net/httpserver/Test11.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -78,7 +78,7 @@ public static void main (String[] args) throws Exception { System.out.println ("OK"); } finally { s.shutdown(); - server.stop(2); + server.stop(0); } } } diff --git a/test/jdk/com/sun/net/httpserver/Test12.java b/test/jdk/com/sun/net/httpserver/Test12.java index 95e179db19819..91354d38f8871 100644 --- a/test/jdk/com/sun/net/httpserver/Test12.java +++ b/test/jdk/com/sun/net/httpserver/Test12.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -88,11 +88,10 @@ public static void main (String[] args) throws Exception { join (r); System.out.println ("OK"); } finally { - delay(); if (s1 != null) - s1.stop(2); + s1.stop(0); if (s2 != null) - s2.stop(2); + s2.stop(0); if (executor != null) executor.shutdown (); } diff --git a/test/jdk/com/sun/net/httpserver/Test13.java b/test/jdk/com/sun/net/httpserver/Test13.java index 138acd8710539..f0ee7a8e6c61f 100644 --- a/test/jdk/com/sun/net/httpserver/Test13.java +++ b/test/jdk/com/sun/net/httpserver/Test13.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -93,11 +93,10 @@ public static void main (String[] args) throws Exception { join (r); System.out.println ("OK"); } finally { - delay(); if (s1 != null) - s1.stop(2); + s1.stop(0); if (s2 != null) - s2.stop(2); + s2.stop(0); if (executor != null) executor.shutdown (); } diff --git a/test/jdk/com/sun/net/httpserver/Test14.java b/test/jdk/com/sun/net/httpserver/Test14.java index 8e023f9cd5af9..532078e82156b 100644 --- a/test/jdk/com/sun/net/httpserver/Test14.java +++ b/test/jdk/com/sun/net/httpserver/Test14.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -114,7 +114,7 @@ public static void main (String[] args) throws Exception { output = output + (char)x; } error = !output.equals (test_output); - server.stop(2); + server.stop(0); executor.shutdown(); if (error ) { throw new RuntimeException ("test failed error"); diff --git a/test/jdk/com/sun/net/httpserver/Test2.java b/test/jdk/com/sun/net/httpserver/Test2.java index 296d8b4b19dbd..dd675c8933fe8 100644 --- a/test/jdk/com/sun/net/httpserver/Test2.java +++ b/test/jdk/com/sun/net/httpserver/Test2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -79,7 +79,7 @@ public boolean checkCredentials (String username, String pw) { while (is.read()!= -1) { c ++; } - server.stop(2); + server.stop(0); executor.shutdown(); if (error ) { throw new RuntimeException ("test failed error"); diff --git a/test/jdk/com/sun/net/httpserver/Test3.java b/test/jdk/com/sun/net/httpserver/Test3.java index 7e40b9505fe3c..a9dab54a388bd 100644 --- a/test/jdk/com/sun/net/httpserver/Test3.java +++ b/test/jdk/com/sun/net/httpserver/Test3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -64,9 +64,8 @@ public static void main (String[] args) throws Exception { doClient(port); System.out.println ("OK"); } finally { - delay(); if (server != null) - server.stop(2); + server.stop(0); if (exec != null) exec.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/Test4.java b/test/jdk/com/sun/net/httpserver/Test4.java index e6527f272db90..996614c0a4cca 100644 --- a/test/jdk/com/sun/net/httpserver/Test4.java +++ b/test/jdk/com/sun/net/httpserver/Test4.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -62,9 +62,8 @@ public static void main (String[] args) throws Exception { doClient(port); System.out.println ("OK"); } finally { - delay(); if (server != null) - server.stop(2); + server.stop(0); if (exec != null) exec.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/Test5.java b/test/jdk/com/sun/net/httpserver/Test5.java index 31c42f12e7211..b57778a522663 100644 --- a/test/jdk/com/sun/net/httpserver/Test5.java +++ b/test/jdk/com/sun/net/httpserver/Test5.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -63,9 +63,8 @@ public static void main (String[] args) throws Exception { doClient(port); System.out.println ("OK"); } finally { - delay (); if (server != null) - server.stop(2); + server.stop(0); if (exec != null) exec.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/Test6.java b/test/jdk/com/sun/net/httpserver/Test6.java index f13277e4994be..cf49cead89b6c 100644 --- a/test/jdk/com/sun/net/httpserver/Test6.java +++ b/test/jdk/com/sun/net/httpserver/Test6.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -81,8 +81,7 @@ public static void main (String[] args) throws Exception { if (error) { throw new RuntimeException ("test failed error"); } - delay(); - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); diff --git a/test/jdk/com/sun/net/httpserver/Test6a.java b/test/jdk/com/sun/net/httpserver/Test6a.java index 73daf0a5f1b9a..bbe107f5e2fdd 100644 --- a/test/jdk/com/sun/net/httpserver/Test6a.java +++ b/test/jdk/com/sun/net/httpserver/Test6a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -86,8 +86,7 @@ public static void main (String[] args) throws Exception { if (error) { throw new RuntimeException ("test failed error"); } - delay(); - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); diff --git a/test/jdk/com/sun/net/httpserver/Test7.java b/test/jdk/com/sun/net/httpserver/Test7.java index e022109578dcd..2c204a8a60b5d 100644 --- a/test/jdk/com/sun/net/httpserver/Test7.java +++ b/test/jdk/com/sun/net/httpserver/Test7.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -80,8 +80,7 @@ public static void main (String[] args) throws Exception { if (error) { throw new RuntimeException ("test failed error"); } - delay(); - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); diff --git a/test/jdk/com/sun/net/httpserver/Test7a.java b/test/jdk/com/sun/net/httpserver/Test7a.java index 65e8998f9d8a3..5ff01ade9a035 100644 --- a/test/jdk/com/sun/net/httpserver/Test7a.java +++ b/test/jdk/com/sun/net/httpserver/Test7a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -89,8 +89,7 @@ public static void main (String[] args) throws Exception { if (error) { throw new RuntimeException ("test failed error"); } - delay(); - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); diff --git a/test/jdk/com/sun/net/httpserver/Test8.java b/test/jdk/com/sun/net/httpserver/Test8.java index 343421e8adce1..0dfc35e50f434 100644 --- a/test/jdk/com/sun/net/httpserver/Test8.java +++ b/test/jdk/com/sun/net/httpserver/Test8.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -80,8 +80,7 @@ public static void main (String[] args) throws Exception { if (error) { throw new RuntimeException ("test failed error"); } - delay(); - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); diff --git a/test/jdk/com/sun/net/httpserver/Test8a.java b/test/jdk/com/sun/net/httpserver/Test8a.java index 06cffa913aa92..6c642f7c22aa3 100644 --- a/test/jdk/com/sun/net/httpserver/Test8a.java +++ b/test/jdk/com/sun/net/httpserver/Test8a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -99,8 +99,7 @@ public static void main (String[] args) throws Exception { } is.close(); } finally { - delay(); - if (server != null) server.stop(2); + if (server != null) server.stop(0); if (executor != null) executor.shutdown(); } if (error) { diff --git a/test/jdk/com/sun/net/httpserver/Test9.java b/test/jdk/com/sun/net/httpserver/Test9.java index d989d7d4d3cbe..af491d2233f28 100644 --- a/test/jdk/com/sun/net/httpserver/Test9.java +++ b/test/jdk/com/sun/net/httpserver/Test9.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -100,11 +100,10 @@ public static void main (String[] args) throws Exception { System.out.println ("OK"); } finally { - delay(); if (s1 != null) - s1.stop(2); + s1.stop(0); if (s2 != null) - s2.stop(2); + s2.stop(0); if (executor != null) executor.shutdown (); } diff --git a/test/jdk/com/sun/net/httpserver/Test9a.java b/test/jdk/com/sun/net/httpserver/Test9a.java index 66b044e8d9a73..fc061886d1e73 100644 --- a/test/jdk/com/sun/net/httpserver/Test9a.java +++ b/test/jdk/com/sun/net/httpserver/Test9a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -96,9 +96,8 @@ public static void main (String[] args) throws Exception { System.out.println ("OK"); } finally { - delay(); if (server != null) - server.stop(2); + server.stop(0); if (executor != null) executor.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/TestLogging.java b/test/jdk/com/sun/net/httpserver/TestLogging.java index 4f45197872cc0..0dd1fe00dc545 100644 --- a/test/jdk/com/sun/net/httpserver/TestLogging.java +++ b/test/jdk/com/sun/net/httpserver/TestLogging.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -105,9 +105,8 @@ public static void main (String[] args) throws Exception { os.close(); is.close(); s.close(); System.out.println ("OK"); } finally { - delay(); if (s1 != null) - s1.stop(2); + s1.stop(0); if (executor != null) executor.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/bugs/8199849/BasicAuthenticatorCharset.java b/test/jdk/com/sun/net/httpserver/bugs/8199849/BasicAuthenticatorCharset.java index 4c520c91b77a6..675786242115b 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/8199849/BasicAuthenticatorCharset.java +++ b/test/jdk/com/sun/net/httpserver/bugs/8199849/BasicAuthenticatorCharset.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -181,7 +181,7 @@ public static void main(String[] args) throws Exception { connectAndAuth("/test3/defaultCharset.html", 200); } - testHttpServer.stop(2); + testHttpServer.stop(0); executor.shutdown(); // should fail once with UNICODE_PW and unsupporting character set diff --git a/test/jdk/com/sun/net/httpserver/bugs/8199849/TestHttpUnicode.java b/test/jdk/com/sun/net/httpserver/bugs/8199849/TestHttpUnicode.java index a31958d7dae85..bd608e71ca25c 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/8199849/TestHttpUnicode.java +++ b/test/jdk/com/sun/net/httpserver/bugs/8199849/TestHttpUnicode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -94,7 +94,7 @@ public boolean checkCredentials(String username, String pw) { InputStream is = testConnection.getInputStream(); while (is.read() != -1) ; } finally { - testHttpServer.stop(2); + testHttpServer.stop(0); } } } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6339483.java b/test/jdk/com/sun/net/httpserver/bugs/B6339483.java index d2a62155a9537..2bfa8ad3efc08 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6339483.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6339483.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -66,7 +66,7 @@ public static void main (String[] args) throws Exception { c ++; } } catch (IOException e) { - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6341616.java b/test/jdk/com/sun/net/httpserver/bugs/B6341616.java index d8239481c3d27..82222faf08b37 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6341616.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6341616.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -75,7 +75,7 @@ public boolean checkCredentials (String username, String pw) { c ++; } } catch (IOException e) { - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6361557.java b/test/jdk/com/sun/net/httpserver/bugs/B6361557.java index 0b5ef9488f802..57e831ec693d0 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6361557.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6361557.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -126,7 +126,7 @@ public static void main (String[] args) throws Exception { break; } } - server.stop (1); + server.stop(0); selector.close(); executor.shutdown (); diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6393710.java b/test/jdk/com/sun/net/httpserver/bugs/B6393710.java index 1eb4c2b64400c..89170e9aad94a 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6393710.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6393710.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -96,7 +96,7 @@ public boolean checkCredentials (String user, String pass) { ok = false; } finally { s.close(); - server.stop(2); + server.stop(0); } if (requests != 1) { diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6401598.java b/test/jdk/com/sun/net/httpserver/bugs/B6401598.java index 7a4477adbbadf..3a7821dbf5123 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6401598.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6401598.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -130,7 +130,7 @@ public static void main(String[] args) { } catch (Exception e) { throw new AssertionError("Unexpected exception: " + e, e); } finally { - server.stop (1); + server.stop(0); exec.shutdown(); } } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6431193.java b/test/jdk/com/sun/net/httpserver/bugs/B6431193.java index be9e75f7c3f5b..9be9759054b9a 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6431193.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6431193.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -85,7 +85,7 @@ public void handle(HttpExchange t) throws IOException { .toURL(); InputStream is = url.openConnection(Proxy.NO_PROXY).getInputStream(); read (is); - server.stop (1); + server.stop(0); if (error) { throw new RuntimeException ("error in test"); } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6433018.java b/test/jdk/com/sun/net/httpserver/bugs/B6433018.java index 6ae6607dec146..1a8e52cc34cf8 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6433018.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6433018.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -77,7 +77,7 @@ public static void main(String[] args) throws Exception { os.write(cmd.getBytes()); finished.await(30, TimeUnit.SECONDS); } finally { - server.stop(2); + server.stop(0); } if (finished.getCount() != 0) diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6526158.java b/test/jdk/com/sun/net/httpserver/bugs/B6526158.java index 5207d07e7ccbf..c38f12b49c315 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6526158.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6526158.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -78,7 +78,7 @@ public static void main (String[] args) throws Exception { } is.close(); } finally { - server.stop(2); + server.stop(0); executor.shutdown(); } if (error) { diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6526913.java b/test/jdk/com/sun/net/httpserver/bugs/B6526913.java index a8c4fe64f12af..4fb2efd67f8e8 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6526913.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6526913.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -71,7 +71,7 @@ public static void main (String[] args) throws Exception { } is.close(); } finally { - server.stop(2); + server.stop(0); executor.shutdown(); } if (error) { diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6529200.java b/test/jdk/com/sun/net/httpserver/bugs/B6529200.java index 8c86fc93daae4..3ce792ffcd7f8 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6529200.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6529200.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -72,7 +72,7 @@ public static void main (String[] args) throws Exception { /* test will timeout otherwise */ } } catch (SocketTimeoutException e) { - server.stop (2); + server.stop(0); executor.shutdown (); throw new RuntimeException ("Test failed in test1"); } @@ -92,20 +92,20 @@ public static void main (String[] args) throws Exception { buf[i++] = (byte)c; } } catch (SocketTimeoutException e) { - server.stop (2); + server.stop(0); executor.shutdown (); throw new RuntimeException ("Test failed in test2"); } String ss = new String (buf, "ISO-8859-1"); if (ss.indexOf ("\r\n\r\nhello world") == -1) { - server.stop (2); + server.stop(0); executor.shutdown (); throw new RuntimeException ("Test failed in test2: wrong string"); } System.out.println (ss); is.close (); - server.stop (2); + server.stop(0); executor.shutdown(); } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6744329.java b/test/jdk/com/sun/net/httpserver/bugs/B6744329.java index b0ecc4f480bc1..9a782fd6c9474 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6744329.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6744329.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -72,7 +72,7 @@ public static void main (String[] args) throws Exception { e.printStackTrace(); error = true; } - server.stop(2); + server.stop(0); executor.shutdown(); if (error) { throw new RuntimeException ("Test failed"); diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6886436.java b/test/jdk/com/sun/net/httpserver/bugs/B6886436.java index 710c27d4daa6b..050d2b20d5dbd 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6886436.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6886436.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 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 @@ -74,11 +74,11 @@ public static void main (String[] args) throws Exception { is.close (); } catch (IOException e) { - server.stop(2); + server.stop(0); executor.shutdown(); throw new RuntimeException ("Test failed"); } - server.stop(2); + server.stop(0); executor.shutdown(); System.out.println ("OK"); } diff --git a/test/jdk/com/sun/net/httpserver/bugs/B8211420.java b/test/jdk/com/sun/net/httpserver/bugs/B8211420.java index 7c7e13ba3b295..1a322e7945dc6 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B8211420.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B8211420.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -86,7 +86,7 @@ public static void main(String[] args) throws Exception { throw new RuntimeException("Content-length not present or has wrong value"); System.out.println("OK"); } finally { - server.stop(2); + server.stop(0); executor.shutdown(); } } diff --git a/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/AutoCloseableHttpExchange.java b/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/AutoCloseableHttpExchange.java index f53bd9765ffb1..b25854c592134 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/AutoCloseableHttpExchange.java +++ b/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/AutoCloseableHttpExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 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 @@ -101,7 +101,7 @@ public static void main(String[] args) throws Exception { connectAndCheck("/test"); } latch.await(); - testHttpServer.stop(2); + testHttpServer.stop(0); executor.shutdown(); if (exchangeCloseFail.get()) diff --git a/test/lib/jdk/test/lib/net/SimpleHttpServer.java b/test/lib/jdk/test/lib/net/SimpleHttpServer.java index a347e383b358e..312df96a64bff 100644 --- a/test/lib/jdk/test/lib/net/SimpleHttpServer.java +++ b/test/lib/jdk/test/lib/net/SimpleHttpServer.java @@ -1,6 +1,6 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 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 @@ -71,7 +71,7 @@ public void start() throws IOException, URISyntaxException { } public void stop() { - httpServer.stop(2); + httpServer.stop(0); executor.shutdown(); }