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/11/25 16:55:13 UTC

DO NOT REPLY [Bug 48284] New: [PATCH] Raised visibility of FormulaParseException to catch it outside the POI internal.

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

           Summary: [PATCH] Raised visibility of FormulaParseException to
                    catch it outside the POI internal.
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
        AssignedTo: dev@poi.apache.org
        ReportedBy: Petr.Udalau@exigenservices.com


Created an attachment (id=24614)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24614)
Fix.

There is simple example when we set wrong formula and get
FormulaParseException.

public class Test {
    public static void main(String[] args) throws Exception{
        HSSFWorkbook wb = new HSSFWorkbook();
        Sheet sheet = wb.createSheet();
        Row row = sheet.createRow(0);
        Cell cell = row.createCell(0);
        cell.setCellFormula("Sasd(1)");
    }
}

But we cant catch it because its visibility is package. We can't catch this
exception outside the POI internal.

Visibility is raised in patch.

-- 
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 48284] [PATCH] Raised visibility of FormulaParseException to catch it outside the POI internal.

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #24614|0                           |1
        is obsolete|                            |

--- Comment #2 from Josh Micich <jo...@gildedtree.com> 2009-11-25 17:21:12 UTC ---
Created an attachment (id=24621)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24621)
Revised patch making FormulaParseException a public top-level type

I originally added this exception quite some time back in the patch of bug
44504.  The purpose of the exception is to tell the difference between internal
POI errors and parsing errors caused by a bad user-supplied formula.  I
deliberately restricted visibility for two reasons - firstly because I didn't
want to augment POI's public API and secondly because I wasn't confident that
the formula parser did a good job of recognising formula errors yet.

Having said that, I think the formula parser has improved greatly since then
(almost thirty bugs fixed and more than a dozen additional enhancements) so it
is probably more reliable in throwing FormulaParseException correctly now.

As far as the API is concerned, I'd like to make this class a top level class
perhaps:
org.apache.poi.ss.formula.FormulaParseException
It should be OK to make this change since no-one has been able to specifically
catch this exception so far.

I see in your patch you left the the exception unchecked (which I agree with). 
I'm also considering declaring this exception on Cell.setCellFormula() for
clarity.  It's slightly unusual to have declared unchecked exceptions but that
seems like the best approach here.


The attached patch file includes the changes described here and some related
clean-up.  Let me know if you think it needs further changes.  Otherwise I'll
apply it over the weekend.

-- 
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 48284] [PATCH] Raised visibility of FormulaParseException to catch it outside the POI internal.

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

--- Comment #3 from Petr.Udalau <Pe...@exigenservices.com> 2009-11-26 01:44:03 UTC ---
Your patch completely resolves the problem.

Thanks.

-- 
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 48284] [PATCH] Raised visibility of FormulaParseException to catch it outside the POI internal.

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

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

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

--- Comment #4 from Josh Micich <jo...@gildedtree.com> 2009-11-30 16:17:27 UTC ---
Applied in svn r885007.

-- 
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 48284] [PATCH] Raised visibility of FormulaParseException to catch it outside the POI internal.

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

--- Comment #1 from Nick Burch <ni...@torchbox.com> 2009-11-25 09:19:59 UTC ---
There's a comment on the exception:

    // This class was given package scope until it would become clear that it
is useful to
    // general client code.

Probably one for Josh to comment on?

-- 
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 48284] [PATCH] Raised visibility of FormulaParseException to catch it outside the POI internal.

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

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

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

--- Comment #4 from Josh Micich <jo...@gildedtree.com> 2009-11-27 13:03:01 UTC ---
Applied in svn r885007.

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