Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes the option to zip or not the binary serialisation format #356

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

AlexisDrogoul
Copy link
Member

Simplifies lots of serialisation function. Fixes #351

Simplifies lots of serialisation function.
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

Change in average Code Health of affected files: -0.00 (9.60 -> 9.60)

View detailed results in CodeScene

@lesquoyb
Copy link
Contributor

Now it's the record experiments that are broken, when I try to step back nothing happens and I have this message:

unable to decode:���
java.io.IOException: java.lang.NullPointerException: Cannot load from object array because the return value of "org.nustaq.serialization.FSTClazzInfo$FSTFieldInfo.getPossibleClasses()" is null
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:377)
	at org.nustaq.serialization.FSTConfiguration.asObject(FSTConfiguration.java:801)
	at gama.extension.serialize.binary.BinarySerialiser.restoreAgentFromBytes(BinarySerialiser.java:95)
	at gama.extension.serialize.binary.SimulationSerialiser.restore(SimulationSerialiser.java:94)
	at gama.core.kernel.experiment.ExperimentAgent.lambda$0(ExperimentAgent.java:994)
	at gama.core.runtime.GAMA.runAndUpdateAll(GAMA.java:553)
	at gama.core.kernel.experiment.ExperimentAgent.backward(ExperimentAgent.java:991)
	at gama.core.kernel.experiment.DefaultExperimentController.processUserCommand(DefaultExperimentController.java:108)
	at gama.core.kernel.experiment.AbstractExperimentController.lambda$0(AbstractExperimentController.java:63)
	at java.base/java.lang.Thread.run(Thread.java:1570)
Caused by: java.lang.NullPointerException: Cannot load from object array because the return value of "org.nustaq.serialization.FSTClazzInfo$FSTFieldInfo.getPossibleClasses()" is null
	at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:523)
	at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:487)
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:447)
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:375)
	... 9 more
Java error: I/O error
	at gama.core.runtime.exceptions.GamaRuntimeException.create(GamaRuntimeException.java:71)
	at gama.extension.serialize.binary.BinarySerialiser.restoreAgentFromBytes(BinarySerialiser.java:98)
	at gama.extension.serialize.binary.SimulationSerialiser.restore(SimulationSerialiser.java:94)
	at gama.core.kernel.experiment.ExperimentAgent.lambda$0(ExperimentAgent.java:994)
	at gama.core.runtime.GAMA.runAndUpdateAll(GAMA.java:553)
	at gama.core.kernel.experiment.ExperimentAgent.backward(ExperimentAgent.java:991)
	at gama.core.kernel.experiment.DefaultExperimentController.processUserCommand(DefaultExperimentController.java:108)
	at gama.core.kernel.experiment.AbstractExperimentController.lambda$0(AbstractExperimentController.java:63)
	at java.base/java.lang.Thread.run(Thread.java:1570)
Caused by: java.io.IOException: java.lang.NullPointerException: Cannot load from object array because the return value of "org.nustaq.serialization.FSTClazzInfo$FSTFieldInfo.getPossibleClasses()" is null
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:377)
	at org.nustaq.serialization.FSTConfiguration.asObject(FSTConfiguration.java:801)
	at gama.extension.serialize.binary.BinarySerialiser.restoreAgentFromBytes(BinarySerialiser.java:95)
	... 7 more
Caused by: java.lang.NullPointerException: Cannot load from object array because the return value of "org.nustaq.serialization.FSTClazzInfo$FSTFieldInfo.getPossibleClasses()" is null
	at org.nustaq.serialization.FSTObjectInput.readObjectWithHeader(FSTObjectInput.java:523)
	at org.nustaq.serialization.FSTObjectInput.readObjectInternal(FSTObjectInput.java:487)
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:447)
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:375)
	... 9 more

The two functions are now being used only in one place, offering the possibility to turn it off or on much more easily.
Copy link

@codescene-delta-analysis codescene-delta-analysis bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Quality Gates: OK

Change in average Code Health of affected files: -0.00 (9.60 -> 9.60)

View detailed results in CodeScene

@AlexisDrogoul
Copy link
Member Author

The issue(s) should now be completely fixed.

@lesquoyb
Copy link
Contributor

