diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 17a1e5258f2727046350fa5a5ff87453792db952..a6013ad5f5405d5b0a3d5e9791d1c8bbccf2ae32 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -27,4 +27,4 @@ shark-build: stage: build image: registry.orfeo-toolbox.org/gbonnefille/otb-build-env/otb-ubuntu-shark:18.04 script: - - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-gcc-shark-3.1.4 + - ctest -VV -S CI/main_ci.cmake -DIMAGE_NAME:string=ubuntu-18.04-llvm-shark diff --git a/CI/ubuntu-18.04-gcc-shark-3.1.4.cmake b/CI/ubuntu-18.04-gcc-shark.cmake similarity index 100% rename from CI/ubuntu-18.04-gcc-shark-3.1.4.cmake rename to CI/ubuntu-18.04-gcc-shark.cmake diff --git a/CI/ubuntu-18.04-llvm-shark.cmake b/CI/ubuntu-18.04-llvm-shark.cmake new file mode 100644 index 0000000000000000000000000000000000000000..610da34da206b53f5b35444ec1721f120e94deb3 --- /dev/null +++ b/CI/ubuntu-18.04-llvm-shark.cmake @@ -0,0 +1,29 @@ +# +# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Configuration options for ubuntu-18.04-llvm-shark-3.1.4 + +set(site_option +"opencv_INCLUDE_DIR:PATH=/usr/include +CMAKE_C_COMPILER:STRING=clang +CMAKE_CXX_COMPILER:STRING=clang++ +CMAKE_EXE_LINKER_FLAGS:STRING=-fuse-ld=lld +CMAKE_MODULE_LINKER_FLAGS:STRING=-fuse-ld=lld +CMAKE_SHARED_LINKER_FLAGS:STRING=-fuse-ld=lld") diff --git a/CI/ubuntu-18.04-llvm.cmake b/CI/ubuntu-18.04-llvm.cmake new file mode 100644 index 0000000000000000000000000000000000000000..a92364f2b45d82176aa65d3d112753055421aef1 --- /dev/null +++ b/CI/ubuntu-18.04-llvm.cmake @@ -0,0 +1,30 @@ +# +# Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) +# +# This file is part of Orfeo Toolbox +# +# https://www.orfeo-toolbox.org/ +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Configuration options for ubuntu-18.04-llvm + +set(site_option +"opencv_INCLUDE_DIR:PATH=/usr/include +OTB_USE_SHARK:BOOL=OFF +CMAKE_C_COMPILER:STRING=clang +CMAKE_CXX_COMPILER:STRING=clang++ +CMAKE_EXE_LINKER_FLAGS:STRING=-fuse-ld=lld +CMAKE_MODULE_LINKER_FLAGS:STRING=-fuse-ld=lld +CMAKE_SHARED_LINKER_FLAGS:STRING=-fuse-ld=lld") diff --git a/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx b/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx index 58d5e42b1e007d82b1534f0674a9ab4f525586bb..9402e9949e53897ea70a0c94f937a20ba638070e 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbDEMHandler.cxx @@ -23,6 +23,8 @@ #include <cassert> +#include "otb_ossim.h" + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx b/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx index 0a35fb615f3afb3cd91fff7eabbb2a07ac4607d8..726bbcbaf3c5b791f3260623219f27958f7a7729 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbRPCSolverAdapter.cxx @@ -23,6 +23,8 @@ #include "otbImageKeywordlist.h" #include "otbMacro.h" +#include "otb_ossim.h" + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx index f61ff4e51a563095351717b01ce8df31d0e6b1e9..200a23fa8453d9c136bb0195a0fd4e8f5e4eb1b3 100644 --- a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx +++ b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest2.cxx @@ -22,6 +22,8 @@ #include <fstream> #include <cstdlib> +#include "otb_ossim.h" + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx index ecaeb3e91330d1fe4c3ded55f596752085499bd6..0d29384921138246ac3316c027603e5c46d4d587 100644 --- a/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx +++ b/Modules/Adapters/OSSIMAdapters/test/otbOssimElevManagerTest4.cxx @@ -23,6 +23,8 @@ #include <fstream> #include <sstream> +#include "otb_ossim.h" + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileResourceLeakTest.cxx b/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileResourceLeakTest.cxx index 39e845d910ee14af4d76bc4f3c1868fad883909c..0e49feca855800a1ee32c49d6406e6b21e28635a 100644 --- a/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileResourceLeakTest.cxx +++ b/Modules/Adapters/OSSIMAdapters/test/otbOssimJpegFileResourceLeakTest.cxx @@ -21,6 +21,7 @@ #include <stdlib.h> #include <iostream> +#include "otb_ossim.h" #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push diff --git a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx index 540bcbd10f95ad9a520265bc5d8960f141d84514..d59f5334c1e40312a3e1e73bb36abe43f463c2f0 100644 --- a/Modules/Applications/AppProjection/app/otbSuperimpose.cxx +++ b/Modules/Applications/AppProjection/app/otbSuperimpose.cxx @@ -283,7 +283,7 @@ private: m_BasicResampler->SetOutputSpacing(xsSpacing); m_BasicResampler->SetOutputSize(size); - m_Resampler->SetOutputStartIndex(start); + m_BasicResampler->SetOutputStartIndex(start); m_BasicResampler->SetEdgePaddingValue(defaultValue); m_GeoImport->SetInput(m_BasicResampler->GetOutput()); diff --git a/Modules/Core/Common/include/otbLogger.h b/Modules/Core/Common/include/otbLogger.h index cc9f4e9f18d69552b097ff957c4aaf3d2e5990f6..6ae206fe2611038834f5721c01c67126420afdc2 100644 --- a/Modules/Core/Common/include/otbLogger.h +++ b/Modules/Core/Common/include/otbLogger.h @@ -71,6 +71,9 @@ public: /** Set the flag m_LogSetupInfoDone to true */ void LogSetupInformationDone(); + // Overwrite this to provide custom formatting of log entries + std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) override; + protected: Logger(); virtual ~Logger() override = default; diff --git a/Modules/Core/Common/src/otbLogger.cxx b/Modules/Core/Common/src/otbLogger.cxx index 95e107e9090c02e3633df05fbadec43c301e83dc..20685d1651d1bc4d249ab6d862acdc518fcde3e9 100644 --- a/Modules/Core/Common/src/otbLogger.cxx +++ b/Modules/Core/Common/src/otbLogger.cxx @@ -26,6 +26,9 @@ #include "gdal.h" #include "itkMultiThreader.h" +#include <type_traits> +#include <cassert> + namespace otb { @@ -120,4 +123,21 @@ void Logger::LogSetupInformationDone() m_LogSetupInfoDone = true; } +std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const& content) +{ + static const std::string levelString[] = {"(MUSTFLUSH)", "(FATAL)", "(CRITICAL)", "(WARNING)", "(INFO)", "(DEBUG)", "(NOTSET)"}; + + assert(level <= std::extent<decltype(levelString)>::value); + + if (strcmp(this->GetName(), "") == 0) + { + return itksys::SystemTools::GetCurrentDateTime("%Y-%m-%d %H:%M:%S") + " " + levelString[level] + ": " + content; + } + else + { + return itksys::SystemTools::GetCurrentDateTime("%Y-%m-%d %H:%M:%S") + " " + levelString[level] + " " + this->GetName() + ": " + content; + } +} + + } // namespace otb diff --git a/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx b/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx index 30f63d89cf0d3b4fc83004dbb39c69a8c3db002b..499853964bc0d34c1c6ffa5d5e241951017b4eef 100644 --- a/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx +++ b/Modules/Core/Transform/test/otbCreateProjectionWithOSSIM.cxx @@ -47,6 +47,8 @@ #include "otbInverseSensorModel.h" +#include "otb_ossim.h" + #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.hxx b/Modules/IO/ImageIO/include/otbImageFileReader.hxx index 770f8b791230c14cfe68f9e58c304c892e5191ff..09c7e0cae81c623443aeb33566093047a2a67c7c 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.hxx +++ b/Modules/IO/ImageIO/include/otbImageFileReader.hxx @@ -601,11 +601,11 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> // Test if the file exists. if (!itksys::SystemTools::FileExists(fileToCheck)) { - throw otb::ImageFileReaderException (__FILE__, __LINE__, "The file does not exist.", fileToCheck); + throw otb::ImageFileReaderException (__FILE__, __LINE__, std::string("Cannot open image ") + fileToCheck + std::string(". The file does not exist."), fileToCheck); } else { - throw otb::ImageFileReaderException(__FILE__, __LINE__, "Probably unsupported format or incorrect filename extension.", this->m_FileName); + throw otb::ImageFileReaderException(__FILE__, __LINE__, std::string("Cannot open image ") + this->m_FileName + std::string(". Probably unsupported format or incorrect filename extension."), this->m_FileName); } } } diff --git a/Modules/IO/TestKernel/include/otbTestMain.h b/Modules/IO/TestKernel/include/otbTestMain.h index 8b9e2e9fb6c850037d0ea9b68e39838531fb3557..40696ad53934f22e1864e316565cda2f79b7ae3e 100644 --- a/Modules/IO/TestKernel/include/otbTestMain.h +++ b/Modules/IO/TestKernel/include/otbTestMain.h @@ -300,56 +300,36 @@ int main(int ac, char* av[]) return -1; } else - { + { otb::Logger::Instance()->LogSetupInformation(); MainFuncPointer f = j->second; int result; try - { + { // Invoke the test's "main" function. result = (*f)(ac - 1, av + 1); - if (result != EXIT_SUCCESS ) - { + if (result != EXIT_SUCCESS) + { std::cout << "-> Test EXIT FAILURE (" << result << ")." << std::endl; itkGenericExceptionMacro(<< "Function returns EXIT_FAILURE (not from regression, failure inside the test)"); - } } - catch (const otb::ImageFileReaderException& e) - { - std::cerr << "otbTestMain '" << testToRun << "': ImageFileReaderException:" << std::endl; - std::cerr << e.GetFile() << ":" << e.GetLine() << ":" << std::endl; - std::cerr << std::string("Cannot open image ") + e.m_Filename + std::string(". ") + e.GetDescription() << std::endl; - result = EXIT_FAILURE; } - catch (const itk::ExceptionObject& e) - { - std::cerr << "otbTestMain '" << testToRun << "': ITK Exception thrown:" << std::endl; - std::cerr << e.GetFile() << ":" << e.GetLine() << ":" << std::endl; - std::cerr << e.GetDescription() << std::endl; - result = EXIT_FAILURE; - } - catch (const std::bad_alloc& err) - { - std::cerr << "otbTestMain '" << testToRun << "': Exception bad_alloc thrown: " << std::endl; - std::cerr << (char*) err.what() << std::endl; - result = EXIT_FAILURE; - } catch (const std::exception& e) - { - std::cerr << "otbTestMain '" << testToRun << "': std::exception thrown:" << std::endl; - std::cerr << e.what() << std::endl; + { + std::cerr << "otbTestMain '" << testToRun << "': exception caught:" << std::endl; + std::cerr << e.what() << std::endl; result = EXIT_FAILURE; - } + } catch (...) - { - std::cerr << "otbTestMain '" << testToRun << "': Unknown exception thrown !" << std::endl; + { + std::cerr << "otbTestMain '" << testToRun << "': unknown exception caught!" << std::endl; result = EXIT_FAILURE; - } + } - if (result != EXIT_SUCCESS ) - { - return -1; - } + if (result != EXIT_SUCCESS) + { + return -1; + } result = EXIT_SUCCESS; diff --git a/Modules/ThirdParty/Ossim/include/otb_ossim.h b/Modules/ThirdParty/Ossim/include/otb_ossim.h new file mode 100644 index 0000000000000000000000000000000000000000..1a898b9fe353d567bd162047ce4c917d63f32fd5 --- /dev/null +++ b/Modules/ThirdParty/Ossim/include/otb_ossim.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2005-2019 Centre National d'Etudes Spatiales (CNES) + * + * This file is part of Orfeo Toolbox + * + * https://www.orfeo-toolbox.org/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef otb_ossim_h +#define otb_ossim_h + +#include <cstddef> +// export nullptr_t from std as ossimRefPtr uses it (ossim 2.2.0) +using std::nullptr_t; + +#endif diff --git a/Modules/ThirdParty/OssimPlugins/include/ossimPluginConstants.h b/Modules/ThirdParty/OssimPlugins/include/ossimPluginConstants.h index 5f9128df13a6cff87283f8d184187276bf332170..bf547cc2cb82c5ece6cda84c875318631155f3c0 100644 --- a/Modules/ThirdParty/OssimPlugins/include/ossimPluginConstants.h +++ b/Modules/ThirdParty/OssimPlugins/include/ossimPluginConstants.h @@ -50,4 +50,8 @@ # define OSSIM_PLUGINS_DLL #endif /* #if defined(_MSC_VER) */ +/** Export nullptr_t from std namespace as ossimRefPtr needs it */ +#include <cstddef> +using std::nullptr_t; + #endif /* #ifndef ossimPluginConstants_HEADER */ diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginCommon.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginCommon.h index e47cf3dacb6ec3e475835802cc8d2cadb84c23cc..dace28afa17d1cee5f4620c8e60cf9c8ab0c0ea2 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginCommon.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimPluginCommon.h @@ -28,6 +28,7 @@ #include <string> #include <vector> +#include <ossimPluginConstants.h> #include <ossim/base/ossimRefPtr.h> class ossimString; diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.h index bbaea410ccd4dc898d2852f7114a326bf8e8b25c..9bc02282b3980ae7b41d8bbb1d633eb1039ea893 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimRadarSat2TiffReader.h @@ -25,6 +25,7 @@ #ifndef ossimRadarSat2TiffReader_HEADER #define ossimRadarSat2TiffReader_HEADER 1 +#include <ossimPluginConstants.h> #include <ossim/imaging/ossimTiffTileSource.h> #include <ossim/base/ossimFilename.h> diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h index abccfe6db54a75d50eed3cc3429cea059f76249c..487037e855756f4e83459254c4275f5f986d6074 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimSentinel1Model.h @@ -30,6 +30,8 @@ #include <string> #include <boost/config.hpp> +#include "ossimPluginConstants.h" // OSSIM_PLUGINS_DLL + #include <ossim/base/ossimCommon.h> #include <ossim/base/ossimFilename.h> #include <ossim/base/ossimKeywordNames.h> @@ -40,7 +42,6 @@ //#include <ossim/projection/ossimSensorModel.h> //#include <ossim/projection/ossimCoarseGridModel.h> #include "ossim/ossimSarSensorModel.h" -#include "ossimPluginConstants.h" // OSSIM_PLUGINS_DLL #include <ossim/support_data/ossimSupportFilesList.h> diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarProductDoc.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarProductDoc.h index 5aee4d20257d0856f8c2ac8b424d587c82f68dfb..b56713887014e17ce0e6ea996e6c4030e756e676 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarProductDoc.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarProductDoc.h @@ -28,6 +28,8 @@ #include <list> #include <string> #include <vector> + +#include <ossimPluginConstants.h> #include <ossim/base/ossimConstants.h> #include <ossim/base/ossimRefPtr.h> diff --git a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.h b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.h index 8aa413c499a34d86c65bcea94d0b0e1843819099..8740f96e7b80e3783937c71e73a2b2c1c08060d3 100644 --- a/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.h +++ b/Modules/ThirdParty/OssimPlugins/src/ossim/ossimTerraSarTiffReader.h @@ -25,6 +25,7 @@ #ifndef ossimTerraSarTiffReader_HEADER #define ossimTerraSarTiffReader_HEADER 1 +#include <ossimPluginConstants.h> #include <ossim/imaging/ossimTiffTileSource.h> #include <ossim/base/ossimFilename.h> diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index 6c06362daa8a96f412c24dced81203110a335b5c..bed8cd21dcbbfd8af0cf2cd0491151a2d7aa5a0e 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -179,7 +179,7 @@ bool CommandLineLauncher::ExecuteAndWriteOutput() { m_Application->GetLogger()->Debug("Caught otb::ImageFileReaderException during application execution:\n"); m_Application->GetLogger()->Debug(string(err.what()) + "\n"); - m_Application->GetLogger()->Fatal(string("Cannot open image ") + err.m_Filename + string(". ") + err.GetDescription() + string("\n")); + m_Application->GetLogger()->Fatal(err.GetDescription() + string("\n")); return false; } catch(itk::ExceptionObject& err) diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx index 05a1d3f394673ee630008f45fe2abc83d3bc16fe..6803a555110064cfcb0199661c6280313618b32b 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx @@ -73,27 +73,26 @@ QtWidgetModel { m_Application->GetLogger()->Debug("Caught otb::ApplicationException during application update:\n"); m_Application->GetLogger()->Debug(string(err.what()) + "\n"); - emit ExceptionRaised( err.what() ); + emit ExceptionRaised(err.what()); } catch(otb::ImageFileReaderException& err) { m_Application->GetLogger()->Debug("Caught otb::ImageFileReaderException during application update:\n"); m_Application->GetLogger()->Debug(string(err.what()) + "\n"); - string message( string("Cannot open image ") + err.m_Filename + string(". ") + err.GetDescription() ); - m_Application->GetLogger()->Fatal( message + string("\n")); - emit ExceptionRaised( message.c_str() ); + m_Application->GetLogger()->Fatal(err.GetDescription() + string("\n")); + emit ExceptionRaised(err.what()); } catch(itk::ExceptionObject& err) { m_Application->GetLogger()->Debug("Caught itk::ExceptionObject during application update:\n"); m_Application->GetLogger()->Debug(string(err.what()) + "\n"); m_Application->GetLogger()->Fatal(string(err.GetDescription()) + "\n"); - emit ExceptionRaised( err.GetDescription() ); + emit ExceptionRaised(err.GetDescription()); } catch(std::exception& err) { m_Application->GetLogger()->Fatal(string("Caught std::exception during application update: ") + err.what() + "\n"); - emit ExceptionRaised( err.what() ); + emit ExceptionRaised(err.what()); } catch(...) { @@ -305,8 +304,8 @@ AppliThread { m_Application->GetLogger()->Debug("Caught otb::ImageFileReaderException during application execution:\n"); m_Application->GetLogger()->Debug(string(err.what()) + "\n"); - m_Application->GetLogger()->Fatal(string("Cannot open image ") + err.m_Filename + string(". ") + err.GetDescription() + string("\n")); - emit ExceptionRaised( err.what() ); + m_Application->GetLogger()->Fatal(err.GetDescription() + string("\n")); + emit ExceptionRaised(err.what()); } catch(itk::ProcessAborted& /*err*/) { diff --git a/Modules/Wrappers/SWIG/src/itkBase.i b/Modules/Wrappers/SWIG/src/itkBase.i index e02857dcc7b3b17d38a4e826bf34f06f3614f22c..60e352a8a8b7578c42c321dd37a76305503c20a9 100644 --- a/Modules/Wrappers/SWIG/src/itkBase.i +++ b/Modules/Wrappers/SWIG/src/itkBase.i @@ -31,7 +31,7 @@ $action } catch(otb::ImageFileReaderException& err) { std::ostringstream oss; - oss << "Cannot open image " << err.m_Filename + ". " + err.GetDescription(); + oss << err.GetDescription(); SWIG_exception( SWIG_RuntimeError, oss.str().c_str() ); } catch( itk::ExceptionObject &ex ) { std::ostringstream oss;