Skip to content

Commit 1b9f8f7

Browse files
author
Alexander Perepelkin
committed
fix for bug 147 - Being prepared for Removing Deprecated Exception Specifications from C++17
1 parent 4b6dd21 commit 1b9f8f7

12 files changed

+43
-32
lines changed

include/log4cpp/Category.hh

+2-4
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ namespace log4cpp {
118118
* @exception std::invalid_argument if the caller tries to set
119119
* Priority::NOTSET on the Root Category.
120120
**/
121-
virtual void setPriority(Priority::Value priority)
122-
throw(std::invalid_argument);
121+
virtual void setPriority(Priority::Value priority);
123122

124123
/**
125124
* Returns the assigned Priority, if any, for this Category.
@@ -152,8 +151,7 @@ namespace log4cpp {
152151
* @param appender The Appender to wich this category has to log.
153152
* @exception std::invalid_argument if the appender is NULL.
154153
**/
155-
virtual void addAppender(Appender* appender)
156-
throw(std::invalid_argument);
154+
virtual void addAppender(Appender* appender);
157155

158156
/**
159157
* Adds an Appender for this Category.

include/log4cpp/PatternLayout.hh

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ namespace log4cpp {
8181
* @param conversionPattern the conversion pattern
8282
* @exception ConfigureFailure if the pattern is invalid
8383
**/
84-
virtual void setConversionPattern(const std::string& conversionPattern)
85-
throw(ConfigureFailure);
84+
virtual void setConversionPattern(const std::string& conversionPattern);
8685

8786
virtual std::string getConversionPattern() const;
8887

include/log4cpp/Priority.hh

+1-2
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ namespace log4cpp {
103103
* @throw std::invalid_argument if the priorityName does not
104104
* correspond with a known Priority name or a number
105105
**/
106-
static Value getPriorityValue(const std::string& priorityName)
107-
throw(std::invalid_argument);
106+
static Value getPriorityValue(const std::string& priorityName);
108107
};
109108
}
110109

include/log4cpp/PropertyConfigurator.hh

+7-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ namespace log4cpp {
4545
**/
4646
class LOG4CPP_EXPORT PropertyConfigurator {
4747
public:
48-
static void configure(const std::string& initFileName) throw (ConfigureFailure);
48+
/**
49+
*
50+
* @param initFileName
51+
* @exception ConfigureFailure if the method encountered a read or
52+
* syntax error.
53+
*/
54+
static void configure(const std::string& initFileName);
4955
};
5056
}
5157

include/log4cpp/SimpleConfigurator.hh

+3-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace log4cpp {
3434
* @exception ConfigureFailure if the method encountered a read or
3535
* syntax error.
3636
**/
37-
static void configure(const std::string& initFileName) throw (ConfigureFailure);
37+
static void configure(const std::string& initFileName);
3838

3939
/**
4040
* Configure log4cpp with the configuration in the given file.
@@ -45,7 +45,8 @@ namespace log4cpp {
4545
* @exception ConfigureFailure if the method encountered a read or
4646
* syntax error.
4747
**/
48-
static void configure(std::istream& initFile) throw (ConfigureFailure); };
48+
static void configure(std::istream& initFile);
49+
};
4950
}
5051

5152
#endif

src/Category.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ namespace log4cpp {
7474
return _priority;
7575
}
7676

