apache / apache/netbeans

Cannot invoke "org.netbeans.Module.getCodeNameBase()" random error

Open
#6,913 0 comments 0 reactions 0 assignees View on GitHub
kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 20

### What happened

Attempting to compile an existing Maven project with JDK17 running NetBeans 20 and received this error in the notification window.

```
java.lang.NullPointerException: Cannot invoke "org.netbeans.Module.getCodeNameBase()" because "this.addedBecauseOfDependent" is null
at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1783)
at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1815)
at org.netbeans.ModuleManager.searchForPossibleEager(ModuleManager.java:1918)
at org.netbeans.ModuleManager.simulateEnable(ModuleManager.java:1714)
at org.netbeans.ModuleManager.simulateEnable(ModuleManager.java:1675)
at org.netbeans.modules.autoupdate.services.OperationValidator$EnableValidator.getModulesToEnable(OperationValidator.java:340)
at org.netbeans.modules.autoupdate.services.OperationValidator$EnableValidator.getRequiredElementsImpl(OperationValidator.java:376)
at org.netbeans.modules.autoupdate.services.OperationValidator.getRequiredElements(OperationValidator.java:108)
at org.netbeans.modules.autoupdate.services.OperationContainerImpl$OperationInfoImpl.getRequiredElements(OperationContainerImpl.java:443)
at org.netbeans.api.autoupdate.OperationContainer$OperationInfo.getRequiredElements(OperationContainer.java:383)
at org.netbeans.modules.ide.ergonomics.fod.FindComponentModules.getMissingModules(FindComponentModules.java:408)
at org.netbeans.modules.ide.ergonomics.fod.FindComponentModules.findComponentModules(FindComponentModules.java:284)
at org.netbeans.modules.ide.ergonomics.fod.FindComponentModules.access$000(FindComponentModules.java:58)
at org.netbeans.modules.ide.ergonomics.fod.FindComponentModules$2.run(FindComponentModules.java:239)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1420)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2035)
```

### Language / Project Type / NetBeans Component

Java Maven Project no modules

### How to reproduce

I don't have a reproducer because it doesn't always happen

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

MacOS Sonoma 14.2.1 on M1 Mac

### JDK

17.0.8.1 OpenJDK

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

### Are you willing to submit a pull request?

Yes

Contributor guide

Open the contributing guide

Research direction

Start with org.netbeans.ModuleManager.maybeAddToEnableList at ModuleManager.java:1783 and trace the calls through searchForPossibleEager and simulateEnable. Reproduce by compiling a Java Maven project in NetBeans 20 with JDK 17, if possible, and determine the conditions that leave addedBecauseOfDependent null; done means the intermittent notification-window NullPointerException no longer occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.