[Libreoffice-commits] core.git: 2 commits - jvmfwk/plugins

Tor Lillqvist tml at collabora.com
Mon Oct 20 01:33:08 PDT 2014


 jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx |   22 +++-----
 jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx    |    2 
 jvmfwk/plugins/sunmajor/pluginlib/util.cxx          |   51 +++++++-------------
 jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx    |    9 ++-
 4 files changed, 36 insertions(+), 48 deletions(-)

New commits:
commit 68e0f4d4f2becba41a12109095c693680825cb3e
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sun Oct 19 00:50:17 2014 +0300

    Clean jvmfwk tracing output
    
    Change-Id: I070fb24e9466d697a6014bd65635f6cda8736819

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index d1e02ce..db58c54 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -602,8 +602,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     if ( ! isVendorSupported(pInfo->sVendor))
         return JFW_PLUGIN_E_WRONG_VENDOR;
     OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
-    JFW_TRACE2("[Java framework] Using Java runtime library: "
-              + sRuntimeLib + ".\n");
+    JFW_TRACE2("Using Java runtime library: " << sRuntimeLib);
 
 #ifndef ANDROID
     // On linux we load jvm with RTLD_GLOBAL. This is necessary for debugging, because
@@ -624,9 +623,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
                     "[Java framework]sunjavaplugin" SAL_DLLEXTENSION
                        " could not load Java runtime library: \n"
                     + sRuntimeLib + "\n");
-         JFW_TRACE0("[Java framework]sunjavaplugin" SAL_DLLEXTENSION
-                    " could not load Java runtime library: \n"
-                    + sRuntimeLib +  "\n");
+         JFW_TRACE0("Could not load Java runtime library: " << sRuntimeLib);
          return JFW_PLUGIN_E_VM_CREATION_FAILED;
      }
 
@@ -704,7 +701,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
         }
 #endif
 #if OSL_DEBUG_LEVEL >= 2
-        JFW_TRACE2("VM option: " << options[n].optionString << "\n");
+        JFW_TRACE2("VM option: " << options[n].optionString);
 #endif
         ++n;
     }
@@ -765,7 +762,7 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
     else
     {
         *ppVm = pJavaVM;
-        JFW_TRACE2("[Java framework] sunjavaplugin" SAL_DLLEXTENSION " has created a VM.\n");
+        JFW_TRACE2("JVM created");
     }
 #else
     (void) arOptions;
@@ -809,28 +806,25 @@ javaPluginError jfw_plugin_existJRE(const JavaInfo *pInfo, sal_Bool *exist)
     if (ret == JFW_PLUGIN_E_NONE && *exist == sal_True)
     {
         OUString sRuntimeLib = getRuntimeLib(pInfo->arVendorData);
-        JFW_TRACE2("[Java framework] Checking existence of Java runtime library.\n");
+        JFW_TRACE2("Checking existence of Java runtime library");
 
         ::osl::DirectoryItem itemRt;
         ::osl::File::RC rc_itemRt = ::osl::DirectoryItem::get(sRuntimeLib, itemRt);
         if (::osl::File::E_None == rc_itemRt)
         {
             *exist = sal_True;
-            JFW_TRACE2("[Java framework] Java runtime library exist: "
-              + sRuntimeLib + "\n");
+            JFW_TRACE2("Java runtime library exist: " << sRuntimeLib);
 
         }
         else if (::osl::File::E_NOENT == rc_itemRt)
         {
             *exist = sal_False;
-            JFW_TRACE2("[Java framework] Java runtime library does not exist: "
-                       + sRuntimeLib + "\n");
+            JFW_TRACE2("Java runtime library does not exist: " << sRuntimeLib);
         }
         else
         {
             ret = JFW_PLUGIN_E_ERROR;
-            JFW_TRACE2("[Java framework] Error while looking for Java runtime library: "
-                       + sRuntimeLib + " \n");
+            JFW_TRACE2("Error while looking for Java runtime library: " << sRuntimeLib);
         }
     }
     return ret;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
index 457ba8d..504c16c 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
@@ -403,7 +403,7 @@ SelfTest::SelfTest()
             break;
     }
     if (bRet)
-        JFW_TRACE2("[Java framework] sunjavaplugin: Testing class SunVersion succeeded.\n");
+        JFW_TRACE2("Testing class SunVersion succeeded.");
     else
         OSL_ENSURE(bRet, "[Java framework] sunjavaplugin: SunVersion self test failed.\n");
 }
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index eb840b6..6d46121 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -165,8 +165,7 @@ namespace
 #endif
             buf.appendAscii( SAL_CONFIGFILE("/sunjavaplugin") );
             sIni = buf.makeStringAndClear();
-            JFW_TRACE2("[Java framework] sunjavaplugin: "
-                       "Using configuration file \n" +  sIni);
+            JFW_TRACE2("Using configuration file " << sIni);
             return sIni;
         }
    };
@@ -441,7 +440,7 @@ bool getJavaProps(const OUString & exePath,
     FileHandleReader stdoutReader(fileOut);
     rtl::Reference< AsynchReader > stderrReader(new AsynchReader(fileErr));
 
-    JFW_TRACE2("\n[Java framework] Executing: " + exePath + ".\n");
+    JFW_TRACE2("Executing: " + exePath);
     oslProcessError procErr =
         osl_executeProcess_WithRedirectedIO( exePath.pData,//usExe.pData,
                                              args,
@@ -458,7 +457,7 @@ bool getJavaProps(const OUString & exePath,
 
     if( procErr != osl_Process_E_None)
     {
-        JFW_TRACE2("[Java framework] Execution failed. \n");
+        JFW_TRACE2("Execution failed");
         *bProcessRun = false;
         SAL_WARN("jfw",
             "osl_executeProcess failed (" << ret << "): \"" << exePath << "\"");
@@ -466,7 +465,7 @@ bool getJavaProps(const OUString & exePath,
     }
     else
     {
-        JFW_TRACE2("[Java framework] Java executed successfully.\n");
+        JFW_TRACE2("Java executed successfully");
         *bProcessRun = true;
     }
 
@@ -484,7 +483,7 @@ bool getJavaProps(const OUString & exePath,
         OUString sLine;
         if (!decodeOutput(aLine, &sLine))
             continue;
-        JFW_TRACE2("[Java framework]:\" " << sLine << " \".\n");
+        JFW_TRACE2(" \"" << sLine << " \"");
         sLine = sLine.trim();
         if (sLine.isEmpty())
             continue;
@@ -511,8 +510,8 @@ bool getJavaProps(const OUString & exePath,
 
     //process error stream data
     stderrReader->join();
-    JFW_TRACE2("[Java framework]  Java wrote to stderr:\" "
-               << stderrReader->getData().getStr() << " \".\n");
+    JFW_TRACE2("Java wrote to stderr:\" "
+               << stderrReader->getData().getStr() << " \"");
 
     TimeValue waitMax= {5 ,0};
     procErr = osl_joinProcessWithTimeout(javaProcess, &waitMax);
@@ -904,9 +903,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
                            SameOrSubDirJREMap(sResolvedDir));
     if (entry2 != mapJREs.end())
     {
-        JFW_TRACE2(OUString("[Java framework] sunjavaplugin")
-                   + SAL_DLLEXTENSION ": JRE found again (detected before): "
-                   + sResolvedDir + ".\n");
+        JFW_TRACE2("JRE found again (detected before): " << sResolvedDir);
         return entry2->second;
     }
 
@@ -936,7 +933,6 @@ rtl::Reference<VendorBase> getJREInfoByPath(
                 sFullPath = sResolvedDir +
                 OUString("/") + (*i);
 
-
             sFilePath = resolveFilePath(sFullPath);
 
             if (sFilePath.isEmpty())
@@ -959,9 +955,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
             MapIt entry =  mapJREs.find(sFilePath);
             if (entry != mapJREs.end())
             {
-                JFW_TRACE2(OUString("[Java framework] sunjavaplugin")
-                   + SAL_DLLEXTENSION ": JRE found again (detected before): "
-                   + sFilePath + ".\n");
+                JFW_TRACE2("JRE found again (detected before): " << sFilePath);
 
                 return entry->second;
             }
@@ -1059,9 +1053,7 @@ rtl::Reference<VendorBase> getJREInfoByPath(
     }
     else
     {
-        JFW_TRACE2(OUString("[Java framework] sunjavaplugin")
-                   + SAL_DLLEXTENSION ": Found JRE: " + sResolvedDir
-                   + " \n at: " + path + ".\n");
+        JFW_TRACE2("Found JRE: " << sResolvedDir << " at: " << path);
 
         mapJREs.insert(MAPJRE::value_type(sResolvedDir, ret));
         mapJREs.insert(MAPJRE::value_type(sFilePath, ret));
@@ -1140,6 +1132,11 @@ void createJavaInfoFromPath(vector<rtl::Reference<VendorBase> >& vecInfos)
 void createJavaInfoFromJavaHome(vector<rtl::Reference<VendorBase> >& vecInfos)
 {
     // Get Java from JAVA_HOME environment
+
+    // Note that on OS X is it not normal at all to have a JAVA_HOME environment
+    // variable. We set it in our build environment for build-time programs, though,
+    // so it is set when running unit tests that involve Java functionality. (Which affects
+    // at least CppunitTest_dbaccess_dialog_save, too, and not only the JunitTest ones.)
     char *szJavaHome= getenv("JAVA_HOME");
     if(szJavaHome)
     {
@@ -1173,7 +1170,7 @@ bool makeDriveLetterSame(OUString * fileURL)
 
 void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
 {
-    JFW_TRACE2("\n[Java framework] Checking \"/usr/jdk/latest\"\n");
+    JFW_TRACE2("Checking /usr/jdk/latest");
     getJREInfoByPath("file:////usr/jdk/latest", vecInfos);
 }
 
@@ -1239,15 +1236,10 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
                     case File::E_NOTDIR:
                         continue;
                     case File::E_ACCES:
-                        JFW_TRACE2(OUString("[Java framework] sunjavaplugin: ")
-                                   + "Could not read directory " + usDir2
-                                   + " because of missing access rights.");
+                        JFW_TRACE2("Could not read directory " << usDir2 << " because of missing access rights");
                         continue;
                     default:
-                        JFW_TRACE2(OUString("[Java framework] sunjavaplugin: ")
-                                   + "Could not read directory "
-                                   + usDir2 + ". Osl file error: "
-                                   + OUString::number(openErr));
+                        JFW_TRACE2("Could not read directory << usDir2 << ". Osl file error: " << openErr);
                         continue;
                     }
 
@@ -1259,13 +1251,10 @@ void createJavaInfoDirScan(vector<rtl::Reference<VendorBase> >& vecInfos)
                         File::RC errStatus = File::E_None;
                         if ((errStatus = curIt.getFileStatus(aStatus)) != File::E_None)
                         {
-                            JFW_TRACE2(excMessage + "getFileStatus failed with error "
-                                + OUString::number(errStatus));
+                            JFW_TRACE2(excMessage + "getFileStatus failed with error " << errStatus);
                             continue;
                         }
-                        JFW_TRACE2(OUString("[Java framework] sunjavaplugin: ") +
-                                   "Checking if directory: " + aStatus.getFileURL() +
-                                   " is a Java. \n");
+                        JFW_TRACE2("Checking if directory: " << aStatus.getFileURL() << " is a Java");
 
                         getJREInfoByPath(aStatus.getFileURL(),vecInfos);
                     }
commit 247f197cba49f2382995196ae50b3fc15ffa9db4
Author: Tor Lillqvist <tml at collabora.com>
Date:   Sun Oct 19 00:48:00 2014 +0300

    Skip vendors that are irrelevant
    
    There surely are no Apple JVMs for other OSes than OS X.
    Correspondingly, there surely are no IBM, Blackdown, BEA, FSF or
    FreeBSD JVMs for OS X. At least not ones that would be relevant today.
    
    Change-Id: I0ee6f904665a2145771802beffe54268718bef50

diff --git a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx
index 11ed82e..3f23ff3 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx
@@ -36,15 +36,20 @@ namespace jfw_plugin
    by "\xXX\xXX"
  */
 BEGIN_VENDOR_MAP()
+// For OS X, don't bother with implementations that aren't relevant (or have never existed)
+#ifdef MACOSX
+    VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo)
+    VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo)
+#endif
     VENDOR_MAP_ENTRY("Sun Microsystems Inc.", SunInfo)
     VENDOR_MAP_ENTRY("Oracle Corporation", SunInfo)
+#ifndef MACOSX
     VENDOR_MAP_ENTRY("IBM Corporation", OtherInfo)
     VENDOR_MAP_ENTRY("Blackdown Java-Linux Team", OtherInfo)
-    VENDOR_MAP_ENTRY("Apple Inc.", OtherInfo)
-    VENDOR_MAP_ENTRY("Apple Computer, Inc.", OtherInfo)
     VENDOR_MAP_ENTRY("BEA Systems, Inc.", OtherInfo)
     VENDOR_MAP_ENTRY("Free Software Foundation, Inc.", GnuInfo)
     VENDOR_MAP_ENTRY("The FreeBSD Foundation", OtherInfo)
+#endif
 END_VENDOR_MAP()
 
 


More information about the Libreoffice-commits mailing list