diff options
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 06617bf86669..3ffceb2ec5bd 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -3344,6 +3344,17 @@ private: rtl::Reference< unoidl::SingleInterfaceBasedServiceEntity > entity_; }; +static OUString failsToSupply(const OUString& name_, const OString& baseName) +{ + return OUString( + "\n" + "#if OSL_DEBUG_LEVEL > 0\n" + " ::rtl::OUString(\"component context fails to supply service '" + name_ + "' of type '" + OStringToOUString(baseName, RTL_TEXTENCODING_UTF8) + "'\")\n" + "#else\n" + " ::rtl::OUString(\"service not supplied\")\n" + "#endif\n"); +} + void ServiceType::dumpHxxFile( FileStream & o, codemaker::cppumaker::Includes & includes) { @@ -3480,24 +3491,16 @@ void ServiceType::dumpHxxFile( << ("} catch (const ::css::uno::Exception & the_exception) {\n"); inc(); o << indent() - << ("throw ::css::uno::DeploymentException(" - "::rtl::OUString( " - "\"component context fails to supply service \" ) + ") - << "\"" << name_ << "\" + " - << "\" of type \" + " - << "\"" << baseName << "\" + " - << "\": \" + the_exception.Message, the_context);\n"; + << "throw ::css::uno::DeploymentException(" + << failsToSupply(name_, baseName) + << " + \": \" + the_exception.Message, the_context);\n"; dec(); o << indent() << "}\n" << indent() << "if (!the_instance.is()) {\n"; inc(); o << indent() - << ("throw ::css::uno::DeploymentException(" - "::rtl::OUString( " - "\"component context fails to supply service \" ) + ") - << "\"" << name_ << "\" + " - << "\" of type \" + " - << "\"" << baseName << "\"" + << "throw ::css::uno::DeploymentException(" + << failsToSupply(name_, baseName) << ", the_context);\n"; dec(); o << indent() << "}\n" << indent() << "return the_instance;\n"; @@ -3649,22 +3652,18 @@ void ServiceType::dumpHxxFile( " the_exception) {\n"); inc(); o << indent() - << ("throw ::css::uno::DeploymentException(" - "::rtl::OUString( " - "\"component context fails to supply service ") - << name_ << " of type " << baseName - << ": \" ) + the_exception.Message, the_context);\n"; + << "throw ::css::uno::DeploymentException(" + << failsToSupply(name_, baseName) + << " + \": \" + the_exception.Message, the_context);\n"; dec(); o << indent() << "}\n"; } o << indent() << "if (!the_instance.is()) {\n"; inc(); o << indent() - << ("throw ::css::uno::DeploymentException(" - "::rtl::OUString( " - "\"component context fails to supply service ") - << name_ << " of type " << baseName - << "\" ), the_context);\n"; + << "throw ::css::uno::DeploymentException(" + << failsToSupply(name_, baseName) + << ", the_context);\n"; dec(); o << indent() << "}\n" << indent() << "return the_instance;\n"; dec(); |