NullPointException when using SketchIt!

Issue #11 resolved
Till Becker created an issue

I cannot create any uml files. As soon as I click Tools->Sketch it! an IDE error is reported with the following stacktrace:

java.lang.NullPointerException
    at org.pmesmeur.sketchit.diagram.UmlModuleClassDiagram.getOutputFile(UmlModuleClassDiagram.java:28)
    at org.pmesmeur.sketchit.diagram.UmlDiagram.generate(UmlDiagram.java:21)
    at org.pmesmeur.sketchit.diagram.UmlDiagramsGenerator.generateModuleClassDiagram(UmlDiagramsGenerator.java:44)
    at org.pmesmeur.sketchit.diagram.UmlDiagramsGenerator.generateClassDiagrams(UmlDiagramsGenerator.java:35)
    at org.pmesmeur.sketchit.SketchIt.actionBody(SketchIt.java:41)
    at org.pmesmeur.sketchit.SketchIt.access$000(SketchIt.java:8)
    at org.pmesmeur.sketchit.SketchIt$1.run(SketchIt.java:31)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1038)
    at org.pmesmeur.sketchit.SketchIt.runInsideAnIntellijWriteAction(SketchIt.java:29)
    at org.pmesmeur.sketchit.SketchIt.actionPerformed(SketchIt.java:23)
    at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:255)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:272)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:304)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:307)
    at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:294)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:114)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
    at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:114)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:308)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
    at com.apple.laf.ScreenMenuItemCheckbox.itemStateChanged(ScreenMenuItemCheckbox.java:193)
    at java.awt.CheckboxMenuItem.processItemEvent(CheckboxMenuItem.java:389)
    at java.awt.CheckboxMenuItem.processEvent(CheckboxMenuItem.java:357)
    at java.awt.MenuComponent.dispatchEventImpl(MenuComponent.java:355)
    at java.awt.MenuComponent.dispatchEvent(MenuComponent.java:343)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:767)
    at java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.awt.EventQueue$3.run(EventQueue.java:715)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:737)
    at java.awt.EventQueue$4.run(EventQueue.java:735)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:781)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:722)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

What is the issue here? Subsequent incovations do not throw any Exceptions but create a file with just a title and footnote, nothing else.

