Loading net with product colors fails

Bug #2007676 reported by Jiri Srba
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TAPAAL
Fix Committed
Critical
Kenneth Yrke Jørgensen

Bug Description

In cpn branch I have a problem to save a net as I get:

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
        at java.base/java.util.Vector.get(Vector.java:750)
        at dk.aau.cs.model.CPN.Expressions.AddExpression.toString(AddExpression.java:176)
        at dk.aau.cs.io.writeTACPN.appendColoredPlaceDependencies(writeTACPN.java:370)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.createPlaceElement(TimedArcPetriNetNetworkWriter.java:481)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.appendPlaces(TimedArcPetriNetNetworkWriter.java:269)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.appendTemplates(TimedArcPetriNetNetworkWriter.java:253)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.savePNML(TimedArcPetriNetNetworkWriter.java:114)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.savePNML(TimedArcPetriNetNetworkWriter.java:136)
        at pipe.gui.petrinet.PetriNetTab.writeNetToFile(PetriNetTab.java:1816)
        at pipe.gui.petrinet.PetriNetTab.writeNetToFile(PetriNetTab.java:1830)
        at pipe.gui.petrinet.PetriNetTab.saveNet(PetriNetTab.java:1836)
        at net.tapaal.gui.GuiFrameController.save(GuiFrameController.java:528)
        at net.tapaal.gui.GuiFrameController.save(GuiFrameController.java:510)
        at net.tapaal.helpers.Reference.Reference.ifPresent(Reference.java:29)
        at pipe.gui.GuiFrame$4.actionPerformed(GuiFrame.java:94)
        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.AbstractButton.doClick(AbstractButton.java:374)
        at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:354)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:983)
        at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810)
        at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2947)
        at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:710)
        at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:717)
        at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:717)
        at java.desktop/javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:688)
        at java.desktop/javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:311)
        at java.desktop/javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:297)
        at java.desktop/javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:3040)
        at java.desktop/javax.swing.SwingUtilities.processKeyBindings(SwingUtilities.java:1731)
        at java.desktop/javax.swing.UIManager$2.postProcessKeyEvent(UIManager.java:1549)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:894)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1150)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1020)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:848)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4882)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
        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:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
        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:746)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
        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:743)
        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)
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0
        at java.base/java.util.Vector.get(Vector.java:750)
        at dk.aau.cs.model.CPN.Expressions.AddExpression.toString(AddExpression.java:176)
        at dk.aau.cs.io.writeTACPN.appendColoredPlaceDependencies(writeTACPN.java:370)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.createPlaceElement(TimedArcPetriNetNetworkWriter.java:481)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.appendPlaces(TimedArcPetriNetNetworkWriter.java:269)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.appendTemplates(TimedArcPetriNetNetworkWriter.java:253)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.savePNML(TimedArcPetriNetNetworkWriter.java:114)
        at dk.aau.cs.io.TimedArcPetriNetNetworkWriter.savePNML(TimedArcPetriNetNetworkWriter.java:136)
        at pipe.gui.petrinet.PetriNetTab.writeNetToFile(PetriNetTab.java:1816)
        at pipe.gui.petrinet.PetriNetTab.writeNetToFile(PetriNetTab.java:1830)
        at pipe.gui.petrinet.PetriNetTab.saveNet(PetriNetTab.java:1836)
        at net.tapaal.gui.GuiFrameController.save(GuiFrameController.java:528)
        at net.tapaal.gui.GuiFrameController.save(GuiFrameController.java:510)
        at net.tapaal.helpers.Reference.Reference.ifPresent(Reference.java:29)
        at pipe.gui.GuiFrame$4.actionPerformed(GuiFrame.java:94)
        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.AbstractButton.doClick(AbstractButton.java:374)
        at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:354)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Actions.actionPerformed(BasicMenuItemUI.java:983)
        at java.desktop/javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1810)
        at java.desktop/javax.swing.JComponent.processKeyBinding(JComponent.java:2947)
        at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:710)
        at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:717)
        at java.desktop/javax.swing.JMenuBar.processBindingForKeyStrokeRecursive(JMenuBar.java:717)
        at java.desktop/javax.swing.JMenuBar.processKeyBinding(JMenuBar.java:688)
        at java.desktop/javax.swing.KeyboardManager.fireBinding(KeyboardManager.java:311)
        at java.desktop/javax.swing.KeyboardManager.fireKeyboardAction(KeyboardManager.java:297)
        at java.desktop/javax.swing.JComponent.processKeyBindingsForAllComponents(JComponent.java:3040)
        at java.desktop/javax.swing.SwingUtilities.processKeyBindings(SwingUtilities.java:1731)
        at java.desktop/javax.swing.UIManager$2.postProcessKeyEvent(UIManager.java:1549)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:894)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1150)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:1020)
        at java.desktop/java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:848)
        at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4882)
        at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
        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:773)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
        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:746)
        at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
        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:743)
        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

Revision history for this message
Jiri Srba (srba) wrote :

Open the attached CPN net. Add a new place of color type "lift" and add a new token 1'(1, closed, up). Then try to save/load and it fails (in the debug menu).

Revision history for this message
Jiri Srba (srba) wrote :

A simpler way to recreate the problem. See the attached net and just add any token to the single place in the net. This breaks the save/load test.

Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :

It seems to happen when a product color type containers a int-range product type

Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :
summary: - Cannot save net - index out of bounds
+ Loading net with product color with int-rage fails
description: updated
Changed in tapaal:
importance: Undecided → Critical
Revision history for this message
Jiri Srba (srba) wrote : Re: Loading net with product color with int-rage fails

This is a problem even if no integer ranges are used. See the attached net, add a token and try to save/load the net.

Revision history for this message
Jiri Srba (srba) wrote :

The problem seems to be that the floor colortype appears in two different product types at the same time.

Revision history for this message
Jiri Srba (srba) wrote :

And even simpler example gives a problem (enumeration type inside of a product type). Just add a token to the place and will not save/load again.

summary: - Loading net with product color with int-rage fails
+ Loading net with product colors fails
Revision history for this message
Jiri Srba (srba) wrote :

After PR65 there is still a problem. Open the net and save/load and all is fine.
Then open the button product type and reorder the two colors so that it starts with floor.
Now try to save/load again and it fails.

Revision history for this message
Kenneth Yrke Jørgensen (yrke) wrote :
Revision history for this message
Jiri Srba (srba) wrote :

Anothe problem with PR65 is that it makes NPE when adding a token of type (.all,something,something). Open the attached net and to the place buttons add a token where the first coordinate is all (all floors) and the other default. This will raise an expection.

Revision history for this message
Jiri Srba (srba) wrote :

These issues have been fixed.

Changed in tapaal:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.