8204521: compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java fails trying to delete temp file

Reviewed-by: kvn
This commit is contained in:
Dean Long 2018-11-05 22:22:49 -08:00
parent 1e9d3b5358
commit 88fec44661
2 changed files with 10 additions and 13 deletions

View File

@ -43,8 +43,6 @@ compiler/intrinsics/mathexact/LongMulOverflowTest.java 8196568 generi
compiler/jvmci/SecurityRestrictionsTest.java 8181837 generic-all
compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java 8204521 windows-all
compiler/unsafe/UnsafeGetConstantField.java 8181833 generic-all
compiler/unsafe/UnsafeGetStableArrayElement.java 8181833 generic-all
compiler/unsafe/UnsafeOffHeapBooleanTest.java 8181833 generic-all

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -115,16 +115,15 @@ public class RedefineMethodUsedByMultipleMethodHandles {
mainAttrs.putValue("Can-Redefine-Classes", "true");
mainAttrs.putValue("Can-Retransform-Classes", "true");
Path jar = Files.createTempFile("myagent", ".jar");
try {
JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
add(jarStream, FooAgent.class);
add(jarStream, FooTransformer.class);
jarStream.close();
runAgent(jar);
} finally {
Files.deleteIfExists(jar);
}
// The jar file will be added to the system classloader search path. It is not safe
// to delete it while the JVM is running, so make sure to create it in the test
// directory so it will be cleaned up by the test harness.
Path jar = Files.createTempFile(Path.of(""), "myagent", ".jar");
JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
add(jarStream, FooAgent.class);
add(jarStream, FooTransformer.class);
jarStream.close();
runAgent(jar);
}
public static void runAgent(Path agent) throws Exception {