GraphvizGrapher fails with non-descriptive NullPointerException when writer is not set
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 1.7k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
If `GraphvizGrapher#graph()` is invoked befroe the output `PrintWriter` is set, then a not very useful `NullPointerException` is thrown:
```
java.lang.NullPointerException
at com.google.inject.grapher.graphviz.GraphvizGrapher.start(GraphvizGrapher.java:100)
at com.google.inject.grapher.graphviz.GraphvizGrapher.postProcess(GraphvizGrapher.java:78)
at com.google.inject.grapher.AbstractInjectorGrapher.graph(AbstractInjectorGrapher.java:112)
at com.google.inject.grapher.AbstractInjectorGrapher.graph(AbstractInjectorGrapher.java:102)
```
Adding a `Preconditions.checkNotNull` with a more descriptive message at the beginning of [`GraphvizGrapher#postProcess()`](https://github.com/google/guice/blob/master/extensions/grapher/src/com/google/inject/grapher/graphviz/GraphvizGrapher.java#L77), or something along those lines, would be helpful.
Contributor guide
Assessment
This issue has not been assessed yet.