desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx |    6 ++--
 framework/source/services/autorecovery.cxx                   |   15 ++---------
 2 files changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 885338844e6e7da789575d80010b13ead1c0bd93
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Jul 23 08:07:12 2025 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Jul 23 11:23:24 2025 +0200

    Move variable declaration to the place it's actually used
    
    This shows why. The string, created just to be re-initialized later, was
    mistakenly used in a message constructed for an exception; and that went
    unnoticed just because of that early declaration. Not a critical error,
    but made the diagnostic less useful.
    
    Was that way ever since commit 7c25b2baae4c8f45c7a588598b3af0a8aae3fc39
    (INTEGRATION: CWS jl49 (1.1.2); FILE ADDED, 2006-12-20).
    
    Change-Id: I253a99fafa6720faadce0b2e4dc0ff793c243530
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188196
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx 
b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
index 24e480b326c9..84f1b5f5ec57 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
@@ -542,17 +542,17 @@ bool UpdateInstallDialog::Thread::download(OUString const 
& sDownloadURL, Update
     }
 
     OSL_ASSERT(m_sDownloadFolder.getLength());
-    OUString destFolder, tempEntry;
+    OUString tempEntry;
     if (::osl::File::createTempFile(
         &m_sDownloadFolder,
         nullptr, &tempEntry ) != ::osl::File::E_None)
     {
         //ToDo feedback in window that download of this component failed
-        throw css::uno::Exception("Could not create temporary file in folder " 
+ destFolder + ".", nullptr);
+        throw css::uno::Exception("Could not create temporary file in folder " 
+ m_sDownloadFolder + ".", nullptr);
     }
     tempEntry = tempEntry.copy( tempEntry.lastIndexOf( '/' ) + 1 );
 
-    destFolder = dp_misc::makeURL( m_sDownloadFolder, tempEntry ) + "_";
+    OUString destFolder = dp_misc::makeURL(m_sDownloadFolder, tempEntry) + "_";
 
     ::ucbhelper::Content destFolderContent;
     dp_misc::create_folder( &destFolderContent, destFolder, m_updateCmdEnv );
commit 367b9151d355c0510d9ea5bd6c0f213a3835e04d
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Jul 23 09:17:34 2025 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Jul 23 11:23:10 2025 +0200

    Simplify AutoRecovery::implts_copyFile a bit
    
    Remove unneeded variables; use normal ctor - it is not too expensive
    here in the try block.
    
    Change-Id: Ie88f39c11d6ab3c87fa7b95e98d2290e04853b83
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188199
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index f3c2ddfc7b2c..56fda9621bfb 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -3971,29 +3971,22 @@ AutoRecovery::EFailureSafeResult 
AutoRecovery::implts_copyFile(const OUString& s
     // create content for the parent folder and call transfer on that content 
with the source content
     // and the destination file name as parameters
 
-    css::uno::Reference< css::ucb::XCommandEnvironment > xEnvironment;
-
-    ::ucbhelper::Content aSourceContent;
     ::ucbhelper::Content aTargetContent;
 
     try
     {
-        aTargetContent = ::ucbhelper::Content(sTargetPath, xEnvironment, 
m_xContext);
+        aTargetContent = ::ucbhelper::Content(sTargetPath, {}, m_xContext);
     }
     catch(const css::uno::Exception&)
     {
         return AutoRecovery::E_WRONG_TARGET_PATH;
     }
 
-    sal_Int32 nNameClash;
-    nNameClash = css::ucb::NameClash::RENAME;
-
     try
     {
-        bool bSuccess = ::ucbhelper::Content::create(sSource, xEnvironment, 
m_xContext, aSourceContent);
-        if (!bSuccess)
-            return AutoRecovery::E_ORIGINAL_FILE_MISSING;
-        aTargetContent.transferContent(aSourceContent, 
::ucbhelper::InsertOperation::Copy, sTargetName, nNameClash);
+        ::ucbhelper::Content aSourceContent(sSource, {}, m_xContext);
+        aTargetContent.transferContent(aSourceContent, 
::ucbhelper::InsertOperation::Copy,
+                                       sTargetName, 
css::ucb::NameClash::RENAME);
     }
     catch(const css::uno::Exception&)
     {

Reply via email to