UnitTestBot / UTBotJava

Automated unit test generation and precise code analysis for Java
Apache License 2.0
136 stars 43 forks source link

JS. NPE on action when Experimental languages support is enabled after plugin reinstallation #1947

Closed alisevych closed 1 year ago

alisevych commented 1 year ago

Description

Plugin was reinstalled with IDEA restart. After that Experimental languages support was enabled. Action called on a JS-file - NPE is thrown in IDE from

To Reproduce

  1. Open 'utbot' project in in IntelliJ Idea Ultimate 2022.2.4
  2. Clean the project: uninstall previously installed UnitTestBot plugin, restart
  3. Delete /.idea/utbot-settings.xml file
  4. Install the latest IU plugin built from unit-test-bot/rc3102023 branch - take *`utbot-intellij-IU-2023.3.`** artefact
  5. Check UnitTestBot action is disabled on samples in utbot-js module
  6. Turn on 'Experimental languages support' in File->Settings->Tools->UnitTestBot
  7. Open samples/arrays.js, place cursor in ObjectParameter, call Alt+Shift+U

Expected behavior

UnitTestBot dialog is supposed to be opened.

Actual behavior

java.lang.NullPointerException is thrown down to IDE from org.utbot.intellij.plugin.language.js.JsDialogProcessor

Visual proofs (screenshots, logs, images)

java.lang.NullPointerException: currDir.parentFile must not be null
    at service.PackageJsonService.findClosestConfig(PackageJsonService.kt:30)
    at settings.PackageDataService.<init>(JsPackagesSettings.kt:54)
    at org.utbot.intellij.plugin.language.js.JsDialogProcessor$createDialogAndGenerateTests$1$run$$inlined$invokeLater$1.run(ApplicationUtils.kt:94)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
    at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:513)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:75)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:118)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:779)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:749)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:766)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

Environment

2023-03-14 12:19:38,952 [1583492] SEVERE - #c.i.o.a.i.FlushQueue - IntelliJ IDEA 2022.2.4 Build #IU-222.4459.24 2023-03-14 12:19:38,953 [1583493] SEVERE - #c.i.o.a.i.FlushQueue - JDK: 17.0.5; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o. 2023-03-14 12:19:38,953 [1583493] SEVERE - #c.i.o.a.i.FlushQueue - OS: Windows 10 2023-03-14 12:19:38,953 [1583493] SEVERE - #c.i.o.a.i.FlushQueue - Plugin to blame: UnitTestBot version: 2023.3.3871.

Additional context

Reproducing only when project is "cleaned" - utbot_settings.xml is deleted after previously installed plugin deinstallation.

alisevych commented 1 year ago

Reproducing

on fresh version of unit-test-bot/rc3102023 branch. IU-plugin from this run: https://github.com/UnitTestBot/UTBotJava/actions/runs/4434721564 The last commit for this run was dccfdade.

zishkaz commented 1 year ago

A pull request will be made today.