You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2024/02/21 08:07:44 UTC

[Bug 68652] New: Creating XSSFWorkbook with path argument in constructor cause unexpected and not transparent source file modification.

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

            Bug ID: 68652
           Summary: Creating XSSFWorkbook with path argument in
                    constructor cause unexpected and not transparent
                    source file modification.
           Product: POI
           Version: 5.2.3-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: drozhdzhal@gmail.com
  Target Milestone: ---

I am using XSSFWorkbook for parsing xlsx files (only reading data).

For XSSFWorkbook creation I am using following constructor:

XSSFWorkbook(String path)

After testing my solution I discovered that there is some unexpected
non-transparent undesired behavior:

after closing workbook (I am using try with resources construction) source file
is rewritten updated by its compressed version; this is unexpected for me since
file is opened only for reading data.

Using following workaround changes this behavior:

static Workbook getWorkbook(String fullFileName) throws IOException {
        try {
            return new XSSFWorkbook(OPCPackage.open(fullFileName,
PackageAccess.READ));
        } catch (InvalidFormatException e) {
            throw new IOException(e.toString(), e);
        }
    }

Library version used in my solution is 5.2.5 (not present in version dropdown).

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68652] Creating XSSFWorkbook with path argument in constructor cause unexpected and not transparent source file modification.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68652

ydrozhdzhal <dr...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |drozhdzhal@gmail.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68652] Add constructor which allows to prevent writing changes to XSSFWorkbook back to the source file upon closing

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68652

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Creating XSSFWorkbook with  |Add constructor which
                   |path argument in            |allows to prevent writing
                   |constructor cause           |changes to XSSFWorkbook
                   |unexpected and not          |back to the source file
                   |transparent source file     |upon closing
                   |modification.               |
           Severity|normal                      |enhancement

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68652] Creating XSSFWorkbook with path argument in constructor cause unexpected and not transparent source file modification.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68652

--- Comment #2 from ydrozhdzhal <dr...@gmail.com> ---
It would be nice to add new constructor, I agree.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68652] Creating XSSFWorkbook with path argument in constructor cause unexpected and not transparent source file modification.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68652

--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
This has long been the behaviour and we can't change pre-existing behaviour.

We could potentially ass a new constructor to XSSFWorkbook -- eg

public XSSFWorkbook(String, PackageAccess)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


[Bug 68652] Creating XSSFWorkbook with path argument in constructor cause unexpected and not transparent source file modification.

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=68652

Matafagafo <ma...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matafagafo@yahoo.com

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org