mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-01 03:30:34 +00:00
8130424: if directory specified with --dest-dir does not exist, only .class files are dumped and .js files are not
Reviewed-by: attila, lagergren, hannesw
This commit is contained in:
parent
52cdae26ef
commit
833d238585
@ -88,7 +88,7 @@ public final class DumpBytecode {
|
||||
}
|
||||
|
||||
|
||||
// should code be dumped to disk - only valid in compile_only mode?
|
||||
// should code be dumped to disk
|
||||
if (env._dest_dir != null) {
|
||||
final String fileName = className.replace('.', File.separatorChar) + ".class";
|
||||
final int index = fileName.lastIndexOf(File.separatorChar);
|
||||
|
||||
@ -995,7 +995,7 @@ public final class Source implements Loggable {
|
||||
return initLogger(Context.getContextTrusted());
|
||||
}
|
||||
|
||||
private File dumpFile(final String dir) {
|
||||
private File dumpFile(final File dirFile) {
|
||||
final URL u = getURL();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
// make it unique by prefixing current date & time
|
||||
@ -1010,11 +1010,17 @@ public final class Source implements Loggable {
|
||||
buf.append(getName());
|
||||
}
|
||||
|
||||
return new File(dir, buf.toString());
|
||||
return new File(dirFile, buf.toString());
|
||||
}
|
||||
|
||||
void dump(final String dir) {
|
||||
final File file = dumpFile(dir);
|
||||
final File dirFile = new File(dir);
|
||||
final File file = dumpFile(dirFile);
|
||||
if (!dirFile.exists() && !dirFile.mkdirs()) {
|
||||
debug("Skipping source dump for " + name);
|
||||
return;
|
||||
}
|
||||
|
||||
try (final FileOutputStream fos = new FileOutputStream(file)) {
|
||||
final PrintWriter pw = new PrintWriter(fos);
|
||||
pw.print(data.toString());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user