Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE SVGDiagram.setIgnoringClipHeuristic(boolean)" because "diagram" is null #194

Open
icyerasor opened this issue Aug 30, 2022 · 6 comments

Comments

@icyerasor
Copy link

icyerasor commented Aug 30, 2022

With latest id("com.vanniktech.dependency.graph.generator") version "0.8.0" i get the following error:

./gradlew generateProjectDependencyGraph --stacktrace

> Configure project :integration
Build was configured to prefer settings repositories over project repositories but repository 'MavenRepo' was added by build file 'integration\build.gradle.kts'

> Task :generateProjectDependencyGraph FAILED
Generated SVG has not the expected format. There might be image size problems.
[Fatal Error] :-1:-1: Premature end of file.
Error processing svgSalamander://graph/
org.xml.sax.SAXParseException; Premature end of file.
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:608)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:545)
        at com.kitfox.svg.SVGUniverse.loadSVG(SVGUniverse.java:502)
        at guru.nidi.graphviz.engine.SalamanderRasterizer.createDiagram(SalamanderRasterizer.java:43)
        at guru.nidi.graphviz.engine.SalamanderRasterizer.doRasterize(SalamanderRasterizer.java:31)
        at guru.nidi.graphviz.engine.SvgRasterizer.rasterize(SvgRasterizer.java:40)
        at guru.nidi.graphviz.engine.Renderer.toImage(Renderer.java:123)
        at guru.nidi.graphviz.engine.Renderer.toFile(Renderer.java:75)
        at guru.nidi.graphviz.engine.Renderer.lambda$toFile$4(Renderer.java:61)
        at guru.nidi.graphviz.engine.EngineResult.mapIO(EngineResult.java:72)
        at guru.nidi.graphviz.engine.Renderer.toFile(Renderer.java:59)
        at com.vanniktech.dependency.graph.generator.ProjectDependencyGraphGeneratorTask.run(ProjectDependencyGraphGeneratorTask.kt:34
        ....
        ....
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':generateProjectDependencyGraph'.
> Cannot invoke "com.kitfox.svg.SVGDiagram.setIgnoringClipHeuristic(boolean)" because "diagram" is null

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':generateProjectDependencyGraph'.
        ...
        ...
Caused by: java.lang.NullPointerException: Cannot invoke "com.kitfox.svg.SVGDiagram.setIgnoringClipHeuristic(boolean)" because "diagram" is null
        at guru.nidi.graphviz.engine.SalamanderRasterizer.createDiagram(SalamanderRasterizer.java:45)
        at guru.nidi.graphviz.engine.SalamanderRasterizer.doRasterize(SalamanderRasterizer.java:31)
        at guru.nidi.graphviz.engine.SvgRasterizer.rasterize(SvgRasterizer.java:40)
        at guru.nidi.graphviz.engine.Renderer.toImage(Renderer.java:123)
        at guru.nidi.graphviz.engine.Renderer.toFile(Renderer.java:75)
        at guru.nidi.graphviz.engine.Renderer.lambda$toFile$4(Renderer.java:61)
        at guru.nidi.graphviz.engine.EngineResult.mapIO(EngineResult.java:72)
        at guru.nidi.graphviz.engine.Renderer.toFile(Renderer.java:59)
        at com.vanniktech.dependency.graph.generator.ProjectDependencyGraphGeneratorTask.run(ProjectDependencyGraphGeneratorTask.kt:34)
        ...
        ...

BUILD FAILED in 1s
4 actionable tasks: 1 executed, 3 up-to-date

see full errorlog.txt
see generated .dot file project-dependency-graph.dot.txt

With id("com.vanniktech.dependency.graph.generator") version "0.7.0" it works (at least when I start with a fresh gradle deamon).

@katkoff
Copy link

katkoff commented Jun 23, 2023

builds with gradle commands generateDependencyGraph or generateProjectDependencyGraph finished with next error

Execution failed for task ':generateProjectDependencyGraph'.
> Cannot invoke "com.kitfox.svg.SVGDiagram.setIgnoringClipHeuristic(boolean)" because "diagram" is null

tried different versions:

classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.8.0"
classpath "com.vanniktech:gradle-dependency-graph-generator-plugin:0.7.0"

same result

tried with fresh daemon also - the same

@vanniktech check it please

@vanniktech
Copy link
Owner

Hitting this also now in #228 - might be due to JDK 17.

Reported it here: nidi3/graphviz-java#249

@wverdese
Copy link

wverdese commented Nov 7, 2023

same here. Will this problem be fixed?

@xpenatan
Copy link

Hitting the same issue. looks like graphviz-java is a dead project to update to jdk17

@dees91
Copy link

dees91 commented Jan 15, 2024

Due to this problem, at this point the tool is not useful for most projects with current AGP (current AGP requires JDK17 which is also included along with the latest Android Studio).

Have you considered removing graphviz-java dependency and requiring the presence of an installed graphiz tool on the user's system?

@vanniktech
Copy link
Owner

Have you considered removing graphviz-java dependency and requiring the presence of an installed graphiz tool on the user's system?

It used to be like this but many users had problems. Or they didn't have it installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants