Bug - Fixed r12520 - Item Manager failed to initialize at startup

Fluxxdog

Active member
One of the tabs I usually have launch at startup is the Item Manager. Today, it didn't launch and I found the following debug log.
 

Attachments

swingui.panel.CreateSpecialPanel has something in it called a "PrefSpinner". That is a widget that is tied to a preference. In this case, it is tied to "valueOfAdventure".

When you manipulate the widget, it calls stateChanged method, which looks at the widget and sets the setting appropriately.
When you create the widget, it calls the "update" method, which reads the setting and sets the widget appropriately.

Looking at the stack trace, initialization calls update - which reads the setting - which sets the widget which calls stateChanged - which writes the setting.

Now, that's clearly coded incorrectly; when creating a widget and initializing it from a setting, it should not be writing the setting file. For whatever reason, it generally works, but there seems to be a race condition, since it's getting a ConcurrentModificationException iterating over the map of settings to write to the file.

I'm surprised that your setting file is not trashed, actually.

Here is the relevant part of the stack trace.

Code:
	at net.sourceforge.kolmafia.preferences.Preferences.setInteger(Preferences.java:313)
	at net.sourceforge.kolmafia.swingui.panel.CreateSpecialPanel$PrefSpinner.stateChanged(CreateSpecialPanel.java:267)
	at javax.swing.JSpinner.fireStateChanged(Unknown Source)
	at javax.swing.JSpinner$ModelListener.stateChanged(Unknown Source)
	at javax.swing.AbstractSpinnerModel.fireStateChanged(Unknown Source)
	at javax.swing.SpinnerNumberModel.setValue(Unknown Source)
	at javax.swing.JSpinner.setValue(Unknown Source)
	at net.sourceforge.kolmafia.swingui.widget.AutoHighlightSpinner$AutoHighlightNumberEditor$AutoHighlightNumberEditorDocumentListener.updateSpinnerModel(AutoHighlightSpinner.java:119)
	at net.sourceforge.kolmafia.swingui.widget.AutoHighlightSpinner$AutoHighlightNumberEditor$AutoHighlightNumberEditorDocumentListener.insertUpdate(AutoHighlightSpinner.java:104)
	at javax.swing.text.AbstractDocument.fireInsertUpdate(Unknown Source)
	at javax.swing.text.AbstractDocument.handleInsertString(Unknown Source)
	at javax.swing.text.AbstractDocument.insertString(Unknown Source)
	at javax.swing.text.PlainDocument.insertString(Unknown Source)
	at javax.swing.text.AbstractDocument.replace(Unknown Source)
	at javax.swing.text.JTextComponent.setText(Unknown Source)
	at net.sourceforge.kolmafia.swingui.widget.AutoHighlightTextField.setText(AutoHighlightTextField.java:62)
	at net.sourceforge.kolmafia.swingui.widget.AutoHighlightSpinner$AutoHighlightNumberEditor.stateChanged(AutoHighlightSpinner.java:92)
	at javax.swing.JSpinner.fireStateChanged(Unknown Source)
	at javax.swing.JSpinner$ModelListener.stateChanged(Unknown Source)
	at javax.swing.AbstractSpinnerModel.fireStateChanged(Unknown Source)
	at javax.swing.SpinnerNumberModel.setValue(Unknown Source)
	at javax.swing.JSpinner.setValue(Unknown Source)
	at net.sourceforge.kolmafia.swingui.widget.AutoHighlightSpinner.setValue(AutoHighlightSpinner.java:61)
	at net.sourceforge.kolmafia.swingui.panel.CreateSpecialPanel$PrefSpinner.update(CreateSpecialPanel.java:272)
	at net.sourceforge.kolmafia.swingui.panel.CreateSpecialPanel$PrefSpinner.<init>(CreateSpecialPanel.java:261)
	at net.sourceforge.kolmafia.swingui.panel.CreateSpecialPanel.<init>(CreateSpecialPanel.java:109)
	at net.sourceforge.kolmafia.swingui.ItemManageFrame.<init>(ItemManageFrame.java:193)
	at net.sourceforge.kolmafia.swingui.ItemManageFrame.<init>(ItemManageFrame.java:117)
I'm working on it.
 
Last edited:
Back
Top