Uploaded image for project: 'SonarSlang'
  1. SonarSlang
  2. SONARSLANG-249

Ruby converter fails to be started multiple times

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.1
    • Component/s: None
    • Labels:
      None

      Description

      SonarRuby needs to read a resource packaged inside the SonarRuby JAR.
      For that purpose, it attempts to create a new zip file system for that JAR, to be able to read the resource in it using the Java NIO API.
      The problem is that the Zip FileSystem Provider caches the file systems that are created with FileSystems#newFileSystem(URI,Map) and throws an exception if a file system was already created for a given JAR file.
      This happens in SonarLint for IntelliJ.

      Some options to fix this:

      • use FileSystems#newFileSystem(Path,Classloader) which creates a new file system for the provided Path (the JAR file), and using it explicitly when creating a Path.
      • checking if the filesystem already exists with FileSystems#getFileSystem before attempting to create it. The advantage is that the filesystem will be cached and the Path can be created without using the filesystem explicitly.
      Error running SonarLint analysis
      java.nio.file.FileSystemAlreadyExistsException
              at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:113)
              at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326)
              at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276)
              at org.sonarsource.ruby.converter.RubyConverter.initializeRubyRuntime(RubyConverter.java:196)
              at org.sonarsource.ruby.converter.RubyConverter.<init>(RubyConverter.java:81)
              at org.sonarsource.ruby.converter.RubyConverter.<init>(RubyConverter.java:88)
              at org.sonarsource.ruby.plugin.RubySensor.astConverter(RubySensor.java:44)
              at org.sonarsource.slang.plugin.SlangSensor.execute(SlangSensor.java:144)
              at org.sonarsource.sonarlint.core.analyzer.sensor.SensorsExecutor.executeSensor(SensorsExecutor.java:81)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alban.auzeill Alban Auzeill
                Reporter:
                duarte.meneses Duarte Meneses
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: