From f2d41883cef4a6ada1ce597124f1f12b94f1c6fc Mon Sep 17 00:00:00 2001 From: AlexisDrogoul Date: Wed, 17 Apr 2024 11:38:41 +0700 Subject: [PATCH] Minor fix to prevent an NPE when documenting constants. --- .../gaml/descriptions/ValidationContext.java | 2 +- .../metadata/FileMetaDataProvider.java | 22 +++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/gama.core/src/gama/gaml/descriptions/ValidationContext.java b/gama.core/src/gama/gaml/descriptions/ValidationContext.java index dd142e15e9..024ebe1107 100644 --- a/gama.core/src/gama/gaml/descriptions/ValidationContext.java +++ b/gama.core/src/gama/gaml/descriptions/ValidationContext.java @@ -267,7 +267,7 @@ public void doDocument(final ModelDescription description) { public void setGamlDocumentation(final EObject e, final IGamlDescription d) { // Called by SymbolDescription to document individual expressions -- they are kept in a Map and done when the whole model is documented - if (shouldDocument) { expressionsToDocument.put(e, d); } + if (shouldDocument && e != null && d != null) { expressionsToDocument.put(e, d); } } /** diff --git a/gama.ui.navigator/src/gama/ui/navigator/metadata/FileMetaDataProvider.java b/gama.ui.navigator/src/gama/ui/navigator/metadata/FileMetaDataProvider.java index 66d07f7d0b..fbe37cfb7c 100644 --- a/gama.ui.navigator/src/gama/ui/navigator/metadata/FileMetaDataProvider.java +++ b/gama.ui.navigator/src/gama/ui/navigator/metadata/FileMetaDataProvider.java @@ -1,9 +1,9 @@ /******************************************************************************************************* * - * FileMetaDataProvider.java, in gama.ui.navigator.view, is part of the source code of the GAMA modeling and - * simulation platform . + * FileMetaDataProvider.java, in gama.ui.navigator, is part of the source code of the GAMA modeling and simulation + * platform (v.2024-06). * - * (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU) + * (c) 2007-2024 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, ESPACE-DEV, CTU) * * Visit https://github.com/gama-platform/gama for license information and contacts. * @@ -44,15 +44,15 @@ import gama.core.common.GamlFileExtension; import gama.core.util.file.GamaCSVFile; +import gama.core.util.file.GamaCSVFile.CSVInfo; import gama.core.util.file.GamaFileMetaData; import gama.core.util.file.GamaOsmFile; +import gama.core.util.file.GamaOsmFile.OSMInfo; import gama.core.util.file.GamaShapeFile; +import gama.core.util.file.GamaShapeFile.ShapeInfo; import gama.core.util.file.GamlFileInfo; import gama.core.util.file.IFileMetaDataProvider; import gama.core.util.file.IGamaFileMetaData; -import gama.core.util.file.GamaCSVFile.CSVInfo; -import gama.core.util.file.GamaOsmFile.OSMInfo; -import gama.core.util.file.GamaShapeFile.ShapeInfo; import gama.dev.DEBUG; import gama.dev.THREADS; import gama.gaml.compilation.GAML; @@ -643,16 +643,6 @@ private void startup() { }); } catch (final CoreException e) {} }); - // new Thread(() -> { - // try { - // TIMER_WITH_EXCEPTIONS( - // DEBUG.PAD("> GAMA: workspace projects ", 55, ' ') + DEBUG.PAD(" built in", 15, '_'), () -> { - // workspace.build(IncrementalProjectBuilder.FULL_BUILD, null); - // }); - // } catch (CoreException e) { - // e.printStackTrace(); - // } - // }).start(); try { workspace.addSaveParticipant("gama.ui.shared.modeling", getSaveParticipant());