apache / apache/netbeans

IllegalArgumentException when trying to autocomplete missing Maven dependency version.

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

Description

### Apache NetBeans version

Apache NetBeans 15

### What happened

Unsure specifically (Silent Error), but when I noticed it I was trying to Ctrl+Space on a maven pom dependency version to get a list of available versions, but the maven index was still being unpacked.

```
java.lang.IllegalArgumentException: version can neither be null, empty nor blank
at org.apache.commons.lang3.Validate.notBlank(Validate.java:454)
at org.apache.maven.artifact.ArtifactUtils.notBlank(ArtifactUtils.java:107)
at org.apache.maven.artifact.ArtifactUtils.toSnapshotVersion(ArtifactUtils.java:57)
at org.apache.maven.artifact.DefaultArtifact.setBaseVersionInternal(DefaultArtifact.java:389)
at org.apache.maven.artifact.DefaultArtifact.selectVersion(DefaultArtifact.java:506)
at org.apache.maven.artifact.DefaultArtifact.selectVersionFromNewRangeIfAvailable(DefaultArtifact.java:494)
at org.apache.maven.artifact.DefaultArtifact.(DefaultArtifact.java:106)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:162)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:122)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createArtifact(DefaultArtifactFactory.java:116)
at org.apache.maven.artifact.factory.DefaultArtifactFactory.createBuildArtifact(DefaultArtifactFactory.java:80)
at org.apache.maven.repository.legacy.LegacyRepositorySystem.createArtifact(LegacyRepositorySystem.java:124)
at org.netbeans.modules.maven.embedder.MavenEmbedder.createArtifact(MavenEmbedder.java:334)
at org.netbeans.modules.maven.hyperlinks.HyperlinkProviderImpl$PomHyperlinkInfo.getMavenArtifactAbsolutePomPath(HyperlinkProviderImpl.java:447)
at org.netbeans.modules.maven.hyperlinks.HyperlinkProviderImpl$PomHyperlinkInfo.isHyperlinkPoint(HyperlinkProviderImpl.java:313)
at org.netbeans.modules.maven.hyperlinks.HyperlinkProviderImpl.isHyperlinkPoint(HyperlinkProviderImpl.java:85)
at org.netbeans.lib.editor.hyperlink.HyperlinkOperation.findProvider(HyperlinkOperation.java:266)
at org.netbeans.lib.editor.hyperlink.HyperlinkOperation.performHyperlinking(HyperlinkOperation.java:224)
at org.netbeans.lib.editor.hyperlink.HyperlinkOperation.keyPressed(HyperlinkOperation.java:382)
at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEvent
Multicaster.java:258)
at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:257)
at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:257)
at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:257)
at java.desktop/java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:257)
at java.desktop/java.awt.Component.processKeyEvent(Component.java:6593)
at java.desktop/javax.swing.JComponent.processKeyEvent(JComponent.java:2849)
at java.desktop/java.awt.Component.processEvent(Component.java:6412)
at java.desktop/java.awt.Container.processEvent(Container.java:2263)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5011)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1950)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:870)
at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1139)
at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1009)
at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:835)
at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4892)
at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2772)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4843)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:743)
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:742)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136)
[catch] 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)
```

### How to reproduce

New install of NB 15, OpenJDK 11, external Maven v3.8.6
Multi-module Maven project was open an built successfully, but project view showed errors with a couple of POM files (missing version).
Tried to add the version to the protobuf-java dependency.

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

No / Don't know

### Operating System

Windows Server 2019 Datacenter Edition

### JDK

Adoptium OpenJDK 11

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

_No response_

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

No

### Code of Conduct

Yes

[messages.log](https://github.com/apache/netbeans/files/9587110/messages.log)

Contributor guide

Open the contributing guide

Research direction

Start with org.netbeans.modules.maven.hyperlinks.HyperlinkProviderImpl, especially PomHyperlinkInfo.isHyperlinkPoint and getMavenArtifactAbsolutePomPath, then inspect MavenEmbedder.createArtifact. Reproduce the Ctrl+Space scenario while the Maven index is unpacking and verify that a dependency with a missing version no longer raises IllegalArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.