0

In ubuntu 20.04, I run a java program named batfish-tiramisu but fell into problem. The error log is shown as below:

Question: arcRAG actions=[ACCEPTED]
org.batfish.common.BatfishException: Failed to answer question
   at org.batfish.main.Batfish.answer(Batfish.java:635)
   at org.batfish.main.Batfish.run(Batfish.java:3042)
   at org.batfish.main.Driver.lambda$runBatfish$3(Driver.java:580)
   at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException
   at org.batfish.mulgraph.Rag.taint_propagate(Rag.java:191)
   at org.batfish.mulgraph.Rag.taint(Rag.java:187)
   at org.batfish.mulgraph.buildRag.run(buildRag.java:124)
   at org.batfish.mulgraph.buildTpg.buildGraph(buildTpg.java:123)
   at org.batfish.mulgraph.buildTpg.run(buildTpg.java:144)
   at org.batfish.symbolic.smt.PropertyChecker.checkRAG(PropertyChecker.java:962)
   at org.batfish.main.Batfish.arcRAG(Batfish.java:3681)
   at org.batfish.question.GraphRAGQuestionPlugin$GraphRAGAnswerer.answer(GraphRAGQuestionPlugin.java:33)
   at org.batfish.main.Batfish.answer(Batfish.java:632)
   ... 3 more

Summary: 0 (non-assertion) results; 

There wrote "3 more", how can I let it show all the function stack? Any help would be highly appreciated.

DevThiman
  • 920
  • 1
  • 9
  • 24
ylwdsd
  • 1
  • 2
  • 1
    The stacktrace elements are ordered from "most specific" on top to "least specific" on bottom. I doubt you will gain more insight into the problem by showing the "3 more" lines. – Thomas Behr Apr 13 '23 at 13:45

1 Answers1

1

'3 more' refers to the same stack as above. In other words, whenever you see '... x more' in a java stack trace like this, that only ever occurs if you're in a Caused by: ... trace. Look at the stacktrace that this stacktrace is a 'caused by' for, and take the last x lines. In other words, the missing 3 lines are the last 3 lines immediately above Caused by:

   at org.batfish.main.Batfish.run(Batfish.java:3042)
   at org.batfish.main.Driver.lambda$runBatfish$3(Driver.java:580)
   at java.base/java.lang.Thread.run(Thread.java:829)

There is no way to make java just emit this cruft and I don't really understand why you would want it to in light of the solution simply being: 'look up and count'. If you have control over the source code, you could set up a default exception handler on the main thread and write your own stack stace printer. Would be about half a page worth of code at most; check the javadoc of Throwable (particularly, getStackTrace()) for more information.

There is no way to do that without controlling the source code or other similar hacky alternatives (editing the class files, running an agent to modify them in place, etc).

rzwitserloot
  • 85,357
  • 5
  • 51
  • 72
  • That it to say, java will always print the bottom part of the function trace fisrt, and then show the 'real cause' which, in a word, are the top part of the trace. Is that correct? – ylwdsd Apr 13 '23 at 14:18
  • 1
    @ylwdsd: **not always**; only when an exception thrown in an inner scope is caught and 'wrapped' in another exception, usually one that reflects the application or context where the inner problem occurred. Like BatfishException in your case. This is a usually-helpful and thus widespread programming style/structure in Java, but it is not required or enforced; it is _possible_ for code to simply let an inner exception pass outward, in which case you get one single stack showing everything. – dave_thompson_085 Apr 13 '23 at 15:16