Spring Tool Suite
  1. Spring Tool Suite
  2. STS-3462

autowire hyperlink detector still throws NPE in some situations

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3.0.RELEASE
    • Fix Version/s: 3.4.0.RELEASE
    • Component/s: None
    • Labels:
      None

      Description

      The AutowireHyperlinkDetector still throws NPE in some cases. I can reproduce this with the latest release when having a simple Java project and hovering over a method argument (with hyperlinking active, so while pressing Cmd in my case).

      The workaround for this to deactivate the autowire hyperlink detector in the preferences. The good thing here is that is doesn't break the Java hyperlinking completely.

      This is the exception for the 3.3.0 release

      java.lang.NullPointerException
      	at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinksHelper(AutowireHyperlinkDetector.java:100)
      	at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinks(AutowireHyperlinkDetector.java:59)
      	at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(JavaElementHyperlinkDetector.java:114)
      	at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
      	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
      	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)
      	at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469)
      	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
      	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
      	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
      	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
      	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
      	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
      	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
      	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
      	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
      	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
      	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
      	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
      	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
      	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
      	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
      	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
      	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
      	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
      	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
      	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
      

      I will also try to reproduce this on the latest version from master to see how the stack trace looks like.

      1. .log
        313 kB
        Serkan Kaba

        Activity

        Hide
        Martin Lippert (c) added a comment -

        Here is the same exception from the master branch:

        java.lang.NullPointerException
        	at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinksHelper(AutowireHyperlinkDetector.java:84)
        	at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinks(AutowireHyperlinkDetector.java:60)
        	at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(JavaElementHyperlinkDetector.java:114)
        	at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
        	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
        	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)
        	at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469)
        	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
        	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
        	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
        	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
        	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
        	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
        	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
        	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
        	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
        	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
        	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
        	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
        	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
        	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
        	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
        	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
        	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
        	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
        	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.lang.reflect.Method.invoke(Method.java:606)
        	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
        	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
        	at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
        	at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
        
        Show
        Martin Lippert (c) added a comment - Here is the same exception from the master branch: java.lang.NullPointerException at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinksHelper(AutowireHyperlinkDetector.java:84) at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinks(AutowireHyperlinkDetector.java:60) at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(JavaElementHyperlinkDetector.java:114) at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80) at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289) at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261) at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450) at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
        Hide
        Martin Lippert (c) added a comment -

        One more stack trace from a forum post on this, using the latest 3.3.0 release:

        java.lang.NullPointerException    at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinksHelper(AutowireHyperlinkDetector.java:151)
            at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinks(AutowireHyperlinkDetector.java:88)
            at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(JavaElementHyperlinkDetector.java:114)
            at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)
            at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
            at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)
            at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469)
            at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
            at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
            at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
            at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
            at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
            at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
            at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
            at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
            at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
            at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
            at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
            at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
            at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
            at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
        
        Show
        Martin Lippert (c) added a comment - One more stack trace from a forum post on this, using the latest 3.3.0 release: java.lang.NullPointerException at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinksHelper(AutowireHyperlinkDetector.java:151) at org.springframework.ide.eclipse.quickfix.hyperlinks.AutowireHyperlinkDetector.addHyperlinks(AutowireHyperlinkDetector.java:88) at org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(JavaElementHyperlinkDetector.java:114) at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80) at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289) at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261) at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591) at org.eclipse.equinox.launcher.Main.run(Main.java:1450) at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
        Hide
        Terry Hon (c) added a comment -

        Thanks for reporting this Martin. I am able to reproduce your stack trace and fix it, but unfortunately not the one from the forum. It seems like that one might be pointing at older code still, since that line is an end bracket from what I can tell. I looked at the code around that line and couldn't really see what could be causing the NPE either. I will investigate further to make sure there's not another NPE before marking as fixed.

        Show
        Terry Hon (c) added a comment - Thanks for reporting this Martin. I am able to reproduce your stack trace and fix it, but unfortunately not the one from the forum. It seems like that one might be pointing at older code still, since that line is an end bracket from what I can tell. I looked at the code around that line and couldn't really see what could be causing the NPE either. I will investigate further to make sure there's not another NPE before marking as fixed.
        Hide
        Serkan Kaba added a comment -

        Attached is a recent log.

        Show
        Serkan Kaba added a comment - Attached is a recent log.
        Hide
        Serkan Kaba added a comment -

        BTW I can't start the IDE due to this so I would say this is a blocker.

        Show
        Serkan Kaba added a comment - BTW I can't start the IDE due to this so I would say this is a blocker.
        Hide
        Martin Lippert (c) added a comment -

        I think this got fixed for 3.4.0 already, therefore closing this item here. If the error appears again, please comment and we will re-open.

        Show
        Martin Lippert (c) added a comment - I think this got fixed for 3.4.0 already, therefore closing this item here. If the error appears again, please comment and we will re-open.

          People

          • Assignee:
            Terry Hon (c)
            Reporter:
            Martin Lippert (c)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date: