LCOV - code coverage report
Current view: top level - jvmfwk/plugins/sunmajor/pluginlib - sunjre.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 20 22 90.9 %
Date: 2012-08-25 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 26 46.2 %

           Branch data     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                 :            : 
      21                 :            : #include "osl/thread.h"
      22                 :            : #include "sunjre.hxx"
      23                 :            : #include "sunversion.hxx"
      24                 :            : #include "diagnostics.h"
      25                 :            : 
      26                 :            : using namespace std;
      27                 :            : 
      28                 :            : #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
      29                 :            : namespace jfw_plugin
      30                 :            : {
      31                 :            : 
      32                 :          6 : rtl::Reference<VendorBase> SunInfo::createInstance()
      33                 :            : {
      34         [ +  - ]:          6 :     return new SunInfo;
      35                 :            : }
      36                 :            : 
      37                 :          6 : char const* const* SunInfo::getJavaExePaths(int * size)
      38                 :            : {
      39                 :            :     static char const * ar[] = {
      40                 :            : #if defined(WNT)
      41                 :            :         "java.exe",
      42                 :            :         "bin/java.exe",
      43                 :            :         "jre/bin/java.exe"
      44                 :            : #elif UNX
      45                 :            :         "java",
      46                 :            :         "bin/java",
      47                 :            :         "jre/bin/java"
      48                 :            : #endif
      49                 :            :     };
      50                 :          6 :     *size = SAL_N_ELEMENTS(ar);
      51                 :          6 :     return ar;
      52                 :            : }
      53                 :            : 
      54                 :          6 : char const* const* SunInfo::getRuntimePaths(int * size)
      55                 :            : {
      56                 :            :     static char const* ar[]= {
      57                 :            : #if defined(WNT)
      58                 :            :         "/bin/client/jvm.dll",
      59                 :            :         "/bin/hotspot/jvm.dll",
      60                 :            :         "/bin/classic/jvm.dll",
      61                 :            :         // The 64-bit JRE has the jvm in bin/server
      62                 :            :         "/bin/server/jvm.dll"
      63                 :            : #elif UNX
      64                 :            :         "/lib/" JFW_PLUGIN_ARCH "/client/libjvm.so",
      65                 :            :         "/lib/" JFW_PLUGIN_ARCH "/server/libjvm.so",
      66                 :            :         "/lib/" JFW_PLUGIN_ARCH "/classic/libjvm.so"
      67                 :            : #endif
      68                 :            :     };
      69                 :          6 :     *size = SAL_N_ELEMENTS(ar);
      70                 :          6 :     return ar;
      71                 :            : }
      72                 :            : 
      73                 :          6 : char const* const* SunInfo::getLibraryPaths(int* size)
      74                 :            : {
      75                 :            : #ifdef UNX
      76                 :            :     static char const * ar[] = {
      77                 :            :         "/lib/" JFW_PLUGIN_ARCH "/client",
      78                 :            :         "/lib/" JFW_PLUGIN_ARCH "/server",
      79                 :            :         "/lib/" JFW_PLUGIN_ARCH "/native_threads",
      80                 :            :         "/lib/" JFW_PLUGIN_ARCH
      81                 :            :     };
      82                 :          6 :     *size = SAL_N_ELEMENTS(ar);
      83                 :          6 :     return ar;
      84                 :            : #else
      85                 :            :     *size = 0;
      86                 :            :     return NULL;
      87                 :            : #endif
      88                 :            : }
      89                 :            : 
      90                 :          6 : int SunInfo::compareVersions(const rtl::OUString& sSecond) const
      91                 :            : {
      92         [ +  - ]:          6 :     rtl::OUString sFirst = getVersion();
      93                 :            : 
      94         [ +  - ]:          6 :     SunVersion version1(sFirst);
      95                 :            :     JFW_ENSURE(version1, OUSTR("[Java framework] sunjavaplugin" SAL_DLLEXTENSION
      96                 :            :                                " does not know the version: ")
      97                 :            :                + sFirst + OUSTR(" as valid for a SUN/Oracle JRE."));
      98         [ +  - ]:          6 :     SunVersion version2(sSecond);
      99 [ +  - ][ -  + ]:          6 :     if ( ! version2)
     100         [ #  # ]:          0 :         throw MalformedVersionException();
     101                 :            : 
     102 [ +  - ][ -  + ]:          6 :     if (version1 == version2)
     103                 :          0 :         return 0;
     104 [ +  - ][ +  - ]:          6 :     if (version1 > version2)
     105                 :          6 :         return 1;
     106                 :            :     else
     107 [ +  - ][ +  - ]:          6 :         return -1;
     108                 :            : }
     109                 :            : 
     110                 :            : 
     111                 :            : }
     112                 :            : 
     113                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10