-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat: add base URL preference for CLI downloads and only download CLI [HEAD-779] (#151)" This reverts commit e0b255d.
- Loading branch information
1 parent
56a4b81
commit a7190d2
Showing
23 changed files
with
244 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 10 additions & 12 deletions
22
plugin/src/main/java/io/snyk/eclipse/plugin/utils/LsMetadataResponseHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
package io.snyk.eclipse.plugin.utils; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.charset.Charset; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.snyk.languageserver.download.LsMetadata; | ||
import org.apache.http.HttpResponse; | ||
import org.apache.http.client.ResponseHandler; | ||
|
||
public class LsMetadataResponseHandler implements ResponseHandler<String> { | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class LsMetadataResponseHandler implements ResponseHandler<LsMetadata> { | ||
private final ObjectMapper om = new ObjectMapper(); | ||
|
||
public LsMetadataResponseHandler() { | ||
} | ||
|
||
@Override | ||
public String handleResponse(HttpResponse httpResponse) { | ||
String latestCliSupportingLSProtocolVersion = "10"; | ||
InputStream inputStream; | ||
try { | ||
inputStream = httpResponse.getEntity().getContent(); | ||
latestCliSupportingLSProtocolVersion = new String(inputStream.readAllBytes(), Charset.defaultCharset()); | ||
public LsMetadata handleResponse(HttpResponse httpResponse) { | ||
try (InputStream inputStream = httpResponse.getEntity().getContent()) { | ||
return om.readValue(inputStream, LsMetadata.class); | ||
} catch (UnsupportedOperationException | IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return latestCliSupportingLSProtocolVersion; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.