Skip to content

Commit

Permalink
fix hhtpclient dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Nicklas Körtge <[email protected]>
  • Loading branch information
n1ckl0sk0rtge committed Jan 7, 2025
1 parent 92be140 commit bf62357
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4.1</version>
</dependency>


<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import jakarta.annotation.Nullable;

public class ScanRequest {
private String scanUrl;
private @Nonnull String scanUrl;
private @Nullable String branch;
private @Nullable String subfolder;
private @Nullable Credentials credentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import org.apache.http.StatusLine;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.jboss.logging.Logger;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DepsDevService {
private static final Logger LOGGER = Logger.getLogger(DepsDevService.class);
private static final Logger LOGGER = LoggerFactory.getLogger(DepsDevService.class);
private static final String DEPS_DEV_URI = "https://api.deps.dev/v3alpha/purl/";
private static final String SOURCE_REPO = "SOURCE_REPO";

Expand All @@ -48,10 +48,9 @@ public String fetch(@Nonnull String purl) throws NoDataAvailableInDepsDevForPurl

try (final CloseableHttpClient httpClient = HttpClientBuilder.create().build();
final CloseableHttpResponse response = httpClient.execute(request); ) {
final StatusLine status = response.getStatusLine();
if (status.getStatusCode() != 200) {
if (response.getCode() != 200) {
throw new NoDataAvailableInDepsDevForPurl(
purl, "bad status code: " + status.getStatusCode());
purl, "bad status code: " + response.getCode());
}
final InputStream in = response.getEntity().getContent();
return extractSourceRepo(in);
Expand Down

0 comments on commit bf62357

Please sign in to comment.