[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 3 commits - desktop/source stoc/source

Petr Mladek pmladek at kemper.freedesktop.org
Mon Feb 20 06:00:23 PST 2012


 desktop/source/deployment/registry/help/dp_help.cxx |   30 ++++++++++++++++++++
 stoc/source/javavm/javavm.cxx                       |   10 +++++-
 2 files changed, 38 insertions(+), 2 deletions(-)

New commits:
commit c97a01d009f8b5f686998f3638cff25e228a1305
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Feb 20 13:35:57 2012 +0100

    Clean up work around spurious warning about missing JRE
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index ba1009c..43762f2 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -37,8 +37,9 @@
 #include "ucbhelper/content.hxx"
 #include "comphelper/servicedecl.hxx"
 #include "svl/inettype.hxx"
-#include "unotools/pathoptions.hxx"
+#include "svtools/javainteractionhandler.hxx"
 #include "uno/current_context.hxx"
+#include "unotools/pathoptions.hxx"
 
 #include <l10ntools/compilehelp.hxx>
 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
@@ -59,6 +60,29 @@ namespace backend {
 namespace help {
 namespace {
 
+// A current context that filters out java-vm.interaction-handler:
+class NonJavaCurrentContext: public cppu::WeakImplHelper1< XCurrentContext > {
+public:
+    NonJavaCurrentContext(Reference< XCurrentContext > const & parent):
+        parent_(parent) {}
+
+    virtual Any SAL_CALL getValueByName(rtl::OUString const & Name)
+        throw (RuntimeException);
+
+private:
+    Reference< XCurrentContext > parent_;
+};
+
+Any NonJavaCurrentContext::getValueByName(rtl::OUString const & Name)
+    throw (RuntimeException)
+{
+    return
+        (Name.equalsAsciiL(
+            RTL_CONSTASCII_STRINGPARAM(JAVA_INTERACTION_HANDLER_NAME))
+         || !parent_.is())
+        ? Any() : parent_->getValueByName(Name);
+}
+
 //==============================================================================
 class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
 {
@@ -418,10 +442,11 @@ void BackendImpl::implProcessHelp(
                 Reference< script::XInvocation > xInvocation;
                 if( xContext.is() )
                 {
-                    // Ignore the missing JRE scenario on upgrade/first-start without
-                    // horrible end-user warnings that are ignorable,and cause grief.
-                    Reference< XCurrentContext > xNoContext;
-                    com::sun::star::uno::ContextLayer dummyLayer( xNoContext );
+                    // Ignore the missing JRE scenario on upgrade/first-start
+                    // without horrible end-user warnings that are ignorable,
+                    // and cause grief:
+                    ContextLayer l(
+                        new NonJavaCurrentContext(getCurrentContext()));
                     try
                     {
                         xInvocation = Reference< script::XInvocation >(
commit 5004de693a95ba3678ec41f25bb55beef4a32ed1
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Feb 16 12:44:56 2012 +0000

    disable JRE warnings during help compilation on first start
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index 9d96328..ba1009c 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -38,6 +38,7 @@
 #include "comphelper/servicedecl.hxx"
 #include "svl/inettype.hxx"
 #include "unotools/pathoptions.hxx"
+#include "uno/current_context.hxx"
 
 #include <l10ntools/compilehelp.hxx>
 #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
@@ -417,6 +418,10 @@ void BackendImpl::implProcessHelp(
                 Reference< script::XInvocation > xInvocation;
                 if( xContext.is() )
                 {
+                    // Ignore the missing JRE scenario on upgrade/first-start without
+                    // horrible end-user warnings that are ignorable,and cause grief.
+                    Reference< XCurrentContext > xNoContext;
+                    com::sun::star::uno::ContextLayer dummyLayer( xNoContext );
                     try
                     {
                         xInvocation = Reference< script::XInvocation >(
commit 92b7c7db8356beef47df682b993e1aaeeb9a734c
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Thu Feb 16 12:38:24 2012 +0000

    java: add STOC_FORCE_NO_JRE env. var to enable easy testing of no-JRE case.
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 33d8280..2640f1d 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -782,8 +782,12 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
 
         JNIEnv * pMainThreadEnv = 0;
         javaFrameworkError errcode = JFW_E_NONE;
-        errcode = jfw_startVM(arOptions, index, & m_pJavaVm,
-                                & pMainThreadEnv);
+
+        if (getenv("STOC_FORCE_NO_JRE"))
+            errcode = JFW_E_NO_SELECT;
+        else
+            errcode = jfw_startVM(arOptions, index, & m_pJavaVm,
+                                  & pMainThreadEnv);
 
         bool bStarted = false;
         switch (errcode)
@@ -794,6 +798,8 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
             // No Java configured. We silenty run the java configuration
             // Java.
             javaFrameworkError errFind = jfw_findAndSelectJRE( NULL );
+            if (getenv("STOC_FORCE_NO_JRE"))
+                errFind = JFW_E_NO_JAVA_FOUND;
             if (errFind == JFW_E_NONE)
             {
                 continue;


More information about the Libreoffice-commits mailing list