Avoid closing System.out after All-Users GC in NoteDB migration

By using try-with-resource wrappers around System.out for the garbage
collection of the `All-Users` repo, System.out got closed when the
wrappers got closed after the garbage collection. Due to the closed
System.out, the final status messages of the migration got swallowed
and did not make it to the screen.

We no longer close the wrappers to keep System.out open.

Bug: Issue 12935
Change-Id: I549a027f4ef7bbd863f08532b849e4c43b3d50e1
This commit is contained in:
Christian Aistleitner
2020-06-14 11:57:33 +02:00
parent 8db58c8fc2
commit 11770a5658

View File

@@ -149,9 +149,11 @@ public class MigrateToNoteDb extends SiteProgram {
migrator.migrate();
}
}
try (PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out, UTF_8), true)) {
gcAllUsers.run(w);
}
PrintWriter w = new PrintWriter(new OutputStreamWriter(System.out, UTF_8), true);
gcAllUsers.run(w);
// No closing of the PrintWriter here, as it would cascade down and eventually close
// System.out and thereby swallow further output.
} finally {
stop();
}