You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2026/02/16 00:57:10 UTC
(logging-log4cxx) branch master updated: Harmonize exception messages (#596)
This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 62aca856 Harmonize exception messages (#596)
62aca856 is described below
commit 62aca8562d87afd8ce707219cdcf69b5813ca52c
Author: Stephen Webb <st...@ieee.org>
AuthorDate: Mon Feb 16 11:57:05 2026 +1100
Harmonize exception messages (#596)
---
src/main/cpp/cacheddateformat.cpp | 2 +-
src/main/cpp/exception.cpp | 2 +-
src/main/cpp/inputstreamreader.cpp | 12 ++++++------
src/main/cpp/logger.cpp | 2 +-
src/main/cpp/logmanager.cpp | 2 +-
src/main/cpp/outputstreamwriter.cpp | 6 +++---
src/test/cpp/asyncappendertestcase.cpp | 2 +-
7 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/main/cpp/cacheddateformat.cpp b/src/main/cpp/cacheddateformat.cpp
index 197f94cf..bcd1cc5c 100644
--- a/src/main/cpp/cacheddateformat.cpp
+++ b/src/main/cpp/cacheddateformat.cpp
@@ -128,7 +128,7 @@ CachedDateFormat::CachedDateFormat(const DateFormatPtr& dateFormat,
{
if (dateFormat == NULL)
{
- throw IllegalArgumentException(LOG4CXX_STR("dateFormat cannot be null"));
+ throw NullPointerException(LOG4CXX_STR("dateFormat"));
}
if (expiration1 < 0)
diff --git a/src/main/cpp/exception.cpp b/src/main/cpp/exception.cpp
index 0ef952ab..d536006b 100644
--- a/src/main/cpp/exception.cpp
+++ b/src/main/cpp/exception.cpp
@@ -112,7 +112,7 @@ LogString RuntimeException::formatMessage(log4cxx_status_t stat)
}
NullPointerException::NullPointerException(const LogString& msg1)
- : RuntimeException(msg1)
+ : RuntimeException(msg1 + LOG4CXX_STR(" may not be null"))
{
}
diff --git a/src/main/cpp/inputstreamreader.cpp b/src/main/cpp/inputstreamreader.cpp
index e300202a..9b3b0d86 100644
--- a/src/main/cpp/inputstreamreader.cpp
+++ b/src/main/cpp/inputstreamreader.cpp
@@ -43,23 +43,23 @@ struct InputStreamReader::InputStreamReaderPrivate{
InputStreamReader::InputStreamReader(const InputStreamPtr& in1)
: m_priv(std::make_unique<InputStreamReaderPrivate>(in1))
{
- if (in1 == 0)
+ if (!in1)
{
- throw NullPointerException(LOG4CXX_STR("in parameter may not be null."));
+ throw NullPointerException(LOG4CXX_STR("InputStream parameter"));
}
}
InputStreamReader::InputStreamReader(const InputStreamPtr& in1, const CharsetDecoderPtr& dec1)
: m_priv(std::make_unique<InputStreamReaderPrivate>(in1, dec1))
{
- if (in1 == 0)
+ if (!in1)
{
- throw NullPointerException(LOG4CXX_STR("in parameter may not be null."));
+ throw NullPointerException(LOG4CXX_STR("InputStream parameter"));
}
- if (dec1 == 0)
+ if (!dec1)
{
- throw NullPointerException(LOG4CXX_STR("dec parameter may not be null."));
+ throw NullPointerException(LOG4CXX_STR("CharsetDecoder parameter"));
}
}
diff --git a/src/main/cpp/logger.cpp b/src/main/cpp/logger.cpp
index 935d8bdd..491a0f01 100644
--- a/src/main/cpp/logger.cpp
+++ b/src/main/cpp/logger.cpp
@@ -321,7 +321,7 @@ const LevelPtr& Logger::getEffectiveLevel() const
}
}
- throw NullPointerException(LOG4CXX_STR("No level specified for logger or ancestors."));
+ throw NullPointerException(LOG4CXX_STR("Logger level"));
#if LOG4CXX_RETURN_AFTER_THROW
return m_priv->level;
#endif
diff --git a/src/main/cpp/logmanager.cpp b/src/main/cpp/logmanager.cpp
index 935154de..9888382d 100644
--- a/src/main/cpp/logmanager.cpp
+++ b/src/main/cpp/logmanager.cpp
@@ -65,7 +65,7 @@ void LogManager::setRepositorySelector(spi::RepositorySelectorPtr selector, void
if (selector == 0)
{
- throw IllegalArgumentException(LOG4CXX_STR("RepositorySelector must be non-null."));
+ throw NullPointerException(LOG4CXX_STR("RepositorySelector"));
}
LogManager::guard = guard1;
diff --git a/src/main/cpp/outputstreamwriter.cpp b/src/main/cpp/outputstreamwriter.cpp
index 659a6c8b..ba39f8f1 100644
--- a/src/main/cpp/outputstreamwriter.cpp
+++ b/src/main/cpp/outputstreamwriter.cpp
@@ -46,7 +46,7 @@ OutputStreamWriter::OutputStreamWriter(LOG4CXX_16_CONST OutputStreamPtr& out)
{
if (!out)
{
- throw NullPointerException(LOG4CXX_STR("OutputStream parameter may not be null."));
+ throw NullPointerException(LOG4CXX_STR("OutputStream parameter"));
}
}
@@ -58,12 +58,12 @@ OutputStreamWriter::OutputStreamWriter
{
if (!out)
{
- throw NullPointerException(LOG4CXX_STR("OutputStream parameter may not be null."));
+ throw NullPointerException(LOG4CXX_STR("OutputStream parameter"));
}
if (!enc)
{
- throw NullPointerException(LOG4CXX_STR("CharsetEncoder parameter may not be null."));
+ throw NullPointerException(LOG4CXX_STR("CharsetEncoder parameter"));
}
}
diff --git a/src/test/cpp/asyncappendertestcase.cpp b/src/test/cpp/asyncappendertestcase.cpp
index 871ce4a4..2c474528 100644
--- a/src/test/cpp/asyncappendertestcase.cpp
+++ b/src/test/cpp/asyncappendertestcase.cpp
@@ -77,7 +77,7 @@ class NullPointerAppender : public AppenderSkeleton
*/
void append(const spi::LoggingEventPtr&, log4cxx::helpers::Pool&) override
{
- throw NullPointerException(LOG4CXX_STR("Intentional NullPointerException"));
+ throw RuntimeException(LOG4CXX_STR("Intentional Exception"));
}
void close() override