diff --git a/Modules/Core/Metadata/include/otbMetadataSupplierInterface.h b/Modules/Core/Metadata/include/otbMetadataSupplierInterface.h index b78599207c2daad1dcb35584cf44d0d5f06e9564..93e78a1f444293a5dff983479a1c72840915f28d 100644 --- a/Modules/Core/Metadata/include/otbMetadataSupplierInterface.h +++ b/Modules/Core/Metadata/include/otbMetadataSupplierInterface.h @@ -24,10 +24,9 @@ #include "OTBMetadataExport.h" #include <vector> #include <string> -#include "otbStringUtils.h" #include "otbMacro.h" -#include "otbStringUtilities.h" #include "otbStringUtils.h" +#include "otbStringUtilities.h" namespace otb { diff --git a/Modules/Core/Metadata/src/otbGeomMetadataSupplier.cxx b/Modules/Core/Metadata/src/otbGeomMetadataSupplier.cxx index 41a745ad7dbabf2aa2c1bbb79a2538ce89bb4045..190f24ff1b0c9707772efe972da298fe5e1267c7 100644 --- a/Modules/Core/Metadata/src/otbGeomMetadataSupplier.cxx +++ b/Modules/Core/Metadata/src/otbGeomMetadataSupplier.cxx @@ -24,6 +24,7 @@ #include "otbGeomMetadataSupplier.h" #include "otbMetaDataKey.h" #include "otbGeometryMetadata.h" +#include "otbStringUtils.h" namespace otb { @@ -52,7 +53,13 @@ std::string GeomMetadataSupplier::GetResourceFile(std::string) const int GeomMetadataSupplier::GetNbBands() const { - return this->GetAsVector<std::string>("support_data.band_name_list").size(); + bool hasValue; + std::string ret = this->GetMetadataValue("support_data.band_name_list", hasValue); + if (!hasValue) + otbGenericExceptionMacro(MissingMetadataException,<<"Missing metadata 'support_data.band_name_list'") + std::vector<std::string> ret_vect; + otb::Utils::ConvertStringToVector(ret, ret_vect, "band name"); + return ret_vect.size(); } const boost::any& GeomMetadataSupplier::FetchRPC(ImageMetadata & imd)