Kaydet (Commit) 2270f32c authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean up redundant explicit OUString(...) ctors

Change-Id: Ieb5d4a1d669e0472ec08704c618a9d9c1d30b77f
üst bb67e709
This diff is collapsed.
...@@ -193,7 +193,7 @@ void Broadcaster::send() { ...@@ -193,7 +193,7 @@ void Broadcaster::send() {
} }
if (exception.hasValue()) { if (exception.hasValue()) {
throw css::lang::WrappedTargetRuntimeException( throw css::lang::WrappedTargetRuntimeException(
(OUString("configmgr exceptions during listener notification") + ("configmgr exceptions during listener notification" +
messages.makeStringAndClear()), messages.makeStringAndClear()),
css::uno::Reference< css::uno::XInterface >(), css::uno::Reference< css::uno::XInterface >(),
exception); exception);
......
...@@ -166,8 +166,7 @@ void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &) ...@@ -166,8 +166,7 @@ void ChildAccess::setParent(css::uno::Reference< css::uno::XInterface > const &)
osl::MutexGuard g(*lock_); osl::MutexGuard g(*lock_);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
throw css::lang::NoSupportException( throw css::lang::NoSupportException(
OUString("setParent"), "setParent", static_cast< cppu::OWeakObject * >(this));
static_cast< cppu::OWeakObject * >(this));
} }
sal_Int64 ChildAccess::getSomething( sal_Int64 ChildAccess::getSomething(
......
This diff is collapsed.
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "sal/types.h" #include "sal/types.h"
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetag.hxx>
...@@ -73,8 +72,8 @@ char const updateAccessServiceName[] = ...@@ -73,8 +72,8 @@ char const updateAccessServiceName[] =
void badNodePath() { void badNodePath() {
throw css::uno::Exception( throw css::uno::Exception(
OUString("com.sun.star.configuration.ConfigurationProvider expects a" ("com.sun.star.configuration.ConfigurationProvider expects a single,"
" single, non-empty, string nodepath argument"), " non-empty, string nodepath argument"),
0); 0);
} }
...@@ -198,8 +197,8 @@ Service::createInstanceWithArguments( ...@@ -198,8 +197,8 @@ Service::createInstanceWithArguments(
break; break;
} else { } else {
throw css::uno::Exception( throw css::uno::Exception(
OUString("com.sun.star.configuration.ConfigurationProvider" ("com.sun.star.configuration.ConfigurationProvider expects"
" expects NamedValue or PropertyValue arguments"), " NamedValue or PropertyValue arguments"),
0); 0);
} }
// For backwards compatibility, allow "nodepath" and "Locale" in any // For backwards compatibility, allow "nodepath" and "Locale" in any
...@@ -215,9 +214,8 @@ Service::createInstanceWithArguments( ...@@ -215,9 +214,8 @@ Service::createInstanceWithArguments(
locale.isEmpty()) locale.isEmpty())
{ {
throw css::uno::Exception( throw css::uno::Exception(
OUString("com.sun.star.configuration.ConfigurationProvider" ("com.sun.star.configuration.ConfigurationProvider expects"
" expects at most one, non-empty, string Locale" " at most one, non-empty, string Locale argument"),
" argument"),
0); 0);
} }
} }
...@@ -228,27 +226,24 @@ Service::createInstanceWithArguments( ...@@ -228,27 +226,24 @@ Service::createInstanceWithArguments(
// For backwards compatibility, allow a nodepath that misses the leading // For backwards compatibility, allow a nodepath that misses the leading
// slash: // slash:
if (nodepath[0] != '/') { if (nodepath[0] != '/') {
nodepath = OUString("/") + nodepath; nodepath = "/" + nodepath;
} }
if (locale.isEmpty()) { if (locale.isEmpty()) {
//TODO: should the Access use the dynamically changing locale_ instead? //TODO: should the Access use the dynamically changing locale_ instead?
locale = locale_; locale = locale_;
if (locale.isEmpty()) { if (locale.isEmpty()) {
locale = OUString("en-US"); locale = "en-US";
} }
} }
bool update; bool update;
if ( ServiceSpecifier == accessServiceName ) if (ServiceSpecifier == accessServiceName) {
{
update = false; update = false;
} else if ( ServiceSpecifier == updateAccessServiceName ) } else if (ServiceSpecifier == updateAccessServiceName) {
{
update = true; update = true;
} else { } else {
throw css::uno::Exception( throw css::uno::Exception(
(OUString("com.sun.star.configuration.ConfigurationProvider does not" ("com.sun.star.configuration.ConfigurationProvider does not support"
" support service ") + " service " + ServiceSpecifier),
ServiceSpecifier),
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
osl::MutexGuard guard(*lock_); osl::MutexGuard guard(*lock_);
...@@ -257,9 +252,8 @@ Service::createInstanceWithArguments( ...@@ -257,9 +252,8 @@ Service::createInstanceWithArguments(
new RootAccess(components, nodepath, locale, update)); new RootAccess(components, nodepath, locale, update));
if (root->isValue()) { if (root->isValue()) {
throw css::uno::Exception( throw css::uno::Exception(
(OUString("com.sun.star.configuration.ConfigurationProvider: there is" ("com.sun.star.configuration.ConfigurationProvider: there is a leaf"
" a leaf value at nodepath ") + " value at nodepath " + nodepath),
nodepath),
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
components.addRootAccess(root); components.addRootAccess(root);
...@@ -270,8 +264,8 @@ css::uno::Sequence< OUString > Service::getAvailableServiceNames() ...@@ -270,8 +264,8 @@ css::uno::Sequence< OUString > Service::getAvailableServiceNames()
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
css::uno::Sequence< OUString > names(2); css::uno::Sequence< OUString > names(2);
names[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(accessServiceName)); names[0] = accessServiceName;
names[1] = OUString(RTL_CONSTASCII_USTRINGPARAM(updateAccessServiceName)); names[1] = updateAccessServiceName;
return names; return names;
} }
...@@ -417,9 +411,8 @@ Factory::createInstanceWithArgumentsAndContext( ...@@ -417,9 +411,8 @@ Factory::createInstanceWithArgumentsAndContext(
value = v2.Value; value = v2.Value;
} else { } else {
throw css::uno::Exception( throw css::uno::Exception(
OUString("com.sun.star.configuration.ConfigurationProvider" ("com.sun.star.configuration.ConfigurationProvider factory"
" factory expects NamedValue or PropertyValue" " expects NamedValue or PropertyValue arguments"),
" arguments"),
0); 0);
} }
// For backwards compatibility, allow "Locale" and (ignored) // For backwards compatibility, allow "Locale" and (ignored)
...@@ -429,15 +422,15 @@ Factory::createInstanceWithArgumentsAndContext( ...@@ -429,15 +422,15 @@ Factory::createInstanceWithArgumentsAndContext(
locale.isEmpty()) locale.isEmpty())
{ {
throw css::uno::Exception( throw css::uno::Exception(
OUString("com.sun.star.configuration." ("com.sun.star.configuration.ConfigurationProvider"
"ConfigurationProvider factory expects at most" " factory expects at most one, non-empty, string"
" one, non-empty, string Locale argument"), " Locale argument"),
0); 0);
} }
} else if (!name.equalsIgnoreAsciiCase("enableasync")) { } else if (!name.equalsIgnoreAsciiCase("enableasync")) {
throw css::uno::Exception( throw css::uno::Exception(
OUString("com.sun.star.configuration.ConfigurationProvider" ("com.sun.star.configuration.ConfigurationProvider factory:"
" factory: unknown argument ") + name, " unknown argument " + name),
0); 0);
} }
} }
...@@ -450,8 +443,7 @@ Factory::createInstanceWithArgumentsAndContext( ...@@ -450,8 +443,7 @@ Factory::createInstanceWithArgumentsAndContext(
css::uno::Reference< css::uno::XInterface > createDefault( css::uno::Reference< css::uno::XInterface > createDefault(
css::uno::Reference< css::uno::XComponentContext > const & context) css::uno::Reference< css::uno::XComponentContext > const & context)
{ {
return static_cast< cppu::OWeakObject * >( return static_cast< cppu::OWeakObject * >(new Service(context, ""));
new Service(context, OUString()));
} }
OUString getImplementationName() { OUString getImplementationName() {
......
...@@ -132,7 +132,7 @@ sal_Int32 Data::parseSegment( ...@@ -132,7 +132,7 @@ sal_Int32 Data::parseSegment(
} }
if (templateName != 0) { if (templateName != 0) {
if (i - index == 1 && path[index] == '*') { if (i - index == 1 && path[index] == '*') {
*templateName = OUString(); *templateName = "";
} else { } else {
*templateName = path.copy(index, i - index); *templateName = path.copy(index, i - index);
} }
...@@ -159,8 +159,7 @@ OUString Data::fullTemplateName( ...@@ -159,8 +159,7 @@ OUString Data::fullTemplateName(
{ {
if (component.indexOf(':') != -1 || name.indexOf(':') != -1) { if (component.indexOf(':') != -1 || name.indexOf(':') != -1) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad component/name pair containing colon ") + ("bad component/name pair containing colon " + component + "/" +
component + OUString("/") +
name), name),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
...@@ -203,8 +202,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( ...@@ -203,8 +202,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
{ {
if (pathRepresentation.isEmpty() || pathRepresentation[0] != '/') { if (pathRepresentation.isEmpty() || pathRepresentation[0] != '/') {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (path != 0) { if (path != 0) {
...@@ -226,8 +224,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( ...@@ -226,8 +224,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
if (n == -1 || setElement) if (n == -1 || setElement)
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
NodeMap const & components = getComponents(); NodeMap const & components = getComponents();
...@@ -251,8 +248,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( ...@@ -251,8 +248,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
pathRepresentation[n++] != '/') pathRepresentation[n++] != '/')
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
// for backwards compatibility, ignore a final slash // for backwards compatibility, ignore a final slash
...@@ -266,13 +262,12 @@ rtl::Reference< Node > Data::resolvePathRepresentation( ...@@ -266,13 +262,12 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
return p; return p;
} }
parent = p; parent = p;
templateName = OUString(); templateName = "";
n = parseSegment( n = parseSegment(
pathRepresentation, n, &seg, &setElement, &templateName); pathRepresentation, n, &seg, &setElement, &templateName);
if (n == -1) { if (n == -1) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
// For backwards compatibility, allow set members to be accessed with // For backwards compatibility, allow set members to be accessed with
...@@ -283,8 +278,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( ...@@ -283,8 +278,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
case Node::KIND_LOCALIZED_PROPERTY: case Node::KIND_LOCALIZED_PROPERTY:
if (!templateName.isEmpty()) { if (!templateName.isEmpty()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
break; break;
...@@ -294,23 +288,20 @@ rtl::Reference< Node > Data::resolvePathRepresentation( ...@@ -294,23 +288,20 @@ rtl::Reference< Node > Data::resolvePathRepresentation(
templateName)) templateName))
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
break; break;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (!templateName.isEmpty() && p != 0) { if (!templateName.isEmpty() && p != 0) {
assert(!p->getTemplateName().isEmpty()); assert(!p->getTemplateName().isEmpty());
if (!equalTemplateNames(templateName, p->getTemplateName())) { if (!equalTemplateNames(templateName, p->getTemplateName())) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad path ") + "bad path " + pathRepresentation,
pathRepresentation),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -338,8 +329,7 @@ Additions * Data::addExtensionXcuAdditions( ...@@ -338,8 +329,7 @@ Additions * Data::addExtensionXcuAdditions(
url, rtl::Reference< ExtensionXcu >())).first); url, rtl::Reference< ExtensionXcu >())).first);
if (i->second.is()) { if (i->second.is()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("already added extension xcu ") + "already added extension xcu " + url,
url),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
i->second = item; i->second = item;
......
...@@ -37,8 +37,7 @@ namespace configmgr { ...@@ -37,8 +37,7 @@ namespace configmgr {
NodeMap & Node::getMembers() { NodeMap & Node::getMembers() {
assert(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("this cannot happen"), "this cannot happen", css::uno::Reference< css::uno::XInterface >());
css::uno::Reference< css::uno::XInterface >());
} }
OUString Node::getTemplateName() const { OUString Node::getTemplateName() const {
......
...@@ -55,8 +55,7 @@ bool parseSegment( ...@@ -55,8 +55,7 @@ bool parseSegment(
} }
} }
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("bad path ") + path, "bad path " + path, css::uno::Reference< css::uno::XInterface >());
css::uno::Reference< css::uno::XInterface >());
} }
} }
......
...@@ -61,7 +61,7 @@ css::uno::Any PropertyNode::getValue(Components & components) { ...@@ -61,7 +61,7 @@ css::uno::Any PropertyNode::getValue(Components & components) {
if (val.IsPresent) { if (val.IsPresent) {
value_ = val.Value; //TODO: check value type value_ = val.Value; //TODO: check value type
} }
externalDescriptor_ = OUString(); // must not throw externalDescriptor_ = ""; // must not throw
} }
SAL_WARN_IF( SAL_WARN_IF(
!(value_.hasValue() || nillable_), "configmgr", !(value_.hasValue() || nillable_), "configmgr",
...@@ -72,7 +72,7 @@ css::uno::Any PropertyNode::getValue(Components & components) { ...@@ -72,7 +72,7 @@ css::uno::Any PropertyNode::getValue(Components & components) {
void PropertyNode::setValue(int layer, css::uno::Any const & value) { void PropertyNode::setValue(int layer, css::uno::Any const & value) {
setLayer(layer); setLayer(layer);
value_ = value; value_ = value;
externalDescriptor_ = OUString(); externalDescriptor_ = "";
} }
void PropertyNode::setExternal(int layer, OUString const & descriptor) { void PropertyNode::setExternal(int layer, OUString const & descriptor) {
......
...@@ -128,8 +128,7 @@ void RootAccess::addChangesListener( ...@@ -128,8 +128,7 @@ void RootAccess::addChangesListener(
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
if (!aListener.is()) { if (!aListener.is()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("null listener"), "null listener", static_cast< cppu::OWeakObject * >(this));
static_cast< cppu::OWeakObject * >(this));
} }
if (!isDisposed()) { if (!isDisposed()) {
changesListeners_.insert(aListener); changesListeners_.insert(aListener);
...@@ -226,9 +225,7 @@ rtl::Reference< Node > RootAccess::getNode() { ...@@ -226,9 +225,7 @@ rtl::Reference< Node > RootAccess::getNode() {
pathRepresentation_, &canonic, &path_, &finalizedLayer); pathRepresentation_, &canonic, &path_, &finalizedLayer);
if (!node_.is()) { if (!node_.is()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("cannot find ") + "cannot find " + pathRepresentation_, 0);
pathRepresentation_),
0);
// RootAccess::queryInterface indirectly calls // RootAccess::queryInterface indirectly calls
// RootAccess::getNode, so if this RootAccess were passed out in // RootAccess::getNode, so if this RootAccess were passed out in
// RuntimeException.Context, client code that called // RuntimeException.Context, client code that called
...@@ -273,11 +270,9 @@ void RootAccess::addSupportedServiceNames( ...@@ -273,11 +270,9 @@ void RootAccess::addSupportedServiceNames(
std::vector< OUString > * services) std::vector< OUString > * services)
{ {
assert(services != 0); assert(services != 0);
services->push_back( services->push_back("com.sun.star.configuration.AccessRootElement");
OUString("com.sun.star.configuration.AccessRootElement"));
if (update_) { if (update_) {
services->push_back( services->push_back("com.sun.star.configuration.UpdateRootElement");
OUString("com.sun.star.configuration.UpdateRootElement"));
} }
} }
......
...@@ -61,7 +61,7 @@ Type elementType(Type type) { ...@@ -61,7 +61,7 @@ Type elementType(Type type) {
default: default:
assert(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("this cannot happen"), "this cannot happen",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -102,7 +102,7 @@ css::uno::Type mapType(Type type) { ...@@ -102,7 +102,7 @@ css::uno::Type mapType(Type type) {
default: default:
assert(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("this cannot happen"), "this cannot happen",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
......
...@@ -171,8 +171,7 @@ template< typename T > css::uno::Any parseSingleValue( ...@@ -171,8 +171,7 @@ template< typename T > css::uno::Any parseSingleValue(
T val; T val;
if (!parseValue(text, &val)) { if (!parseValue(text, &val)) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("invalid value"), "invalid value", css::uno::Reference< css::uno::XInterface >());
css::uno::Reference< css::uno::XInterface >());
} }
return css::uno::makeAny(val); return css::uno::makeAny(val);
} }
...@@ -196,7 +195,7 @@ template< typename T > css::uno::Any parseListValue( ...@@ -196,7 +195,7 @@ template< typename T > css::uno::Any parseListValue(
xmlreader::Span(t.begin, i == -1 ? t.length : i), &val)) xmlreader::Span(t.begin, i == -1 ? t.length : i), &val))
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("invalid value"), "invalid value",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
seq.push_back(val); seq.push_back(val);
...@@ -216,7 +215,7 @@ css::uno::Any parseValue( ...@@ -216,7 +215,7 @@ css::uno::Any parseValue(
switch (type) { switch (type) {
case TYPE_ANY: case TYPE_ANY:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("invalid value of type any"), "invalid value of type any",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
case TYPE_BOOLEAN: case TYPE_BOOLEAN:
return parseSingleValue< sal_Bool >(text); return parseSingleValue< sal_Bool >(text);
...@@ -250,7 +249,7 @@ css::uno::Any parseValue( ...@@ -250,7 +249,7 @@ css::uno::Any parseValue(
default: default:
assert(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("this cannot happen"), "this cannot happen",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -333,8 +332,7 @@ bool ValueParser::startElement( ...@@ -333,8 +332,7 @@ bool ValueParser::startElement(
pad_.add(RTL_CONSTASCII_STRINGPARAM("\xEF\xBF\xBF")); pad_.add(RTL_CONSTASCII_STRINGPARAM("\xEF\xBF\xBF"));
} else { } else {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad unicode scalar attribute in ") + "bad unicode scalar attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
state_ = State(state_ + 1); state_ = State(state_ + 1);
...@@ -345,9 +343,7 @@ bool ValueParser::startElement( ...@@ -345,9 +343,7 @@ bool ValueParser::startElement(
break; break;
} }
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad member <") + "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl(),
name.convertFromUtf8() +
OUString("> in ") + reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
......
...@@ -69,7 +69,7 @@ OString convertToUtf8( ...@@ -69,7 +69,7 @@ OString convertToUtf8(
RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("cannot convert to UTF-8"), "cannot convert to UTF-8",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
return s; return s;
...@@ -110,8 +110,7 @@ void writeData(oslFileHandle handle, char const * begin, sal_Int32 length) { ...@@ -110,8 +110,7 @@ void writeData(oslFileHandle handle, char const * begin, sal_Int32 length) {
n != static_cast< sal_uInt32 >(length)) n != static_cast< sal_uInt32 >(length))
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("write failure"), "write failure", css::uno::Reference< css::uno::XInterface >());
css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -500,8 +499,7 @@ void writeModifications( ...@@ -500,8 +499,7 @@ void writeModifications(
} else { } else {
assert(node.is()); assert(node.is());
OUString pathRep( OUString pathRep(
parentPathRepresentation + parentPathRepresentation + "/" +
OUString("/") +
Data::createSegment(node->getTemplateName(), nodeName)); Data::createSegment(node->getTemplateName(), nodeName));
for (Modifications::Node::Children::const_iterator i( for (Modifications::Node::Children::const_iterator i(
modifications.children.begin()); modifications.children.begin());
...@@ -534,8 +532,7 @@ void writeModFile( ...@@ -534,8 +532,7 @@ void writeModFile(
return; return;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("cannot create directory ") + "cannot create directory " + dir,
dir),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
TempFile tmp; TempFile tmp;
...@@ -550,8 +547,7 @@ void writeModFile( ...@@ -550,8 +547,7 @@ void writeModFile(
return; return;
default: default:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("cannot create temporary file in ") + "cannot create temporary file in " + dir,
dir),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
writeData( writeData(
...@@ -569,8 +565,7 @@ void writeModFile( ...@@ -569,8 +565,7 @@ void writeModFile(
j != data.modifications.getRoot().children.end(); ++j) j != data.modifications.getRoot().children.end(); ++j)
{ {
writeModifications( writeModifications(
components, tmp.handle, OUString(), rtl::Reference< Node >(), components, tmp.handle, "", rtl::Reference< Node >(), j->first,
j->first,
Data::findNode(Data::NO_LAYER, data.getComponents(), j->first), Data::findNode(Data::NO_LAYER, data.getComponents(), j->first),
j->second); j->second);
} }
...@@ -579,14 +574,12 @@ void writeModFile( ...@@ -579,14 +574,12 @@ void writeModFile(
tmp.closed = true; tmp.closed = true;
if (e != osl_File_E_None) { if (e != osl_File_E_None) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("cannot close ") + "cannot close " + tmp.url,
tmp.url),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (osl::File::move(tmp.url, url) != osl::FileBase::E_None) { if (osl::File::move(tmp.url, url) != osl::FileBase::E_None) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("cannot move ") + "cannot move " + tmp.url,
tmp.url),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
tmp.handle = 0; tmp.handle = 0;
......
...@@ -96,15 +96,13 @@ bool XcdParser::startElement( ...@@ -96,15 +96,13 @@ bool XcdParser::startElement(
} }
if (!attrFile.is()) { if (!attrFile.is()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no dependency file attribute in ") + "no dependency file attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
dependencyFile_ = attrFile.convertFromUtf8(); dependencyFile_ = attrFile.convertFromUtf8();
if (dependencyFile_.isEmpty()) { if (dependencyFile_.isEmpty()) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad dependency file attribute in ") + "bad dependency file attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -117,7 +115,7 @@ bool XcdParser::startElement( ...@@ -117,7 +115,7 @@ bool XcdParser::startElement(
return false; return false;
} }
state_ = STATE_DEPENDENCY; state_ = STATE_DEPENDENCY;
dependencyFile_ = OUString(); dependencyFile_ = "";
return true; return true;
} }
state_ = STATE_COMPONENTS; state_ = STATE_COMPONENTS;
...@@ -145,9 +143,7 @@ bool XcdParser::startElement( ...@@ -145,9 +143,7 @@ bool XcdParser::startElement(
break; break;
} }
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad member <") + "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl(),
name.convertFromUtf8() +
OUString("> in ") + reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
......
...@@ -169,8 +169,7 @@ bool XcsParser::startElement( ...@@ -169,8 +169,7 @@ bool XcsParser::startElement(
assert(elements_.empty()); assert(elements_.empty());
elements_.push( elements_.push(
Element( Element(
new GroupNode( new GroupNode(valueParser_.getLayer(), false, ""),
valueParser_.getLayer(), false, OUString()),
componentName_)); componentName_));
return true; return true;
} }
...@@ -253,9 +252,7 @@ bool XcsParser::startElement( ...@@ -253,9 +252,7 @@ bool XcsParser::startElement(
} }
} }
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad member <") + "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl(),
name.convertFromUtf8() +
OUString("> in ") + reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
...@@ -298,7 +295,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { ...@@ -298,7 +295,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) {
default: default:
assert(false); assert(false);
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
OUString("this cannot happen"), "this cannot happen",
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} else { } else {
...@@ -306,10 +303,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { ...@@ -306,10 +303,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) {
NodeMap::value_type(top.name, top.node)).second) NodeMap::value_type(top.name, top.node)).second)
{ {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("duplicate ") + "duplicate " + top.name + " in " + reader.getUrl(),
top.name +
OUString(" in ") +
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -326,8 +320,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { ...@@ -326,8 +320,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) {
break; break;
case STATE_TEMPLATES_DONE: case STATE_TEMPLATES_DONE:
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no component element in ") + "no component element in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
case STATE_COMPONENT_DONE: case STATE_COMPONENT_DONE:
break; break;
...@@ -357,8 +350,7 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { ...@@ -357,8 +350,7 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) {
{ {
if (hasPackage) { if (hasPackage) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("multiple component-schema package attributes" ("multiple component-schema package attributes in " +
" in ") +
reader.getUrl()), reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
...@@ -370,7 +362,7 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { ...@@ -370,7 +362,7 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) {
{ {
if (hasName) { if (hasName) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("multiple component-schema name attributes in ") + ("multiple component-schema name attributes in " +
reader.getUrl()), reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
...@@ -381,14 +373,12 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { ...@@ -381,14 +373,12 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) {
} }
if (!hasPackage) { if (!hasPackage) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no component-schema package attribute in ") + "no component-schema package attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (!hasName) { if (!hasName) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no component-schema name attribute in ") + "no component-schema name attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()).
...@@ -423,8 +413,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { ...@@ -423,8 +413,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) {
} }
if (!hasName) { if (!hasName) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no node-ref name attribute in ") + "no node-ref name attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
rtl::Reference< Node > tmpl( rtl::Reference< Node > tmpl(
...@@ -436,9 +425,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { ...@@ -436,9 +425,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) {
//TODO: this can erroneously happen as long as import/uses attributes //TODO: this can erroneously happen as long as import/uses attributes
// are not correctly processed // are not correctly processed
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("unknown node-ref ") + "unknown node-ref " + name + " in " + reader.getUrl(),
name + OUString(" in ") +
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
rtl::Reference< Node > node(tmpl->clone(false)); rtl::Reference< Node > node(tmpl->clone(false));
...@@ -478,14 +465,12 @@ void XcsParser::handleProp(xmlreader::XmlReader & reader) { ...@@ -478,14 +465,12 @@ void XcsParser::handleProp(xmlreader::XmlReader & reader) {
} }
if (!hasName) { if (!hasName) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no prop name attribute in ") + "no prop name attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (valueParser_.type_ == TYPE_ERROR) { if (valueParser_.type_ == TYPE_ERROR) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no prop type attribute in ") + "no prop type attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
elements_.push( elements_.push(
...@@ -517,8 +502,7 @@ void XcsParser::handlePropValue( ...@@ -517,8 +502,7 @@ void XcsParser::handlePropValue(
attrSeparator = reader.getAttributeValue(false); attrSeparator = reader.getAttributeValue(false);
if (attrSeparator.length == 0) { if (attrSeparator.length == 0) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("bad oor:separator attribute in ") + "bad oor:separator attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
} }
...@@ -549,8 +533,7 @@ void XcsParser::handleGroup(xmlreader::XmlReader & reader, bool isTemplate) { ...@@ -549,8 +533,7 @@ void XcsParser::handleGroup(xmlreader::XmlReader & reader, bool isTemplate) {
} }
if (!hasName) { if (!hasName) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no group name attribute in ") + "no group name attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (isTemplate) { if (isTemplate) {
...@@ -592,8 +575,7 @@ void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) { ...@@ -592,8 +575,7 @@ void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) {
} }
if (!hasName) { if (!hasName) {
throw css::uno::RuntimeException( throw css::uno::RuntimeException(
(OUString("no set name attribute in ") + "no set name attribute in " + reader.getUrl(),
reader.getUrl()),
css::uno::Reference< css::uno::XInterface >()); css::uno::Reference< css::uno::XInterface >());
} }
if (isTemplate) { if (isTemplate) {
...@@ -632,7 +614,7 @@ void XcsParser::handleSetItem(xmlreader::XmlReader & reader, SetNode * set) { ...@@ -632,7 +614,7 @@ void XcsParser::handleSetItem(xmlreader::XmlReader & reader, SetNode * set) {
} }
set->getAdditionalTemplateNames().push_back( set->getAdditionalTemplateNames().push_back(
xmldata::parseTemplateReference(component, hasNodeType, nodeType, 0)); xmldata::parseTemplateReference(component, hasNodeType, nodeType, 0));
elements_.push(Element(rtl::Reference< Node >(), OUString())); elements_.push(Element(rtl::Reference< Node >(), ""));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment