summaryrefslogtreecommitdiff
path: root/stoc/source/uriproc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-08-22 09:34:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2019-08-23 14:47:43 +0200
commit5264c7dcef25492e94d2d2e9a3025a7ec7571699 (patch)
tree8da78233044dc52966e6a87d85ad352943ba3906 /stoc/source/uriproc
parent6f2bada24a059a9a5f24195496d2adb50c276d33 (diff)
Clean up OSL_ASSERT in stoc/source/uriproc/
Change-Id: Ia474439d4e35009ec0941b122653a649692aead7 Reviewed-on: https://gerrit.libreoffice.org/77943 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc/source/uriproc')
-rw-r--r--stoc/source/uriproc/UriReference.cxx8
-rw-r--r--stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx6
-rw-r--r--stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx9
3 files changed, 15 insertions, 8 deletions
diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx
index 468d6653d2c5..dd4d68d3144e 100644
--- a/stoc/source/uriproc/UriReference.cxx
+++ b/stoc/source/uriproc/UriReference.cxx
@@ -17,10 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
#include "UriReference.hxx"
-#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
@@ -40,8 +42,8 @@ UriReference::UriReference(
m_hasQuery(bHasQuery),
m_hasFragment(false)
{
- OSL_ASSERT(authority.isEmpty() || bHasAuthority);
- OSL_ASSERT(query.isEmpty() || bHasQuery);
+ assert(authority.isEmpty() || bHasAuthority);
+ assert(query.isEmpty() || bHasQuery);
}
UriReference::~UriReference() {}
diff --git a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx
index cebe754cbaaa..1b73543bc5fb 100644
--- a/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx
+++ b/stoc/source/uriproc/UriSchemeParser_vndDOTsunDOTstarDOTexpand.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uri/XUriSchemeParser.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrlReference.hpp>
@@ -28,7 +29,6 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
-#include <osl/diagnose.h>
#include <rtl/textenc.h>
#include <rtl/uri.h>
#include <rtl/uri.hxx>
@@ -126,7 +126,9 @@ private:
OUString UrlReference::expand(
css::uno::Reference< css::util::XMacroExpander > const & expander)
{
- OSL_ASSERT(expander.is());
+ if (!expander.is()) {
+ throw css::uno::RuntimeException("null expander passed to XVndSunStarExpandUrl.expand");
+ }
return expander->expandMacros(
::rtl::Uri::decode(
getPath(), ::rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8));
diff --git a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx
index e2b37db202df..ff8aa8e84a8e 100644
--- a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx
+++ b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx
@@ -19,6 +19,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XUriReference.hpp>
@@ -31,7 +32,6 @@
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/ustring.hxx>
-#include <osl/diagnose.h>
#include <sal/types.h>
namespace com::sun::star::uno { class XComponentContext; }
@@ -88,7 +88,11 @@ css::uno::Reference< css::uri::XUriReference >
Factory::createVndSunStarPkgUrlReference(
css::uno::Reference< css::uri::XUriReference > const & authority)
{
- OSL_ASSERT(authority.is());
+ if (!authority.is()) {
+ throw css::uno::RuntimeException(
+ "null authority passed to"
+ " XVndSunStarPkgUrlReferenceFactory.createVndSunStarPkgUrlReference");
+ }
if (authority->isAbsolute() && !authority->hasFragment()) {
OUStringBuffer buf;
buf.append("vnd.sun.star.pkg://");
@@ -99,7 +103,6 @@ Factory::createVndSunStarPkgUrlReference(
css::uno::Reference< css::uri::XUriReference > uriRef(
css::uri::UriReferenceFactory::create(m_context)->parse(
buf.makeStringAndClear()));
- OSL_ASSERT(uriRef.is());
return uriRef;
} else {
return css::uno::Reference< css::uri::XUriReference >();