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 2009/01/16 15:24:23 UTC

DO NOT REPLY [Bug 46548] New: HSSFPrintSetup throws NPE when accasing print settings of existing XLS

https://issues.apache.org/bugzilla/show_bug.cgi?id=46548

           Summary: HSSFPrintSetup throws NPE when accasing print settings
                    of existing XLS
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: dq@mail.com


The following code throws NPE on certain XLS files

HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(xlsFile));
HSSFSheet sheet = wb.getSheetAt(0);
HSSFPrintSetup ps = sheet.getPrintSetup();
ps.getCopies();


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 46548] HSSFPrintSetup throws NPE when accasing print settings of existing XLS

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





--- Comment #2 from Dmitriy Kumshayev <dq...@mail.com>  2009-01-16 08:01:52 PST ---
Created an attachment (id=23132)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23132)
Unit test and proposed fix

When PLS record in Print Settings Block is long some xls files
contain additional Continue record going right after PLS.

The while loop in the constructor PageSettingsBlock() breaks 
right after the PLS record since it does no expect the Continue Record.

There is impression that there might be more than one 
PageSettingsBlock and the logic in org.apache.poi.hssf.model.Sheet
even creates and gets that second aggregated piece of records following PLS and
Continue records, but finally just drops it. As a result 
PageSettingsBlock gets created without a very important PageSetupRecord
causing NPE when some of the getter methods (the ones which internaly supposed
to deal with that missing PageSetupRecord) in  HSSFPrintSetup are called.

Someone put these comments at in Sheet.java

           // more than one 'Page Settings Block' at nesting level 1 ?
           // apparently this happens in about 15 test sample files


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 46548] HSSFPrintSetup throws NPE when accesing print settings of existing XLS

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


Dmitriy Kumshayev <dq...@mail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|HSSFPrintSetup throws NPE   |HSSFPrintSetup throws NPE
                   |when accasing print settings|when accesing print settings
                   |of existing XLS             |of existing XLS




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 46548] HSSFPrintSetup throws NPE when accessing print settings of existing XLS

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


Josh Micich <jo...@gildedtree.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #4 from Josh Micich <jo...@gildedtree.com>  2009-01-16 19:18:16 PST ---
Fixed in svn r735179 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=735179 )
Part of this change-list was the supplied patch (support for continued PLS
records).  The rest was additional fixes for other ways of getting multiple
PageSettingsBlocks.

I added the comments to Sheet.java in svn r683871 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=683871 )because I did not understand
why sheets sometimes appeared to have more than one PageSettingsBlock.  Further
investigation (of the test sample files) now, suggests that there are two
situations where this occurs: with nested chart sub-streams and nested 'Custom
View Settings' sub-streams each of which can contain its own PageSettingsBlock.
 Prior to this fix POI handled PSBs in nested charts OK, but not within the
'Custom View Settings'.

There were also two circumstances in which POI would incorrectly create two
PageSettingsBlocks where one was needed.  The first was in the case of a
continued PLS record (fixed by the patch provided).  The other situation
occurred when a WSBOOL record appears among the PSB records.  According to the
OOO docs WSBOOL is not part of the PSB; it should occur before the PSB.  All
but two of the junit test files agree with this.

The 'Custom View Settings' fix and the misplaced WSBOOL fix resulted in changes
to the code near the comments you pointed out.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 46548] HSSFPrintSetup throws NPE when accasing print settings of existing XLS

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





--- Comment #1 from David Fisher <df...@jmlafferty.com>  2009-01-16 07:28:42 PST ---
Please attach an example of a file that fails. The smallest that demonstrates
the trouble would be helpful. Without an example it is much, more difficult to
solve the trouble.

Thanks,
Dave


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 46548] HSSFPrintSetup throws NPE when accessing print settings of existing XLS

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


Dmitriy Kumshayev <dq...@mail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|HSSFPrintSetup throws NPE   |HSSFPrintSetup throws NPE
                   |when accesing print settings|when accessing print
                   |of existing XLS             |settings of existing XLS




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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


DO NOT REPLY [Bug 46548] HSSFPrintSetup throws NPE when accasing print settings of existing XLS

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





--- Comment #3 from Dmitriy Kumshayev <dq...@mail.com>  2009-01-16 08:06:28 PST ---
Created an attachment (id=23133)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23133)
XLS Example for the bug 

Please put this file to 
src/testcases/org/apache/poi/hssf/data/46548.xls


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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