Mercurial > hg > graal-compiler
changeset 7153:c421c19b7bf8
made initialization of GraphPrinterDumpHandler.sdf be lazy to workaround an initialization order issue during VM start up
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 12 Dec 2012 15:46:11 +0100 |
parents | e86ac899c5be |
children | 5d0bb7d52783 |
files | graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Tue Dec 11 20:54:11 2012 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Wed Dec 12 15:46:11 2012 +0100 @@ -39,7 +39,6 @@ * inspected with the <a href="http://kenai.com/projects/igv">Ideal Graph Visualizer</a>. */ public class GraphPrinterDumpHandler implements DebugDumpHandler { - private static final SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd-HHmm"); private GraphPrinter printer; private List<String> previousInlineContext; @@ -66,6 +65,11 @@ } } + // This field must be lazily initialized as this class may be loaded in a version + // VM startup phase at which not all required features (such as system properties) + // are online. + private static SimpleDateFormat sdf; + private void initializeFilePrinter() { String ext; if (GraalOptions.PrintBinaryGraphs) { @@ -73,6 +77,9 @@ } else { ext = ".gv.xml"; } + if (sdf == null) { + sdf = new SimpleDateFormat("YYYY-MM-dd-HHmm"); + } String fileName = "Graphs-" + Thread.currentThread().getName() + "-" + sdf.format(new Date()) + ext; try { if (GraalOptions.PrintBinaryGraphs) {