Hi all,
During testing I faced with some issues on the latest (downloaded 10 of September) Aspose.Total components. The goal of using Aspose components is to determine file type/format at runtime and get the reason why file cannot be opened if so: unknown file format, invalid password or other. So I found inconsistency in exceptions raised by Aspose components.
Please review my findings and give me an answer whether it possible to get the situation changed, because (I believe you agree with following) determining the reason of failure by exception’s message is NOT good practice.
I also attached “Aspose file format detector.xlsx” which illustrates the point in the list below.
1. Aspose.Slides.Pptx.PptxException (Message: Unknown file format.) is raised in following situations:
1.1. While opening DOC/DOT/XLS/XLT file via Aspose.Slides.Pptx.PresentationEx (string path) constructor. It would be better to raise Aspose.Slides.Pptx.PptxUnsupportedFormatException.
1.2. While opening password protected DOC/DOT/XLS/XLT (without specifying password at all) files via Aspose.Slides.Pptx.PresentationEx (string path) constructor. It would be better to raise something like InvalidPasswordOrMalformedException.
2. POT/PPT (regular and password protected) files are successfully opened by Aspose.Cells. Workbook() and FileFormat is Excel97To2003 . Believe it would be better to raise exception with code = ExceptionType.FileFormat.
3. System.NullReferenceException is raised instead of Aspose.Slides.Pptx.PptxUnsupportedFormatException when I try to open following files:
3.1. DOCM/DOCX/DOTM/DOTX/XLSM/XLSX/XLTM/XLTX via Aspose.Slides.Pptx.PresentationEx.
3.2. password protected (with correct password being specified) DOCM/DOCX/DOTM/DOTX/XLSM/XLSX/XLTM/XLTX via Aspose.Slides.Pptx.PresentationEx.
4. Aspose.Slides.PptReadException (Message: Couldn't read "PowerPoint Document" record.) is raised when I try to open password protected (without specifying any password at all) POT/PPT via Aspose.Slides.Presentation constructor. It would be better to raise something like InvalidPasswordOrMalformedException.
5. Aspose.Slides.Pptx.PptxReadException. (Message: This file is not correctly encrypted or malformed) is raised instead of Aspose.Slides.UnsupportedFormatException when I try to open password protected (with correct password being specified) POT/PPT/XLS/XLT/DOC/DOT via Aspose.Slides.Pptx.PptxPresentation constructor. It would be better to raise Aspose.Slides.Pptx.PptxUnsupportedFormatException.
6. Aspose.Slides.Pptx.PptxReadException (Message: Can't read MSCDFileSystem.) is raised instead of Aspose.Slides.Pptx.PptxUnsupportedFormatException when I try to open password protected (with correct password being specified) RTF via Aspose.Slides.Pptx.PptxPresentation constructor. It would be better to raise Aspose.Slides.Pptx.PptxUnsupportedFormatException.
<span style=“font-size:9.0pt;mso-bidi-font-size:11.0pt;line-height:115%;
font-family:“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
color:#548DD4;mso-themecolor:text2;mso-themetint:153;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>System.Exception <span style=“font-size:9.0pt;mso-bidi-font-size:11.0pt;line-height:115%;font-family:
“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>(Message:
Presentation is encrypted but LoadOptions.Password is null. Set right password
or set LoadOptions.OnlyLoadDocumentProperties to true.) when I try to open
password protected (without specifying password at all) DOCM/DOCX/DOTM/DOTX/XLSB/XLSM/XLSX/XLTM/XLTX/PPTM/PPTX/POTM/POTX.
It would be better to raise something like InvalidPasswordException.
“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>
“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>Best regards,
“Calibri”,“sans-serif”;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:“Times New Roman”;mso-bidi-theme-font:minor-bidi;
mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA”>Alex Shloma