diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-27 16:09:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-28 09:22:55 +0000 |
commit | f1d83ac45f08270f7f2dd7128056effd0251dc5e (patch) | |
tree | 55d924eaa7f55627039d44458d869ef65130fdf8 /unoxml/source | |
parent | 53d3755972bfd3bd2cd650edf91f1483038028c8 (diff) |
loplugin:stringconstant check for unnecessary OUString constructor..
..calls when creating exceptions
Change-Id: I3bc58a5aa4dc6f0508ecb88b3a843b96b8c7ebfe
Reviewed-on: https://gerrit.libreoffice.org/33617
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml/source')
-rw-r--r-- | unoxml/source/rdf/CBlankNode.cxx | 9 | ||||
-rw-r--r-- | unoxml/source/rdf/CLiteral.cxx | 18 | ||||
-rw-r--r-- | unoxml/source/rdf/CURI.cxx | 24 |
3 files changed, 17 insertions, 34 deletions
diff --git a/unoxml/source/rdf/CBlankNode.cxx b/unoxml/source/rdf/CBlankNode.cxx index 5d687876d223..b9a41668fdc8 100644 --- a/unoxml/source/rdf/CBlankNode.cxx +++ b/unoxml/source/rdf/CBlankNode.cxx @@ -83,15 +83,13 @@ void SAL_CALL CBlankNode::initialize(const css::uno::Sequence< css::uno::Any > & { if (aArguments.getLength() != 1) { throw css::lang::IllegalArgumentException( - OUString("CBlankNode::initialize: " - "must give exactly 1 argument"), *this, 1); + "CBlankNode::initialize: must give exactly 1 argument", *this, 1); } OUString arg; if (!(aArguments[0] >>= arg)) { throw css::lang::IllegalArgumentException( - OUString("CBlankNode::initialize: " - "argument must be string"), *this, 0); + "CBlankNode::initialize: argument must be string", *this, 0); } //FIXME: what is legal? @@ -99,8 +97,7 @@ void SAL_CALL CBlankNode::initialize(const css::uno::Sequence< css::uno::Any > & m_NodeID = arg; } else { throw css::lang::IllegalArgumentException( - OUString("CBlankNode::initialize: " - "argument is not valid blank node ID"), *this, 0); + "CBlankNode::initialize: argument is not valid blank node ID", *this, 0); } } diff --git a/unoxml/source/rdf/CLiteral.cxx b/unoxml/source/rdf/CLiteral.cxx index 6643df240acd..fc1b2044ec3d 100644 --- a/unoxml/source/rdf/CLiteral.cxx +++ b/unoxml/source/rdf/CLiteral.cxx @@ -93,23 +93,20 @@ void SAL_CALL CLiteral::initialize(const css::uno::Sequence< css::uno::Any > & a const sal_Int32 len( aArguments.getLength() ); if (len < 1 || len > 2) { throw css::lang::IllegalArgumentException( - OUString("CLiteral::initialize: " - "must give 1 or 2 argument(s)"), *this, 2); + "CLiteral::initialize: must give 1 or 2 argument(s)", *this, 2); } OUString arg0; if (!(aArguments[0] >>= arg0)) { throw css::lang::IllegalArgumentException( - OUString("CLiteral::initialize: " - "argument must be string"), *this, 0); + "CLiteral::initialize: argument must be string", *this, 0); } //FIXME: what is legal? if (true) { m_Value = arg0; } else { throw css::lang::IllegalArgumentException( - OUString("CLiteral::initialize: " - "argument is not valid literal value"), *this, 0); + "CLiteral::initialize: argument is not valid literal value", *this, 0); } if (len > 1) { @@ -120,21 +117,18 @@ void SAL_CALL CLiteral::initialize(const css::uno::Sequence< css::uno::Any > & a m_Language = arg1; } else { throw css::lang::IllegalArgumentException( - OUString("CLiteral::initialize: " - "argument is not valid language"), *this, 1); + "CLiteral::initialize: argument is not valid language", *this, 1); } } else if ((aArguments[1] >>= xURI)) { if (xURI.is()) { m_xDatatype = xURI; } else { throw css::lang::IllegalArgumentException( - OUString("CLiteral::initialize: " - "argument is null"), *this, 1); + "CLiteral::initialize: argument is null", *this, 1); } } else { throw css::lang::IllegalArgumentException( - OUString("CLiteral::initialize: " - "argument must be string or URI"), *this, 1); + "CLiteral::initialize: argument must be string or URI", *this, 1); } } } diff --git a/unoxml/source/rdf/CURI.cxx b/unoxml/source/rdf/CURI.cxx index 0a6d903b1088..2b45f65a77d2 100644 --- a/unoxml/source/rdf/CURI.cxx +++ b/unoxml/source/rdf/CURI.cxx @@ -700,8 +700,7 @@ void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant) default: throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "invalid URIs constant argument"), *this, 0); + "CURI::initialize: invalid URIs constant argument", *this, 0); } m_Namespace = OUString::createFromAscii(ns).intern(); m_LocalName = OUString::createFromAscii(ln).intern(); @@ -714,8 +713,7 @@ void SAL_CALL CURI::initialize(const css::uno::Sequence< css::uno::Any > & aArgu sal_Int32 len = aArguments.getLength(); if ((len < 1) || (len > 2)) { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "must give 1 or 2 argument(s)"), *this, 2); + "CURI::initialize: must give 1 or 2 argument(s)", *this, 2); } sal_Int16 arg(0); @@ -725,22 +723,19 @@ void SAL_CALL CURI::initialize(const css::uno::Sequence< css::uno::Any > & aArgu // integer argument: constant from rdf::URIs if (len != 1) { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "must give 1 int argument"), *this, 1); + "CURI::initialize: must give 1 int argument", *this, 1); } initFromConstant(arg); return; } if (!(aArguments[0] >>= arg0)) { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "argument must be string or short"), *this, 0); + "CURI::initialize: argument must be string or short", *this, 0); } if (len > 1) { if (!(aArguments[1] >>= arg1)) { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "argument must be string"), *this, 1); + "CURI::initialize: argument must be string", *this, 1); } // just append the parameters and then split them again; seems simplest arg0 = arg0 + arg1; @@ -760,8 +755,7 @@ void SAL_CALL CURI::initialize(const css::uno::Sequence< css::uno::Any > & aArgu } } else { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "argument not splittable: no separator [#/:]"), *this, 0); + "CURI::initialize: argument not splittable: no separator [#/:]", *this, 0); } //FIXME: what is legal? @@ -769,16 +763,14 @@ void SAL_CALL CURI::initialize(const css::uno::Sequence< css::uno::Any > & aArgu m_Namespace = arg0; } else { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "argument is not valid namespace"), *this, 0); + "CURI::initialize: argument is not valid namespace", *this, 0); } //FIXME: what is legal? if (true) { m_LocalName = arg1; } else { throw css::lang::IllegalArgumentException( - OUString("CURI::initialize: " - "argument is not valid local name"), *this, 1); + "CURI::initialize: argument is not valid local name", *this, 1); } } |