dbeaver / dbeaver/dbeaver

Errors when adding new row in record mode

Open
#13,531 0 comments 0 reactions 1 assignee Claimed by @serge-rider View on GitHub
xf:data
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 10h
Merged PRs (30d)
185

Description

#### System information:
- Operating system (distribution) and version Win10
- DBeaver version 21.1.5

#### Describe the problem you're observing:
IndexOutOfBounds exception when reverting new row in record mode

#### Steps to reproduce, if exist:
1. Select 3 or more non-adjacent rows in grid view and switch to record mode
2. Select the middle record and click `add new row`
3. Cancel changes

**Expected:** New row is created and when reverted the view is returned to it's initial state.
**Actual:** 1. Instead of adding new row another existing row is shown
2. After reverting all records disappear and IndexOutOfBoundsException is thrown

![zfmYKRHWgY](https://user-images.githubusercontent.com/82543000/129367171-adb8c8c4-7a7b-496e-868f-85ffa5eaab97.gif)

#### Include any warning/errors/backtraces from the logs
```java
org.eclipse.core.commands.ExecutionException: Error executing 'org.jkiss.dbeaver.core.resultset.rejectChanges': java.lang.IndexOutOfBoundsException: Index 8 out of bounds for length 8
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:170)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:389)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:785)
at org.eclipse.ui.menus.CommandContributionItem.lambda$3(CommandContributionItem.java:762)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4209)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1043)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4026)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3626)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.jkiss.dbeaver.ui.app.standalone.DBeaverApplication.start(DBeaverApplication.java:265)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
Caused by: org.eclipse.e4.core.di.InjectionException: java.lang.IndexOutOfBoundsException: Index 8 out of bounds for length 8
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
... 32 more
Caused by: java.lang.IndexOutOfBoundsException: Index 8 out of bounds for length 8
at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source)
at java.base/jdk.internal.util.Preconditions.checkIndex(Unknown Source)
at java.base/java.util.Objects.checkIndex(Unknown Source)
at java.base/java.util.ArrayList.get(Unknown Source)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetModel.getRow(ResultSetModel.java:345)
at org.jkiss.dbeaver.ui.controls.resultset.spreadsheet.SpreadsheetPresentation$ContentProvider.getElements(SpreadsheetPresentation.java:1745)
at org.jkiss.dbeaver.ui.controls.lightgrid.LightGrid.refreshData(LightGrid.java:504)
at org.jkiss.dbeaver.ui.controls.resultset.spreadsheet.Spreadsheet.refreshData(Spreadsheet.java:367)
at org.jkiss.dbeaver.ui.controls.resultset.spreadsheet.SpreadsheetPresentation.refreshData(SpreadsheetPresentation.java:860)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer.redrawData(ResultSetViewer.java:1576)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetPersister.rejectChanges(ResultSetPersister.java:478)
at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer.rejectChanges(ResultSetViewer.java:4011)
at org.jkiss.dbeaver.ui.controls.resultset.handler.ResultSetHandlerMain.execute(ResultSetHandlerMain.java:283)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at jdk.internal.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.