]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13314 Request pack200 compression only if library is available
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Fri, 17 Apr 2020 19:12:40 +0000 (14:12 -0500)
committersonartech <sonartech@sonarsource.com>
Fri, 24 Apr 2020 20:03:29 +0000 (20:03 +0000)
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/PluginFiles.java

index d0f557a2c3482bd8084ffc26333c6afb9d7f4295..7e4ea2141b60ed21b891bcbfe6c1bc8856848eeb 100644 (file)
@@ -92,9 +92,15 @@ public class PluginFiles {
   private Optional<File> download(InstalledPlugin plugin) {
     GetRequest request = new GetRequest("api/plugins/download")
       .setParam("plugin", plugin.key)
-      .setParam("acceptCompressions", PACK200)
       .setTimeOutInMs(5 * 60_000);
 
+    try {
+      Class.forName("java.util.jar.Pack200");
+      request.setParam("acceptCompressions", PACK200);
+    } catch (ClassNotFoundException e) {
+      // ignore and don't use any compression
+    }
+
     File downloadedFile = newTempFile();
     LOGGER.debug("Download plugin '{}' to '{}'", plugin.key, downloadedFile);