svtools/source/java/javainteractionhandler.cxx |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 4f400eecc10a04d37652ff1d4dc63aaeee3f0340
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Jun 1 19:30:47 2025 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Jun 1 20:34:19 2025 +0200

    Move variable declarations to where they are used
    
    Makes it much more clear, which exception is handled there
    
    Change-Id: I0b9fb5d5f356af85e9904f12e038246abea7c8ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186112
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/svtools/source/java/javainteractionhandler.cxx 
b/svtools/source/java/javainteractionhandler.cxx
index 79052d884456..4d4541d5dfb8 100644
--- a/svtools/source/java/javainteractionhandler.cxx
+++ b/svtools/source/java/javainteractionhandler.cxx
@@ -113,16 +113,11 @@ void SAL_CALL JavaInteractionHandler::handle( const 
Reference< XInteractionReque
             break;
     }
 
-    css::java::JavaNotFoundException           e1;
-    css::java::InvalidJavaSettingsException    e2;
-    css::java::JavaDisabledException           e3;
-    css::java::JavaVMCreationFailureException  e4;
-    css::java::RestartRequiredException        e5;
     // Try to recover the Exception type in the any and
     // react accordingly.
     sal_uInt16      nResult = RET_CANCEL;
 
-    if ( anyExc >>= e1 )
+    if (css::java::JavaNotFoundException e1; anyExc >>= e1)
     {
         SolarMutexGuard aSolarGuard;
         if( !g_JavaEvents.bNotFoundHandled )
@@ -155,7 +150,7 @@ void SAL_CALL JavaInteractionHandler::handle( const 
Reference< XInteractionReque
             nResult = RET_OK;
         }
     }
-    else if ( anyExc >>= e2 )
+    else if (css::java::InvalidJavaSettingsException e2; anyExc >>= e2)
     {
         SolarMutexGuard aSolarGuard;
         if( !g_JavaEvents.bInvalidSettingsHandled )
@@ -177,7 +172,7 @@ void SAL_CALL JavaInteractionHandler::handle( const 
Reference< XInteractionReque
             nResult = RET_OK;
         }
     }
-    else if ( anyExc >>= e3 )
+    else if (css::java::JavaDisabledException e3; anyExc >>= e3)
     {
         SolarMutexGuard aSolarGuard;
         if( !g_JavaEvents.bDisabledHandled )
@@ -200,7 +195,7 @@ void SAL_CALL JavaInteractionHandler::handle( const 
Reference< XInteractionReque
             nResult = g_JavaEvents.nResult_JavaDisabled;
         }
     }
-    else if ( anyExc >>= e4 )
+    else if (css::java::JavaVMCreationFailureException e4; anyExc >>= e4)
     {
         SolarMutexGuard aSolarGuard;
         if( !g_JavaEvents.bVMCreationFailureHandled )
@@ -222,7 +217,7 @@ void SAL_CALL JavaInteractionHandler::handle( const 
Reference< XInteractionReque
             nResult = RET_OK;
         }
     }
-    else if ( anyExc >>= e5 )
+    else if (css::java::RestartRequiredException e5; anyExc >>= e5)
     {
         SolarMutexGuard aSolarGuard;
         if( !g_JavaEvents.bRestartRequiredHandled )

Reply via email to