Throwing std::runtime_error in stringhelper-iconv.cxx
Logging Framework for C++
Brought to you by:
wilx
Hi,
iconv_handle in stringhelper-iconv.cxx throws a runtime_error if iconv_open() or iconv_close() fail. IMHO this is bad style in a library that is used in other code. Instead, just printing the error (and perhaps mentioning "log4cplus" in the error message) would mean the app can survive this problem.
Also, iconv_conv() checks if cvt.handle == iconv_error_handle in line 157. Due to the above exception this is dead code, because the constructor would have thrown an exception if iconv_open() failed. Personally, I prefer the way that iconv_conv() deals with this problem over the exception.
(This was found via cppcheck which complained that destructors should not throw exceptions)
Thanks,
Uli
Thank you for the bug report. I have applied the attached patch to fix the issue of an exception escaping from dtor.