Uploaded image for project: 'Apache Roller'
  1. Apache Roller
  2. ROL-2062

Missing NPE check in IndexOperation#getDocument()

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.1
    • Fix Version/s: 5.1.2
    • Labels:
      None

      Description

      In entry deletion, invocation of IndexManagerImpl#addEntryReIndexOperation() occurs and it assumes WeblogEntry.pubTime is present but it's null if it is a unpublished entry.

      I think there's no impact for regular use but it seems like not intended behavior so I think adding simple null check is reasonable.

      Step to reproduce:

      1. Save a new entry as draft
      2. Delete the draft

      Exception:

      ERROR 2015-02-08 09:39:10,152 WriteToIndexOperation:run - Error acquiring write lock on index
      java.lang.NullPointerException
      at org.apache.roller.weblogger.business.search.operations.IndexOperation.getDocument(IndexOperation.java:138)
      at org.apache.roller.weblogger.business.search.operations.ReIndexEntryOperation.doRun(ReIndexEntryOperation.java:91)
      at org.apache.roller.weblogger.business.search.operations.WriteToIndexOperation.run(WriteToIndexOperation.java:42)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

      UPDATE:

      I found an another problematic situation. following procedure brings NPE at the same point:

      1. Publish a entry
      2. Save same entry which is published as a draft (back to draft)
      3. Publish the entry again

      It has possibility of making some un-indexed content so it should be fixed.

      1. ROL-2062.patch
        0.9 kB
        Kohei Nozaki

        Activity

        Hide
        djohnson David Johnson added a comment -

        5.1.2 released

        Show
        djohnson David Johnson added a comment - 5.1.2 released
        Hide
        djohnson David Johnson added a comment -

        Thanks!

        $ svn commit -m "Null pointer check for pubTime field in indexer via Kohei Nozaki (ROL-2062)" .
        Sending app/src/main/java/org/apache/roller/weblogger/business/search/operations/IndexOperation.java
        Transmitting file data .
        Committed revision 1658184.

        Show
        djohnson David Johnson added a comment - Thanks! $ svn commit -m "Null pointer check for pubTime field in indexer via Kohei Nozaki ( ROL-2062 )" . Sending app/src/main/java/org/apache/roller/weblogger/business/search/operations/IndexOperation.java Transmitting file data . Committed revision 1658184.

          People

          • Assignee:
            djohnson David Johnson
            Reporter:
            xkylex Kohei Nozaki
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development