Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexOutOfBounds Exception when chaning entry type with opened entry editor #3435

Closed
Siedlerchr opened this issue Nov 15, 2017 · 2 comments
Closed
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-editor

Comments

@Siedlerchr
Copy link
Member

Siedlerchr commented Nov 15, 2017

I got this IndexOutOfBounds exception we previously had:

I more or less could reproduce it: Have an entry with some required fields set (e.g. article), change entry type to WWW, and then back to article. Entry editor has to stay open.

The method which is responsible for changing type: in BasePanel
private void changeType(List<BibEntry> entries, String newType) {

You will probably get this exception (Master on Win10).

 :12:39.353 [JavaFX Application Thread] ERROR org.jabref.FallbackExceptionHandler - Uncaught exception occurred in Thread[JavaFX Application Thread,5,main]
java.lang.IndexOutOfBoundsException: [-2147483648, 14) is not a valid range within [0, 14)
	at org.reactfx.util.Lists.checkRange(Lists.java:128) ~[reactfx-2.0-M5.jar:?]
	at org.reactfx.util.Lists.checkRange(Lists.java:123) ~[reactfx-2.0-M5.jar:?]
	at org.reactfx.collection.MemoizationListImpl.forget(MemoizationList.java:184) ~[reactfx-2.0-M5.jar:?]
	at org.fxmisc.flowless.CellListManager.cropTo(CellListManager.java:82) ~[flowless-0.6.jar:?]
	at org.fxmisc.flowless.CellPositioner.cropTo(CellPositioner.java:29) ~[flowless-0.6.jar:?]
	at org.fxmisc.flowless.Navigator.cropToNeighborhoodOf(Navigator.java:227) ~[flowless-0.6.jar:?]
	at org.fxmisc.flowless.Navigator.placeStartAtMayCrop(Navigator.java:200) ~[flowless-0.6.jar:?]
	at org.fxmisc.flowless.Navigator.visit(Navigator.java:129) ~[flowless-0.6.jar:?]
	at org.fxmisc.flowless.StartOffStart.accept(TargetPosition.java:85) ~[flowless-0.6.jar:?]
	at org.fxmisc.flowless.Navigator.layoutChildren(Navigator.java:78) ~[flowless-0.6.jar:?]
	at javafx.scene.Parent.layout(Parent.java:1087) ~[jfxrt.jar:?]
	at org.fxmisc.flowless.VirtualFlow.layoutChildren(VirtualFlow.java:257) ~[flowless-0.6.jar:?]
	at javafx.scene.Parent.layout(Parent.java:1087) ~[jfxrt.jar:?]
	at javafx.scene.Parent.layout(Parent.java:1093) ~[jfxrt.jar:?]
	at javafx.scene.Parent.layout(Parent.java:1093) ~[jfxrt.jar:?]
	at javafx.scene.Parent.layout(Parent.java:1093) ~[jfxrt.jar:?]
	at javafx.scene.Scene.doLayoutPass(Scene.java:552) ~[jfxrt.jar:?]
	at javafx.scene.Scene.preferredSize(Scene.java:1646) ~[jfxrt.jar:?]
	at javafx.scene.Scene.impl_preferredSize(Scene.java:1720) ~[jfxrt.jar:?]
	at javafx.stage.Window$9.invalidated(Window.java:864) ~[jfxrt.jar:?]
	at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109) ~[jfxrt.jar:?]
	at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144) ~[jfxrt.jar:?]
	at javafx.stage.Window.setShowing(Window.java:940) ~[jfxrt.jar:?]
	at javafx.stage.Window.show(Window.java:955) ~[jfxrt.jar:?]
	at com.sun.javafx.stage.EmbeddedWindow.show(EmbeddedWindow.java:58) ~[jfxrt.jar:?]
	at javafx.embed.swing.JFXPanel.lambda$addNotify$51(JFXPanel.java:833) ~[jfxrt.jar:?]
	at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295) ~[jfxrt.jar:?]
	at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_152]
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294) ~[jfxrt.jar:?]
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) ~[jfxrt.jar:?]
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) ~[jfxrt.jar:?]
	at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) ~[jfxrt.jar:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_152]
@Siedlerchr Siedlerchr added bug Confirmed bugs or reports that are very likely to be bugs entry-editor labels Nov 15, 2017
@Siedlerchr Siedlerchr reopened this Nov 29, 2017
@Siedlerchr
Copy link
Member Author

