cbm64chris opened a new issue, #7924:
URL: https://github.com/apache/netbeans/issues/7924
### Apache NetBeans version
Apache NetBeans 23
### What happened
Using (macOS 14) opening a maven pom.xml in and positioning the cursor over
the Dependency Management stanza; ctrl+I or Source->Insert->Dependency does not
insert the chosen dependency. The dependency is not duplicate.
On cold start of NetBeans this action works fine - external actions to the
IDE introduce this behaviour - see steps to reproduce.
Only trace in the IDE log I have seen after this event;
```
WARNING [org.netbeans.modules.options.keymap.LayersBridge]: Invalid
shortcut:
org.openide.loaders.XMLDataObject@1856ee2c[MultiFileObject@4b4ca015[Actions/Help/master-help.xml]]
INFO [org.netbeans.ui.indexing]: Indexing started, time from last indexing
1,584,970 ms.
INFO [org.netbeans.ui.indexing]: Indexing finished, indexing took 0 ms.
INFO [org.netbeans.ui.indexing]: Indexing started, time from last indexing
26,493 ms.
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]:
Resolving dependencies took: 6 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]:
Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]:
Complete indexing of 0 source roots took: 0 ms (New or modified files: 0,
Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.ui.indexing]: Indexing finished, indexing took 13 ms.
INFO [org.netbeans.ui.indexing]: Indexing started, time from last indexing
851 ms.
INFO [org.netbeans.ui.indexing]: Indexing finished, indexing took 0 ms.
SEVERE [global]
java.lang.IllegalArgumentException: bad position: 35153
at
java.desktop/javax.swing.text.JTextComponent.setCaretPosition(JTextComponent.java:1685)
at
org.netbeans.modules.maven.codegen.AbstractGenerator.writeModel(AbstractGenerator.java:85)
at
org.netbeans.modules.maven.codegen.DependencyGenerator.doInvoke(DependencyGenerator.java:91)
at
org.netbeans.modules.maven.codegen.AbstractGenerator.invoke(AbstractGenerator.java:64)
at
org.netbeans.modules.editor.codegen.GenerateCodePanel.invokeSelected(GenerateCodePanel.java:165)
at
org.netbeans.modules.editor.codegen.GenerateCodePanel.listMouseReleased(GenerateCodePanel.java:109)
at
org.netbeans.modules.editor.codegen.GenerateCodePanel.access$000(GenerateCodePanel.java:41)
at
org.netbeans.modules.editor.codegen.GenerateCodePanel$2.mouseReleased(GenerateCodePanel.java:85)
at
java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
at
java.desktop/java.awt.Component.processMouseEvent(Component.java:6621)
at
java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3404)
at java.desktop/java.awt.Component.processEvent(Component.java:6386)
at java.desktop/java.awt.Container.processEvent(Container.java:2266)
at
java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4996)
at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
at
java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
at
java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
at
java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
at
java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
at
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
at
java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at
java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
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)
```
### Language / Project Type / NetBeans Component
Java Maven
### How to reproduce
Create a maven project with a dependency management section add any
dependency. Add the sortpom plugin from com.github.ekryd.sortpom.
```XML
<plugin>
<groupId>com.github.ekryd.sortpom</groupId>
<artifactId>sortpom-maven-plugin</artifactId>
<version>4.0.0</version>
<configuration>
<createBackupFile>false</createBackupFile>
<encoding>UTF-8</encoding>
<expandEmptyElements>false</expandEmptyElements>
<spaceBeforeCloseEmptyElement>false</spaceBeforeCloseEmptyElement>
<sortDependencies>scope,groupId,artifactId</sortDependencies>
<sortPlugins>groupId,artifactId</sortPlugins>
<nrOfIndentSpace>4</nrOfIndentSpace>
<keepBlankLines>true</keepBlankLines>
</configuration>
</plugin>
```
Add a new dependency using the ctrl-i command to the dependency management
section - does not matter what. That should work fine.
Now sort the pom using the sort-on:sort goal either from the command line or
with the navigator.
Perform the same action to add a dependency to the pom, the IDE just skips
to a _random_ position in the pom and no dependency is added.
I will add a gif of this behaviour shortly.
### Did this work correctly in an earlier version?
No / Don't know
### Operating System
macOS Sonoma 14.7
### JDK
23 (arm64) "Oracle Corporation" - "Java SE 23"
### Apache NetBeans packaging
Apache NetBeans provided installer
### Anything else
_No response_
### Are you willing to submit a pull request?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists