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