MegaMek/megameklab

[0.50.01-2024-10-30] Array Bounds Exception involving Compact Heat Sinks on a freshly loaded unit.

Opened this issue · 0 comments

Prerequisites and Pre-Issue Checklist

  • I'm reporting the issue to the correct repository:

  • MegaMek

  • MegaMekLab

  • MekHQ

  • I've tested the issue against at least the latest MILESTONE version

  • I've asked on the MegaMek Discord about the error

  • I've reviewed the BattleTech rules and MegaMekLab documentation, and I've confirmed that something isn't working as intended.

  • I've searched the Github tracker and haven't found the issue listed

Severity *

High (Major Disruption): A major feature is broken or incorrect, but a workaround exists. Possibly the same issue as #1575 but I found it happening on canon units with repeatability.

Brief Description *

Something's going wrong with loading units that have Compact Heat Sinks. See Below

Steps to Reproduce

1 . Load the Bombard BMB-016
2. Note the Heat Sink readout displays Singles and Engine Free 4
2024-10-30_221245
3. Check the crits tab and note the 2 CHS in the CT:
2024-10-30_221322
4. Back on first tab, click the up arrow on the heaqt sink number. Exception occurs
2024-10-30_221450
5 . Back on crit tab, in CT:
2024-10-30_221646
6. Back on first tab, click up arrow again. Number goes to 12.
7. Crit tab, suddenly unallocated:
2024-10-30_221733

At this point you can switch back to CHS, set it to 10, and place the 2 CHS back in the CT to get back to how it was (supposed to have) loaded.

Operating System *

Linux

Java Version *

17.0.12

MegaMek Suite Version *

Free Text (type manually)

Custom MegaMekLab Version

v0.50.01-SNAPSHOT 2024-10-30 (HEAD)

Attach Files

The log is very short so I'll just paste it here:

22:08:59,540 INFO  [megamek.MegaMek] {main}
megamek.MegaMek.initializeLogging(MegaMek.java:146) - Starting MegaMek v0.50.1-SNAPSHOT
    Build Date: 2024-10-30T22:08:58.354273302
    Today: 2024-10-30
    Origin Project: MegaMekLab
    Java Vendor: Eclipse Adoptium
    Java Version: 17.0.12
    Platform: Linux 6.11.5-200.fsync.fc40.x86_64 (amd64)
    System Locale: en_US
    Total memory available to MegaMek: 8 GB
    MM Code Revision: Unknown
    MML Code Revision: ae61a4d3af9c055a38d1ceb60d153f5b61e73f01
    MHQ Code Revision: Unknown


22:08:59,542 INFO  [megameklab.MegaMekLab] {main}
megameklab.MegaMekLab.initializeLogging(MegaMekLab.java:81) - Starting MegaMekLab v0.50.1-SNAPSHOT
    Build Date: 2024-10-30T22:08:58.354273302
    Today: 2024-10-30
    Origin Project: MegaMekLab
    Java Vendor: Eclipse Adoptium
    Java Version: 17.0.12
    Platform: Linux 6.11.5-200.fsync.fc40.x86_64 (amd64)
    System Locale: en_US
    Total memory available to MegaMekLab: 8 GB
    MM Code Revision: Unknown
    MML Code Revision: ae61a4d3af9c055a38d1ceb60d153f5b61e73f01
    MHQ Code Revision: Unknown


22:08:59,543 INFO  [megamek.client.ui.swing.util.FontHandler] {main}
megamek.client.ui.swing.util.FontHandler.initializeFonts(FontHandler.java:114) - Loading fonts from data/fonts/

22:08:59,656 INFO  [megamek.client.ui.swing.util.FontHandler] {main}
megamek.client.ui.swing.util.FontHandler.initializeFonts(FontHandler.java:123) - Loading fonts from Java's GraphicsEnvironment

22:08:59,966 INFO  [megamek.client.ui.preferences.SuitePreferences] {main}
megamek.client.ui.preferences.SuitePreferences.loadFromFile(SuitePreferences.java:125) - Loading user preferences from: mmconf/mm.preferences

22:08:59,969 ERROR [megamek.client.ui.preferences.SuitePreferences] {main}
megamek.client.ui.preferences.SuitePreferences.loadFromFile(SuitePreferences.java:151) - loadFromFile - Ignored
java.io.FileNotFoundException: mmconf/mm.preferences (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:111)
	at megamek.client.ui.preferences.SuitePreferences.loadFromFile(SuitePreferences.java:128)
	at megameklab.MegaMekLab.startup(MegaMekLab.java:98)
	at megameklab.MegaMekLab.main(MegaMekLab.java:77)

