From c97a01d009f8b5f686998f3638cff25e228a1305 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 20 Feb 2012 13:35:57 +0100 Subject: Clean up work around spurious warning about missing JRE Signed-off-by: Petr Mladek --- .../source/deployment/registry/help/dp_help.cxx | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index ba1009c25379..43762f266e95 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 #include @@ -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 >( -- cgit