[REVIEW-3-5][REVIEW-3-5-3] Ignore corrupted items in Recent Documents

Stephan Bergmann sbergman at redhat.com
Fri Apr 20 00:38:15 PDT 2012


See <https://bugs.freedesktop.org/show_bug.cgi?id=46074#c59> and the 
comments leading up to it for the reason why I would appreciate it if 
the below master commit would be reviewed for inclusion in -3-5 and esp. 
-3-5-3.

(The diff is longer than necessary due to indentation changes due to an 
additional try--catch block; diff -b shows the actual changes more clearly.)

Stephan

On 04/20/2012 09:22 AM, Stephan Bergmann wrote:
>   unotools/source/config/historyoptions.cxx |   38 ++++++++++++++++++++++--------
>   1 file changed, 28 insertions(+), 10 deletions(-)
>
> New commits:
> commit 4ccb4bda483eb548eb6efb5e2f1952f094522320
> Author: Stephan Bergmann<sbergman at redhat.com>
> Date:   Fri Apr 20 09:21:42 2012 +0200
>
>      fdo#46074 Ignore corrupted items in Recent Documents
>
> diff --git a/unotools/source/config/historyoptions.cxx b/unotools/source/config/historyoptions.cxx
> index 2045074..8ee53cc 100644
> --- a/unotools/source/config/historyoptions.cxx
> +++ b/unotools/source/config/historyoptions.cxx
> @@ -33,6 +33,7 @@
>   #include<com/sun/star/uno/Any.hxx>
>   #include<com/sun/star/uno/Sequence.hxx>
>
> +#include<cassert>
>   #include<deque>
>   #include<algorithm>
>
> @@ -391,20 +392,37 @@ Sequence<  Sequence<  PropertyValue>  >  SvtHistoryOptions_Impl::GetList( EHistoryT
>
>               const sal_Int32 nLength = xOrderList->getElementNames().getLength();
>               Sequence<  Sequence<  PropertyValue>  >  aRet(nLength);
> +            sal_Int32 nCount = 0;
>
>               for(sal_Int32 nItem=0; nItem<nLength; ++nItem)
>               {
> -                ::rtl::OUString sUrl;
> -                xOrderList->getByName(::rtl::OUString::valueOf(nItem))>>= xSet;
> -                xSet->getPropertyValue(rtl::OUString(s_sHistoryItemRef))>>= sUrl;
> -
> -                xItemList->getByName(sUrl)>>= xSet;
> -                seqProperties[s_nOffsetURL  ].Value<<= sUrl;
> -                xSet->getPropertyValue(rtl::OUString(s_sFilter))>>= seqProperties[s_nOffsetFilter   ].Value;
> -                xSet->getPropertyValue(rtl::OUString(s_sTitle))>>= seqProperties[s_nOffsetTitle    ].Value;
> -                xSet->getPropertyValue(rtl::OUString(s_sPassword))>>= seqProperties[s_nOffsetPassword ].Value;
> -                aRet[nItem] = seqProperties;
> +                try
> +                {
> +                    ::rtl::OUString sUrl;
> +                    xOrderList->getByName(::rtl::OUString::valueOf(nItem))>>= xSet;
> +                    xSet->getPropertyValue(rtl::OUString(s_sHistoryItemRef))>>= sUrl;
> +
> +                    xItemList->getByName(sUrl)>>= xSet;
> +                    seqProperties[s_nOffsetURL  ].Value<<= sUrl;
> +                    xSet->getPropertyValue(rtl::OUString(s_sFilter))>>= seqProperties[s_nOffsetFilter   ].Value;
> +                    xSet->getPropertyValue(rtl::OUString(s_sTitle))>>= seqProperties[s_nOffsetTitle    ].Value;
> +                    xSet->getPropertyValue(rtl::OUString(s_sPassword))>>= seqProperties[s_nOffsetPassword ].Value;
> +                    aRet[nCount++] = seqProperties;
> +                }
> +                catch(const css::uno::Exception&  ex)
> +                {
> +                    //<https://bugs.freedesktop.org/show_bug.cgi?id=46074>
> +                    // "FILEOPEN: No Recent Documents..." discusses a problem
> +                    // with corrupted /org.openoffice.Office/Histories/Histories
> +                    // configuration items; to work around that problem, simply
> +                    // ignore such corrupted individual items here, so that at
> +                    // least newly added items are successfully reported back
> +                    // from this function:
> +                    LogHelper::logIt(ex);
> +                }
>               }
> +            assert(nCount<= nLength);
> +            aRet.realloc(nCount);
>               seqReturn = aRet;
>           }
>       }
> _______________________________________________
> Libreoffice-commits mailing list
> Libreoffice-commits at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits



More information about the LibreOffice mailing list