Uploaded image for project: 'yangide'
  1. yangide
  2. YANGIDE-15

Sometimes get NPE in HelpCompositionUtils.getNodeHelp(ASTNode)

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • unspecified
    • None
    • General
    • None
    • Operating System: All
      Platform: All

    • 5891

    Description

      I sometimes see the following stacktrace:

      Exception:java.lang.NullPointerException: null
      at org.opendaylight.yangide.editor.editors.text.help.HelpCompositionUtils.getNodeHelp(HelpCompositionUtils.java:50)
      at org.opendaylight.yangide.editor.editors.text.hover.YangTextHover.getHoverInfo(YangTextHover.java:71)
      at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:168)

      Besides the error dialog, I don't see any consequences from it.

      Here's the "getNodeHelp" method:
      ------------
      public static String getNodeHelp(ASTNode node) {
      if (node.getDescription() != null && node.getDescription().length() > 0)

      { // line 50. return getLocalInfo(node); }

      String info = getIndexedInfo(node);
      if (info == null)
      info = getLanguageHelp(node);
      return info;
      }
      -------------

      From the context of line 50, it appears that "node" is null. I don't think I've ever seen this happen when I had the debugger connected and a breakpoint enabled here. I've tried to connect up the debugger after I see this happen, but I've never been able to repeat it when the debugger is connected.

      A simple fix could be to just return null if node is null. It appears from inspecting the "TextViewerHoverManager" code that calls this indirectly, that it would deal smoothly with a null return value.

      However, it's not clear whether getting a null value here is an indication of something else going wrong.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            dhevendran.k@tcs.com Dhevendran Kulandaivel
            dkarr David M. Karr
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: