lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx |   14 
++++------
 linguistic/source/gciterator.cxx                                  |    5 +++
 2 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 6b6d59d04e0398d67e789db05b6071faf2255ec1
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Mar 8 12:56:06 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Mar 8 12:52:12 2023 +0000

    Add some SAL_WARNs and SAL_INFOs
    
    These help when debugging the LanguageTool issues.
    
    Change-Id: I04bb84dbffc8e4c4e0b353f8e830fe66d8dff576
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148199
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx 
b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
index 06e9f4eddff1..91a027e6ec6b 100644
--- a/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
+++ b/lingucomponent/source/spellcheck/languagetool/languagetoolimp.cxx
@@ -126,7 +126,10 @@ std::string makeHttpRequest_impl(std::string_view aURL, 
HTTP_METHOD method,
 {
     std::unique_ptr<CURL, curl_cleanup_t> curl(curl_easy_init());
     if (!curl)
+    {
+        SAL_WARN("languagetool", "CURL initialization failed");
         return {}; // empty string
+    }
 
     // Same useragent string as in CurlSession 
(ucp/webdav-curl/CurlSession.cxx)
     curl_version_info_data const* const 
pVersion(curl_version_info(CURLVERSION_NOW));
@@ -341,20 +344,15 @@ sal_Bool SAL_CALL 
LanguageToolGrammarChecker::isSpellChecker() { return false; }
 
 sal_Bool SAL_CALL LanguageToolGrammarChecker::hasLocale(const Locale& rLocale)
 {
-    bool bRes = false;
     if (!m_aSuppLocales.hasElements())
         getLocales();
 
     for (auto const& suppLocale : std::as_const(m_aSuppLocales))
-    {
         if (rLocale == suppLocale)
-        {
-            bRes = true;
-            break;
-        }
-    }
+            return true;
 
-    return bRes;
+    SAL_INFO("languagetool", "No locale \"" << 
LanguageTag::convertToBcp47(rLocale, false) << "\"");
+    return false;
 }
 
 Sequence<Locale> SAL_CALL LanguageToolGrammarChecker::getLocales()
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index a43a990a886f..edd028e31e28 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -565,6 +565,11 @@ uno::Reference< linguistic2::XProofreader > 
GrammarCheckingIterator::GetGrammarC
             }
         }
     }
+    else // not found - quite normal
+    {
+        SAL_INFO("linguistic", "No grammar checker found for \""
+                                   << LanguageTag::convertToBcp47(rLocale, 
false) << "\"");
+    }
     // ---- THREAD SAFE END ----
 
     return xRes;

Reply via email to