Skip to content

Commit 576f969

Browse files
serhiysachkovSendaoYan
authored andcommitted
8361106: [TEST] com/sun/net/httpserver/Test9.java fails with java.nio.file.FileSystemException
Reviewed-by: dfuchs
1 parent dadbad0 commit 576f969

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

test/jdk/com/sun/net/httpserver/Test9.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ public class Test9 extends Test {
5959
HttpServer.class.getPackageName() + '-' + Test9.class.getSimpleName() + '-';
6060

6161
static SSLContext ctx;
62-
static boolean error = false;
62+
static volatile boolean error = false;
6363

6464
public static void main (String[] args) throws Exception {
6565
HttpServer s1 = null;
6666
HttpsServer s2 = null;
6767
ExecutorService executor=null;
6868
Path smallFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 23);
6969
Path largeFilePath = createTempFileOfSize(TEMP_FILE_PREFIX, null, 2730088);
70+
smallFilePath.toFile().deleteOnExit();
71+
largeFilePath.toFile().deleteOnExit();
7072
try {
7173
System.out.print ("Test9: ");
7274
InetAddress loopback = InetAddress.getLoopbackAddress();
@@ -122,20 +124,16 @@ public static void main (String[] args) throws Exception {
122124
s2.stop(0);
123125
if (executor != null)
124126
executor.shutdown ();
125-
Files.delete(smallFilePath);
126-
Files.delete(largeFilePath);
127127
}
128128
}
129129

130-
static int foo = 1;
131-
132130
static ClientThread test (boolean fixedLen, String protocol, int port, Path filePath) throws Exception {
133131
ClientThread t = new ClientThread (fixedLen, protocol, port, filePath);
134132
t.start();
135133
return t;
136134
}
137135

138-
static Object fileLock = new Object();
136+
static final Object fileLock = new Object();
139137

140138
static class ClientThread extends Thread {
141139

@@ -203,9 +201,8 @@ public boolean verify (String s, SSLSession s1) {
203201
error = true;
204202
}
205203
assertFileContentsEqual(filePath, temp.toPath());
206-
temp.delete();
207204
} catch (Exception e) {
208-
e.printStackTrace();
205+
System.err.println("Error occurred: " + e);
209206
error = true;
210207
}
211208
}

0 commit comments

Comments
 (0)