Comments (25)

  1. Philippe MESMEUR repo owner

    many people reported me this issue. Unfortunately, until now I am unable to reproduce it.

    I would strongly appreciate if you could send me a sample that help me to understand the defect and correct it

    Best regards

  2. Philippe MESMEUR repo owner

    many people reported me this issue. Unfortunately, until now I am unable to reproduce it.

    I would strongly appreciate if you could send me a sample that help me to understand the defect and correct it

    Best regards Philippe MESMEUR 10 rue Charles Baudelaire 60440 Nanteuil le Haudouin tel: 06 77 89 92 96

  3. Simon Vaillancourt

    Hi Philippe, I have the same problem, here. Maybe this is related to the fact that we do not know how to run the plug-in. I have a simple spring boot project that compile fine and run fine. When I try to get the UML out from SketchIT, I got no file generated and the same stracktrace above. I selected the project from project explorer and Tools-> SketchIt! I got the error immediately. Is this the proper way to uses the Plug-in? Should we select any specific files or Package? Is the plug-in can analyze any type of java project (Spring, Spring Boot, Spring Cloud)? What do you need from me to give you more details?

  4. Philippe MESMEUR repo owner

    Hi Simon,

    There is only one way to use the plugin and this is like you do. Would it be possible for you to send me a sample in order to enable me to reproduce the issue?

    Thanks for your contribution

  5. Sebastien TANIERE

    Hello, I get the same problem and perhaps it can give some clue.

    SketchIt is working fine on my computer (it has been installed some months ago). I recently asked my collegue to install sketchIt and plantUml plugin, and SketchIt does not want to work on its computer because he also get this error :
    " java.lang.NullPointerException at org.pmesmeur.sketchit.diagram.UmlModuleClassDiagram.getOutputFile(UmlModuleClassDiagram.java:28) .... "

    So it seem that this error is not due to project (we work on the same project with my collegue), but perhaps to the way sketchIT plugin was installed ?

    when looking at error, I suppose that previous line 27 in UmlModuleClassDiagram.java returns null instead of module object :

    VirtualFile moduleFile = module.getModuleFile();
    

    but i don't know how is initialized this module object.

  6. Philippe MESMEUR repo owner

    Interesting. I would be surprised if the issue was related to the way the plugin was installed... maybe...

    Another possibility could be the version of IntelliJ: my plugin strongly relies on the IntelliJ framework (com.intellij.openapi.*): any behavior change between to IntelliJ could explain your problem Do you and your collegue have the same version of IntelliJ?

    Thank you very much for your contribution

    Best Regards, Philippe

  7. Sebastien TANIERE

    My collegue is not present today so I cannot compare versions. I will give you information thirsday (but i think we have similar versions because I update intellijIDEA quite frequently).

    Here is my present version : IntelliJ IDEA 2018.2.5 (Community Edition) Build #IC-182.4892.20, built on October 16, 2018 JRE: 1.8.0_152-release-1248-b19 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

    I tried to find some file containing keyword "SketchIt" on my computer to compare differences. When looking at my c:\users\%my_user%, I can see there are 4 folders lminked to intellij which means I used lot of versions :

    .IdeaIC2017.2
    .IdeaIC2017.3
    .IdeaIC2018.1
    .IdeaIC2018.2
    

    but I don't know on which version I installed plugin

    following both folder contains same file SketchIt.jar of 44,6 Ko (45 680 octets) 19/04/2018 :

    C:\Users\staniere\.IdeaIC2018.1\config\plugins\SketchIt.jar   
    C:\Users\staniere\.IdeaIC2018.2\config\plugins\SketchIt.jar
    

    perhaps installation with intellij 2018.1 was ok and intellij 2018.2 lacks something...

    my collegue have same Sketchit.jar version I don't know what i may compare else

    Have a good day, Sébastien

  8. Philippe MESMEUR repo owner

    Thank you for your quick answer Thank you to let me know the IntelliJ version of your colleage as soon as you'll got it

    If the issue is relate to the install/deployment of the plugin, I don't know what to do... but I am almost sure this is not the case!

    Honestly,

  9. Sebastien TANIERE

    Hello, I just check my collegue IntelliJ version which is the same than mine : IntelliJ IDEA 2018.2.5 (Community Edition) Build #IC-182.4892.20, built on October 16, 2018 JRE: 1.8.0_152-release-1248-b19 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

    Only difference between our PCs is I have several intellij folders as said in previous post. My collegue has only one intellij folder : .IdeaIC2018.2 But files related to SketchIt are the same than me (SketchIt.jar & availables.xml in folder config\plugins)

    Other slight difference, I use jdk1.8.0_141 , while he uses jdk1.8.0_191

    I did not saw any other relevant differences

  10. Philippe MESMEUR repo owner

    Extremely strange. So you are using the same IntelliJ version. Do you confirm that you and your colleague are launching Sketch.It on the same code base?

    Unfortunately, I currently do not have many time to investigate this problem. I'll try to find time ASAP

    Regards

  11. Philippe MESMEUR repo owner

    Other question, I did almost all of my tests with project solution based on maven build (i.e. maven modules): what is the type of your project, what kind of build solution are you using?

  12. Philippe MESMEUR repo owner

    I succeed reproduce the defect in particular conditions: - only under Windows (I used to work on Linux) - With a sandbox located in a subfolder of my user account (I my sandbox is in a subfolder at the root of c:, it works)

    For the moment, to be honest I do not understand what's happening. I suspect it comes from a specificity of this OS but I am not a Windows specialist... :-(

    On your side, do you and your colleague have comparable situations with the location of your sandboxes?

  13. Philippe MESMEUR repo owner

    I found time this week-end to investigate the issue and to develop a correction.

    JetBrains will validate it soon so IntelliJ should notify you in a few days (I hope before the end of the week) for a Sketch.It! update

    Please, let me know if my update corrects your problem

    Regards

  14. Sebastien TANIERE

    Hello, sorry to no help end of previous week, thank you for your investigation ! I wait for intelij' update, and then will give feeback

  15. Philippe MESMEUR repo owner

    Hello, the new version is available. Unfortunately, new elements let me think that the problem is not completely corrected...

    Let's try it and please let me know it it helps you...

  16. Sebastien TANIERE

    Hello, patch is working for my collegue :), but only after installing new intellijIDEA 2018.3 (instead of 2018.2)

    • First he tried to update Sketch'It to V0.04 => it did not correct NullPointerException.
    • Then, he tried to update intellijIDEA to new version 2018.3 => Now, uml is well generated and rendered by plantUML :) !

    Thank you for your patch

  17. Philippe MESMEUR repo owner

    Ok, great!!!! However, I am not fully satisfied of my patch. I'll try to deliver soon a better version

    Thank you very much for your contribution; do not hesitate to promote Sketch.It!

  18. Philippe MESMEUR repo owner

    FYI I published a new version of Sketch.It!: v0.04.01 which delivers a better correction for Issue-11 and Issue-13

    It is now available: please do not hesitate to install it and give me your feedback

    Regards, Philippe

  19. hellboy007

    I have #21

    IntelliJ IDEA 2018.3.3 (Community Edition) Build #IC-183.5153.38, built on January 9, 2019 JRE: 1.8.0_152-release-1343-b26 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 7 6.1

    and plugin version 0.4.01

  20. Former user Account Deleted

    I have 0.4.01 and 2018.3 with build #IC-183.5912.21. Feb 26, 2019. I still getting the same NPE error. Not sure how to fix and generate a diagram?

  21. Log in to comment