I could reliable reproduce this on win10 with latest master

  1. Create a new empty entry. e.g. article
    2., Go to code editor
  2. Remove the entry type from the code, leave the @ symbol
  3. Switch to General Tab
  4. Right click on the entry -> Change entry type to mastersthesis
    => Entry editor frreezes and exception is thrown
    Debuggeed this, seems to come from some layout recalculations:

@tobiasdiez Any idea?

Exception: java.lang.IndexOutOfBoundsException: [-2147483648, 4) is not a valid range within [0, 4)


Thread [JavaFX Application Thread] (Suspended (breakpoint at line 128 in Lists))	
	Lists.checkRange(int, int, int, int) line: 128	
	Lists.checkRange(int, int, int) line: 123	
	MemoizationListImpl<E>.forget(int, int) line: 184	
	CellListManager<T,C>.cropTo(int, int) line: 82	
	CellPositioner<T,C>.cropTo(int, int) line: 29	
	Navigator<T,C>.cropToNeighborhoodOf(int, double) line: 227	
	Navigator<T,C>.placeStartAtMayCrop(int, double) line: 200	
	Navigator<T,C>.visit(StartOffStart) line: 129	
	StartOffStart.accept(TargetPositionVisitor) line: 85	
	Navigator<T,C>.layoutChildren() line: 78	
	Navigator<T,C>(Parent).layout() line: 1087 [local variables unavailable]	
	VirtualFlow<T,C>.layoutChildren() line: 257	
	VirtualFlow<T,C>(Parent).layout() line: 1087 [local variables unavailable]	
	CodeArea(Parent).layout() line: 1093 [local variables unavailable]	
	TabPaneSkin$TabContentRegion(Parent).layout() line: 1093 [local variables unavailable]	
	TabPane(Parent).layout() line: 1093 [local variables unavailable]	
	Scene.doLayoutPass() line: 552 [local variables unavailable]	
	Scene.preferredSize() line: 1646 [local variables unavailable]	
	Scene.impl_preferredSize() line: 1720 [local variables unavailable]	
	Window$9.invalidated() line: 864	
	Window$9(BooleanPropertyBase).markInvalid() line: 109 [local variables unavailable]	
	Window$9(BooleanPropertyBase).set(boolean) line: 144	
	EmbeddedWindow(Window).setShowing(boolean) line: 940	
	EmbeddedWindow(Window).show() line: 955	
	EmbeddedWindow.show() line: 58 [local variables unavailable]	
	JFXPanel.lambda$addNotify$51() line: 833 [local variables unavailable]	
	330294036.run() line: not available [local variables unavailable]	
	PlatformImpl.lambda$null$172(Runnable) line: 295	
	795088611.run() line: not available [local variables unavailable]	
	AccessController.doPrivileged(PrivilegedAction<T>, AccessControlContext) line: not available [native method]	
	PlatformImpl.lambda$runLater$173(Runnable, AccessControlContext) line: 294	
	1463757745.run() line: not available [local variables unavailable]	
	InvokeLaterDispatcher$Future.run() line: 95 [local variables unavailable]	
	WinApplication._runLoop(Runnable) line: not available [native method]	
	WinApplication.lambda$null$147(int, Runnable) line: 177	
	1307096070.run() line: not available [local variables unavailable]	
	Thread.run() line: 748 [local variables unavailable]	


@tobiasdiez
Copy link
Member

This looks one of the other errors we had with the code editor a few weeks ago. Its not quite the same but very similar. There the fix was to correctly update the editor on the JavaFX thread. Thus I would suspect that some code is again invoked on the Swing thread. The change of entry type probably triggers some event (in the swing thread), which then updates the code editor.
Last time, it was hard to find the reason for the problem by debugging since the update on the Swing thread run without any exception but the next update (which was correctly on the JavaFX thread and which was usually the layout recalculation) lead to the exception.

@Siedlerchr Siedlerchr mentioned this issue Dec 4, 2017
6 tasks
tobiasdiez pushed a commit that referenced this issue Dec 5, 2017
* Fix integrity check threading issue and change entry type issue
 #3485 and #3435

* move to inner loop

* add changelog

* use fxthread for whole method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs entry-editor
Projects
None yet
Development

No branches or pull requests

2 participants