LCOV - code coverage report
Current view: top level - jvmaccess/source - unovirtualmachine.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 8 18 44.4 %
Date: 2014-11-03 Functions: 3 8 37.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "sal/config.h"
      21             : 
      22             : #include "jvmaccess/unovirtualmachine.hxx"
      23             : 
      24             : #include "osl/diagnose.h"
      25             : 
      26             : #include "jvmaccess/virtualmachine.hxx"
      27             : 
      28             : #include "jni.h"
      29             : 
      30             : namespace jvmaccess {
      31             : 
      32           0 : UnoVirtualMachine::CreationException::CreationException() {}
      33             : 
      34           0 : UnoVirtualMachine::CreationException::CreationException(
      35           0 :     CreationException const &)
      36           0 : {}
      37             : 
      38           0 : UnoVirtualMachine::CreationException::~CreationException() {}
      39             : 
      40             : UnoVirtualMachine::CreationException &
      41           0 : UnoVirtualMachine::CreationException::operator =(CreationException const &) {
      42           0 :     return *this;
      43             : }
      44             : 
      45          18 : UnoVirtualMachine::UnoVirtualMachine(
      46             :     rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
      47             :     void * classLoader):
      48             :     m_virtualMachine(virtualMachine),
      49          18 :     m_classLoader(0)
      50             : {
      51             :     try {
      52             :         m_classLoader =
      53             :             jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine).
      54          18 :             getEnvironment()->NewGlobalRef(static_cast< jobject >(classLoader));
      55           0 :     } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {}
      56          18 :     if (m_classLoader == 0) {
      57           0 :         throw CreationException();
      58             :     }
      59          18 : }
      60             : 
      61             : 
      62             : 
      63          30 : UnoVirtualMachine::~UnoVirtualMachine() {
      64             :     try {
      65             :         jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine).
      66             :             getEnvironment()->DeleteGlobalRef(
      67          10 :                 static_cast< jobject >(m_classLoader));
      68           0 :     } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {
      69             :         OSL_TRACE(
      70             :             "jvmaccess::UnoVirtualMachine::~UnoVirtualMachine:"
      71             :             " jvmaccess::VirtualMachine::AttachGuard::CreationException" );
      72             :     }
      73          20 : }
      74             : 
      75             : }
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10