diff options
author | Noel Grandin <noel@peralex.com> | 2014-05-23 12:03:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-05-23 15:06:00 +0200 |
commit | e7bc3cab019fbf040f9fb8b53ae2cf3f977d200b (patch) | |
tree | bc507bccee9fb71134e362b72d22991561e32aa0 /configmgr | |
parent | c5d47c327a57df55fa3dac0fff6b65888d0345e4 (diff) |
remove boilerplate in UNO Exception constructor calls
Now that we have default values for Exception constructor params,
remove lots of boilerplate code.
Change-Id: I620bd641eecfed38e6123873b3b94aaf47922e74
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/components.cxx | 66 | ||||
-rw-r--r-- | configmgr/source/data.cxx | 32 | ||||
-rw-r--r-- | configmgr/source/node.cxx | 3 | ||||
-rw-r--r-- | configmgr/source/partial.cxx | 3 | ||||
-rw-r--r-- | configmgr/source/type.cxx | 8 | ||||
-rw-r--r-- | configmgr/source/valueparser.cxx | 21 | ||||
-rw-r--r-- | configmgr/source/winreg.cxx | 3 | ||||
-rw-r--r-- | configmgr/source/writemodfile.cxx | 17 | ||||
-rw-r--r-- | configmgr/source/xcdparser.cxx | 9 | ||||
-rw-r--r-- | configmgr/source/xcsparser.cxx | 49 | ||||
-rw-r--r-- | configmgr/source/xcuparser.cxx | 140 | ||||
-rw-r--r-- | configmgr/source/xmldata.cxx | 9 |
12 files changed, 125 insertions, 235 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index 4e7259b2bbac..9c39f3d0f9de 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -314,8 +314,7 @@ void Components::insertExtensionXcsFile( parseXcsFile(fileUri, layer, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( - "insertExtensionXcsFile does not exist: " + e.Message, - css::uno::Reference< css::uno::XInterface >()); + "insertExtensionXcsFile does not exist: " + e.Message); } } @@ -330,8 +329,7 @@ void Components::insertExtensionXcuFile( } catch (css::container::NoSuchElementException & e) { data_.removeExtensionXcuAdditions(fileUri); throw css::uno::RuntimeException( - "insertExtensionXcuFile does not exist: " + e.Message, - css::uno::Reference< css::uno::XInterface >()); + "insertExtensionXcuFile does not exist: " + e.Message); } } @@ -413,8 +411,7 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue( sal_Int32 i = descriptor.indexOf(' '); if (i <= 0) { throw css::uno::RuntimeException( - "bad external value descriptor " + descriptor, - css::uno::Reference< css::uno::XInterface >()); + "bad external value descriptor " + descriptor); } //TODO: Do not make calls with mutex locked: OUString name(descriptor.copy(0, i)); @@ -450,17 +447,14 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue( value)) { throw css::uno::RuntimeException( - "cannot obtain external value through " + descriptor, - css::uno::Reference< css::uno::XInterface >()); + "cannot obtain external value through " + descriptor); } } catch (css::beans::UnknownPropertyException & e) { throw css::uno::RuntimeException( - "unknown external value descriptor ID: " + e.Message, - css::uno::Reference< css::uno::XInterface >()); + "unknown external value descriptor ID: " + e.Message); } catch (css::lang::WrappedTargetException & e) { throw css::uno::RuntimeException( - "cannot obtain external value: " + e.Message, - css::uno::Reference< css::uno::XInterface >()); + "cannot obtain external value: " + e.Message); } } return value; @@ -483,15 +477,13 @@ Components::Components( } if (!modificationFileUrl_.isEmpty()) { throw css::uno::RuntimeException( - "CONFIGURATION_LAYERS: \"user\" followed by further layers", - css::uno::Reference< css::uno::XInterface >()); + "CONFIGURATION_LAYERS: \"user\" followed by further layers"); } sal_Int32 c = i; for (;; ++c) { if (c == conf.getLength() || conf[c] == ' ') { throw css::uno::RuntimeException( - "CONFIGURATION_LAYERS: missing \":\"", - css::uno::Reference< css::uno::XInterface >()); + "CONFIGURATION_LAYERS: missing \":\""); } if (conf[c] == ':') { break; @@ -513,8 +505,7 @@ Components::Components( } else if ( type == "sharedext" ) { if (sharedExtensionLayer_ != -1) { throw css::uno::RuntimeException( - "CONFIGURATION_LAYERS: multiple \"sharedext\" layers", - css::uno::Reference< css::uno::XInterface >()); + "CONFIGURATION_LAYERS: multiple \"sharedext\" layers"); } sharedExtensionLayer_ = layer; parseXcsXcuIniLayer(layer, url, true); @@ -522,8 +513,7 @@ Components::Components( } else if ( type == "userext" ) { if (userExtensionLayer_ != -1) { throw css::uno::RuntimeException( - "CONFIGURATION_LAYERS: multiple \"userext\" layers", - css::uno::Reference< css::uno::XInterface >()); + "CONFIGURATION_LAYERS: multiple \"userext\" layers"); } userExtensionLayer_ = layer; parseXcsXcuIniLayer(layer, url, true); @@ -537,8 +527,7 @@ Components::Components( } else if ( type == "user" ) { if (url.isEmpty()) { throw css::uno::RuntimeException( - "CONFIGURATION_LAYERS: empty \"user\" URL", - css::uno::Reference< css::uno::XInterface >()); + "CONFIGURATION_LAYERS: empty \"user\" URL"); } modificationFileUrl_ = url; parseModificationLayer(url); @@ -562,8 +551,7 @@ Components::Components( #endif else { throw css::uno::RuntimeException( - "CONFIGURATION_LAYERS: unknown layer type \"" + type + "\"", - css::uno::Reference< css::uno::XInterface >()); + "CONFIGURATION_LAYERS: unknown layer type \"" + type + "\""); } i = n; } @@ -611,8 +599,7 @@ void Components::parseFiles( // fall through default: throw css::uno::RuntimeException( - "cannot open directory " + url, - css::uno::Reference< css::uno::XInterface >()); + "cannot open directory " + url); } for (;;) { osl::DirectoryItem i; @@ -622,16 +609,14 @@ void Components::parseFiles( } if (rc != osl::FileBase::E_None) { throw css::uno::RuntimeException( - "cannot iterate directory " + url, - css::uno::Reference< css::uno::XInterface >()); + "cannot iterate directory " + url); } osl::FileStatus stat( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL); if (i.getFileStatus(stat) != osl::FileBase::E_None) { throw css::uno::RuntimeException( - "cannot stat in directory " + url, - css::uno::Reference< css::uno::XInterface >()); + "cannot stat in directory " + url); } if (stat.getFileType() == osl::FileStatus::Directory) { //TODO: symlinks parseFiles(layer, extension, parseFile, stat.getFileURL(), true); @@ -643,8 +628,7 @@ void Components::parseFiles( parseFile, stat.getFileURL(), layer, data_, 0, 0, 0); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( - "stat'ed file does not exist: " + e.Message, - css::uno::Reference< css::uno::XInterface >()); + "stat'ed file does not exist: " + e.Message); } } } @@ -687,8 +671,7 @@ void Components::parseXcdFiles(int layer, OUString const & url) { return; default: throw css::uno::RuntimeException( - "cannot open directory " + url, - css::uno::Reference< css::uno::XInterface >()); + "cannot open directory " + url); } UnresolvedList unres; std::set< OUString > existingDeps; @@ -701,16 +684,14 @@ void Components::parseXcdFiles(int layer, OUString const & url) { } if (rc != osl::FileBase::E_None) { throw css::uno::RuntimeException( - "cannot iterate directory " + url, - css::uno::Reference< css::uno::XInterface >()); + "cannot iterate directory " + url); } osl::FileStatus stat( osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL); if (i.getFileStatus(stat) != osl::FileBase::E_None) { throw css::uno::RuntimeException( - "cannot stat in directory " + url, - css::uno::Reference< css::uno::XInterface >()); + "cannot stat in directory " + url); } if (stat.getFileType() != osl::FileStatus::Directory) { //TODO: symlinks OUString file(stat.getFileName()); @@ -724,8 +705,7 @@ void Components::parseXcdFiles(int layer, OUString const & url) { new XcdParser(layer, processedDeps, data_)); } catch (css::container::NoSuchElementException & e) { throw css::uno::RuntimeException( - "stat'ed file does not exist: " + e.Message, - css::uno::Reference< css::uno::XInterface >()); + "stat'ed file does not exist: " + e.Message); } if (manager->parse(0)) { processedDeps.insert(name); @@ -748,8 +728,7 @@ void Components::parseXcdFiles(int layer, OUString const & url) { } if (!resolved) { throw css::uno::RuntimeException( - "xcd: unresolved dependencies in " + url, - css::uno::Reference< css::uno::XInterface >()); + "xcd: unresolved dependencies in " + url); } } } @@ -826,8 +805,7 @@ int Components::getExtensionLayer(bool shared) { int layer = shared ? sharedExtensionLayer_ : userExtensionLayer_; if (layer == -1) { throw css::uno::RuntimeException( - "insert extension xcs/xcu file into undefined layer", - css::uno::Reference< css::uno::XInterface >()); + "insert extension xcs/xcu file into undefined layer"); } return layer; } diff --git a/configmgr/source/data.cxx b/configmgr/source/data.cxx index f6535dff9c00..1cd40d16e650 100644 --- a/configmgr/source/data.cxx +++ b/configmgr/source/data.cxx @@ -154,9 +154,8 @@ OUString Data::fullTemplateName( { if (component.indexOf(':') != -1 || name.indexOf(':') != -1) { throw css::uno::RuntimeException( - ("bad component/name pair containing colon " + component + "/" + - name), - css::uno::Reference< css::uno::XInterface >()); + "bad component/name pair containing colon " + component + "/" + + name); } OUStringBuffer buf(component); buf.append(':'); @@ -197,8 +196,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( { if (pathRepresentation.isEmpty() || pathRepresentation[0] != '/') { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } if (path != 0) { path->clear(); @@ -219,8 +217,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( if (n == -1 || setElement) { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } NodeMap const & components = getComponents(); NodeMap::const_iterator i(components.find(seg)); @@ -243,8 +240,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( pathRepresentation[n++] != '/') { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } // for backwards compatibility, ignore a final slash if (n == pathRepresentation.getLength()) { @@ -262,8 +258,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( pathRepresentation, n, &seg, &setElement, &templateName); if (n == -1) { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } // For backwards compatibility, allow set members to be accessed with // simple path segments, like group members: @@ -273,8 +268,7 @@ rtl::Reference< Node > Data::resolvePathRepresentation( case Node::KIND_LOCALIZED_PROPERTY: if (!templateName.isEmpty()) { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } break; case Node::KIND_SET: @@ -283,21 +277,18 @@ rtl::Reference< Node > Data::resolvePathRepresentation( templateName)) { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } break; default: throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } if (!templateName.isEmpty() && p != 0) { assert(!p->getTemplateName().isEmpty()); if (!equalTemplateNames(templateName, p->getTemplateName())) { throw css::uno::RuntimeException( - "bad path " + pathRepresentation, - css::uno::Reference< css::uno::XInterface >()); + "bad path " + pathRepresentation); } } } @@ -324,8 +315,7 @@ Additions * Data::addExtensionXcuAdditions( url, rtl::Reference< ExtensionXcu >())).first); if (i->second.is()) { throw css::uno::RuntimeException( - "already added extension xcu " + url, - css::uno::Reference< css::uno::XInterface >()); + "already added extension xcu " + url); } i->second = item; item->layer = layer; diff --git a/configmgr/source/node.cxx b/configmgr/source/node.cxx index 661f1aaf7bd0..dafea1e70021 100644 --- a/configmgr/source/node.cxx +++ b/configmgr/source/node.cxx @@ -36,8 +36,7 @@ namespace configmgr { NodeMap & Node::getMembers() { assert(false); - throw css::uno::RuntimeException( - "this cannot happen", css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("this cannot happen"); } OUString Node::getTemplateName() const { diff --git a/configmgr/source/partial.cxx b/configmgr/source/partial.cxx index 2856046fe719..5133d1f49556 100644 --- a/configmgr/source/partial.cxx +++ b/configmgr/source/partial.cxx @@ -54,8 +54,7 @@ bool parseSegment( return *index == path.getLength(); } } - throw css::uno::RuntimeException( - "bad path " + path, css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("bad path " + path); } } diff --git a/configmgr/source/type.cxx b/configmgr/source/type.cxx index b257607eef4a..93e5a85722a9 100644 --- a/configmgr/source/type.cxx +++ b/configmgr/source/type.cxx @@ -60,9 +60,7 @@ Type elementType(Type type) { return TYPE_HEXBINARY; default: assert(false); - throw css::uno::RuntimeException( - "this cannot happen", - css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("this cannot happen"); } } @@ -101,9 +99,7 @@ css::uno::Type mapType(Type type) { css::uno::Sequence< css::uno::Sequence< sal_Int8 > > >::get(); default: assert(false); - throw css::uno::RuntimeException( - "this cannot happen", - css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("this cannot happen"); } } diff --git a/configmgr/source/valueparser.cxx b/configmgr/source/valueparser.cxx index 1ed02141c7b1..9c682e4ea38a 100644 --- a/configmgr/source/valueparser.cxx +++ b/configmgr/source/valueparser.cxx @@ -170,8 +170,7 @@ template< typename T > css::uno::Any parseSingleValue( { T val; if (!parseValue(text, &val)) { - throw css::uno::RuntimeException( - "invalid value", css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("invalid value"); } return css::uno::makeAny(val); } @@ -194,9 +193,7 @@ template< typename T > css::uno::Any parseListValue( if (!parseValue( xmlreader::Span(t.begin, i == -1 ? t.length : i), &val)) { - throw css::uno::RuntimeException( - "invalid value", - css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("invalid value"); } seq.push_back(val); if (i < 0) { @@ -214,9 +211,7 @@ css::uno::Any parseValue( { switch (type) { case TYPE_ANY: - throw css::uno::RuntimeException( - "invalid value of type any", - css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("invalid value of type any"); case TYPE_BOOLEAN: return parseSingleValue< sal_Bool >(text); case TYPE_SHORT: @@ -248,9 +243,7 @@ css::uno::Any parseValue( separator, text); default: assert(false); - throw css::uno::RuntimeException( - "this cannot happen", - css::uno::Reference< css::uno::XInterface >()); + throw css::uno::RuntimeException("this cannot happen"); } } @@ -332,8 +325,7 @@ bool ValueParser::startElement( pad_.add(RTL_CONSTASCII_STRINGPARAM("\xEF\xBF\xBF")); } else { throw css::uno::RuntimeException( - "bad unicode scalar attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad unicode scalar attribute in " + reader.getUrl()); } state_ = State(state_ + 1); return true; @@ -343,8 +335,7 @@ bool ValueParser::startElement( break; } throw css::uno::RuntimeException( - "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl()); } bool ValueParser::endElement() { diff --git a/configmgr/source/winreg.cxx b/configmgr/source/winreg.cxx index a47fe25b8f16..235dda0bd0a4 100644 --- a/configmgr/source/winreg.cxx +++ b/configmgr/source/winreg.cxx @@ -212,8 +212,7 @@ bool dumpWindowsRegistry(OUString* pFileURL) return false; default: throw css::uno::RuntimeException( - "cannot create temporary file", - css::uno::Reference< css::uno::XInterface >()); + "cannot create temporary file"); } writeData( aFileHandle, diff --git a/configmgr/source/writemodfile.cxx b/configmgr/source/writemodfile.cxx index b3d7b878a536..9bcdd21c94fe 100644 --- a/configmgr/source/writemodfile.cxx +++ b/configmgr/source/writemodfile.cxx @@ -69,8 +69,7 @@ OString convertToUtf8( RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR))) { throw css::uno::RuntimeException( - "cannot convert to UTF-8", - css::uno::Reference< css::uno::XInterface >()); + "cannot convert to UTF-8"); } return s; } @@ -110,7 +109,7 @@ void writeData_(oslFileHandle handle, char const * begin, sal_Int32 length) { n != static_cast< sal_uInt32 >(length)) { throw css::uno::RuntimeException( - "write failure", css::uno::Reference< css::uno::XInterface >()); + "write failure"); } } @@ -537,8 +536,7 @@ void writeModFile( return; default: throw css::uno::RuntimeException( - "cannot create directory " + dir, - css::uno::Reference< css::uno::XInterface >()); + "cannot create directory " + dir); } TempFile tmp; switch (osl::FileBase::createTempFile(&dir, &tmp.handle, &tmp.url)) { @@ -552,8 +550,7 @@ void writeModFile( return; default: throw css::uno::RuntimeException( - "cannot create temporary file in " + dir, - css::uno::Reference< css::uno::XInterface >()); + "cannot create temporary file in " + dir); } writeData_( tmp.handle, @@ -579,13 +576,11 @@ void writeModFile( tmp.closed = true; if (e != osl_File_E_None) { throw css::uno::RuntimeException( - "cannot close " + tmp.url, - css::uno::Reference< css::uno::XInterface >()); + "cannot close " + tmp.url); } if (osl::File::move(tmp.url, url) != osl::FileBase::E_None) { throw css::uno::RuntimeException( - "cannot move " + tmp.url, - css::uno::Reference< css::uno::XInterface >()); + "cannot move " + tmp.url); } tmp.handle = 0; } diff --git a/configmgr/source/xcdparser.cxx b/configmgr/source/xcdparser.cxx index 27a813fc862d..6b9382d3a870 100644 --- a/configmgr/source/xcdparser.cxx +++ b/configmgr/source/xcdparser.cxx @@ -96,14 +96,12 @@ bool XcdParser::startElement( } if (!attrFile.is()) { throw css::uno::RuntimeException( - "no dependency file attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no dependency file attribute in " + reader.getUrl()); } dependencyFile_ = attrFile.convertFromUtf8(); if (dependencyFile_.isEmpty()) { throw css::uno::RuntimeException( - "bad dependency file attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad dependency file attribute in " + reader.getUrl()); } } if ((processedDependencies_.find(dependencyFile_) == @@ -143,8 +141,7 @@ bool XcdParser::startElement( break; } throw css::uno::RuntimeException( - "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl()); } void XcdParser::endElement(xmlreader::XmlReader const & reader) { diff --git a/configmgr/source/xcsparser.cxx b/configmgr/source/xcsparser.cxx index a550240ee3d3..dd51807b0c70 100644 --- a/configmgr/source/xcsparser.cxx +++ b/configmgr/source/xcsparser.cxx @@ -252,8 +252,7 @@ bool XcsParser::startElement( } } throw css::uno::RuntimeException( - "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad member <" + name.convertFromUtf8() + "> in " + reader.getUrl()); } void XcsParser::endElement(xmlreader::XmlReader const & reader) { @@ -295,16 +294,14 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { default: assert(false); throw css::uno::RuntimeException( - "this cannot happen", - css::uno::Reference< css::uno::XInterface >()); + "this cannot happen"); } } else { if (!elements_.top().node->getMembers().insert( NodeMap::value_type(top.name, top.node)).second) { throw css::uno::RuntimeException( - "duplicate " + top.name + " in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "duplicate " + top.name + " in " + reader.getUrl()); } } } @@ -320,8 +317,7 @@ void XcsParser::endElement(xmlreader::XmlReader const & reader) { break; case STATE_TEMPLATES_DONE: throw css::uno::RuntimeException( - "no component element in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no component element in " + reader.getUrl()); case STATE_COMPONENT_DONE: break; default: @@ -350,9 +346,8 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { { if (hasPackage) { throw css::uno::RuntimeException( - ("multiple component-schema package attributes in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "multiple component-schema package attributes in " + + reader.getUrl()); } hasPackage = true; xmlreader::Span s(reader.getAttributeValue(false)); @@ -362,9 +357,8 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { { if (hasName) { throw css::uno::RuntimeException( - ("multiple component-schema name attributes in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "multiple component-schema name attributes in " + + reader.getUrl()); } hasName = true; xmlreader::Span s(reader.getAttributeValue(false)); @@ -373,13 +367,11 @@ void XcsParser::handleComponentSchema(xmlreader::XmlReader & reader) { } if (!hasPackage) { throw css::uno::RuntimeException( - "no component-schema package attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no component-schema package attribute in " + reader.getUrl()); } if (!hasName) { throw css::uno::RuntimeException( - "no component-schema name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no component-schema name attribute in " + reader.getUrl()); } componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). convertFromUtf8(); @@ -413,8 +405,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { } if (!hasName) { throw css::uno::RuntimeException( - "no node-ref name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no node-ref name attribute in " + reader.getUrl()); } rtl::Reference< Node > tmpl( data_.getTemplate( @@ -425,8 +416,7 @@ void XcsParser::handleNodeRef(xmlreader::XmlReader & reader) { //TODO: this can erroneously happen as long as import/uses attributes // are not correctly processed throw css::uno::RuntimeException( - "unknown node-ref " + name + " in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "unknown node-ref " + name + " in " + reader.getUrl()); } rtl::Reference< Node > node(tmpl->clone(false)); node->setLayer(valueParser_.getLayer()); @@ -465,13 +455,11 @@ void XcsParser::handleProp(xmlreader::XmlReader & reader) { } if (!hasName) { throw css::uno::RuntimeException( - "no prop name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no prop name attribute in " + reader.getUrl()); } if (valueParser_.type_ == TYPE_ERROR) { throw css::uno::RuntimeException( - "no prop type attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no prop type attribute in " + reader.getUrl()); } elements_.push( Element( @@ -502,8 +490,7 @@ void XcsParser::handlePropValue( attrSeparator = reader.getAttributeValue(false); if (attrSeparator.length == 0) { throw css::uno::RuntimeException( - "bad oor:separator attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad oor:separator attribute in " + reader.getUrl()); } } } @@ -533,8 +520,7 @@ void XcsParser::handleGroup(xmlreader::XmlReader & reader, bool isTemplate) { } if (!hasName) { throw css::uno::RuntimeException( - "no group name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no group name attribute in " + reader.getUrl()); } if (isTemplate) { name = Data::fullTemplateName(componentName_, name); @@ -575,8 +561,7 @@ void XcsParser::handleSet(xmlreader::XmlReader & reader, bool isTemplate) { } if (!hasName) { throw css::uno::RuntimeException( - "no set name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no set name attribute in " + reader.getUrl()); } if (isTemplate) { name = Data::fullTemplateName(componentName_, name); diff --git a/configmgr/source/xcuparser.cxx b/configmgr/source/xcuparser.cxx index 9499f9764425..8e99a5b6f5fe 100644 --- a/configmgr/source/xcuparser.cxx +++ b/configmgr/source/xcuparser.cxx @@ -88,9 +88,8 @@ bool XcuParser::startElement( state_.push(State::Modify(rtl::Reference< Node >())); } else { throw css::uno::RuntimeException( - ("bad root element <" + name.convertFromUtf8() + "> in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad root element <" + name.convertFromUtf8() + "> in " + + reader.getUrl()); } } else if (state_.top().ignore) { state_.push(State::Ignore(false)); @@ -100,9 +99,8 @@ bool XcuParser::startElement( handleItem(reader); } else { throw css::uno::RuntimeException( - ("bad items node member <" + name.convertFromUtf8() + "> in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad items node member <" + name.convertFromUtf8() + "> in " + + reader.getUrl()); } } else { switch (state_.top().node->kind()) { @@ -115,9 +113,8 @@ bool XcuParser::startElement( static_cast< PropertyNode * >(state_.top().node.get())); } else { throw css::uno::RuntimeException( - ("bad property node member <" + name.convertFromUtf8() + - "> in " + reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad property node member <" + name.convertFromUtf8() + + "> in " + reader.getUrl()); } break; case Node::KIND_LOCALIZED_PROPERTY: @@ -130,16 +127,14 @@ bool XcuParser::startElement( state_.top().node.get())); } else { throw css::uno::RuntimeException( - ("bad localized property node member <" + - name.convertFromUtf8() + "> in " + reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad localized property node member <" + + name.convertFromUtf8() + "> in " + reader.getUrl()); } break; case Node::KIND_LOCALIZED_VALUE: throw css::uno::RuntimeException( - ("bad member <" + name.convertFromUtf8() + "> in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad member <" + name.convertFromUtf8() + "> in " + + reader.getUrl()); case Node::KIND_GROUP: if (nsId == xmlreader::XmlReader::NAMESPACE_NONE && name.equals("prop")) @@ -153,9 +148,8 @@ bool XcuParser::startElement( handleGroupNode(reader, state_.top().node); } else { throw css::uno::RuntimeException( - ("bad group node member <" + name.convertFromUtf8() + - "> in " + reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad group node member <" + name.convertFromUtf8() + + "> in " + reader.getUrl()); } break; case Node::KIND_SET: @@ -174,9 +168,8 @@ bool XcuParser::startElement( state_.push(State::Ignore(true)); } else { throw css::uno::RuntimeException( - ("bad set node member <" + name.convertFromUtf8() + - "> in " + reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad set node member <" + name.convertFromUtf8() + + "> in " + reader.getUrl()); } break; case Node::KIND_ROOT: @@ -231,8 +224,7 @@ XcuParser::Operation XcuParser::parseOperation(xmlreader::Span const & text) { return OPERATION_REMOVE; } throw css::uno::RuntimeException( - "invalid op " + text.convertFromUtf8(), - css::uno::Reference< css::uno::XInterface >()); + "invalid op " + text.convertFromUtf8()); } void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { @@ -252,9 +244,8 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { { if (hasPackage) { throw css::uno::RuntimeException( - ("multiple component-update package attributes in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "multiple component-update package attributes in " + + reader.getUrl()); } hasPackage = true; xmlreader::Span s(reader.getAttributeValue(false)); @@ -264,9 +255,8 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { { if (hasName) { throw css::uno::RuntimeException( - ("multiple component-update name attributes in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "multiple component-update name attributes in " + + reader.getUrl()); } hasName = true; xmlreader::Span s(reader.getAttributeValue(false)); @@ -283,13 +273,11 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { } if (!hasPackage) { throw css::uno::RuntimeException( - "no component-data package attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no component-data package attribute in " + reader.getUrl()); } if (!hasName) { throw css::uno::RuntimeException( - "no component-data name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no component-data name attribute in " + reader.getUrl()); } componentName_ = xmlreader::Span(buf.getStr(), buf.getLength()). convertFromUtf8(); @@ -319,8 +307,7 @@ void XcuParser::handleComponentData(xmlreader::XmlReader & reader) { break; default: throw css::uno::RuntimeException( - "invalid operation on root node in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "invalid operation on root node in " + reader.getUrl()); } int finalizedLayer = std::min( finalized ? valueParser_.getLayer() : Data::NO_LAYER, @@ -347,8 +334,7 @@ void XcuParser::handleItem(xmlreader::XmlReader & reader) { } if (!attrPath.is()) { throw css::uno::RuntimeException( - "missing path attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "missing path attribute in " + reader.getUrl()); } OUString path(attrPath.convertFromUtf8()); int finalizedLayer; @@ -417,8 +403,7 @@ void XcuParser::handlePropValue( reader, reader.getAttributeValue(true)); if (valueParser_.type_ != TYPE_ANY && type != valueParser_.type_) { throw css::uno::RuntimeException( - "invalid value type in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "invalid value type in " + reader.getUrl()); } valueParser_.type_ = type; } else if (attrNsId == ParseManager::NAMESPACE_OOR && @@ -427,8 +412,7 @@ void XcuParser::handlePropValue( xmlreader::Span s(reader.getAttributeValue(false)); if (s.length == 0) { throw css::uno::RuntimeException( - "bad oor:separator attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad oor:separator attribute in " + reader.getUrl()); } separator = OString(s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && @@ -437,22 +421,19 @@ void XcuParser::handlePropValue( external = reader.getAttributeValue(true).convertFromUtf8(); if (external.isEmpty()) { throw css::uno::RuntimeException( - "bad oor:external attribute value in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad oor:external attribute value in " + reader.getUrl()); } } } if (nil) { if (!prop->isNillable()) { throw css::uno::RuntimeException( - "xsi:nil attribute for non-nillable prop in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "xsi:nil attribute for non-nillable prop in " + reader.getUrl()); } if (!external.isEmpty()) { throw css::uno::RuntimeException( - ("xsi:nil and oor:external attributes for prop in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "xsi:nil and oor:external attributes for prop in " + + reader.getUrl()); } prop->setValue(valueParser_.getLayer(), css::uno::Any()); state_.push(State::Ignore(false)); @@ -493,8 +474,7 @@ void XcuParser::handleLocpropValue( reader, reader.getAttributeValue(true)); if (valueParser_.type_ != TYPE_ANY && type != valueParser_.type_) { throw css::uno::RuntimeException( - "invalid value type in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "invalid value type in " + reader.getUrl()); } valueParser_.type_ = type; } else if (attrNsId == ParseManager::NAMESPACE_OOR && @@ -503,8 +483,7 @@ void XcuParser::handleLocpropValue( xmlreader::Span s(reader.getAttributeValue(false)); if (s.length == 0) { throw css::uno::RuntimeException( - "bad oor:separator attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad oor:separator attribute in " + reader.getUrl()); } separator = OString(s.begin, s.length); } else if (attrNsId == ParseManager::NAMESPACE_OOR && @@ -530,8 +509,7 @@ void XcuParser::handleLocpropValue( } if (nil && !locprop->isNillable()) { throw css::uno::RuntimeException( - "xsi:nil attribute for non-nillable prop in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "xsi:nil attribute for non-nillable prop in " + reader.getUrl()); } switch (op) { case OPERATION_FUSE: @@ -571,8 +549,7 @@ void XcuParser::handleLocpropValue( break; default: throw css::uno::RuntimeException( - "bad op attribute for value element in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "bad op attribute for value element in " + reader.getUrl()); } } @@ -609,8 +586,7 @@ void XcuParser::handleGroupProp( } if (!hasName) { throw css::uno::RuntimeException( - "no prop name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no prop name attribute in " + reader.getUrl()); } if (trackPath_) { path_.push_back(name); @@ -640,8 +616,7 @@ void XcuParser::handleGroupProp( break; default: throw css::uno::RuntimeException( - "inappropriate prop " + name + " in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "inappropriate prop " + name + " in " + reader.getUrl()); } } } @@ -656,9 +631,8 @@ void XcuParser::handleUnknownGroupProp( if (group->isExtensible()) { if (type == TYPE_ERROR) { throw css::uno::RuntimeException( - ("missing type attribute for prop " + name + " in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "missing type attribute for prop " + name + " in " + + reader.getUrl()); } valueParser_.type_ = type; rtl::Reference< Node > prop( @@ -706,8 +680,7 @@ void XcuParser::handlePlainGroupProp( type != property->getStaticType()) { throw css::uno::RuntimeException( - "invalid type for prop " + name + " in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "invalid type for prop " + name + " in " + reader.getUrl()); } valueParser_.type_ = type == TYPE_ERROR ? property->getStaticType() : type; switch (operation) { @@ -720,9 +693,8 @@ void XcuParser::handlePlainGroupProp( case OPERATION_REMOVE: if (!property->isExtension()) { throw css::uno::RuntimeException( - ("invalid remove of non-extension prop " + name + " in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "invalid remove of non-extension prop " + name + " in " + + reader.getUrl()); } group->getMembers().erase(propertyIndex); state_.push(State::Ignore(true)); @@ -751,8 +723,7 @@ void XcuParser::handleLocalizedGroupProp( type != property->getStaticType()) { throw css::uno::RuntimeException( - "invalid type for prop " + name + " in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "invalid type for prop " + name + " in " + reader.getUrl()); } valueParser_.type_ = type == TYPE_ERROR ? property->getStaticType() : type; switch (operation) { @@ -773,9 +744,8 @@ void XcuParser::handleLocalizedGroupProp( break; case OPERATION_REMOVE: throw css::uno::RuntimeException( - ("invalid remove of non-extension prop " + name + " in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "invalid remove of non-extension prop " + name + " in " + + reader.getUrl()); } } @@ -807,8 +777,7 @@ void XcuParser::handleGroupNode( } if (!hasName) { throw css::uno::RuntimeException( - "no node name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no node name attribute in " + reader.getUrl()); } if (trackPath_) { path_.push_back(name); @@ -830,14 +799,12 @@ void XcuParser::handleGroupNode( Node::Kind kind = child->kind(); if (kind != Node::KIND_GROUP && kind != Node::KIND_SET) { throw css::uno::RuntimeException( - ("bad <node> \"" + name + "\" of non group/set kind in " + - reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "bad <node> \"" + name + "\" of non group/set kind in " + + reader.getUrl()); } if (op != OPERATION_MODIFY && op != OPERATION_FUSE) { throw css::uno::RuntimeException( - "invalid operation on group node in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "invalid operation on group node in " + reader.getUrl()); } int finalizedLayer = std::min( finalized ? valueParser_.getLayer() : Data::NO_LAYER, @@ -893,8 +860,7 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { } if (!hasName) { throw css::uno::RuntimeException( - "no node name attribute in " + reader.getUrl(), - css::uno::Reference< css::uno::XInterface >()); + "no node name attribute in " + reader.getUrl()); } if (trackPath_) { path_.push_back(name); @@ -909,17 +875,15 @@ void XcuParser::handleSetNode(xmlreader::XmlReader & reader, SetNode * set) { component, hasNodeType, nodeType, &set->getDefaultTemplateName())); if (!set->isValidTemplate(templateName)) { throw css::uno::RuntimeException( - ("set member node " + name + " references invalid template " + - templateName + " in " + reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "set member node " + name + " references invalid template " + + templateName + " in " + reader.getUrl()); } rtl::Reference< Node > tmpl( data_.getTemplate(valueParser_.getLayer(), templateName)); if (!tmpl.is()) { throw css::uno::RuntimeException( - ("set member node " + name + " references undefined template " + - templateName + " in " + reader.getUrl()), - css::uno::Reference< css::uno::XInterface >()); + "set member node " + name + " references undefined template " + + templateName + " in " + reader.getUrl()); } int finalizedLayer = finalized ? valueParser_.getLayer() : Data::NO_LAYER; int mandatoryLayer = mandatory ? valueParser_.getLayer() : Data::NO_LAYER; diff --git a/configmgr/source/xmldata.cxx b/configmgr/source/xmldata.cxx index 029cc2312063..2697b4b94394 100644 --- a/configmgr/source/xmldata.cxx +++ b/configmgr/source/xmldata.cxx @@ -143,8 +143,7 @@ Type parseType( } } throw css::uno::RuntimeException( - "invalid type " + text.convertFromUtf8(), - css::uno::Reference< css::uno::XInterface >()); + "invalid type " + text.convertFromUtf8()); } bool parseBoolean(xmlreader::Span const & text) { @@ -156,8 +155,7 @@ bool parseBoolean(xmlreader::Span const & text) { return false; } throw css::uno::RuntimeException( - "invalid boolean " + text.convertFromUtf8(), - css::uno::Reference< css::uno::XInterface >()); + "invalid boolean " + text.convertFromUtf8()); } OUString parseTemplateReference( @@ -169,8 +167,7 @@ OUString parseTemplateReference( return *defaultTemplateName; } throw css::uno::RuntimeException( - "missing node-type attribute", - css::uno::Reference< css::uno::XInterface >()); + "missing node-type attribute"); } return Data::fullTemplateName(component, nodeType); } |