Skip to content

Commit

Permalink
8282036: Change java/util/zip/ZipFile/DeleteTempJar.java to stop Http…
Browse files Browse the repository at this point in the history
…Server cleanly in case of exceptions

Backport-of: 784fa0add77a3e473e2cdbdcc27b3ed076678565
  • Loading branch information
GoeLin committed Feb 1, 2023
1 parent 54692ca commit b10ad19
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/jdk/java/util/zip/ZipFile/DeleteTempJar.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, 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
Expand Down Expand Up @@ -72,16 +72,19 @@ public void handle(HttpExchange e) {
}
}
});
server.start();

URL url = new URL("jar:http://localhost:"
server.start();
try {
URL url = new URL("jar:http://localhost:"
+ new Integer(server.getAddress().getPort()).toString()
+ "/deletetemp.jar!/");
JarURLConnection c = (JarURLConnection)url.openConnection();
JarFile f = c.getJarFile();
check(f.getEntry("entry") != null);
System.out.println(f.getName());
server.stop(0);
JarURLConnection c = (JarURLConnection)url.openConnection();
JarFile f = c.getJarFile();
check(f.getEntry("entry") != null);
System.out.println(f.getName());
} finally {
server.stop(0);
}
}

//--------------------- Infrastructure ---------------------------
Expand Down

1 comment on commit b10ad19

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.