LCOV - code coverage report
Current view: top level - jvmaccess/source - unovirtualmachine.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 18 44.4 %
Date: 2015-06-13 12:38:46 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 "jvmaccess/virtualmachine.hxx"
      25             : #include "sal/log.hxx"
      26             : 
      27             : #include "jni.h"
      28             : 
      29             : namespace jvmaccess {
      30             : 
      31           0 : UnoVirtualMachine::CreationException::CreationException() {}
      32             : 
      33           0 : UnoVirtualMachine::CreationException::CreationException(
      34           0 :     CreationException const &)
      35           0 : {}
      36             : 
      37           0 : UnoVirtualMachine::CreationException::~CreationException() {}
      38             : 
      39             : UnoVirtualMachine::CreationException &
      40           0 : UnoVirtualMachine::CreationException::operator =(CreationException const &) {
      41           0 :     return *this;
      42             : }
      43             : 
      44           7 : UnoVirtualMachine::UnoVirtualMachine(
      45             :     rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine,
      46             :     void * classLoader):
      47             :     m_virtualMachine(virtualMachine),
      48           7 :     m_classLoader(0)
      49             : {
      50             :     try {
      51             :         m_classLoader =
      52             :             jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine).
      53           7 :             getEnvironment()->NewGlobalRef(static_cast< jobject >(classLoader));
      54           0 :     } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {}
      55           7 :     if (m_classLoader == 0) {
      56           0 :         throw CreationException();
      57             :     }
      58           7 : }
      59             : 
      60             : 
      61             : 
      62           9 : UnoVirtualMachine::~UnoVirtualMachine() {
      63             :     try {
      64             :         jvmaccess::VirtualMachine::AttachGuard(m_virtualMachine).
      65             :             getEnvironment()->DeleteGlobalRef(
      66           3 :                 static_cast< jobject >(m_classLoader));
      67           0 :     } catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {
      68             :         SAL_INFO(
      69             :             "jvmaccess",
      70             :             "ignored"
      71             :                 " jvmaccess::VirtualMachine::AttachGuard::CreationException");
      72             :     }
      73           6 : }
      74             : 
      75             : }
      76             : 
      77             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11