mbien commented on PR #8326:
URL: https://github.com/apache/netbeans/pull/8326#issuecomment-2728218840
this avoids out of bounds issues:
```diff
diff --git
a/ide/diff/src/org/netbeans/modules/diff/builtin/visualizer/editable/DiffViewManager.java
b/ide/diff/src/org/netbeans/modules/diff/builtin/visualizer/editable/DiffViewManager.java
index 40ecfd9..42df713 100644
---
a/ide/diff/src/org/netbeans/modules/diff/builtin/visualizer/editable/DiffViewManager.java
+++
b/ide/diff/src/org/netbeans/modules/diff/builtin/visualizer/editable/DiffViewManager.java
@@ -505,7 +505,7 @@
if (checkFileEdge && rightOffet >=
rightPane.getScrollPane().getVerticalScrollBar().getMaximum()) {
rightOffet = map.length - 1;
}
- if (rightOffet >= map.length) return;
+ if (rightOffet >= map.length || rightOffet < 0) return;
leftPane.getScrollPane().getVerticalScrollBar().setValue(map[rightOffet]
- halfScreen);
}
```
This happens when preview is off and the refactoring view changes selection.
The diff panel tries to scroll even though it is not visible. This sounds like
unnecessary work given that it is not visible but i think it is probably ok,
because if you toggle it on again it will show at the right position - which is
what you would expect from it I think.
<details>
```
java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at
org.netbeans.modules.diff.builtin.visualizer.editable.DiffViewManager.smartScroll(DiffViewManager.java:509)
at
org.netbeans.modules.diff.builtin.visualizer.editable.DiffViewManager.access$300(DiffViewManager.java:47)
at
org.netbeans.modules.diff.builtin.visualizer.editable.DiffViewManager$2.run(DiffViewManager.java:154)
at
java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at
java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:702)
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)
```
</details>
--
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