Bug 53553

Summary: No appropriate error message when trying to open a zero-length file
Product: LibreOffice Reporter: Tristan Miller <psychonaut>
Component: LibreofficeAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME QA Contact:
Severity: enhancement    
Priority: low CC: jmadero.dev, momonasmon, psychonaut
Version: 3.6.0.4 release   
Hardware: All   
OS: Linux (All)   
Whiteboard: ProposedEasyHack
i915 platform: i915 features:

Description Tristan Miller 2012-08-15 19:30:34 UTC
If you try to open a zero-length file with an unrecognized filename extension from the command line, LibreOffice outputs a rather unhelpful error message:

$ touch somefile

$ libreoffice somefile
terminate called after throwing an instance of 'libcdr::EndOfStreamException'

Trying to open such a zero-length file from the GUI results in no error message at all; the user is returned to the file selection dialog without any explanation of what is wrong.
Comment 1 Joel Madero 2013-06-10 16:01:39 UTC
What would you think would be a good message to send? 

I get this error with 4.2 master:

Version Incompatibility
Incorrect file version.
Comment 2 Tristan Miller 2013-06-10 16:29:10 UTC
Anything which indicates that the reason for failure was because the file was zero-length, or more generally because the file format was not valid, would be better than the behaviour I encountered, or the misleading error message you got.  Ideas:

"Cannot open file: file is zero-length"
"Cannot open file: invalid format"
Comment 3 Joel Madero 2013-06-10 16:32:00 UTC
Sure - I think that this is an enhancement request and not a bug report - nothing is really broken, just a slightly clearer message.


Enhancement
Low - seems like a very very unlikely situation and more likely than not just a user error but a clearer message couldn't hurt

ProposedEasyHack - probably easy to implement
Comment 4 Maxim Monastirsky 2014-02-26 21:45:27 UTC
With recent builds of 4.2/master, zero length files are opened in Writer. So I'm closing this bug as WORKSFORME. One problem that was in that scenario is that libreoffice wrote garbage to the file. I fixed it yesterday with http://cgit.freedesktop.org/libreoffice/core/commit/?id=27c3b8bca22353dfdcf4c248539a727522fc4e76.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.