I still noticed a problem, when trying to restore agents from a file in the Serialize and Restore Agents.gaml using the restore people from disk I have this in the eclipse console:

java.util.zip.ZipException: Not in GZIP format
	at java.base/java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:176)
	at java.base/java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)
	at java.base/java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91)
	at gama.core.util.ByteArrayZipper.unzip(ByteArrayZipper.java:66)
	at org.nustaq.serialization.FSTConfiguration.asObject(FSTConfiguration.java:666)
	at gama.extension.serialize.binary.BinarySerialiser.restoreAgentFromBytes(BinarySerialiser.java:95)
	at gama.extension.serialize.binary.BinarySerialisation.restoreFromBytes(BinarySerialisation.java:158)
	at gama.extension.serialize.binary.BinarySerialisation.restoreFromString(BinarySerialisation.java:135)
	at gama.extension.serialize.gaml.RestoreStatement.privateExecuteIn(RestoreStatement.java:105)
	at gama.extension.serialize.gaml.RestoreStatement.privateExecuteIn(RestoreStatement.java:1)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.RemoteSequence.privateExecuteIn(RemoteSequence.java:62)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.concurrent.GamaExecutorService.execute(GamaExecutorService.java:334)
	at gama.core.runtime.concurrent.GamaExecutorService.execute(GamaExecutorService.java:363)
	at gama.gaml.statements.AskStatement.privateExecuteIn(AskStatement.java:218)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:69)
	at gama.gaml.statements.IfStatement.privateExecuteIn(IfStatement.java:215)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:69)
	at gama.gaml.statements.AbstractStatementSequenceWithArgs.privateExecuteIn(AbstractStatementSequenceWithArgs.java:59)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:427)
	at gama.gaml.statements.DoStatement.privateExecuteIn(DoStatement.java:308)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.RemoteSequence.privateExecuteIn(RemoteSequence.java:62)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.gaml.statements.AskStatement.privateExecuteIn(AskStatement.java:229)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:69)
	at gama.gaml.statements.UserCommandStatement.privateExecuteIn(UserCommandStatement.java:216)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.ui.experiment.parameters.ExperimentsParametersList.lambda$4(ExperimentsParametersList.java:171)
	at gama.core.kernel.experiment.ActionExecuter.executeOneAction(ActionExecuter.java:147)
	at gama.core.kernel.experiment.ExperimentAgent.executeAction(ExperimentAgent.java:1313)
	at gama.ui.experiment.parameters.ExperimentsParametersList.lambda$3(ExperimentsParametersList.java:170)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:265)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4285)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1160)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1184)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1169)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:841)
	at gama.ui.shared.controls.FlatButton.doButtonUp(FlatButton.java:264)
	at gama.ui.shared.controls.FlatButton.handleEvent(FlatButton.java:226)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4285)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1160)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4083)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3673)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:152)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
	at gama.ui.application.Application.start(Application.java:148)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1454)

All other serialisation models work properly

@AlexisDrogoul
Copy link
Member Author

Make sure you clean your directory before. Agents / Simulations files are not overwritten, so you may have old ones in your directory

@lesquoyb
Copy link
Contributor

Yes I tried to remove previous saved agents and even create a new workspace but I still have this problem

@AlexisDrogoul
Copy link
Member Author

I couldn't reproduce the problem you described on macOS. So i tried the model in a Windows installation and I do not have any problem... Restoring and recreating agents from disk work w/o problems.

@lesquoyb
Copy link
Contributor

I tried on two other computers and can reproduce it. I forgot to add this part of the exception:

