Skip to content

Commit

Permalink
Merge pull request #31 from wearefrank/refactor/switching-to-java-11
Browse files Browse the repository at this point in the history
Moved the exception given in xml output to the trace output
  • Loading branch information
yelga authored Jun 26, 2024
2 parents 2572fc4 + fb6d7b3 commit dcf1656
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private void xalanTransform() throws IOException {
transformer.getTraceManager().addTraceListener(traceListener);
transformer.transform(xmlSource, result);
} catch (Exception e) {
writer.append(e.toString());
this.traceListener.getSelectedTrace().addTraceContext(String.format("\n%s", e));
} finally {
writer.close();
}
Expand All @@ -93,7 +93,7 @@ private void saxonTransform() throws IOException {
transformer.transform(xmlContext.getSourceObject(), result);

} catch (Exception e) {
writer.append(e.toString());
this.traceListener.getSelectedTrace().addTraceContext(String.format("\n%s", e));
} finally {
writer.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public interface LadybugTraceListener {
/**Root trace of the tree that that holds all the traces.
* @return returns the root trace*/
Trace getRootTrace();
Trace getSelectedTrace();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
public class SaxonTraceListener extends StandardDiagnostics implements TraceListener, LadybugTraceListener {
@Getter
private final Trace rootTrace = new Trace();
@Getter
private Trace selectedTrace;
//needed because the order of the methods to end a trace is reversed for some reason by saxon
private boolean end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class XalanTraceListener implements TraceListenerEx2, LadybugTraceListene

@Getter
private final Trace rootTrace = new Trace();
@Getter
private Trace selectedTrace;
/**
* This needs to be set to true if the listener is to print an event whenever a template is invoked.
Expand Down

0 comments on commit dcf1656

Please sign in to comment.