JSPWiki
  1. JSPWiki
  2. JSPWIKI-742

ERROR [com.ecyrd.jspwiki.tags.WikiTagBase] Tag failed: java.lang.NullPointerException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.3, 2.8.4, 2.9
    • Fix Version/s: 2.8.5, 2.9.1
    • Component/s: Core & storage
    • Labels:
      None
    • Environment:

      RHEL_6.1

      Description

      Hello,

      I had used jspwiki2.8.3, i got the following error and the pages were displayed with an empty content.
      After restarting the apache in the site ,the jspwiki pages got displayed with contents and no errors were thrown.I'm sure this error was thrown from jspwiki code. could anyone know about this error?

      ERROR [com.ecyrd.jspwiki.tags.WikiTagBase] Tag failed: java.lang.NullPointerException
      at com.ecyrd.jspwiki.util.PriorityList.get(PriorityList.java:96) [:]
      at java.util.AbstractList$Itr.next(AbstractList.java:345) [:1.6.0_26]
      at com.ecyrd.jspwiki.filters.FilterManager.doPreTranslateFiltering(FilterManager.java:324) [:]
      at com.ecyrd.jspwiki.WikiEngine.textToHTML(WikiEngine.java:1511) [:]
      at com.ecyrd.jspwiki.WikiEngine.getHTML(WikiEngine.java:1455) [:]
      at com.ecyrd.jspwiki.tags.InsertPageTag.doWikiStartTag(InsertPageTag.java:128) [:]
      at com.ecyrd.jspwiki.tags.WikiTagBase.doStartTag(WikiTagBase.java:89) [:]

      1. JSPWiki-742.patch
        1.0 kB
        Harry Metske
      2. TestArrayListNPE.java
        1 kB
        Rakesh K. Cherukuri

        Activity

        Hide
        Florian Holeczek added a comment -

        Previously resolved by Harry.

        Show
        Florian Holeczek added a comment - Previously resolved by Harry.
        Hide
        Florian Holeczek added a comment -

        As far as I understood, this is also a problem in versions 2.8.4 and 2.9, so adding these ones to the affected versions.

        Show
        Florian Holeczek added a comment - As far as I understood, this is also a problem in versions 2.8.4 and 2.9, so adding these ones to the affected versions.
        Hide
        Florian Holeczek added a comment -

        Reopening, since 2.9.1 hasn't been released yet.

        Show
        Florian Holeczek added a comment - Reopening, since 2.9.1 hasn't been released yet.
        Hide
        Harry Metske added a comment -

        fixed in 2.9.1-svn-5 and 2.8.5-svn-14 (including the unnecessary casts)

        Show
        Harry Metske added a comment - fixed in 2.9.1-svn-5 and 2.8.5-svn-14 (including the unnecessary casts)
        Hide
        Juan Pablo Santos Rodríguez added a comment -

        why not

        CopyOnWriteArrayList<Item> m_elements = new CopyOnWriteArrayList<Item>();

        and then removing the casts on lines 58 & 94?

        br,
        juan pablo

        Show
        Juan Pablo Santos Rodríguez added a comment - why not CopyOnWriteArrayList<Item> m_elements = new CopyOnWriteArrayList<Item>(); and then removing the casts on lines 58 & 94? br, juan pablo
        Hide
        Harry Metske added a comment -

        proposing the attached patch.
        Which is Ichiro's suggestion to use CopyOnWriteArrayList

        regards,
        Harry

        Show
        Harry Metske added a comment - proposing the attached patch. Which is Ichiro's suggestion to use CopyOnWriteArrayList regards, Harry
        Hide
        Rakesh K. Cherukuri added a comment -

        JSPWiki : 2.8.3

        As part of RCA, found out that PriorityList is using ArrayList internally to maintain the filters. As there is no synchronization in place, there will be concurrent scenario (while adding filters) where there can be a null at one of the index in the ArrayList. This is resulting in NullPointerExceptions for any wiki page view requests.

        Attached is a stand alone class that confirms the behavior in PriorityList.

        Show
        Rakesh K. Cherukuri added a comment - JSPWiki : 2.8.3 As part of RCA, found out that PriorityList is using ArrayList internally to maintain the filters. As there is no synchronization in place, there will be concurrent scenario (while adding filters) where there can be a null at one of the index in the ArrayList. This is resulting in NullPointerExceptions for any wiki page view requests. Attached is a stand alone class that confirms the behavior in PriorityList.
        Hide
        Rakesh K. Cherukuri added a comment -

        Class that confirms the concurrency issue in PriorityList class

        Show
        Rakesh K. Cherukuri added a comment - Class that confirms the concurrency issue in PriorityList class

          People

          • Assignee:
            Harry Metske
            Reporter:
            RAJESHWARAN
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development