Skip to content

Commit

Permalink
Finish 1.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
amb1ent committed Jul 10, 2023
2 parents c8bf940 + 7bca0ff commit ca6510e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
12 changes: 4 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ plugins {
}

group = "io.err0"
version = "1.3.6-BETA"
version = "1.3.7-BETA"

repositories {
mavenCentral()
Expand Down Expand Up @@ -79,7 +79,7 @@ dependencies {
implementation("org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r")

// https://mvnrepository.com/artifact/org.apache.httpcomponents.client5/httpclient5
implementation("org.apache.httpcomponents.client5:httpclient5:5.1")
implementation("org.apache.httpcomponents.client5:httpclient5:5.2")

// https://mvnrepository.com/artifact/commons-cli/commons-cli
implementation("commons-cli:commons-cli:1.5.0")
Expand Down Expand Up @@ -120,10 +120,6 @@ tasks.withType<Test> {
}

tasks.withType<JavaExec> {
args = listOf(
"--token", "../open-source-bundle/dev-localhost/err0-rails-20230723-82c92bf1-1997-11ee-8025-305a3ac84b71.json", "--insert", "../open-source-bundle/rails", // Ruby
)
/*
// Check-out the open-source-bundle project at the same parent level as this project:
args = listOf(
// pass #1 -- insert error codes (or re-insert error codes).
Expand All @@ -146,6 +142,7 @@ tasks.withType<JavaExec> {
"--token", "../open-source-bundle/dev-localhost/err0-strapi-20221207-82bf8921-763f-11ed-8b95-4401bb8de3b3.json", "--insert", "../open-source-bundle/strapi", // javascript
"--token", "../open-source-bundle/dev-localhost/err0-cerbos-20221207-33d4bf05-763f-11ed-8b95-4401bb8de3b3.json", "--insert", "../open-source-bundle/cerbos", // go
"--token", "../open-source-bundle/dev-localhost/err0-mender-20221207-5b47787b-763f-11ed-8b95-4401bb8de3b3.json", "--insert", "../open-source-bundle/mender", // go
"--token", "../open-source-bundle/dev-localhost/err0-rails-20230723-82c92bf1-1997-11ee-8025-305a3ac84b71.json", "--insert", "../open-source-bundle/rails", // Ruby
// pass #2 -- analyse source code, ignoring dirty checkout.
"--token", "../open-source-bundle/dev-localhost/err0-leptos-20221220-7c62eafd-806b-11ed-b59e-4401bb8de3b3.json", "--analyse", "--dirty", "../open-source-bundle/leptos", // Rust
"--token", "../open-source-bundle/dev-localhost/err0-postfix-20221220-5cd5d49b-806b-11ed-b59e-4401bb8de3b3.json", "--analyse", "--dirty", "../open-source-bundle/postfix", // C
Expand All @@ -166,9 +163,8 @@ tasks.withType<JavaExec> {
"--token", "../open-source-bundle/dev-localhost/err0-strapi-20221207-82bf8921-763f-11ed-8b95-4401bb8de3b3.json", "--analyse", "--dirty", "../open-source-bundle/strapi", // javascript
"--token", "../open-source-bundle/dev-localhost/err0-cerbos-20221207-33d4bf05-763f-11ed-8b95-4401bb8de3b3.json", "--analyse", "--dirty", "../open-source-bundle/cerbos", // go
"--token", "../open-source-bundle/dev-localhost/err0-mender-20221207-5b47787b-763f-11ed-8b95-4401bb8de3b3.json", "--analyse", "--dirty", "../open-source-bundle/mender", // go
"--token", "../open-source-bundle/dev-localhost/err0-rails-20230723-82c92bf1-1997-11ee-8025-305a3ac84b71.json", "--analyse", "--dirty", "../open-source-bundle/rails", // Ruby
)

*/
//args = listOf("--version", "--help")
}
16 changes: 12 additions & 4 deletions src/main/java/io/err0/client/core/RestApiProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,33 @@
import com.google.gson.JsonParser;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.io.entity.StringEntity;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.ParseException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;

public class RestApiProvider implements ApiProvider {
public RestApiProvider(final String tokenPath) throws IOException {
httpClient = HttpClients.createDefault();
ConnectionConfig connectionConfig = ConnectionConfig.custom()
.setConnectTimeout(5, TimeUnit.MINUTES)
.setSocketTimeout(15, TimeUnit.MINUTES)
.build();

BasicHttpClientConnectionManager connectionManager = new BasicHttpClientConnectionManager();
connectionManager.setConnectionConfig(connectionConfig);

httpClient = HttpClients.custom().setConnectionManager(connectionManager).build();

try {
tokenJson = JsonParser.parseString(Utils.readString(Utils.pathOf(tokenPath))).getAsJsonObject();
Expand Down

0 comments on commit ca6510e

Please sign in to comment.