bzixilu / dotplugin

Dot language plugin for Intellij IDEA
57 stars 10 forks source link

Plugin fails to render on arm based MacOS #26

Open leftler opened 2 years ago

leftler commented 2 years ago

I installed Intellij on my MacOS with a new arm processor. The plugin fails to render any dot file, even the most simple.

digraph RegionBuild {
    node[shape=plaintext]
    test -> a
}

scratch_1.dot.txt (renamed because github won't upload .dot)

This causes the following to happen.

image

I created a fork and a PR #25 to add logging to see what the details where. The output from the added logging was

guru.nidi.graphviz.engine.GraphvizException: Error during rasterization
    at guru.nidi.graphviz.engine.BatikRasterizer.doRasterize(BatikRasterizer.java:48)
    at guru.nidi.graphviz.engine.SvgRasterizer.rasterize(SvgRasterizer.java:37)
    at guru.nidi.graphviz.engine.Renderer.toImage(Renderer.java:117)
    at guru.nidi.graphviz.engine.EngineResult.map(EngineResult.java:58)
    at guru.nidi.graphviz.engine.Renderer.toImage(Renderer.java:109)
    at guru.nidi.graphviz.engine.Renderer.toImage(Renderer.java:105)
    at org.plugin.dot.preview.GraphPreviewFileEditor$ImagePanel.paintGraph(GraphPreviewFileEditor.java:245)
    at org.plugin.dot.preview.GraphPreviewFileEditor$ImagePanel.paintComponent(GraphPreviewFileEditor.java:270)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1077)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at com.intellij.ui.tabs.impl.JBTabsImpl.paintChildren(JBTabsImpl.java:580)
    at com.intellij.openapi.fileEditor.impl.EditorTabbedContainer$EditorTabs.paintChildren(EditorTabbedContainer.java:717)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JLayeredPane.paint(JLayeredPane.java:590)
    at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:910)
    at java.desktop/javax.swing.JComponent.paint(JComponent.java:1086)
    at java.desktop/javax.swing.JComponent.paintToOffscreen(JComponent.java:5263)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBufferedImpl(RepaintManager.java:1654)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1629)
    at java.desktop/javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1566)
    at java.desktop/javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:262)
    at java.desktop/javax.swing.RepaintManager.paint(RepaintManager.java:1333)
    at java.desktop/javax.swing.JComponent._paintImmediately(JComponent.java:5211)
    at java.desktop/javax.swing.JComponent.paintImmediately(JComponent.java:5021)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:868)
    at java.desktop/javax.swing.RepaintManager$4.run(RepaintManager.java:851)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:851)
    at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:826)
    at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:775)
    at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1901)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:891)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:760)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:447)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:818)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:446)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:488)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
Premature end of file.
    at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:136)
    at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:141)
    at guru.nidi.graphviz.engine.BatikRasterizer.doRasterize(BatikRasterizer.java:45)
    ... 76 more
Caused by: org.apache.batik.dom.util.SAXIOException: Premature end of file.
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:459)
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:357)
    at org.apache.batik.anim.dom.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:255)
    at org.apache.batik.anim.dom.SAXSVGDocumentFactory.createDocument(SAXSVGDocumentFactory.java:317)
    at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:119)
    ... 78 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
    at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
    at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1465)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1013)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
    at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
    at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:453)
    ... 82 more

My intelij version information

IntelliJ IDEA 2021.3.3 (Ultimate Edition)
Build #IU-213.7172.25, built on March 15, 2022
Licensed to Scott Chamberlain
Subscription is active until September 19, 2022.
Runtime version: 11.0.14.1+1-b1751.46 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 8048M
Cores: 8
Registry:
    debugger.watches.in.variables=false

Non-Bundled Plugins:
    org.plugin.dot.id (1.4.1)
    org.jetbrains.plugins.go (213.7172.6)
    com.perl5 (2021.3.1)
    com.intellij.ideolog (203.0.28.1)
    org.jetbrains.plugins.ruby (213.7172.6)
    uk.co.itmoore.intellisubsteps (1.1.0)
    org.jetbrains.kotlin (213-1.6.21-release-334-IJ6777.52)
    com.intellij.guice (213.6461.21)
    mobi.hsz.idea.gitignore (4.4.0)
    CheckStyle-IDEA (5.63.0)
    org.mapstruct.intellij (1.3.1)
    jbehave-support-plugin (1.57)
    Pythonid (213.7172.26)

Kotlin: 213-1.6.21-release-334-IJ6777.52
Eraldo commented 2 years ago

I am also experiencing this error. :|

ironScripter commented 2 years ago

I am experiencing this as well.

bzixilu commented 2 years ago

Hi all, could you please check if this workaround works for you: https://github.com/bzixilu/dotplugin/issues/23#issuecomment-1100512024

pooyk commented 2 years ago

Hi all, could you please check if this workaround works for you: #23 (comment)

doesn't work. (Error during rasterization) Apple M1

❯ dot -V
dot - graphviz version 6.0.1 (20220911.1526)
alexbepple commented 1 year ago

Hi all, could you please check if this workaround works for you: #23 (comment)

For me, that workaround does not work either. However, I could work around the issue by starting IntelliJ not via Spotlight/Finder, but from a shell via open -a "IntelliJ IDEA.app".

kenahoo commented 1 year ago

I can confirm that starting IntelliJ from a shell, via open -a "IntelliJ IDEA.app", also gets rendering working for me. Is this simply because then it inherits my PATH value from the shell?

If that's the case, perhaps a configuration option for this plugin could be added to let the user specify where the dot binary is located?

alexbepple commented 1 year ago

Is this simply because then it inherits my PATH value from the shell?

I think so.

If that's the case, perhaps a configuration option for this plugin could be added to let the user specify where the dot binary is located?

Sounds consistent with many other config options in the JetBrains platform

bzixilu commented 1 year ago

Hi, could you please check if it starts working for you in 1.5.3 version of the plugin? New version will appear on JetBrains marketplace after verification from JB side

bzixilu commented 3 months ago

Please update the plugin to 1.5.4 version. It should help.