77-
void Category::setPriority(Priority::Value priority)
78-
throw(std::invalid_argument) {
77+
void Category::setPriority(Priority::Value priority) {
7978
if ((priority < Priority::NOTSET) || (getParent() != NULL)) {
8079
_priority = priority;
8180
} else {
@@ -97,8 +96,7 @@ namespace log4cpp {
9796
return c->getPriority();
9897
}
9998

100-
void Category::addAppender(Appender* appender)
101-
throw(std::invalid_argument) {
99+
void Category::addAppender(Appender* appender) {
102100
if (appender) {
103101
threading::ScopedLock lock(_appenderSetMutex);
104102
{

src/PatternLayout.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ namespace log4cpp {
276276
_conversionPattern = "";
277277
}
278278

279-
void PatternLayout::setConversionPattern(const std::string& conversionPattern) throw(ConfigureFailure) {
279+
void PatternLayout::setConversionPattern(const std::string& conversionPattern) {
280280
#ifdef LOG4CPP_HAVE_SSTREAM
281281
std::istringstream conversionStream(conversionPattern);
282282
#else

src/Priority.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ namespace log4cpp {
4141
return names()[((priority < 0) || (priority > 8)) ? 8 : priority];
4242
}
4343

44-
Priority::Value Priority::getPriorityValue(const std::string& priorityName)
45-
throw(std::invalid_argument) {
44+
Priority::Value Priority::getPriorityValue(const std::string& priorityName) {
4645
Priority::Value value = -1;
4746

4847
for (unsigned int i = 0; i < 10; i++) {

src/PropertyConfigurator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace log4cpp {
1313

14-
void PropertyConfigurator::configure(const std::string& initFileName) throw (ConfigureFailure) {
14+
void PropertyConfigurator::configure(const std::string& initFileName) {
1515
static PropertyConfiguratorImpl configurator;
1616

1717
configurator.doConfigure(initFileName);

src/PropertyConfiguratorImpl.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace log4cpp {
6666
PropertyConfiguratorImpl::~PropertyConfiguratorImpl() {
6767
}
6868

69-
void PropertyConfiguratorImpl::doConfigure(const std::string& initFileName) throw (ConfigureFailure) {
69+
void PropertyConfiguratorImpl::doConfigure(const std::string& initFileName) {
7070
std::ifstream initFile(initFileName.c_str());
7171

7272
if (!initFile) {
@@ -77,7 +77,7 @@ namespace log4cpp {
7777
}
7878

7979

80-
void PropertyConfiguratorImpl::doConfigure(std::istream& in) throw (ConfigureFailure) {
80+
void PropertyConfiguratorImpl::doConfigure(std::istream& in) {
8181
// parse the file to get all of the configuration
8282
_properties.load(in);
8383

@@ -93,7 +93,7 @@ namespace log4cpp {
9393
}
9494
}
9595

96-
void PropertyConfiguratorImpl::instantiateAllAppenders() throw(ConfigureFailure) {
96+
void PropertyConfiguratorImpl::instantiateAllAppenders() {
9797
std::string currentAppender;
9898

9999
std::string prefix("appender");
@@ -132,7 +132,7 @@ namespace log4cpp {
132132
}
133133
}
134134

135-
void PropertyConfiguratorImpl::configureCategory(const std::string& categoryName) throw (ConfigureFailure) {
135+
void PropertyConfiguratorImpl::configureCategory(const std::string& categoryName) {
136136
// start by reading the "rootCategory" key
137137
std::string tempCatName =
138138
(categoryName == "rootCategory") ? categoryName : "category." + categoryName;

src/PropertyConfiguratorImpl.hh

+18-7
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,20 @@ namespace log4cpp {
2828

2929
PropertyConfiguratorImpl();
3030
virtual ~PropertyConfiguratorImpl();
31-
virtual void doConfigure(const std::string& initFileName)
32-
throw (ConfigureFailure);
33-
virtual void doConfigure(std::istream& in)
34-
throw (ConfigureFailure);
31+
/**
32+
*
33+
* @param initFileName
34+
* @exception ConfigureFailure if the method encountered a read or
35+
* syntax error.
36+
*/
37+
virtual void doConfigure(const std::string& initFileName);
38+
/**
39+
*
40+
* @param in
41+
* @exception ConfigureFailure if the method encountered a read or
42+
* syntax error.
43+
*/
44+
virtual void doConfigure(std::istream& in);
3545

3646
protected:
3747
/**
@@ -40,9 +50,10 @@ namespace log4cpp {
4050
@todo setting other properties like 'additivity'.
4151
@param categoryname Name of the category to configure.
4252
The name 'rootCategory' refers to the root Category.
43-
throw ConfigureFailure
53+
* @exception ConfigureFailure if the method encountered a read or
54+
* syntax error.
4455
**/
45-
void configureCategory(const std::string& categoryname) throw (ConfigureFailure);
56+
void configureCategory(const std::string& categoryname);
4657

4758
/**
4859
* Get a list of categories for which we should do the configuration. This simply
@@ -51,7 +62,7 @@ namespace log4cpp {
5162
*/
5263
void getCategories(std::vector<std::string>& categories) const;
5364

54-
void instantiateAllAppenders() throw(ConfigureFailure);
65+
void instantiateAllAppenders();
5566

5667
/**
5768
* Intantiate and configure the appender referred to by the given name. This method searches the

src/SimpleConfigurator.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
namespace log4cpp {
4747

48-
void SimpleConfigurator::configure(const std::string& initFileName) throw (ConfigureFailure) {
48+
void SimpleConfigurator::configure(const std::string& initFileName) {
4949
std::ifstream initFile(initFileName.c_str());
5050

5151
if (!initFile) {
@@ -55,7 +55,7 @@ namespace log4cpp {
5555
configure(initFile);
5656
}
5757

58-
void SimpleConfigurator::configure(std::istream& initFile) throw (ConfigureFailure) {
58+
void SimpleConfigurator::configure(std::istream& initFile) {
5959
std::string nextCommand;
6060
std::string categoryName;
6161

0 commit comments

Comments
 (0)