Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigDecimal读取到c.t为‘e’时,解析失败 #177

Closed
CarlJia opened this issue May 10, 2021 · 1 comment
Closed

BigDecimal读取到c.t为‘e’时,解析失败 #177

CarlJia opened this issue May 10, 2021 · 1 comment

Comments

@CarlJia
Copy link
Contributor

CarlJia commented May 10, 2021

版本:eec:0.4.11

    /**
     * Get {@link java.math.BigDecimal} value
     *
     * @param c the {@link Cell}
     * @return BigDecimal
     */
    protected BigDecimal getDecimal(Cell c) {
        BigDecimal bd;
        switch (c.t) {
            case DOUBLE:
                bd = BigDecimal.valueOf(c.dv);
                break;
            case NUMERIC:
                bd = BigDecimal.valueOf(c.nv);
                break;
            case LONG:
                bd = BigDecimal.valueOf(c.lv);
                break;
            case SST:
                if (c.sv == null) {
                    c.setSv(sst.get(c.nv));
                }
                // @Mark:=>There is no missing `break`, this is normal logic here
            case INLINESTR:
                bd = new BigDecimal(c.sv);
                break;
            default: throw new UncheckedTypeException("Can't convert cell value to java.math.BigDecimal");
        }
        return bd;
    }

获取decimal 值时没有解析空数据,解析报错

@wangguanquan
Copy link
Owner

#180

@CarlJia CarlJia closed this as completed May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants