From 44eaa539c58bc05bb1c7ce17cfde4bd925bca22c Mon Sep 17 00:00:00 2001 From: Julien Osman Date: Tue, 21 Jul 2020 09:25:25 +0200 Subject: [PATCH] FIX: Prevent XMLMetadataSupplier from being copied The class XMLMetadataSupplier belongs to a public hierarchy, it should not be possible to copy it. --- Modules/Core/Metadata/include/otbXMLMetadataSupplier.h | 2 ++ .../Metadata/src/otbSentinel1ImageMetadataInterface.cxx | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Modules/Core/Metadata/include/otbXMLMetadataSupplier.h b/Modules/Core/Metadata/include/otbXMLMetadataSupplier.h index 9481708b50..b7969b3300 100644 --- a/Modules/Core/Metadata/include/otbXMLMetadataSupplier.h +++ b/Modules/Core/Metadata/include/otbXMLMetadataSupplier.h @@ -43,6 +43,8 @@ class OTBMetadata_EXPORT XMLMetadataSupplier { public: XMLMetadataSupplier(const std::string &); + XMLMetadataSupplier(const XMLMetadataSupplier &) = delete; + XMLMetadataSupplier& operator=(const XMLMetadataSupplier&) = delete; /** * @brief Get the metadata value corresponding to a given path diff --git a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx index 959aa22fad..0d8d81ffea 100644 --- a/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx +++ b/Modules/Core/Metadata/src/otbSentinel1ImageMetadataInterface.cxx @@ -549,7 +549,7 @@ void Sentinel1ImageMetadataInterface::Parse(const MetadataSupplierInterface *mds std::string ManifestFilePath = mds->GetResourceFile(std::string("manifest\\.safe")); if (!ManifestFilePath.empty()) { - XMLMetadataSupplier ManifestMS = XMLMetadataSupplier(ManifestFilePath); + XMLMetadataSupplier ManifestMS(ManifestFilePath); m_Imd.Add(MDTime::ProductionDate, ManifestMS.GetFirstAs("xfdu:XFDU.metadataSection.metadataObject_#.metadataWrap.xmlData.safe:processing.start")); m_Imd.Add(MDTime::AcquisitionDate, @@ -569,7 +569,7 @@ void Sentinel1ImageMetadataInterface::Parse(const MetadataSupplierInterface *mds + std::string("-.*\\.xml")); if (AnnotationFilePath.empty()) otbGenericExceptionMacro(MissingMetadataException,<<"Missing Annotation file for band '"<GetAzimuthFmRate(AnnotationMS); sarParam.dopplerCentroid = this->GetDopplerCentroid(AnnotationMS); @@ -587,7 +587,7 @@ void Sentinel1ImageMetadataInterface::Parse(const MetadataSupplierInterface *mds + itksys::SystemTools::GetFilenameName(AnnotationFilePath); if (CalibrationFilePath.empty()) otbGenericExceptionMacro(MissingMetadataException,<<"Missing Calibration file for band '"<("calibration.calibrationInformation.absoluteCalibrationConstant")); sarParam.calibrationVectors = this->GetCalibrationVector(CalibrationMS); std::istringstream(CalibrationMS.GetAs("calibration.adsHeader.startTime")) >> sarParam.calibrationStartTime; @@ -599,7 +599,7 @@ void Sentinel1ImageMetadataInterface::Parse(const MetadataSupplierInterface *mds + itksys::SystemTools::GetFilenameName(AnnotationFilePath); if (NoiseFilePath.empty()) otbGenericExceptionMacro(MissingMetadataException,<<"Missing Noise file for band '"<