Update ooo320-m1
[ooovba.git] / cppuhelper / test / testimplhelper.cxx
blob0b8c2e27e40aa0071ce75b32e3a8fa42c995525f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: testimplhelper.cxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #if !defined(OSL_DEBUG_LEVEL) || OSL_DEBUG_LEVEL == 0
32 # undef OSL_DEBUG_LEVEL
33 # define OSL_DEBUG_LEVEL 2
34 #endif
36 // MARKER(update_precomp.py): autogen include statement, do not remove
37 #include "precompiled_cppuhelper.hxx"
39 #include <stdio.h>
41 #include <cppuhelper/implbase1.hxx>
42 #include <cppuhelper/implbase2.hxx>
43 #include <cppuhelper/implbase3.hxx>
44 #include <cppuhelper/implbase4.hxx>
45 #include <cppuhelper/implbase5.hxx>
46 #include <cppuhelper/implbase6.hxx>
47 #include <cppuhelper/implbase7.hxx>
48 #include <cppuhelper/implbase8.hxx>
49 #include <cppuhelper/implbase9.hxx>
50 #include <cppuhelper/implbase10.hxx>
51 #include <cppuhelper/implbase11.hxx>
52 #include <cppuhelper/implbase12.hxx>
54 #include <cppuhelper/compbase1.hxx>
55 #include <cppuhelper/compbase2.hxx>
56 #include <cppuhelper/compbase3.hxx>
57 #include <cppuhelper/compbase4.hxx>
58 #include <cppuhelper/compbase5.hxx>
59 #include <cppuhelper/compbase6.hxx>
60 #include <cppuhelper/compbase7.hxx>
61 #include <cppuhelper/compbase8.hxx>
62 #include <cppuhelper/compbase9.hxx>
63 #include <cppuhelper/compbase10.hxx>
64 #include <cppuhelper/compbase11.hxx>
65 #include <cppuhelper/compbase12.hxx>
67 #include <osl/diagnose.h>
68 #include <cppuhelper/servicefactory.hxx>
69 #include <cppuhelper/implbase4.hxx>
70 #include <cppuhelper/compbase4.hxx>
71 #include <cppuhelper/exc_hlp.hxx>
73 #include <test/A.hpp>
74 #include <test/BA.hpp>
75 #include <test/CA.hpp>
76 #include <test/DBA.hpp>
77 #include <test/E.hpp>
78 #include <test/FE.hpp>
79 #include <test/G.hpp>
80 #include <test/H.hpp>
81 #include <test/I.hpp>
83 #include <com/sun/star/lang/IllegalAccessException.hpp>
85 using namespace test;
86 using namespace rtl;
87 using namespace osl;
88 using namespace cppu;
89 using namespace com::sun::star;
90 using namespace com::sun::star::uno;
92 //==================================================================================================
93 struct TestImpl : public ImplHelper4< CA, DBA, FE, G >
95 sal_Int32 nRef;
97 virtual ~TestImpl()
98 { OSL_TRACE( "> TestImpl dtor called... <\n" ); }
100 virtual Any SAL_CALL queryInterface( const Type & rType ) throw(RuntimeException)
101 { return ImplHelper4< CA, DBA, FE, G >::queryInterface( rType ); }
102 virtual void SAL_CALL acquire( ) throw()
103 { ++nRef; }
104 virtual void SAL_CALL release( ) throw()
105 { if (! --nRef) delete this; }
107 // A
108 virtual OUString SAL_CALL a() throw(RuntimeException)
109 { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
110 // BA
111 virtual OUString SAL_CALL ba() throw(RuntimeException)
112 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
113 // CA
114 virtual OUString SAL_CALL ca() throw(RuntimeException)
115 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
116 // DBA
117 virtual OUString SAL_CALL dba() throw(RuntimeException)
118 { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
119 // E
120 virtual OUString SAL_CALL e() throw(RuntimeException)
121 { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
122 // FE
123 virtual OUString SAL_CALL fe() throw(RuntimeException)
124 { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
125 // G
126 virtual OUString SAL_CALL g() throw(RuntimeException)
127 { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
130 //==================================================================================================
131 struct TestWeakAggImpl : public WeakAggImplHelper4< CA, DBA, FE, G >
133 virtual ~TestWeakAggImpl()
134 { OSL_TRACE( "> TestWeakAggImpl dtor called... <\n" ); }
136 // A
137 virtual OUString SAL_CALL a() throw(RuntimeException)
138 { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
139 // BA
140 virtual OUString SAL_CALL ba() throw(RuntimeException)
141 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
142 // CA
143 virtual OUString SAL_CALL ca() throw(RuntimeException)
144 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
145 // DBA
146 virtual OUString SAL_CALL dba() throw(RuntimeException)
147 { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
148 // E
149 virtual OUString SAL_CALL e() throw(RuntimeException)
150 { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
151 // FE
152 virtual OUString SAL_CALL fe() throw(RuntimeException)
153 { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
154 // G
155 virtual OUString SAL_CALL g() throw(RuntimeException)
156 { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
159 //==================================================================================================
160 struct TestWeakImpl : public WeakImplHelper4< CA, DBA, FE, G >
162 TestWeakImpl() {}
164 virtual ~TestWeakImpl()
165 { OSL_TRACE( "> TestWeakImpl dtor called... <\n" ); }
167 // A
168 virtual OUString SAL_CALL a() throw(RuntimeException)
169 { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
170 // BA
171 virtual OUString SAL_CALL ba() throw(RuntimeException)
172 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
173 // CA
174 virtual OUString SAL_CALL ca() throw(RuntimeException)
175 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
176 // DBA
177 virtual OUString SAL_CALL dba() throw(RuntimeException)
178 { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
179 // E
180 virtual OUString SAL_CALL e() throw(RuntimeException)
181 { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
182 // FE
183 virtual OUString SAL_CALL fe() throw(RuntimeException)
184 { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
185 // G
186 virtual OUString SAL_CALL g() throw(RuntimeException)
187 { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
189 protected:
190 TestWeakImpl(int) {}
192 TestWeakImpl(int, int) {}
194 TestWeakImpl(int, int, int) {}
196 TestWeakImpl(int, int, int, int) {}
198 TestWeakImpl(int, int, int, int, int) {}
200 TestWeakImpl(int, int, int, int, int, int, int = 0) {}
203 //==================================================================================================
204 struct TestWeakComponentImpl : public WeakComponentImplHelper4< CA, DBA, FE, G >
206 Mutex m;
207 TestWeakComponentImpl()
208 : WeakComponentImplHelper4< CA, DBA, FE, G >( m )
210 virtual ~TestWeakComponentImpl()
211 { OSL_TRACE( "> TestWeakComponentImpl dtor called... <\n" ); }
213 void SAL_CALL disposing()
214 { OSL_TRACE( "> TestWeakComponentImpl disposing called... <\n" ); }
216 // A
217 virtual OUString SAL_CALL a() throw(RuntimeException)
218 { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
219 // BA
220 virtual OUString SAL_CALL ba() throw(RuntimeException)
221 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
222 // CA
223 virtual OUString SAL_CALL ca() throw(RuntimeException)
224 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
225 // DBA
226 virtual OUString SAL_CALL dba() throw(RuntimeException)
227 { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
228 // E
229 virtual OUString SAL_CALL e() throw(RuntimeException)
230 { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
231 // FE
232 virtual OUString SAL_CALL fe() throw(RuntimeException)
233 { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
234 // G
235 virtual OUString SAL_CALL g() throw(RuntimeException)
236 { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
239 //==================================================================================================
240 struct TestWeakAggComponentImpl : public WeakAggComponentImplHelper4< CA, DBA, FE, G >
242 Mutex m;
243 TestWeakAggComponentImpl()
244 : WeakAggComponentImplHelper4< CA, DBA, FE, G >( m )
246 virtual ~TestWeakAggComponentImpl()
247 { OSL_TRACE( "> TestWeakAggComponentImpl dtor called... <\n" ); }
249 void SAL_CALL disposing()
250 { OSL_TRACE( "> TestWeakAggComponentImpl disposing called... <\n" ); }
252 // A
253 virtual OUString SAL_CALL a() throw(RuntimeException)
254 { return OUString( RTL_CONSTASCII_USTRINGPARAM("a") ); }
255 // BA
256 virtual OUString SAL_CALL ba() throw(RuntimeException)
257 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ba") ); }
258 // CA
259 virtual OUString SAL_CALL ca() throw(RuntimeException)
260 { return OUString( RTL_CONSTASCII_USTRINGPARAM("ca") ); }
261 // DBA
262 virtual OUString SAL_CALL dba() throw(RuntimeException)
263 { return OUString( RTL_CONSTASCII_USTRINGPARAM("dba") ); }
264 // E
265 virtual OUString SAL_CALL e() throw(RuntimeException)
266 { return OUString( RTL_CONSTASCII_USTRINGPARAM("e") ); }
267 // FE
268 virtual OUString SAL_CALL fe() throw(RuntimeException)
269 { return OUString( RTL_CONSTASCII_USTRINGPARAM("fe") ); }
270 // G
271 virtual OUString SAL_CALL g() throw(RuntimeException)
272 { return OUString( RTL_CONSTASCII_USTRINGPARAM("g") ); }
275 //==================================================================================================
276 struct TestImplInh : public ImplInheritanceHelper2< TestWeakImpl, H, I >
278 TestImplInh() {}
280 explicit TestImplInh(int):
281 ImplInheritanceHelper2< TestWeakImpl, H, I >(1) {}
283 TestImplInh(int, int):
284 ImplInheritanceHelper2< TestWeakImpl, H, I >(1, 2) {}
286 TestImplInh(int, int, int):
287 ImplInheritanceHelper2< TestWeakImpl, H, I >(1, 2, 3) {}
289 TestImplInh(int, int, int, int):
290 ImplInheritanceHelper2< TestWeakImpl, H, I >(1, 2, 3, 4) {}
292 TestImplInh(int, int, int, int, int):
293 ImplInheritanceHelper2< TestWeakImpl, H, I >(1, 2, 3, 4, 5) {}
295 TestImplInh(int, int, int, int, int, int):
296 ImplInheritanceHelper2< TestWeakImpl, H, I >(1, 2, 3, 4, 5, 6) {}
298 virtual ~TestImplInh()
299 { OSL_TRACE( "> TestWeakImplInh dtor called... <\n" ); }
301 // H
302 virtual OUString SAL_CALL h() throw(RuntimeException)
303 { return OUString( RTL_CONSTASCII_USTRINGPARAM("h") ); }
304 // I
305 virtual OUString SAL_CALL i() throw(RuntimeException)
306 { return OUString( RTL_CONSTASCII_USTRINGPARAM("i") ); }
309 //==================================================================================================
310 struct TestAggImplInh : public AggImplInheritanceHelper2< TestWeakAggImpl, H, I >
312 virtual ~TestAggImplInh()
313 { OSL_TRACE( "> TestAggImplInh dtor called... <\n" ); }
315 // H
316 virtual OUString SAL_CALL h() throw(RuntimeException)
317 { return OUString( RTL_CONSTASCII_USTRINGPARAM("h2") ); }
318 // I
319 virtual OUString SAL_CALL i() throw(RuntimeException)
320 { return OUString( RTL_CONSTASCII_USTRINGPARAM("i2") ); }
324 static bool isIn( Sequence< Type > const & rTypes, char const * name )
326 OUString str( OUString::createFromAscii( name ) );
327 Type const * pTypes = rTypes.getConstArray();
328 for ( sal_Int32 nPos = rTypes.getLength(); nPos--; )
330 if (pTypes[ nPos ].getTypeName().equals( str ))
331 return true;
333 return false;
336 //==================================================================================================
337 static void dotest( const Reference< XInterface > & xOriginal )
339 Reference< lang::XTypeProvider > xTP( xOriginal, UNO_QUERY );
340 Sequence< sal_Int8 > id( xTP->getImplementationId() );
341 Sequence< Type > types( xTP->getTypes() );
342 ::fprintf( stderr, "> supported types: " );
343 long n = 0;
344 for ( ; n < types.getLength(); ++n )
346 OString str( OUStringToOString( types[ n ].getTypeName(), RTL_TEXTENCODING_ASCII_US ) );
347 ::fprintf( stderr, (n < (types.getLength()-1)) ? "%s, " : "%s; type-id=\n", str.getStr() );
349 for ( n = 0; n < 16; ++n )
351 ::fprintf( stderr, n < 15 ? "%x " : "%x \n", id[ n ] );
354 Reference< A > xa( xOriginal, UNO_QUERY );
355 OSL_ENSURE( xa->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### A failed!" );
356 Reference< BA > xba( xa, UNO_QUERY );
357 OSL_ENSURE( xba->ba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ba") ), "### BA failed!" );
358 OSL_ENSURE( xba->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### BA failed!" );
359 Reference< CA > xca( xba, UNO_QUERY );
360 OSL_ENSURE( xca->ca().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ca") ), "### CA failed!" );
361 OSL_ENSURE( xca->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### CA failed!" );
362 Reference< DBA > xdba( xca, UNO_QUERY );
363 OSL_ENSURE( xdba->dba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("dba") ), "### DBA failed!" );
364 OSL_ENSURE( xdba->ba().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ba") ), "### DBA failed!" );
365 OSL_ENSURE( xdba->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### DBA failed!" );
366 Reference< E > xe( xdba, UNO_QUERY );
367 OSL_ENSURE( xe->e().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("e") ), "### E failed!" );
368 Reference< FE > xfe( xe, UNO_QUERY );
369 OSL_ENSURE( xfe->fe().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fe") ), "### FE failed!" );
370 Reference< G > xg( xfe, UNO_QUERY );
371 OSL_ENSURE( xg->g().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("g") ), "### G failed!" );
372 OSL_ENSURE( xg->a().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("a") ), "### G failed!" );
374 // type provider
375 Reference< lang::XTypeProvider > xProv( xg, UNO_QUERY );
376 Sequence< Type > aTypes( xProv->getTypes() );
378 // CA, DBA, FE, G, XTypeProvider
379 OSL_ASSERT( isIn( aTypes, "test.CA" ) );
380 OSL_ASSERT( isIn( aTypes, "test.DBA" ) );
381 OSL_ASSERT( isIn( aTypes, "test.FE") );
382 OSL_ASSERT( isIn( aTypes, "test.G") );
383 OSL_ASSERT( isIn( aTypes, "com.sun.star.lang.XTypeProvider") );
385 Reference< XWeak > xWeak( xg, UNO_QUERY );
386 if (xWeak.is())
388 OSL_ASSERT( isIn( aTypes, "com.sun.star.uno.XWeak") );
390 Reference< lang::XComponent > xComp( xg, UNO_QUERY );
391 if (xComp.is())
393 OSL_ASSERT( isIn( aTypes, "com.sun.star.lang.XComponent") );
396 Reference< XAggregation > xAgg( xg, UNO_QUERY );
397 if (xAgg.is())
399 OSL_ASSERT( isIn( aTypes, "com.sun.star.uno.XAggregation") );
401 Reference< H > xH( xg, UNO_QUERY );
402 if (xH.is())
404 OSL_ASSERT( isIn( aTypes, "test.H") );
406 Reference< I > xI( xg, UNO_QUERY );
407 if (xI.is())
409 OSL_ASSERT( isIn( aTypes, "test.I") );
412 OSL_ENSURE( xg == xOriginal, "### root!" );
415 void rethrow()
417 throw;
420 void throw_one(
421 lang::IllegalAccessException exc )
425 throw exc;
427 catch (...)
429 rethrow();
434 //==================================================================================================
435 void test_ImplHelper( const Reference< lang::XMultiServiceFactory > & /*xSF*/ )
437 Reference< XInterface > xImpl( (lang::XTypeProvider *)new TestImpl() );
438 Reference< lang::XTypeProvider > xTP1( xImpl, UNO_QUERY );
439 Reference< XInterface > xWeakImpl( (OWeakObject *)new TestWeakImpl() );
440 Reference< lang::XTypeProvider > xTP2( xWeakImpl, UNO_QUERY );
441 Reference< XInterface > xWeakAggImpl( (OWeakObject *)new TestWeakAggImpl() );
442 Reference< lang::XTypeProvider > xTP3( xWeakAggImpl, UNO_QUERY );
443 Reference< XInterface > xWeakComponentImpl( (OWeakObject *)new TestWeakComponentImpl() );
444 Reference< lang::XTypeProvider > xTP4( xWeakComponentImpl, UNO_QUERY );
445 Reference< XInterface > xWeakAggComponentImpl( (OWeakObject *)new TestWeakAggComponentImpl() );
446 Reference< lang::XTypeProvider > xTP5( xWeakAggComponentImpl, UNO_QUERY );
448 OSL_ASSERT(
449 xTP1->getImplementationId() != xTP2->getImplementationId() &&
450 xTP1->getImplementationId() != xTP3->getImplementationId() &&
451 xTP1->getImplementationId() != xTP4->getImplementationId() &&
452 xTP1->getImplementationId() != xTP5->getImplementationId() &&
453 xTP2->getImplementationId() != xTP3->getImplementationId() &&
454 xTP2->getImplementationId() != xTP4->getImplementationId() &&
455 xTP2->getImplementationId() != xTP5->getImplementationId() &&
456 xTP3->getImplementationId() != xTP4->getImplementationId() &&
457 xTP3->getImplementationId() != xTP5->getImplementationId() &&
458 xTP4->getImplementationId() != xTP5->getImplementationId() );
461 dotest( xImpl );
462 dotest( xWeakImpl );
463 dotest( xWeakAggImpl );
464 dotest( xWeakComponentImpl );
465 dotest( xWeakAggComponentImpl );
467 xWeakImpl = (OWeakObject *)new TestImplInh();
468 Reference< lang::XTypeProvider > xTP6( xWeakImpl, UNO_QUERY );
469 dotest( xWeakImpl );
470 Reference< H > xH( xWeakImpl, UNO_QUERY );
471 Reference< I > xI( xH, UNO_QUERY );
472 OSL_ASSERT( xH->h().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("h") ) );
473 OSL_ASSERT( xI->i().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("i") ) );
475 xWeakAggImpl = (OWeakObject *)new TestAggImplInh();
476 Reference< lang::XTypeProvider > xTP7( xWeakAggImpl, UNO_QUERY );
477 dotest( xWeakAggImpl );
478 xH.set( xWeakAggImpl, UNO_QUERY );
479 xI.set( xH, UNO_QUERY );
480 OSL_ASSERT( xH->h().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("h2") ) );
481 OSL_ASSERT( xI->i().equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("i2") ) );
484 OSL_ASSERT(
485 xTP6->getImplementationId() != xTP1->getImplementationId() &&
486 xTP6->getImplementationId() != xTP2->getImplementationId() &&
487 xTP6->getImplementationId() != xTP3->getImplementationId() &&
488 xTP6->getImplementationId() != xTP4->getImplementationId() &&
489 xTP6->getImplementationId() != xTP5->getImplementationId() &&
490 xTP6->getImplementationId() != xTP7->getImplementationId() &&
491 xTP7->getImplementationId() != xTP1->getImplementationId() &&
492 xTP7->getImplementationId() != xTP2->getImplementationId() &&
493 xTP7->getImplementationId() != xTP3->getImplementationId() &&
494 xTP7->getImplementationId() != xTP4->getImplementationId() &&
495 xTP7->getImplementationId() != xTP5->getImplementationId() );
498 bool exc_succ = false;
499 lang::IllegalAccessException exc(
500 OUString( RTL_CONSTASCII_USTRINGPARAM("testtest") ),
501 xWeakAggImpl );
502 // exception helper tests
505 throw exc;
507 catch (Exception &)
509 Any a( getCaughtException() );
510 OSL_ASSERT( a == exc );
514 throwException( a );
516 catch (lang::IllegalAccessException & e)
518 OSL_ASSERT( exc.Message == e.Message && exc.Context == e.Context );
522 throw_one( exc );
524 catch (Exception &)
526 Any a2( getCaughtException() );
527 OSL_ASSERT( (a2 == a) && (a2 == exc) );
531 throw_one( exc );
533 catch (lang::IllegalAccessException &)
535 Any a3( getCaughtException() );
536 OSL_ASSERT( (a3 == a) && (a3 == a2) && (a3 == exc) );
537 exc_succ = true;
542 OSL_ASSERT( exc_succ );
546 throwException( makeAny( RuntimeException(
547 OUString( RTL_CONSTASCII_USTRINGPARAM("runtime exc") ), xImpl ) ) );
549 catch (RuntimeException & rExc)
551 OSL_ENSURE( rExc.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("runtime exc") ) && rExc.Context == xImpl,
552 "### unexpected exception content!" );
555 throwException( makeAny( Exception(
556 OUString( RTL_CONSTASCII_USTRINGPARAM("exc") ), rExc.Context ) ) );
558 catch (lang::IllegalAccessException &)
560 OSL_ENSURE( sal_False, "### unexpected IllegalAccessException exception caught!" );
562 catch (Exception & rExc2)
564 OSL_ENSURE( rExc2.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("exc") ) && rExc2.Context == xImpl,
565 "### unexpected exception content!" );
568 throwException( makeAny( lang::IllegalAccessException(
569 OUString( RTL_CONSTASCII_USTRINGPARAM("axxess exc") ), rExc2.Context ) ) );
571 catch (lang::IllegalAccessException & rExc3)
573 OSL_ENSURE( rExc3.Message.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("axxess exc") ) && rExc3.Context == xImpl,
574 "### unexpected exception content!" );
575 return;
579 catch (...)
582 OSL_ENSURE( sal_False, "### exception test failed!" );