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

Spreadsheet : Call to cell.getTimeValue on cell marked as valueType TIME but no value set gives NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.5-incubating
    • 0.6-incubating
    • odfdom
    • None
    • Linux, JDK1.6

    Description

      Create a spreadsheet with a cell. Call
      cell.setValueType(OfficeValueTypeAttribute.Value.TIME.toString());

      then call
      cell.getTimeValue();

      gives
      java.lang.NullPointerException
      at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1234)
      at java.text.DateFormat.parse(DateFormat.java:335)
      at org.odftoolkit.odfdom.doc.table.OdfTableCell.parseString(OdfTableCell.java:920)
      at org.odftoolkit.odfdom.doc.table.OdfTableCell.getTimeValue(OdfTableCell.java:886)

      I'd expect null if no value is set. Blowing its brains out is not considered a reasonable reply.

      The same thing using DATE valueType doesn't cause this AFAIK

      Attachments

        1. testcase-fix-ODFTOOLKIT-325.patch
          2 kB
          Florian Hopf
        2. testcase-fix-ODFTOOLKIT-325-2.patch
          3 kB
          Florian Hopf

        Activity

          People

            fhopf Florian Hopf
            andyj Andy Jefferson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: