8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:03:03 +01:00

Correct processing of escaped backslash when expanding logfile name pattern.

Bit better error message when regexp processing in trace config is failed.
This commit is contained in:
hvlad 2009-03-26 22:28:21 +00:00
parent e1e46f7420
commit 6082b218be

View File

@ -127,6 +127,7 @@ void TraceCfgReader::readConfig()
match = exactMatch = true;
else
{
bool regExpOk = false;
try
{
#ifdef WIN_NT // !CASE_SENSITIVITY
@ -137,6 +138,8 @@ void TraceCfgReader::readConfig()
SimilarToMatcher<SimilarConverter, UCHAR> matcher(*getDefaultMemoryPool(),
&textType, (const UCHAR*) pattern.c_str(), pattern.length(), '\\', true);
regExpOk = true;
matcher.process((const UCHAR*) m_databaseName.c_str(), m_databaseName.length());
if (matcher.result())
{
@ -155,9 +158,16 @@ void TraceCfgReader::readConfig()
}
catch (const Exception&)
{
fatal_exception::raiseFmt(
"line %d: error while compiling regular expression \"%s\"",
section->lineNumber + 1, pattern.c_str());
if (regExpOk) {
fatal_exception::raiseFmt(
"line %d: error while processing string \"%s\" against regular expression \"%s\"",
section->lineNumber + 1, m_databaseName.c_str(), pattern.c_str());
}
else {
fatal_exception::raiseFmt(
"line %d: error while compiling regular expression \"%s\"",
section->lineNumber + 1, pattern.c_str());
}
}
}
}
@ -240,6 +250,7 @@ void TraceCfgReader::expandPattern(string& valueToExpand)
{
// Kill one of the backslash signs and loop again
valueToExpand.erase(pos, 1);
pos++;
continue;
}