Bug 145687 - Unhandled exception in utl::UCBContentHelper::IsYounger
Summary: Unhandled exception in utl::UCBContentHelper::IsYounger
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL: https://raw.githubusercontent.com/EWS...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-14 19:37 UTC by Christopher Yeleighton
Modified: 2022-04-10 17:03 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Yeleighton 2021-11-14 19:37:59 UTC
I told Writer to open the document License.rtf [1] and pressed the button [ Edit Document! ].


#7  0x00007fc9237a94fd in __cxxabiv1::__cxa_rethrow ()
    at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:133
#8  0x00007fc92741b77e in utl::UCBContentHelper::IsYounger (younger=..., older=...)
    at /usr/src/debug/libreoffice-7.2.2.2-2.1.x86_64/unotools/source/ucbhelper/ucbhelper.cxx:280
#9  0x00007fc92823ccd6 in SfxViewFrame::ExecReload_Impl (this=0xbf0, rReq=...)
    at /usr/src/debug/libreoffice-7.2.2.2-2.1.x86_64/sfx2/source/view/viewfrm.cxx:436

275                 > convert(
276                     content(older).getPropertyValue(
277                         "DateModified").
278                     get<css::util::DateTime>());
279         } catch (css::uno::RuntimeException const &) {
280             throw;

What is the point of catching an exception in order to immediately re-throw it?

___
[1] <URL: https://raw.githubusercontent.com/EWSoftware/VSSpellChecker/master/Source/VSSpellChecker2017And2019/License.rtf >
Comment 1 Roman Kuznetsov 2022-04-07 17:42:39 UTC
Hossein, I thought you may be interested in this
Comment 2 Hossein 2022-04-07 23:33:53 UTC
> I told Writer to open the document License.rtf [1] and pressed the button [
> Edit Document! ].
I can not reproduce this with LibreOffice 7.2. Could you please provide more information on how to reproduce the problem?

Version: 7.2.4.1 / LibreOffice Community
Build ID: 27d75539669ac387bb498e35313b970b7fe9c4f9
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded(In reply to Christopher Yeleighton from comment #0)

$ git grep "Edit Document"
include/sfx2/strings.hrc:#define STR_READONLY_EDIT                       NC_("STR_READONLY_EDIT", "Edit Document")
sfx2/uiconfig/ui/editdocumentdialog.ui:                <property name="label" translatable="yes" context="editdocumentdialog|edit">Edit Document</property>

Grepping for the above string ("Edit Document") shows that the document is read-only for some reason. I tried to open this document in another instance of LibreOffice, and then try opening it in LibreOffice 7.2 release. After choosing "Open Read-Only" or "Notify" in the previous popup, each time I pressed the "Edit Document" button from the notification bar. But, I could not reproduce this issue.

Are you using WebDAV?

And for the exception, this function handles certain exceptions, and re-throws some others. So, it should be OK.

See this description:
"Rethrowing an exception (C++ only)
If a catch block cannot handle the particular exception it has caught, you can rethrow the exception. The rethrow expression (throw without assignment_expression) causes the originally thrown object to be rethrown.

Because the exception has already been caught at the scope in which the rethrow expression occurs, it is rethrown out to the next dynamically enclosing try block. Therefore, it cannot be handled by catch blocks at the scope in which the rethrow expression occurred. Any catch blocks for the dynamically enclosing try block have an opportunity to catch the exception."
https://www.ibm.com/docs/en/i/7.4?topic=only-rethrowing-exception-c

bool utl::UCBContentHelper::IsYounger(
    OUString const & younger, OUString const & older)
{
    try {
        return
            convert(
                content(younger).getPropertyValue(
                    "DateModified").
                get<css::util::DateTime>())
            > convert(
                content(older).getPropertyValue(
                    "DateModified").
                get<css::util::DateTime>());
    } catch (css::uno::RuntimeException const &) {
        throw;
    } catch (css::ucb::CommandAbortedException const &) {
        assert(false && "this cannot happen");
        throw;
    } catch (css::uno::Exception const &) {
        TOOLS_INFO_EXCEPTION(
            "unotools.ucbhelper",
            "UCBContentHelper::IsYounger(" << younger << ", " << older << ")");
        return false;
    }
}
Comment 3 Christopher Yeleighton 2022-04-10 16:57:54 UTC
(In reply to Hossein from comment #2)
> > I told Writer to open the document License.rtf [1] and pressed the button [
> > Edit Document! ].
> I can not reproduce this with LibreOffice 7.2. Could you please provide more
> information on how to reproduce the problem?

The document opens editable as of v7.3, so the problem is not reproducible any more.
Comment 4 Roman Kuznetsov 2022-04-10 17:03:55 UTC
So let's close this one as WFM