22:08:59,970 INFO  [megamek.client.ui.preferences.SuitePreferences] {main}
megamek.client.ui.preferences.SuitePreferences.loadFromFile(SuitePreferences.java:125) - Loading user preferences from: mmconf/mml.preferences

22:08:59,970 ERROR [megamek.client.ui.preferences.SuitePreferences] {main}
megamek.client.ui.preferences.SuitePreferences.loadFromFile(SuitePreferences.java:151) - loadFromFile - Ignored
java.io.FileNotFoundException: mmconf/mml.preferences (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:111)
	at megamek.client.ui.preferences.SuitePreferences.loadFromFile(SuitePreferences.java:128)
	at megameklab.MegaMekLab.startup(MegaMekLab.java:99)
	at megameklab.MegaMekLab.main(MegaMekLab.java:77)

22:08:59,985 INFO  [megamek.common.MMRandom] {Mek Cache Loader}
megamek.common.MMRandom.generate(MMRandom.java:42) - Generating RNG type #1

22:08:59,993 WARN  [megamek.common.WeaponOrderHandler] {Mek Cache Loader}
megamek.common.WeaponOrderHandler.loadWeaponOrderFile(WeaponOrderHandler.java:171) - Could not load custom weapon orders from customWeaponOrder.xml

22:09:10,436 WARN  [megamek.common.Mounted] {Mek Cache Loader}
megamek.common.Mounted.getTonnage(Mounted.java:529) - Found dumper not linked to a Cargo equipment. Using zero for the weight.

22:09:10,440 WARN  [megamek.common.Mounted] {Mek Cache Loader}
megamek.common.Mounted.getTonnage(Mounted.java:529) - Found dumper not linked to a Cargo equipment. Using zero for the weight.

22:12:09,994 INFO  [megamek.client.ui.swing.tileset.MekTileset] {AWT-EventQueue-0}
megamek.client.ui.swing.tileset.MekTileset.loadFromFile(MekTileset.java:370) - Loading unit icons from mekset.txt

22:12:10,007 INFO  [megamek.client.ui.swing.tileset.MekTileset] {AWT-EventQueue-0}
megamek.client.ui.swing.tileset.MekTileset.loadFromFile(MekTileset.java:370) - Loading unit icons from localserver_mekset.txt

22:12:10,007 INFO  [megamek.client.ui.swing.tileset.MekTileset] {AWT-EventQueue-0}
megamek.client.ui.swing.tileset.MekTileset.loadFromFile(MekTileset.java:370) - Loading unit icons from localclient_mekset.txt

22:14:29,307 ERROR [megameklab.MegaMekLab] {AWT-EventQueue-0}
megameklab.MegaMekLab.lambda$main$1(MegaMekLab.java:69) - Uncaught java.lang.ArrayIndexOutOfBoundsException detected. Please open up an issue containing all logs, the game save file, and customs at https://github.com/MegaMek/megamek/issues . If Sentry is enabled, the error has also been logged.
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 9
	at java.base/java.util.Vector.get(Vector.java:750)
	at megameklab.util.MekUtil.removeHeatSinks(MekUtil.java:148)
	at megameklab.ui.mek.BMStructureTab.heatSinksChanged(BMStructureTab.java:959)
	at megameklab.ui.generalUnit.HeatSinkView.lambda$reportChange$5(HeatSinkView.java:390)
	at java.base/java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:807)
	at megameklab.ui.generalUnit.HeatSinkView.reportChange(HeatSinkView.java:390)
	at megameklab.ui.generalUnit.HeatSinkView.stateChanged(HeatSinkView.java:377)
	at java.desktop/javax.swing.JSpinner.fireStateChanged(JSpinner.java:492)
	at java.desktop/javax.swing.JSpinner$ModelListener.stateChanged(JSpinner.java:419)
	at java.desktop/javax.swing.AbstractSpinnerModel.fireStateChanged(AbstractSpinnerModel.java:124)
	at java.desktop/javax.swing.SpinnerNumberModel.setValue(SpinnerNumberModel.java:460)
	at java.desktop/javax.swing.JSpinner.setValue(JSpinner.java:386)
	at java.desktop/javax.swing.plaf.basic.BasicSpinnerUI$ArrowButtonHandler.actionPerformed(BasicSpinnerUI.java:709)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
	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)

Final Checklist

  • I've checked to make sure that this issue has not already been filed
  • I'm reporting only one issue in this ticket for clarity and focus