Sporadic AquaTextFieldSearch exception on MacOS startup
User reports “it occurred when I opened the program”. The presence of AquaTextFieldSearch tells me it’s a “JTextField.variant" "search” field, which I think is IndexerPanel. Offhand, it’s not obvious why one of those would ever be created at startup, though perhaps I’ve got some overly aggressive Guice bindings.
Presumably a JDK bug too, given the lack of anything Scythebill-specific here.
java.lang.StringIndexOutOfBoundsException: offset 9, count 5, length 10
at java.base/java.lang.String.checkBoundsOffCount(String.java:3092)
at java.base/java.lang.String.rangeCheck(String.java:279)
at java.base/java.lang.String.<init>(String.java:275)
at java.desktop/javax.swing.text.GapContent.getString(GapContent.java:169)
at java.desktop/javax.swing.text.AbstractDocument.getText(AbstractDocument.java:779)
at java.desktop/javax.swing.text.JTextComponent.getText(JTextComponent.java:1757)
at java.desktop/com.apple.laf.AquaTextFieldSearch.updateCancelIconOnEDT(AquaTextFieldSearch.java:290)
at java.desktop/com.apple.laf.AquaTextFieldSearch$12.run(AquaTextFieldSearch.java:284)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
Comments (3)
-
reporter -
reporter - changed status to resolved
Stop setting JTextField.variant to search in IndexerPanels, which should resolve issue
#455indirectly.→ <<cset d381c56a8000>>
-
reporter - Log in to comment
Ah, so IndexerPanels are created at startup from stored queries:
at com.scythebill.birdlist.ui.components.IndexerPanel.initComponents(IndexerPanel.java:743)
at com.scythebill.birdlist.ui.components.IndexerPanel.<init>(IndexerPanel.java:145)
at com.scythebill.birdlist.ui.panels.reports.LocationQueryField.<init>(LocationQueryField.java:73)
at com.scythebill.birdlist.ui.panels.reports.QueryFieldFactory$QueryFieldType$2.newField(QueryFieldFactory.java:56)
at com.scythebill.birdlist.ui.panels.reports.QueryFieldFactory.newField(QueryFieldFactory.java:209)
at com.scythebill.birdlist.ui.panels.reports.StoredQueries.restore(StoredQueries.java:319)
That’s kinda lazy of the code (and probably worth fixing for a very modest efficiency boost), but explains how this could possibly appear at startup.
Something else that is distinctly puzzling here: most IndexerPanels do not have the search icon or gray X. But somehow, the “Where?” in a WherePanel does. Huh?
…. aaaand it’s the TextPrompt code. It blows away the layout, and stomps on everything.
Looks like setting JTextField.Search.Prompt to the prompt instead of anything else (for MacOS + a search field) will fix that…. though it won’t address the listed exception.