Sonarlint Cannot download custom quality profile

eclipse
sonarlint

(1796222799) #1

Template for a good bug report, formatted with Markdown:

  • versions used (Eclipse: Version: Photon Release (4.8.0), SonarQube 6.7.4 (build 38452), Scanner sonar-scanner-3.2.0.1227-windows, sonarlint 3.6)
  • error observed (wrap logs/code around triple quote ``` for proper formatting)
!ENTRY org.sonarlint.eclipse.core 4 0 2018-08-24 11:31:31.056
!MESSAGE Unable to update data from server 'localhost'
!STACK 0
org.sonarsource.sonarlint.core.client.api.exceptions.StorageException: Unable to write protocol buffer data to file D:\code\.sonarlint\work\localhost\.sonartmp_1601388592070829890\6139716398102371869\active_rules\myrule.pb
	at org.sonarsource.sonarlint.core.container.storage.ProtobufUtil.writeToFile(ProtobufUtil.java:54)
	at org.sonarsource.sonarlint.core.container.connected.update.RulesDownloader.fetchRulesTo(RulesDownloader.java:63)
	at org.sonarsource.sonarlint.core.container.connected.update.perform.GlobalStorageUpdateExecutor.update(GlobalStorageUpdateExecutor.java:91)
	at org.sonarsource.sonarlint.core.container.connected.ConnectedContainer.update(ConnectedContainer.java:109)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$null$1(ConnectedSonarLintEngineImpl.java:174)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.runInConnectedContainer(ConnectedSonarLintEngineImpl.java:306)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.lambda$update$2(ConnectedSonarLintEngineImpl.java:174)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.withRwLock(ConnectedSonarLintEngineImpl.java:320)
	at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.update(ConnectedSonarLintEngineImpl.java:169)
	at org.sonarlint.eclipse.core.internal.server.Server.updateStorage(Server.java:291)
	at org.sonarlint.eclipse.core.internal.jobs.ServerUpdateJob.run(ServerUpdateJob.java:51)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:60)
Caused by: java.nio.file.NoSuchFileException: D:\code\.sonarlint\work\localhost\.sonartmp_1601388592070829890\6139716398102371869\active_rules\myrule.pb
	at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
	at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(Unknown Source)
	at java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source)
	at java.nio.file.Files.newOutputStream(Unknown Source)
	at org.sonarsource.sonarlint.core.container.storage.ProtobufUtil.writeToFile(ProtobufUtil.java:51)
	... 11 more
  • steps to reproduce
    I create a new quality profile named myrule to check java code in sonarqube server.
    and connect the sonarlint in eclipse to sonarqube server successfully.
    but right click on the server in “sonarqube servers” tab, choose “update all project bindings”, the error above occurs.
  • potential workaround
    googled it but my profile name does not contain any invalid char.
    i digged into the source code , the error may comes from the code:ProtobufUtil::writeToFile.
    Files.newOutputStream(path) won’t work fine if the full path of the new file that being created is not exists.
    P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour