Don't throw if no field is found, just return normal priority.

This commit is contained in:
Vincent Richard 2005-07-24 20:22:14 +00:00
parent e14a8b6adb
commit 67eef25151

View File

@ -63,6 +63,7 @@ const importanceHelper::Importance importanceHelper::getImportance(const ref <co
const importanceHelper::Importance importanceHelper::getImportance(const ref <const header> hdr) const importanceHelper::Importance importanceHelper::getImportance(const ref <const header> hdr)
{ {
// Try "X-Priority" field
try try
{ {
const ref <const defaultField> fld = hdr->findField("X-Priority").dynamicCast <const defaultField>(); const ref <const defaultField> fld = hdr->findField("X-Priority").dynamicCast <const defaultField>();
@ -88,15 +89,24 @@ const importanceHelper::Importance importanceHelper::getImportance(const ref <co
} }
catch (exceptions::no_such_field) catch (exceptions::no_such_field)
{ {
const ref <const defaultField> fld = hdr->findField("Importance").dynamicCast <const defaultField>(); // Try "Importance" field
const string value = utility::stringUtils::toLower(utility::stringUtils::trim(fld->getValue())); try
{
const ref <const defaultField> fld = hdr->findField("Importance").dynamicCast <const defaultField>();
const string value = utility::stringUtils::toLower(utility::stringUtils::trim(fld->getValue()));
if (value == "low") if (value == "low")
return (IMPORTANCE_LOWEST); return (IMPORTANCE_LOWEST);
else if (value == "high") else if (value == "high")
return (IMPORTANCE_HIGHEST); return (IMPORTANCE_HIGHEST);
else else
return (IMPORTANCE_NORMAL);
}
catch (exceptions::no_such_field)
{
// Default
return (IMPORTANCE_NORMAL); return (IMPORTANCE_NORMAL);
}
} }
// Should not go here... // Should not go here...