xmloff/source/core/RDFaExportHelper.cxx | 4 - xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx | 17 +------ xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx | 24 +--------- xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx | 24 +--------- xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 17 +------ xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx | 24 +--------- xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx | 23 +-------- xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 7 -- 8 files changed, 24 insertions(+), 116 deletions(-)
New commits: commit 45aad89c34604d2b075bf4f1122589952f582bdb Author: Stephan Bergmann <[email protected]> Date: Tue Feb 14 16:09:32 2017 +0100 Some simplifications, using UNO_QUERY_THROW Change-Id: Ie82c1f243717eb42218040a9b4d59f8cf10de387 Reviewed-on: https://gerrit.libreoffice.org/34251 Tested-by: Jenkins <[email protected]> Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx index 2bc047b..6311f23 100644 --- a/xmloff/source/core/RDFaExportHelper.cxx +++ b/xmloff/source/core/RDFaExportHelper.cxx @@ -90,9 +90,7 @@ RDFaExportHelper::RDFaExportHelper(SvXMLExport & i_rExport) : m_rExport(i_rExport), m_xRepository(nullptr), m_Counter(0) { const uno::Reference<rdf::XRepositorySupplier> xRS( m_rExport.GetModel(), - uno::UNO_QUERY); - OSL_ENSURE(xRS.is(), "AddRDFa: model is no rdf::XRepositorySupplier"); - if (!xRS.is()) throw uno::RuntimeException(); + uno::UNO_QUERY_THROW); m_xRepository.set(xRS->getRDFRepository(), uno::UNO_QUERY_THROW); } commit 8ca2d453e3008c265c8968529991d01579ff8f3a Author: Stephan Bergmann <[email protected]> Date: Tue Feb 14 16:09:20 2017 +0100 Some simplifications, using UNO_QUERY_THROW Change-Id: I6e7555472da6b23af4c64b299182339a5b324ee9 Reviewed-on: https://gerrit.libreoffice.org/34250 Tested-by: Stephan Bergmann <[email protected]> Reviewed-by: Stephan Bergmann <[email protected]> diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index f383046..710191c 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -638,11 +638,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_MSCryptImpl::buildCer chainPara.cbSize = sizeof( CERT_CHAIN_PARA ) ; chainPara.RequestedUsage = certUsage ; - Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY ) ; - if( !xCertTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY_THROW ) ; xcert = reinterpret_cast<X509Certificate_MSCryptImpl*>(xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() )); if( xcert == nullptr ) { throw RuntimeException() ; @@ -814,10 +810,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( PCCERT_CONTEXT pCertContext = nullptr; const X509Certificate_MSCryptImpl* xcert = nullptr; - Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ; - if( !xCertTunnel.is() ) { - throw RuntimeException() ; - } + Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ; SAL_INFO("xmlsecurity.xmlsec", "Start verification of certificate: " << aCert->getSubjectName()); @@ -981,11 +974,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::getCertificateCharacters( const css:: PCCERT_CONTEXT pCertContext ; const X509Certificate_MSCryptImpl* xcert ; - Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ; - if( !xCertTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ; xcert = reinterpret_cast<X509Certificate_MSCryptImpl*>(xCertTunnel->getSomething( X509Certificate_MSCryptImpl::getUnoTunnelId() )); if( xcert == nullptr ) { throw RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx index 38a329a..14d21e1 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx @@ -74,11 +74,7 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( throw RuntimeException() ; //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); if( pSecEnv == nullptr ) throw RuntimeException() ; @@ -89,11 +85,7 @@ SAL_CALL XMLEncryption_MSCryptImpl::encrypt( throw RuntimeException() ; } - Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY ) ; - if( !xTplTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pTemplate = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); if( pTemplate == nullptr ) { throw RuntimeException() ; @@ -210,11 +202,7 @@ XMLEncryption_MSCryptImpl::decrypt( Reference< XSecurityEnvironment > xSecEnv = aSecurityCtx->getSecurityEnvironmentByIndex( aSecurityCtx->getDefaultSecurityEnvironmentIndex()); - Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY_THROW ) ; SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); if( pSecEnv == nullptr ) throw RuntimeException() ; @@ -225,11 +213,7 @@ XMLEncryption_MSCryptImpl::decrypt( throw RuntimeException() ; } - Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY ) ; - if( !xTplTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pTemplate = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xTplTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); if( pTemplate == nullptr ) { throw RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx index 746dd76..0107435 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx @@ -66,11 +66,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( throw RuntimeException() ; //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); if( pSecEnv == nullptr ) throw RuntimeException() ; @@ -81,11 +77,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( throw RuntimeException() ; } - Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ; - if( !xNodTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); if( pElement == nullptr ) { throw RuntimeException() ; @@ -163,11 +155,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( Reference< XSecurityEnvironment > xSecEnv = aSecurityCtx->getSecurityEnvironmentByIndex( aSecurityCtx->getDefaultSecurityEnvironmentIndex()); - Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY_THROW ) ; SecurityEnvironment_MSCryptImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_MSCryptImpl*>(xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() )); if( pSecEnv == nullptr ) throw RuntimeException() ; @@ -177,11 +165,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( if( !xElement.is() ) throw RuntimeException() ; - Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ; - if( !xNodTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )); if( pElement == nullptr ) throw RuntimeException() ; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 915b4b6..959e62c 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -478,11 +478,7 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi const CERTCertificate* cert ; CERTCertList* certChain ; - Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY ) ; - if( !xCertTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY_THROW ) ; xcert = reinterpret_cast<X509Certificate_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xCertTunnel->getSomething( X509Certificate_NssImpl::getUnoTunnelId() ))) ; if( xcert == nullptr ) { @@ -574,10 +570,7 @@ verifyCertificate( const Reference< csss::XCertificate >& aCert, const X509Certificate_NssImpl* xcert ; const CERTCertificate* cert ; ::std::vector<CERTCertificate*> vecTmpNSSCertificates; - Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ; - if( !xCertTunnel.is() ) { - throw RuntimeException() ; - } + Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ; SAL_INFO("xmlsecurity.xmlsec", "Start verification of certificate: " << aCert->getSubjectName()); @@ -798,11 +791,7 @@ sal_Int32 SecurityEnvironment_NssImpl::getCertificateCharacters( const X509Certificate_NssImpl* xcert ; const CERTCertificate* cert ; - Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY ) ; - if( !xCertTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ; xcert = reinterpret_cast<X509Certificate_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xCertTunnel->getSomething( X509Certificate_NssImpl::getUnoTunnelId() ))) ; if( xcert == nullptr ) { diff --git a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx index 9fa3b31..804e69b 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx @@ -70,11 +70,7 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( throw RuntimeException() ; //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>(xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() ))) ; @@ -87,11 +83,7 @@ SAL_CALL XMLEncryption_NssImpl::encrypt( throw RuntimeException() ; } - Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY ) ; - if( !xTplTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pTemplate = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( @@ -211,11 +203,7 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( throw RuntimeException() ; } - Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY ) ; - if( !xTplTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xTplTunnel( xTemplate , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pTemplate = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( @@ -251,11 +239,7 @@ SAL_CALL XMLEncryption_NssImpl::decrypt( Reference< XSecurityEnvironment > aEnvironment = aSecurityCtx->getSecurityEnvironmentByIndex(i); //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ; - if( !aEnvironment.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>( diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index 8d2e9b4..3271b54 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -75,11 +75,7 @@ SAL_CALL XMLSignature_NssImpl::generate( throw RuntimeException() ; } - Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ; - if( !xNodTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( @@ -99,10 +95,7 @@ SAL_CALL XMLSignature_NssImpl::generate( } //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } + Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; // the key manager should be retrieved from SecurityEnvironment, instead of SecurityContext @@ -177,11 +170,7 @@ SAL_CALL XMLSignature_NssImpl::validate( if( !xElement.is() ) throw RuntimeException() ; - Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ; - if( !xNodTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( @@ -209,11 +198,7 @@ SAL_CALL XMLSignature_NssImpl::validate( Reference< XSecurityEnvironment > aEnvironment = aSecurityCtx->getSecurityEnvironmentByIndex(i); //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ; - if( !xSecTunnel.is() ) { - throw RuntimeException() ; - } - + Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>( diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index fafa81d..d97c9d9 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -384,12 +384,7 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( const cssu::Reference< c if (xXMLElement.is()) { - cssu::Reference< cssl::XUnoTunnel > xNodTunnel( xXMLElement, cssu::UNO_QUERY ) ; - if( !xNodTunnel.is() ) - { - throw cssu::RuntimeException() ; - } - + cssu::Reference< cssl::XUnoTunnel > xNodTunnel( xXMLElement, cssu::UNO_QUERY_THROW ) ; XMLElementWrapper_XmlSecImpl* pElement = reinterpret_cast<XMLElementWrapper_XmlSecImpl*>( sal::static_int_cast<sal_uIntPtr>( _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
