Skip to content

Unclear error message upon non-existing incarnation when reloading effects #933

@DanySK

Description

@DanySK

If an incarnation is no longer available when an effect is requested, an unclear error is printed:

> Task :00-minimal
10:03:42.200 [main] WARN  it.unibo.alchemist.Alchemist - Available launchers: [Alchemist headless runner, Alchemist Swing graphical simulation]
10:03:42.204 [main] WARN  it.unibo.alchemist.launch.Launcher - Alchemist Swing graphical simulation selected because Graphical effects requested, priority shifts up
10:03:43.152 [main] WARN  i.u.a.loader.m2m.SimulationModel - No seeds specified, defaulting to 0 for both scenario and simulation
10:03:43.165 [main] WARN  i.u.a.loader.m2m.SimulationModel - No environment specified, defaulting to Continuous2DEnvironment
10:03:43.185 [main] WARN  i.u.a.loader.m2m.SimulationModel - There are no displacements in the specification, the environment won't have any node
Exception in thread "main" java.util.NoSuchElementException
        at org.danilopianini.lang.ImmutableCollectionWithCurrentElement.setCurrent(ImmutableCollectionWithCurrentElement.java:111)
        at org.danilopianini.lang.ImmutableCollectionWithCurrentElement.<init>(ImmutableCollectionWithCurrentElement.java:33)
        at it.unibo.alchemist.boundary.gui.effects.EffectSerializationFactory$2.read(EffectSerializationFactory.java:63)
        at it.unibo.alchemist.boundary.gui.effects.EffectSerializationFactory$2.read(EffectSerializationFactory.java:54)
        at com.google.gson.internal.bind.TypeAdapters$35$1.read(TypeAdapters.java:894)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.TypeAdapter.fromJsonTree(TypeAdapter.java:285)
        at com.google.gson.typeadapters.RuntimeTypeAdapterFactory$1.read(RuntimeTypeAdapterFactory.java:231)
        at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
        at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
        at com.google.gson.Gson.fromJson(Gson.java:932)
        at com.google.gson.Gson.fromJson(Gson.java:897)
        at it.unibo.alchemist.boundary.gui.effects.EffectSerializationFactory.effectsFromFile(EffectSerializationFactory.java:112)
        at it.unibo.alchemist.boundary.gui.SingleRunGUI.make(SingleRunGUI.java:157)
        at it.unibo.alchemist.boundary.gui.SingleRunGUI.make(SingleRunGUI.java:111)
        at it.unibo.alchemist.launch.SingleRunSwingUI.launch(SingleRunSwingUI.kt:46)
        at it.unibo.alchemist.launch.SimulationLauncher.launch(SimulationLauncher.kt:52)
        at it.unibo.alchemist.launch.Launcher.invoke(Launcher.kt:44)
        at it.unibo.alchemist.Alchemist.launch(Alchemist.kt:170)
        at it.unibo.alchemist.Alchemist.main(Alchemist.kt:128)

Reproducible at https://github.com/AlchemistSimulator/SAPERE-incarnation-tutorial/tree/5ee7ead4d51cd3acb3e0863cd3bc49a36bd07953, with ./gradlew 00

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions