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/12/02 04:41:08 UTC

DO NOT REPLY [Bug 48325] New: bad text 'Page &P of &N' and similar errors when reading in spreadsheets

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

           Summary: bad text 'Page &P of &N' and similar errors when
                    reading in spreadsheets
           Product: POI
           Version: 3.5-FINAL
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: regression
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: trejkaz@trypticon.org


We have seen this error in logs from customer sites, which prevent getting the
text out (HeaderFooter only has API for getLeft(), getCenter() and getRight(),
and all three throw the exception:

Caused by: java.lang.IllegalStateException: bad text 'Page &P of &N'.
    at
org.apache.poi.hssf.usermodel.HeaderFooter.splitParts(HeaderFooter.java:77)
    at org.apache.poi.hssf.usermodel.HeaderFooter.getLeft(HeaderFooter.java:87)
    at
com.nuix.data.file.office.poi.PoiExcelFileReader$SheetReader.createNextReader(SourceFile:273)
    at com.nuix.util.LazyCompositeReader.isReaderAvailable(SourceFile:93)
    at com.nuix.util.LazyCompositeReader.read(SourceFile:40)
    at com.nuix.util.LazyCompositeReader.read(SourceFile:42)
    at com.nuix.data.util.CachingReaderFactory.readFully(SourceFile:201)
    at com.nuix.data.util.CachingReaderFactory.createReader(SourceFile:104)
    ... 14 more

We have seen the same thing with '&A' as well.

This is a regression from before 3.5 beta 6, when these methods used to
silently return null instead.  However I'm not sure that returning null is
correct either - what would make the most sense is to match the behaviour of
Excel in this situation, which is presumably to treat all the text as if it's
the left or the center (but which?)

-- 
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 48325] bad text 'Page &P of &N' and similar errors when reading in spreadsheets

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

--- Comment #2 from Trejkaz <tr...@trypticon.org> 2009-12-03 19:21:22 UTC ---
Created an attachment (id=24669)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24669)
Proposed patch

Patch which makes that test pass.

-- 
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 48325] bad text 'Page &P of &N' and similar errors when reading in spreadsheets

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

Nick Burch <ni...@alfresco.com> changed:

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

--- Comment #3 from Nick Burch <ni...@alfresco.com> 2010-09-21 07:33:35 EDT ---
Thanks for the patch and test, applied in r999320.

-- 
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 48325] bad text 'Page &P of &N' and similar errors when reading in spreadsheets

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

tanakas@jp.ibm.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tanakas@jp.ibm.com

-- 
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 48325] bad text 'Page &P of &N' and similar errors when reading in spreadsheets

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

--- Comment #1 from Trejkaz <tr...@trypticon.org> 2009-12-03 19:20:09 UTC ---
Created an attachment (id=24668)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24668)
Sample file

Sample file attached, was created using an XLS file output from POI but then
mangling the footer to have the problem described.

Test case would look something like this (though there is a small amount of our
own utility method calls up the top):

    @Test
    public void testIllegalFooterText() throws Exception
    {
        HSSFWorkbook wb =
loadWorkbook(getDataFile("office/illegal-footer-text.xls"));
        HSSFSheet sh = wb.getSheetAt(0);
        HSSFFooter f = sh.getFooter();

        // The legal form of the footer would have been "&CBlahBlah Blah Blah 
" but something
        // left the &C off.  In this case it was me and a hex editor.  In the
cases we have seen
        // in the wild it's probably some idiot who thought they knew how to
add a footer but didn't.

        assertEquals("Left text should be empty", "", f.getLeft());
        assertEquals("Right text should be empty", "", f.getRight());
        assertEquals("Center text should contain the illegal value", "BlahBlah
blah blah  ", f.getCenter());
    }

-- 
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 48325] bad text 'Page &P of &N' and similar errors when reading in spreadsheets

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

EL YACOUBI <ae...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aelyacoubi@gmail.com
           Platform|PC                          |Sun
            Version|3.5-FINAL                   |3.6
         OS/Version|Windows NT                  |Solaris

-- 
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