Skip to content

Commit

Permalink
cleanup: remove some dependencies that are easy to replace (#4408)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwatson-verta authored Mar 11, 2024
1 parent 2e12661 commit 4dd6322
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 40 deletions.
6 changes: 3 additions & 3 deletions backend/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.25.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import ai.verta.modeldb.common.exceptions.InvalidArgumentException;
import ai.verta.modeldb.common.exceptions.ModelDBException;
import com.amazonaws.services.s3.model.PartETag;
import com.google.api.client.util.IOUtils;
import com.google.rpc.Code;
import jakarta.servlet.http.HttpServletRequest;
import java.io.File;
Expand Down Expand Up @@ -106,7 +105,7 @@ String storeFile(
}
LOGGER.trace("NFSService - storeFile - file found : {}", foldersExists.getAbsolutePath());
var fileOutputStream = new FileOutputStream(destinationFile);
IOUtils.copy(uploadedFileInputStream, fileOutputStream);
uploadedFileInputStream.transferTo(fileOutputStream);
fileOutputStream.close();
uploadedFileInputStream.close();
LOGGER.trace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.amazonaws.SdkClientException;
import com.amazonaws.services.s3.model.*;
import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
import com.google.api.client.http.HttpStatusCodes;
import com.google.rpc.Code;
import jakarta.servlet.http.HttpServletRequest;
import java.io.*;
Expand Down Expand Up @@ -159,7 +158,7 @@ public void commitMultipart(String s3Key, String uploadId, List<PartETag> partET
client.getClient().completeMultipartUpload(completeMultipartUploadRequest);
LOGGER.info("upload result: {}", result);
} catch (AmazonS3Exception e) {
if (e.getStatusCode() == HttpStatusCodes.STATUS_CODE_BAD_REQUEST) {
if (e.getStatusCode() == 400) {
LOGGER.info("message: {} additional details: {}", e.getMessage(), e.getAdditionalDetails());
throw new ModelDBException(e.getErrorMessage(), Code.FAILED_PRECONDITION);
}
Expand Down
5 changes: 0 additions & 5 deletions backend/server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,6 @@
<scope>TEST</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import ai.verta.uac.GetResourcesResponseItem.OwnerTrackingCase;
import ai.verta.uac.ResourceVisibility;
import ai.verta.uac.Workspace;
import com.google.api.client.util.Objects;
import java.io.Serializable;
import java.util.*;
import javax.persistence.*;
Expand Down Expand Up @@ -350,6 +349,6 @@ public boolean isDataset() {
}

public boolean isProtected() {
return Objects.equal(repositoryAccessModifier, RepositoryModifierEnum.PROTECTED.ordinal());
return Objects.equals(repositoryAccessModifier, RepositoryModifierEnum.PROTECTED.ordinal());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import ai.verta.modeldb.utils.ModelDBHibernateUtil;
import ai.verta.modeldb.utils.ModelDBUtils;
import ai.verta.uac.CollectTelemetry;
import com.google.api.client.http.HttpMethods;
import com.google.protobuf.Value;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -58,7 +57,7 @@ public void run() {

HttpURLConnection httpClient =
(HttpURLConnection) new URL(telemetryUtils.getConsumer()).openConnection();
httpClient.setRequestMethod(HttpMethods.POST);
httpClient.setRequestMethod("POST");
httpClient.setDoOutput(true);
httpClient.setRequestProperty("Content-Type", "application/json");
httpClient.setRequestProperty("Accept", "application/json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import ai.verta.uac.UserInfo;
import ai.verta.uac.VertaUserInfo;
import ai.verta.uac.Workspace;
import com.google.api.client.util.IOUtils;
import com.google.common.util.concurrent.Futures;
import io.grpc.Context;
import io.grpc.ManagedChannel;
Expand Down Expand Up @@ -331,7 +330,7 @@ private void loggedArtifactByUrlExperimentRun() throws IOException {
httpClient.setDoOutput(true);
httpClient.setRequestProperty("Content-Type", "application/json");
try (OutputStream out = httpClient.getOutputStream()) {
IOUtils.copy(inputStream, out);
inputStream.transferTo(out);
out.flush();
}

Expand Down Expand Up @@ -367,7 +366,7 @@ private void loggedArtifactByUrlProject() throws IOException {
httpClient.setDoOutput(true);
httpClient.setRequestProperty("Content-Type", "application/json");
try (OutputStream out = httpClient.getOutputStream()) {
IOUtils.copy(inputStream, out);
inputStream.transferTo(out);
out.flush();
}

Expand Down Expand Up @@ -400,7 +399,7 @@ public void getArtifactByUrlExperimentRunTest() throws IOException {
String rootPath = System.getProperty("user.dir");
FileOutputStream fileOutputStream =
new FileOutputStream(rootPath + File.separator + artifactKey);
IOUtils.copy(inputStream, fileOutputStream);
inputStream.transferTo(fileOutputStream);
fileOutputStream.close();
inputStream.close();

Expand Down Expand Up @@ -437,7 +436,7 @@ public void getArtifactByUrlProjectTest() throws IOException {
String rootPath = System.getProperty("user.dir");
FileOutputStream fileOutputStream =
new FileOutputStream(rootPath + File.separator + artifactKey);
IOUtils.copy(inputStream, fileOutputStream);
inputStream.transferTo(fileOutputStream);
fileOutputStream.close();
inputStream.close();

Expand Down
19 changes: 0 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -267,25 +267,6 @@
<scope>import</scope>
</dependency>


<!-- https://mvnrepository.com/artifact/com.google.cloud/google-cloud-storage -->
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.35.0</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- pin this dependency of ^^^ to upgrade for a CVE (https://snyk.io/vuln/SNYK-JAVA-COMGOOGLEOAUTHCLIENT-2807808) -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.35.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.prometheus/simpleclient_servlet -->
<dependency>
<groupId>io.prometheus</groupId>
Expand Down

2 comments on commit 4dd6322

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker Tag: main-2024-03-11T16-38-34--4dd6322

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total coverage (common): 14.49
Total coverage (server): 61.45

Changed Files coverage (common): coverage 100
Changed Files coverage (server): 43.59

Please sign in to comment.