Author: damjan Date: Tue Oct 18 17:52:44 2016 New Revision: 1765488 URL: http://svn.apache.org/viewvc?rev=1765488&view=rev Log: #i125868# AOO crashes if JRE (Java) is not installed (using help search or picture/makros)
ucbhelper::ResultSetHelper methods calling init() can only throw RuntimeException, yet Exception or its other subclasses are thrown in some cases (eg. with Java disabled, try searching the Help index), resulting in unexpected() on at least FreeBSD and MacOS that crashes AOO. Fix this by catching Exception and instead throwing a RuntimeException with its message. Patch by: me Modified: openoffice/trunk/main/ucbhelper/source/provider/resultsethelper.cxx Modified: openoffice/trunk/main/ucbhelper/source/provider/resultsethelper.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/ucbhelper/source/provider/resultsethelper.cxx?rev=1765488&r1=1765487&r2=1765488&view=diff ============================================================================== --- openoffice/trunk/main/ucbhelper/source/provider/resultsethelper.cxx (original) +++ openoffice/trunk/main/ucbhelper/source/provider/resultsethelper.cxx Tue Oct 18 17:52:44 2016 @@ -298,27 +298,38 @@ void ResultSetImplHelper::init( sal_Bool if ( !m_bInitDone ) { - if ( bStatic ) + try { - // virtual... derived class fills m_xResultSet1 - initStatic(); + if ( bStatic ) + { + // virtual... derived class fills m_xResultSet1 + initStatic(); - OSL_ENSURE( m_xResultSet1.is(), - "ResultSetImplHelper::init - No 1st result set!" ); - m_bStatic = sal_True; + OSL_ENSURE( m_xResultSet1.is(), + "ResultSetImplHelper::init - No 1st result set!" ); + m_bStatic = sal_True; + } + else + { + // virtual... derived class fills m_xResultSet1 and m_xResultSet2 + initDynamic(); + + OSL_ENSURE( m_xResultSet1.is(), + "ResultSetImplHelper::init - No 1st result set!" ); + OSL_ENSURE( m_xResultSet2.is(), + "ResultSetImplHelper::init - No 2nd result set!" ); + m_bStatic = sal_False; + } + m_bInitDone = sal_True; } - else + catch ( uno::RuntimeException const &runtimeException ) { - // virtual... derived class fills m_xResultSet1 and m_xResultSet2 - initDynamic(); - - OSL_ENSURE( m_xResultSet1.is(), - "ResultSetImplHelper::init - No 1st result set!" ); - OSL_ENSURE( m_xResultSet2.is(), - "ResultSetImplHelper::init - No 2nd result set!" ); - m_bStatic = sal_False; + throw runtimeException; + } + catch ( uno::Exception const &exception ) + { + throw uno::RuntimeException( exception.Message, uno::Reference< XInterface >() ); } - m_bInitDone = sal_True; } }