Uploaded image for project: 'ODF Toolkit'
  1. ODF Toolkit
  2. ODFTOOLKIT-124

Call OdfTableCell.getCurrencyValue() throw NullPointerException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • odfdom-0.8.5
    • odfdom-0.8.7
    • java
    • None
    • Operating System: Windows
      Platform: PC
    • 193

    Description

      I use Table API to read a *.ods documnet. Some time a NullPointerException will be thrown when call OdfTableCell.getCurrencyValue(). This method is realized as follow in ODFDOM:
      public double getCurrencyValue() {
      if (getTypeAttr() == OfficeValueTypeAttribute.Value.CURRENCY)

      { return mCellElement.getOfficeValueAttribute().doubleValue(); }

      else

      { throw new IllegalArgumentException(); }

      }
      The reason that NullPointerException thrown is mCellElement.getOfficeValueAttribute() get null value.
      Obviously, getOfficeValueAttribute() return null is valid. Such as, the cell is set as CURRENCY type, but it isn't given a value. The return value of mCellElement.getOfficeValueAttribute() should be checked and a default currency value may be needed.

      Attachments

        Activity

          People

            svanteschubert@odftoolkit.org Svante Schubert
            devin@odftoolkit.org devin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: