From 2a62e615a46f9f9820bbbbcd4acd8d971b685c1d Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 12 Feb 2015 09:59:09 +0100 Subject: Remove uses of osl/diagnose.h from jvmaccess Change-Id: Ic9cda5259db81dd921dd3fa891b1289b8283bf27 --- include/sal/log-areas.dox | 1 + jvmaccess/source/classpath.cxx | 8 +++++--- jvmaccess/source/unovirtualmachine.cxx | 10 +++++----- jvmaccess/source/virtualmachine.cxx | 26 ++++++++++++++------------ 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index bf8f59bbdaa4..1612719f7c62 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -491,6 +491,7 @@ certain functionality. @li @c cppcanvas.emf @li @c drawinglayer @li @c helpcompiler +@li @c jvmaccess @li @c linguistic @li @c mysqlc @li @c postprocess.cppunit diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx index 4b653fe5df45..9fdc0fca78ad 100644 --- a/jvmaccess/source/classpath.cxx +++ b/jvmaccess/source/classpath.cxx @@ -21,6 +21,7 @@ #include "jvmaccess/classpath.hxx" +#include #include #include "com/sun/star/lang/IllegalArgumentException.hpp" @@ -32,7 +33,6 @@ #include "com/sun/star/uri/UriReferenceFactory.hpp" #include "com/sun/star/uri/XVndSunStarExpandUrlReference.hpp" #include "com/sun/star/util/theMacroExpander.hpp" -#include "osl/diagnose.h" #include "rtl/ustring.hxx" #include "sal/types.h" @@ -42,7 +42,8 @@ jobjectArray jvmaccess::ClassPath::translateToUrls( css::uno::Reference< css::uno::XComponentContext > const & context, JNIEnv * environment, OUString const & classPath) { - OSL_ASSERT(context.is() && environment != 0); + assert(context.is()); + assert(environment != 0); jclass classUrl(environment->FindClass("java/net/URL")); if (classUrl == 0) { return 0; @@ -104,7 +105,8 @@ jclass jvmaccess::ClassPath::loadClass( css::uno::Reference< css::uno::XComponentContext > const & context, JNIEnv * environment, OUString const & classPath, OUString const & name) { - OSL_ASSERT(context.is() && environment != 0); + assert(context.is()); + assert(environment != 0); jclass classLoader(environment->FindClass("java/net/URLClassLoader")); if (classLoader == 0) { return 0; diff --git a/jvmaccess/source/unovirtualmachine.cxx b/jvmaccess/source/unovirtualmachine.cxx index e730a4773b40..5ec38d57c1e3 100644 --- a/jvmaccess/source/unovirtualmachine.cxx +++ b/jvmaccess/source/unovirtualmachine.cxx @@ -21,9 +21,8 @@ #include "jvmaccess/unovirtualmachine.hxx" -#include "osl/diagnose.h" - #include "jvmaccess/virtualmachine.hxx" +#include "sal/log.hxx" #include "jni.h" @@ -66,9 +65,10 @@ UnoVirtualMachine::~UnoVirtualMachine() { getEnvironment()->DeleteGlobalRef( static_cast< jobject >(m_classLoader)); } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) { - OSL_TRACE( - "jvmaccess::UnoVirtualMachine::~UnoVirtualMachine:" - " jvmaccess::VirtualMachine::AttachGuard::CreationException" ); + SAL_INFO( + "jvmaccess", + "ignored" + " jvmaccess::VirtualMachine::AttachGuard::CreationException"); } } diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx index 69bcf5fe6669..3ff5dc7aaaf2 100644 --- a/jvmaccess/source/virtualmachine.cxx +++ b/jvmaccess/source/virtualmachine.cxx @@ -17,9 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "jvmaccess/virtualmachine.hxx" +#include -#include "osl/diagnose.h" +#include + +#include +#include using jvmaccess::VirtualMachine; @@ -44,7 +47,7 @@ VirtualMachine::AttachGuard::AttachGuard( rtl::Reference< VirtualMachine > const & rMachine): m_xMachine(rMachine) { - OSL_ENSURE(m_xMachine.is(), "bad parameter"); + assert(m_xMachine.is()); m_pEnvironment = m_xMachine->attachThread(&m_bDetach); if (m_pEnvironment == 0) throw CreationException(); @@ -61,8 +64,9 @@ VirtualMachine::VirtualMachine(JavaVM * pVm, int nVersion, bool bDestroy, m_pVm(pVm), m_nVersion(nVersion), m_bDestroy(bDestroy) { (void) pMainThreadEnv; // avoid warnings - OSL_ENSURE(pVm != 0 && nVersion >= JNI_VERSION_1_2 && pMainThreadEnv != 0, - "bad parameter"); + assert(pVm != 0); + assert(nVersion >= JNI_VERSION_1_2); + assert(pMainThreadEnv); } VirtualMachine::~VirtualMachine() @@ -75,7 +79,7 @@ VirtualMachine::~VirtualMachine() // forever. /* jint n = m_pVm->DestroyJavaVM(); - OSL_ENSURE(n == JNI_OK, "JNI: DestroyJavaVM failed"); + SAL_WARN_IF(n != JNI_OK, "jvmaccess", "JNI: DestroyJavaVM failed"); */ } } @@ -85,9 +89,8 @@ JNIEnv * VirtualMachine::attachThread(bool * pAttached) const assert(pAttached != 0 && "bad parameter"); JNIEnv * pEnv; jint n = m_pVm->GetEnv(reinterpret_cast< void ** >(&pEnv), m_nVersion); - if (n != JNI_OK && n != JNI_EDETACHED) { - OSL_FAIL("JNI: GetEnv failed"); - } + SAL_WARN_IF( + n != JNI_OK && n != JNI_EDETACHED, "jvmaccess", "JNI: GetEnv failed"); if (pEnv == 0) { if (m_pVm->AttachCurrentThread @@ -111,9 +114,8 @@ JNIEnv * VirtualMachine::attachThread(bool * pAttached) const void VirtualMachine::detachThread() const { - if (m_pVm->DetachCurrentThread() != JNI_OK) { - OSL_FAIL("JNI: DetachCurrentThread failed"); - } + jint n = m_pVm->DetachCurrentThread(); + SAL_WARN_IF(n != JNI_OK, "jvmaccess", "JNI: DetachCurrentThread failed"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit