Bug 63373 - XSSFConditionalFormattingThreshold.getRangeType will cause NullPointException if the type is "formula"
Summary: XSSFConditionalFormattingThreshold.getRangeType will cause NullPointException...
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.0.x-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-22 07:52 UTC by Rex Rao
Modified: 2019-04-24 01:29 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rex Rao 2019-04-22 07:52:15 UTC
This function will call RangeType.byName("formula"), in which will traverse all the RangeType enum strings. But one of them is "UNALLOCATED(6, null)" which is behind the formula enum "FORMULA(7, "formula")". When calling null.equals("formula") the exception throws.
Comment 1 Dominik Stadler 2019-04-23 20:32:50 UTC
Any chance you can provide some code-snippet which allows to reproduce this? Ideally as self-sufficient unit-test so we can add it to our set of tests?
Comment 2 Rex Rao 2019-04-24 01:29:05 UTC
(In reply to Dominik Stadler from comment #1)
> Any chance you can provide some code-snippet which allows to reproduce this?
> Ideally as self-sufficient unit-test so we can add it to our set of tests?

Just call:
org.apache.poi.ss.usermodel.ConditionalFormattingThreshold.RangeType.byName("formula");

The OOXML looks like:
    <conditionalFormatting sqref="D1:D1048576">
        <cfRule type="dataBar" priority="4">
            <dataBar>
                <cfvo type="formula" val="$J$1"/>
                <cfvo type="formula" val="SUM(1,10)"/>
                <color rgb="FF638EC6"/>
            </dataBar>
            <extLst>
                <ext uri="{B025F937-C7B1-47D3-B67F-A62EFF666E3E}"
                    xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
                    <x14:id>{8217E8C7-34F0-4144-BB9D-FCDC772EE7C7}</x14:id>
                </ext>
            </extLst>
        </cfRule>
    </conditionalFormatting>