Password protected workbook working with POI 3.9 but not working POI 3.14

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Password protected workbook working with POI 3.9 but not working POI 3.14

Sateesh K Kolusu
Hello all -  I have a Excel workbook with password protected. The
following code worked with APACHE POI 3.9 but not 3.14

if (POIFSFileSystem.hasPOIFSHeader(fileIn) == true)
         {
            try
            {
               workbook = new HSSFWorkbook(fileIn, bDocProps);
            }
            catch (EncryptedDocumentException encryptedEx)
            {
               encryptionException = true;
               // Supplied password is invalid for Excel 2003 file
               message = CC_UnstructuredResourceBundle.getString(
                     "CC_UNSTRUCTURED_MSG_EXCEL_INVALID_PASSWORD");
 
            }

Any inputs if there are changes in 3.14 will be appreciated.

---
Thanks
Sateesh


Reply | Threaded
Open this post in threaded view
|

Re: Password protected workbook working with POI 3.9 but not working POI 3.14

Javen O'Neal-2
If you included an attachment, it didn't make it through.

Are you getting a compile time or run time error? What is the error message
and stack trace?

You're welcome to read through the changelog at
https://poi.apache.org/changes.html to see what changes occurred. If you
don't find anything that explains your problem, you can search through
bugzilla or look for changes to the source if you can narrow it down to a
few files.

Did you try any other builds?

We have made quite a few improvements to password protection in the last
few versions, and it's possible that one or more of those changes broke
backwards compatibility. We aim for maintaining deprecated APIs for at
least 2 releases prior to removing or changing them, so you may want to
compile with 3.11 with deprecated usage ignored, then compile with 3.11
with deprecated usage as fatal, then compile with 3.13 and repeat, then
3.15 and repeat.

FYI, 3.15 is the latest final version. Any reason for testing with 3.14?

On Feb 27, 2017 3:20 AM, "Sateesh K Kolusu" <[hidden email]>
wrote:

Hello all -  I have a Excel workbook with password protected. The
following code worked with APACHE POI 3.9 but not 3.14

if (POIFSFileSystem.hasPOIFSHeader(fileIn) == true)
         {
            try
            {
               workbook = new HSSFWorkbook(fileIn, bDocProps);
            }
            catch (EncryptedDocumentException encryptedEx)
            {
               encryptionException = true;
               // Supplied password is invalid for Excel 2003 file
               message = CC_UnstructuredResourceBundle.getString(
                     "CC_UNSTRUCTURED_MSG_EXCEL_INVALID_PASSWORD");

            }

Any inputs if there are changes in 3.14 will be appreciated.

---
Thanks
Sateesh
Reply | Threaded
Open this post in threaded view
|

Re: Password protected workbook working with POI 3.9 but not working POI 3.14

Sateesh K Kolusu
The attachment(s) test1.xlsx could not be scanned for viruses because it is a password protected file.

Hello Javen - Thank you for the prompt reply

The file in question is



The password is "qa"

At the time of moving to higher version of POI we had 3.14 in mind and so we moved.

The stack trace is
org.apache.poi.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

---
Thanks
Sateesh K Kolusu
Software Engineer - Connectivity
IBM Analytics




From:        "Javen O'Neal" <[hidden email]>
To:        POI Users List <[hidden email]>
Date:        02/27/2017 05:10 PM
Subject:        Re: Password protected workbook working with POI 3.9 but not working POI 3.14




If you included an attachment, it didn't make it through.

Are you getting a compile time or run time error? What is the error message
and stack trace?

You're welcome to read through the changelog at
https://poi.apache.org/changes.htmlto see what changes occurred. If you
don't find anything that explains your problem, you can search through
bugzilla or look for changes to the source if you can narrow it down to a
few files.

Did you try any other builds?

We have made quite a few improvements to password protection in the last
few versions, and it's possible that one or more of those changes broke
backwards compatibility. We aim for maintaining deprecated APIs for at
least 2 releases prior to removing or changing them, so you may want to
compile with 3.11 with deprecated usage ignored, then compile with 3.11
with deprecated usage as fatal, then compile with 3.13 and repeat, then
3.15 and repeat.

FYI, 3.15 is the latest final version. Any reason for testing with 3.14?

On Feb 27, 2017 3:20 AM, "Sateesh K Kolusu" <[hidden email]>
wrote:

Hello all -  I have a Excel workbook with password protected. The
following code worked with APACHE POI 3.9 but not 3.14

if (POIFSFileSystem.hasPOIFSHeader(fileIn) == true)
        {
           try
           {
              workbook = new HSSFWorkbook(fileIn, bDocProps);
           }
           catch (EncryptedDocumentException encryptedEx)
           {
              encryptionException = true;
              // Supplied password is invalid for Excel 2003 file
              message = CC_UnstructuredResourceBundle.getString(
                    "CC_UNSTRUCTURED_MSG_EXCEL_INVALID_PASSWORD");

           }

Any inputs if there are changes in 3.14 will be appreciated.

---
Thanks
Sateesh





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Password protected workbook working with POI 3.9 but not working POI 3.14

Javen O'Neal-2
As the error message suggests, you can't use HSSFDocument to read an XLSX
file.
See https://poi.apache.org/encryption.html

Are you sure you were able to read the same XLSX (not XLS) document with
3.9?


Based on our download numbers, a lot of users are still on 3.9. Out of
curiosity, I have been trying to figure out why that's a popular version,
whether it's because it's lexicographically higher than 3.10 and so wasn't
showing up on people's update list, if there are major libraries that bring
in an old version of poi as a dependency, or if there were backwards
compatibility problems that kept people from upgrading to 3.10.

On Feb 27, 2017 3:49 AM, "Sateesh K Kolusu" <[hidden email]>
wrote:

The attachment(s) test1.xlsx could not be scanned for viruses because it is
a password protected file.
------------------------------
Hello Javen - Thank you for the prompt reply

The file in question is



The password is "qa"

At the time of moving to higher version of POI we had 3.14 in mind and so
we moved.

The stack trace is
*org.apache.poi.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 *

---
Thanks
Sateesh K Kolusu
Software Engineer - Connectivity
IBM Analytics



From:        "Javen O'Neal" <[hidden email]>
To:        POI Users List <[hidden email]>
Date:        02/27/2017 05:10 PM
Subject:        Re: Password protected workbook working with POI 3.9 but
not working POI 3.14
------------------------------



If you included an attachment, it didn't make it through.

Are you getting a compile time or run time error? What is the error message
and stack trace?

You're welcome to read through the changelog at
https://poi.apache.org/changes.htmlto see what changes occurred. If you

don't find anything that explains your problem, you can search through
bugzilla or look for changes to the source if you can narrow it down to a
few files.

Did you try any other builds?

We have made quite a few improvements to password protection in the last
few versions, and it's possible that one or more of those changes broke
backwards compatibility. We aim for maintaining deprecated APIs for at
least 2 releases prior to removing or changing them, so you may want to
compile with 3.11 with deprecated usage ignored, then compile with 3.11
with deprecated usage as fatal, then compile with 3.13 and repeat, then
3.15 and repeat.

FYI, 3.15 is the latest final version. Any reason for testing with 3.14?

On Feb 27, 2017 3:20 AM, "Sateesh K Kolusu" <[hidden email]>
wrote:

Hello all -  I have a Excel workbook with password protected. The
following code worked with APACHE POI 3.9 but not 3.14

if (POIFSFileSystem.hasPOIFSHeader(fileIn) == true)
        {
           try
           {
              workbook = new HSSFWorkbook(fileIn, bDocProps);
           }
           catch (EncryptedDocumentException encryptedEx)
           {
              encryptionException = true;
              // Supplied password is invalid for Excel 2003 file
              message = CC_UnstructuredResourceBundle.getString(
                    "CC_UNSTRUCTURED_MSG_EXCEL_INVALID_PASSWORD");

           }

Any inputs if there are changes in 3.14 will be appreciated.

---
Thanks
Sateesh





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Password protected workbook working with POI 3.9 but not working POI 3.14

kiwiwings
FYI - as Javen implicit suggested - don't use POI 3.12 because of #58133.

@POI 3.9 usage: I've also asked that question at stackoverflow [1] -
although I don't think this would affect a lot of user (... and probably can be workaround easily ...),
this bugs me. Not sure, if this is really worth the effort, but we could contact a few of the
bigger projects in Dominiks github stats (I couldn't link/find his email...)  and asked them, why they still use the old version ...


[1] http://stackoverflow.com/questions/39107649/illegalstateexception-when-trying-to-setfillcolor-using-apache-poi-xslf/42175784?noredirect=1#comment71534204_42175784
Reply | Threaded
Open this post in threaded view
|

Re: Password protected workbook working with POI 3.9 but not working POI 3.14

Sateesh K Kolusu
In reply to this post by Javen O'Neal-2
Hi Javen -
Yes -  we were able to read the same XLSX (not XLS) document with 3.9
What changes were made in 3.14 that doesnot work. Do you have any sample
program that demonstrates new usage


---
Thanks
Sateesh



From:   "Javen O'Neal" <[hidden email]>
To:     POI Users List <[hidden email]>
Date:   02/27/2017 05:32 PM
Subject:        Re: Password protected workbook working with POI 3.9 but
not working POI 3.14



As the error message suggests, you can't use HSSFDocument to read an XLSX
file.
See https://poi.apache.org/encryption.html

Are you sure you were able to read the same XLSX (not XLS) document with
3.9?


Based on our download numbers, a lot of users are still on 3.9. Out of
curiosity, I have been trying to figure out why that's a popular version,
whether it's because it's lexicographically higher than 3.10 and so wasn't
showing up on people's update list, if there are major libraries that
bring
in an old version of poi as a dependency, or if there were backwards
compatibility problems that kept people from upgrading to 3.10.

On Feb 27, 2017 3:49 AM, "Sateesh K Kolusu" <[hidden email]>
wrote:

The attachment(s) test1.xlsx could not be scanned for viruses because it
is
a password protected file.
------------------------------
Hello Javen - Thank you for the prompt reply

The file in question is



The password is "qa"

At the time of moving to higher version of POI we had 3.14 in mind and so
we moved.

The stack trace is
*org.apache.poi.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 *

---
Thanks
Sateesh K Kolusu
Software Engineer - Connectivity
IBM Analytics



From:        "Javen O'Neal" <[hidden email]>
To:        POI Users List <[hidden email]>
Date:        02/27/2017 05:10 PM
Subject:        Re: Password protected workbook working with POI 3.9 but
not working POI 3.14
------------------------------



If you included an attachment, it didn't make it through.

Are you getting a compile time or run time error? What is the error
message
and stack trace?

You're welcome to read through the changelog at
https://poi.apache.org/changes.htmlto see what changes occurred. If you

don't find anything that explains your problem, you can search through
bugzilla or look for changes to the source if you can narrow it down to a
few files.

Did you try any other builds?

We have made quite a few improvements to password protection in the last
few versions, and it's possible that one or more of those changes broke
backwards compatibility. We aim for maintaining deprecated APIs for at
least 2 releases prior to removing or changing them, so you may want to
compile with 3.11 with deprecated usage ignored, then compile with 3.11
with deprecated usage as fatal, then compile with 3.13 and repeat, then
3.15 and repeat.

FYI, 3.15 is the latest final version. Any reason for testing with 3.14?

On Feb 27, 2017 3:20 AM, "Sateesh K Kolusu" <[hidden email]>
wrote:

Hello all -  I have a Excel workbook with password protected. The
following code worked with APACHE POI 3.9 but not 3.14

if (POIFSFileSystem.hasPOIFSHeader(fileIn) == true)
        {
           try
           {
              workbook = new HSSFWorkbook(fileIn, bDocProps);
           }
           catch (EncryptedDocumentException encryptedEx)
           {
              encryptionException = true;
              // Supplied password is invalid for Excel 2003 file
              message = CC_UnstructuredResourceBundle.getString(
                    "CC_UNSTRUCTURED_MSG_EXCEL_INVALID_PASSWORD");

           }

Any inputs if there are changes in 3.14 will be appreciated.

---
Thanks
Sateesh





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




Reply | Threaded
Open this post in threaded view
|

Re: Password protected workbook working with POI 3.9 but not working POI 3.14

Nick Burch-2
On Mon, 27 Feb 2017, Sateesh K Kolusu wrote:
> Yes - we were able to read the same XLSX (not XLS) document with 3.9
> What changes were made in 3.14 that doesnot work. Do you have any sample
> program that demonstrates new usage

Look at the source code for WorkbookFactory for one of the methods that
takes a password. Or, better yet, just switch to using something like
http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/WorkbookFactory.html#create(java.io.File,%20java.lang.String)

Nick

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