/** * Returns the snapshot of the FTL stack trace at the time this exception was created. */ public String getFTLInstructionStack() { synchronized (lock) { if (ftlInstructionStackSnapshot != null || renderedFtlInstructionStackSnapshot != null) { if (renderedFtlInstructionStackSnapshot == null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); _CoreAPI.outputInstructionStack(ftlInstructionStackSnapshot, false, pw); pw.close(); if (renderedFtlInstructionStackSnapshot == null) { renderedFtlInstructionStackSnapshot = sw.toString(); deleteFTLInstructionStackSnapshotIfNotNeeded(); } } return renderedFtlInstructionStackSnapshot; } else { return null; } } }
private String getFTLInstructionStackTopFew() { synchronized (lock) { if (ftlInstructionStackSnapshot != null || renderedFtlInstructionStackSnapshotTop != null) { if (renderedFtlInstructionStackSnapshotTop == null) { int stackSize = ftlInstructionStackSnapshot.length; String s; if (stackSize == 0) { s = ""; } else { StringWriter sw = new StringWriter(); _CoreAPI.outputInstructionStack(ftlInstructionStackSnapshot, true, sw); s = sw.toString(); } if (renderedFtlInstructionStackSnapshotTop == null) { renderedFtlInstructionStackSnapshotTop = s; deleteFTLInstructionStackSnapshotIfNotNeeded(); } } return renderedFtlInstructionStackSnapshotTop.length() != 0 ? renderedFtlInstructionStackSnapshotTop : null; } else { return null; } } }
private void calculatePosition() { synchronized (lock) { if (!positionsCalculated) { // The expressions is the argument of the template element, so we prefer it as it's more specific. TemplateObject templateObject = blamedExpression != null ? (TemplateObject) blamedExpression : ( ftlInstructionStackSnapshot != null && ftlInstructionStackSnapshot.length != 0 ? ftlInstructionStackSnapshot[0] : null); // Line number blow 0 means no info, negative means position in ?eval-ed value that we won't use here. if (templateObject != null && templateObject.getBeginLine() > 0) { final Template template = templateObject.getTemplate(); templateName = template != null ? template.getName() : null; templateSourceName = template != null ? template.getSourceName() : null; lineNumber = Integer.valueOf(templateObject.getBeginLine()); columnNumber = Integer.valueOf(templateObject.getBeginColumn()); endLineNumber = Integer.valueOf(templateObject.getEndLine()); endColumnNumber = Integer.valueOf(templateObject.getEndColumn()); } positionsCalculated = true; deleteFTLInstructionStackSnapshotIfNotNeeded(); } } }
/** * Returns the snapshot of the FTL stack trace at the time this exception was created. */ public String getFTLInstructionStack() { synchronized (lock) { if (ftlInstructionStackSnapshot != null || renderedFtlInstructionStackSnapshot != null) { if (renderedFtlInstructionStackSnapshot == null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); _CoreAPI.outputInstructionStack(ftlInstructionStackSnapshot, false, pw); pw.close(); if (renderedFtlInstructionStackSnapshot == null) { renderedFtlInstructionStackSnapshot = sw.toString(); deleteFTLInstructionStackSnapshotIfNotNeeded(); } } return renderedFtlInstructionStackSnapshot; } else { return null; } } }
/** * Returns the snapshot of the FTL stack trace at the time this exception was created. */ public String getFTLInstructionStack() { synchronized (lock) { if (ftlInstructionStackSnapshot != null || renderedFtlInstructionStackSnapshot != null) { if (renderedFtlInstructionStackSnapshot == null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); _CoreAPI.outputInstructionStack(ftlInstructionStackSnapshot, false, pw); pw.close(); if (renderedFtlInstructionStackSnapshot == null) { renderedFtlInstructionStackSnapshot = sw.toString(); deleteFTLInstructionStackSnapshotIfNotNeeded(); } } return renderedFtlInstructionStackSnapshot; } else { return null; } } }
private String getFTLInstructionStackTopFew() { synchronized (lock) { if (ftlInstructionStackSnapshot != null || renderedFtlInstructionStackSnapshotTop != null) { if (renderedFtlInstructionStackSnapshotTop == null) { int stackSize = ftlInstructionStackSnapshot.length; String s; if (stackSize == 0) { s = ""; } else { StringWriter sw = new StringWriter(); _CoreAPI.outputInstructionStack(ftlInstructionStackSnapshot, true, sw); s = sw.toString(); } if (renderedFtlInstructionStackSnapshotTop == null) { renderedFtlInstructionStackSnapshotTop = s; deleteFTLInstructionStackSnapshotIfNotNeeded(); } } return renderedFtlInstructionStackSnapshotTop.length() != 0 ? renderedFtlInstructionStackSnapshotTop : null; } else { return null; } } }
private String getFTLInstructionStackTopFew() { synchronized (lock) { if (ftlInstructionStackSnapshot != null || renderedFtlInstructionStackSnapshotTop != null) { if (renderedFtlInstructionStackSnapshotTop == null) { int stackSize = ftlInstructionStackSnapshot.length; String s; if (stackSize == 0) { s = ""; } else { StringWriter sw = new StringWriter(); _CoreAPI.outputInstructionStack(ftlInstructionStackSnapshot, true, sw); s = sw.toString(); } if (renderedFtlInstructionStackSnapshotTop == null) { renderedFtlInstructionStackSnapshotTop = s; deleteFTLInstructionStackSnapshotIfNotNeeded(); } } return renderedFtlInstructionStackSnapshotTop.length() != 0 ? renderedFtlInstructionStackSnapshotTop : null; } else { return null; } } }
private void calculatePosition() { synchronized (lock) { if (!positionsCalculated) { // The expressions is the argument of the template element, so we prefer it as it's more specific. TemplateObject templateObject = blamedExpression != null ? (TemplateObject) blamedExpression : ( ftlInstructionStackSnapshot != null && ftlInstructionStackSnapshot.length != 0 ? ftlInstructionStackSnapshot[0] : null); // Line number blow 0 means no info, negative means position in ?eval-ed value that we won't use here. if (templateObject != null && templateObject.getBeginLine() > 0) { final Template template = templateObject.getTemplate(); templateName = template != null ? template.getName() : null; templateSourceName = template != null ? template.getSourceName() : null; lineNumber = Integer.valueOf(templateObject.getBeginLine()); columnNumber = Integer.valueOf(templateObject.getBeginColumn()); endLineNumber = Integer.valueOf(templateObject.getEndLine()); endColumnNumber = Integer.valueOf(templateObject.getEndColumn()); } positionsCalculated = true; deleteFTLInstructionStackSnapshotIfNotNeeded(); } } }
private void calculatePosition() { synchronized (lock) { if (!positionsCalculated) { // The expressions is the argument of the template element, so we prefer it as it's more specific. TemplateObject templateObject = blamedExpression != null ? (TemplateObject) blamedExpression : ( ftlInstructionStackSnapshot != null && ftlInstructionStackSnapshot.length != 0 ? ftlInstructionStackSnapshot[0] : null); // Line number blow 0 means no info, negative means position in ?eval-ed value that we won't use here. if (templateObject != null && templateObject.getBeginLine() > 0) { final Template template = templateObject.getTemplate(); templateName = template != null ? template.getName() : null; templateSourceName = template != null ? template.getSourceName() : null; lineNumber = Integer.valueOf(templateObject.getBeginLine()); columnNumber = Integer.valueOf(templateObject.getBeginColumn()); endLineNumber = Integer.valueOf(templateObject.getEndLine()); endColumnNumber = Integer.valueOf(templateObject.getEndColumn()); } positionsCalculated = true; deleteFTLInstructionStackSnapshotIfNotNeeded(); } } }