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

comphelper::SequenceAsHashMap: throw IllegalArgumentException

...instead of IllegalTypeException (where the latter is not a RuntimeException).
Fixes cid#707218, cid#1224993, etc., and reverts previous fix
358f5280 "Fix coverity#1224993 w/o breaking
JunitTest_framework_unoapi."

Change-Id: I13ce153e1513749fb0be2ee8e560cec86a30c5ba
üst 49329e37
......@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <sal/config.h>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <comphelper/sequenceashashmap.hxx>
......@@ -75,8 +78,9 @@ void SequenceAsHashMap::operator<<(const css::uno::Any& aSource)
return;
}
throw css::beans::IllegalTypeException(
"Any contains wrong type." );
throw css::lang::IllegalArgumentException(
"Any contains wrong type.", css::uno::Reference<css::uno::XInterface>(),
-1);
}
......@@ -94,8 +98,9 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS
(lP.Name.isEmpty()) ||
(!lP.Value.hasValue())
)
throw css::beans::IllegalTypeException(
"PropertyValue struct contains no useful information." );
throw css::lang::IllegalArgumentException(
"PropertyValue struct contains no useful information.",
css::uno::Reference<css::uno::XInterface>(), -1);
(*this)[lP.Name] = lP.Value;
continue;
}
......@@ -107,16 +112,18 @@ void SequenceAsHashMap::operator<<(const css::uno::Sequence< css::uno::Any >& lS
(lN.Name.isEmpty()) ||
(!lN.Value.hasValue())
)
throw css::beans::IllegalTypeException(
"NamedValue struct contains no useful information." );
throw css::lang::IllegalArgumentException(
"NamedValue struct contains no useful information.",
css::uno::Reference<css::uno::XInterface>(), -1);
(*this)[lN.Name] = lN.Value;
continue;
}
// ignore VOID Any ... but reject wrong filled ones!
if (lSource[i].hasValue())
throw css::beans::IllegalTypeException(
"Any contains wrong type." );
throw css::lang::IllegalArgumentException(
"Any contains wrong type.",
css::uno::Reference<css::uno::XInterface>(), -1);
}
}
......
......@@ -22,6 +22,7 @@
#include <loadenv/loadenvexception.hxx>
#include <loadenv/actionlockguard.hxx>
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
......
......@@ -27,7 +27,6 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <comphelper/comphelperdllapi.h>
......@@ -99,7 +98,7 @@ class COMPHELPER_DLLPUBLIC SequenceAsHashMap : public SequenceAsHashMapBase
@param aSource
contains the new items for this map.
@throw An com::sun::star::beans::IllegalTypeException
@throw An com::sun::star::lang::IllegalArgumentException
is thrown, if the given any does not contain a suitable sequence ...
but not if it's a VOID Any!
*/
......@@ -114,7 +113,7 @@ class COMPHELPER_DLLPUBLIC SequenceAsHashMap : public SequenceAsHashMapBase
@param lSource
contains the new items for this map.
@throw An com::sun::star::beans::IllegalTypeException
@throw An com::sun::star::lang::IllegalArgumentException
is thrown, if the given any sequence
uses wrong types for its items. VOID Any will be ignored!
*/
......
......@@ -58,10 +58,8 @@
#include <crstate.hxx>
#include <comphelper/extract.hxx>
#include <comphelper/makesequence.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <svx/scene3d.hxx>
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
#include <fmtwrapinfluenceonobjpos.hxx>
#include <com/sun/star/text/TextContentAnchorType.hpp>
......@@ -1483,14 +1481,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
if (pFmt)
{
// We have a pFmt (but no pEntry): try to sync TextBox property.
try {
SwTextBoxHelper::syncProperty(pFmt, rPropertyName, aValue);
} catch (css::beans::IllegalTypeException & e) {
css::uno::Any a(cppu::getCaughtException());
throw css::lang::WrappedTargetException(
"wrapped IllegalTypeException " + e.Message,
css::uno::Reference<css::uno::XInterface>(), a);
}
SwTextBoxHelper::syncProperty(pFmt, rPropertyName, aValue);
}
// #i31698# - restore object position, if caption point is set.
......
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