java.io.IOException: java.lang.ArrayIndexOutOfBoundsException
unable to decode:/home/baptiste/Documents/gama/gama.extension.serialize/models/Serialization/people/save3.agent
	at org.nustaq.serialization.FSTObjectInput.readObject(FSTObjectInput.java:377)
	at org.nustaq.serialization.FSTConfiguration.asObject(FSTConfiguration.java:667)
	at gama.extension.serialize.binary.BinarySerialiser.restoreAgentFromBytes(BinarySerialiser.java:95)
	at gama.extension.serialize.binary.BinarySerialisation.restoreFromBytes(BinarySerialisation.java:158)
	at gama.extension.serialize.binary.BinarySerialisation.restoreFromString(BinarySerialisation.java:135)
	at gama.extension.serialize.gaml.RestoreStatement.privateExecuteIn(RestoreStatement.java:105)
	at gama.extension.serialize.gaml.RestoreStatement.privateExecuteIn(RestoreStatement.java:1)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.RemoteSequence.privateExecuteIn(RemoteSequence.java:62)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.concurrent.GamaExecutorService.execute(GamaExecutorService.java:334)
	at gama.core.runtime.concurrent.GamaExecutorService.execute(GamaExecutorService.java:363)
	at gama.gaml.statements.AskStatement.privateExecuteIn(AskStatement.java:218)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:69)
	at gama.gaml.statements.IfStatement.privateExecuteIn(IfStatement.java:215)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:69)
	at gama.gaml.statements.AbstractStatementSequenceWithArgs.privateExecuteIn(AbstractStatementSequenceWithArgs.java:59)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:427)
	at gama.gaml.statements.DoStatement.privateExecuteIn(DoStatement.java:308)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.RemoteSequence.privateExecuteIn(RemoteSequence.java:62)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.gaml.statements.AskStatement.privateExecuteIn(AskStatement.java:229)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.gaml.statements.AbstractStatementSequence.privateExecuteIn(AbstractStatementSequence.java:69)
	at gama.gaml.statements.UserCommandStatement.privateExecuteIn(UserCommandStatement.java:216)
	at gama.gaml.statements.AbstractStatement.executeOn(AbstractStatement.java:47)
	at gama.gaml.statements.AbstractStatementSequence.executeOn(AbstractStatementSequence.java:59)
	at gama.core.runtime.ExecutionScope.execute(ExecutionScope.java:509)
	at gama.core.runtime.IScope.execute(IScope.java:443)
	at gama.core.runtime.IScope.execute(IScope.java:414)
	at gama.ui.experiment.parameters.ExperimentsParametersList.lambda$4(ExperimentsParametersList.java:171)
	at gama.core.kernel.experiment.ActionExecuter.executeOneAction(ActionExecuter.java:147)
	at gama.core.kernel.experiment.ExperimentAgent.executeAction(ExperimentAgent.java:1313)
	at gama.ui.experiment.parameters.ExperimentsParametersList.lambda$3(ExperimentsParametersList.java:170)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:265)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1617)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1643)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1626)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1373)
	at gama.ui.shared.controls.FlatButton.doButtonUp(FlatButton.java:264)
	at gama.ui.shared.controls.FlatButton.handleEvent(FlatButton.java:226)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1617)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5065)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4517)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
	at gama.ui.application.Application.start(Application.java:148)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
Caused by: java.lang.ArrayIndexOutOfBoundsException

Also it seems to at least partially work so maybe the error stack is written in the console of eclipse but the error is handled by gama and another mechanism is called to finish the work ?

@lesquoyb
Copy link
Contributor

I followed the execution step by step and it is indeed just an "expected" error message found in the console, and the execution continues to something else, there is no actual bug.

It is caused by the restoreFromString method of BinarySerialisation:

	public static void restoreFromString(final IAgent agent, final String string) {
		try {
			restoreFromBytes(agent, string.getBytes(STRING_BYTE_ARRAY_CHARSET));
		} catch (Throwable e) {
			try {
				restoreFromFile(agent, string);
			} catch (Throwable ex) {
				GAMA.reportAndThrowIfNeeded(agent.getScope(), GamaRuntimeException.create(ex, agent.getScope()), true);
			}
		}
	}

Even though it is not clear from that code, when restoreFromBytes fails in our case it is this code from FSTConfiguration.java that is filling the console with error messages:

	public Object asObject(final byte b[]) {
		try {
			final byte[] input = ByteArrayZipper.unzip(b);
			return getObjectInput(input).readObject();
		} catch (Exception e) {
			System.out.println("unable to decode:" + new String(b, 0, 0, Math.min(b.length, 100)));
			FSTUtil.<RuntimeException> rethrow(e);
		}
		return null;
	}

@lesquoyb lesquoyb merged commit ddf8684 into 2024-06 Oct 30, 2024
6 checks passed
@lesquoyb lesquoyb deleted the Addresses-#351-(Serialization) branch October 30, 2024 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Serialization] Reloading simulation from file doesn't work anymore
2 participants