Unable to retrieve error descriptions on Sonar servers with path components

169 views
Skip to first unread message

Daniel Sobral

unread,
Apr 20, 2015, 4:37:50 PM4/20/15
to sonarqube-in...@googlegroups.com
It seems that whenever a sonar server has a path components, say www.server.com/sonar, the plugin is unable to retrieve the description of the issues, because it goes to www.server.com/api/rules/show instead of www.server.com/sonar/api/rules/show.

omayevskiy

unread,
Apr 21, 2015, 7:28:18 AM4/21/15
to sonarqube-in...@googlegroups.com
nope https://your.server/sonar works for me

But I have similar experience, it seems that for some rules there seems to be no description available.

Daniel Sobral

unread,
Apr 21, 2015, 12:44:24 PM4/21/15
to omayevskiy, sonarqube-in...@googlegroups.com
That's strange. Are we talking about the same thing? When you are over an issue and press CMD-F1 to get more details? Because I haven't seen one issue where that doesn't fail, and, yet, if I go to Sonar and look up the REST api by hand, I always get a valid JSON return. For instance, calling printStackTrace, which is squid:S1148, and I go to http://sonar.richrelevance.com/sonar/api/rules/show?key=squid:S1148, I get back this:

{"rule":{"key":"squid:S1148","name":"Throwable.printStackTrace(...) should never be called","description":"<p>\n<code>Throwable.printStackTrace(...)</code> prints a throwable and its stack trace to some stream.\n</p>\n\n<p>Loggers should be used instead to print throwables, as they have many advantages:</p>\n<ul>\n <li>Users are able to easily retrieve the logs.</li>\n <li>The format of log messages is uniform and allow users to browse the logs easily.</li>\n</ul>\n\n<p>The following code:</p>\n\n<pre>\ntry {\n /* ... */\n} catch(Exception e) {\n e.printStackTrace(); // Non-Compliant\n}\n</pre>\n\n<p>should be refactored into:</p>\n\n<pre>\ntry {\n /* ... */\n} catch(Exception e) {\n LOGGER.log(\"context\", e); // Compliant\n}\n</pre>","language":"Java","createdAt":"2013-10-28T09:34:01-0700","fCreatedAt":"Oct 28, 2013 9:34 AM","updatedAt":"2014-06-13T09:44:34-0700","fUpdatedAt":"Jun 13, 2014 9:44 AM","tags":[],"sysTags":["error-handling"]}}

And if I try an inexisting key, I get this:

{"errors":[{"msg":"Rule not found: squid:S11481"}]}

Whereas doing CMD-F1 will complain about 401s, like

401 Unauthorized
retrofit.RetrofitError: 401 Unauthorized
at retrofit.RetrofitError.httpError(RetrofitError.java:39)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:382)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at org.intellij.sonar.sonarserver.$Proxy184.show(Unknown Source)
at org.intellij.sonar.sonarserver.SonarServer.getRule(SonarServer.java:200)
at org.intellij.sonar.analysis.IssueDescriptionLinkHandler.getDescription(IssueDescriptionLinkHandler.java:79)
at com.intellij.codeInsight.hint.TooltipLinkHandlerEP.getDescription(TooltipLinkHandlerEP.java:62)
at com.intellij.codeInsight.daemon.impl.DaemonTooltipRendererProvider$MyRenderer.dressDescription(DaemonTooltipRendererProvider.java:145)
at com.intellij.codeInsight.hint.LineTooltipRenderer.show(LineTooltipRenderer.java:75)
at com.intellij.codeInsight.hint.TooltipController.showTooltip(TooltipController.java:139)
at com.intellij.codeInsight.hint.LineTooltipRenderer.a(LineTooltipRenderer.java:208)
at com.intellij.codeInsight.hint.LineTooltipRenderer.access$000(LineTooltipRenderer.java:48)
at com.intellij.codeInsight.hint.LineTooltipRenderer$2.actionPerformed(LineTooltipRenderer.java:126)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:576)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:625)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:475)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:211)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

and

401 Unauthorized
retrofit.RetrofitError: 401 Unauthorized
at retrofit.RetrofitError.httpError(RetrofitError.java:39)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:382)
at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
at org.intellij.sonar.sonarserver.$Proxy184.show(Unknown Source)
at org.intellij.sonar.sonarserver.SonarServer.getRule(SonarServer.java:200)
at org.intellij.sonar.analysis.IssueDescriptionLinkHandler.getDescription(IssueDescriptionLinkHandler.java:79)
at com.intellij.codeInsight.hint.TooltipLinkHandlerEP.getDescription(TooltipLinkHandlerEP.java:62)
at com.intellij.codeInsight.daemon.impl.DaemonTooltipRendererProvider$MyRenderer.dressDescription(DaemonTooltipRendererProvider.java:145)
at com.intellij.codeInsight.hint.LineTooltipRenderer.show(LineTooltipRenderer.java:75)
at com.intellij.codeInsight.hint.TooltipController.showTooltip(TooltipController.java:139)
at com.intellij.codeInsight.hint.TooltipController.showTooltip(TooltipController.java:113)
at com.intellij.codeInsight.daemon.impl.DaemonTooltipUtil.showInfoTooltip(DaemonTooltipUtil.java:59)
at com.intellij.codeInsight.daemon.impl.ShowErrorDescriptionHandler.invoke(ShowErrorDescriptionHandler.java:39)
at com.intellij.codeInsight.actions.CodeInsightAction$1$1.run(CodeInsightAction.java:62)
at com.intellij.codeInsight.actions.CodeInsightAction$1.run(CodeInsightAction.java:69)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:85)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:54)
at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformed(CodeInsightAction.java:40)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:576)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:625)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:475)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:211)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Nothing else gives any trouble, and I find it suspicious that this seems to be the only usage of RestAdapter on the code.

Mmmmm, on the other hand, it complains about 401, not 404. Mistyping the path by hand gives me 404, not 401. So maybe the credentials are not being passed to the RestAdapter? It seems you'd need a RequestInterceptor configured to do that, but I don't see anything in the code to handle it.


--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube IntelliJ Plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube-intellij-plugin/JbYjmHbkfNw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube-intellij...@googlegroups.com.
To post to this group, send email to sonarqube-in...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube-intellij-plugin/8484a795-27ae-41e4-8a0a-4e6f670850e1%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Daniel C. Sobral

I travel to the future all the time.

omayevskiy

unread,
Apr 21, 2015, 5:16:48 PM4/21/15
to sonarqube-in...@googlegroups.com, omaye...@gmail.com
Oh, yes there is nothing about auth built in for rules queries
To unsubscribe from this group and all its topics, send an email to sonarqube-intellij-plugin+unsub...@googlegroups.com.
To post to this group, send email to sonarqube-intellij-plugin@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages