https://bz.apache.org/bugzilla/show_bug.cgi?id=57593

--- Comment #6 from Vasili <[email protected]> ---
Seems there is a bug here (unfortunately, due to another problem, mentioned in
another ticket - I can't try to fix it until we fix the build):
we fall through, and if we had EncryptedPackage - we wouldn't have fallen
through the 2nd block. I guess, under the 1st catch we should return something,
may be a default.


HSSFWorkbook.java, lines 237+, poi-3.11, we use
-----------------------------------------------------
    public static String getWorkbookDirEntryName(DirectoryNode directory) {

        for (int i = 0; i < WORKBOOK_DIR_ENTRY_NAMES.length; i++) {
            String wbName = WORKBOOK_DIR_ENTRY_NAMES[i];
            try {
                directory.getEntry(wbName);
                return wbName;
            } catch (FileNotFoundException e) {

            }
        }

        // check for an encrypted .xlsx file - they get OLE2 wrapped
        try {
            directory.getEntry("EncryptedPackage");
            throw new EncryptedDocumentException("The supplied spreadsheet
seems to be an Encrypted .xlsx file. " +
                    "It must be decrypted before use by XSSF, it cannot be used
by HSSF");
        } catch (FileNotFoundException e) {
            // fall through
        }

        // check for previous version of file format
        try {
            directory.getEntry("Book");
            throw new OldExcelFormatException("The supplied spreadsheet seems
to be Excel 5.0/7.0 (BIFF5) format. "
                    + "POI only supports BIFF8 format (from Excel versions
97/2000/XP/2003)");
        } catch (FileNotFoundException e) {
            // fall through
        }

        throw new IllegalArgumentException("The supplied POIFSFileSystem does
not contain a BIFF8 'Workbook' entry. "
            + "Is it really an excel file?");
    }
------------------------------------------------------------

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to