Skip to content

Commit

Permalink
Fix conflict when backport
Browse files Browse the repository at this point in the history
Signed-off-by: zane-neo <[email protected]>
  • Loading branch information
zane-neo committed Sep 27, 2023
1 parent cb83022 commit 7b94c94
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 84 deletions.
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
testImplementation group: 'org.mockito', name: 'mockito-core', version: '4.4.0'

compileOnly group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
compileOnly group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
compileOnly group: 'org.json', name: 'json', version: '20230227'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.opensearch.ml.common.output.model;

import static org.opensearch.core.xcontent.XContentParserUtils.ensureExpectedToken;
import static org.opensearch.ml.common.utils.StringUtils.gson;

import java.io.IOException;
import java.nio.ByteBuffer;
Expand All @@ -25,7 +26,6 @@
import org.opensearch.core.xcontent.ToXContentObject;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.core.xcontent.XContentParser;
import org.opensearch.ml.common.utils.GsonUtil;

@Data
public class ModelTensor implements Writeable, ToXContentObject {
Expand Down Expand Up @@ -224,7 +224,7 @@ public ModelTensor(StreamInput in) throws IOException {
this.result = in.readOptionalString();
if (in.readBoolean()) {
String mapStr = in.readString();
this.dataAsMap = GsonUtil.fromJson(mapStr, Map.class);
this.dataAsMap = gson.fromJson(mapStr, Map.class);
}
}

Expand Down Expand Up @@ -270,7 +270,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(true);
try {
AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
out.writeString(GsonUtil.toJson(dataAsMap));
out.writeString(gson.toJson(dataAsMap));
return null;
});
} catch (PrivilegedActionException e) {
Expand Down
30 changes: 0 additions & 30 deletions common/src/main/java/org/opensearch/ml/common/utils/GsonUtil.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.opensearch.ml.common.model.MLModelFormat;
import org.opensearch.ml.common.model.TextEmbeddingModelConfig;
import org.opensearch.ml.common.transport.register.MLRegisterModelInput;
import org.opensearch.ml.common.utils.GsonUtil;

import java.io.File;
import java.io.FileReader;
Expand Down Expand Up @@ -73,7 +72,7 @@ public void downloadPrebuiltModelConfig(String taskId, MLRegisterModelInput regi

Map<?, ?> config = null;
try (JsonReader reader = new JsonReader(new FileReader(configCacheFilePath))) {
config = GsonUtil.fromJson(reader, Map.class);
config = gson.fromJson(reader, Map.class);
}

if (config == null) {
Expand Down Expand Up @@ -171,7 +170,7 @@ public List downloadPrebuiltModelMetaList(String taskId, MLRegisterModelInput re

List<?> config = null;
try (JsonReader reader = new JsonReader(new FileReader(cacheFilePath))) {
config = GsonUtil.fromJson(reader, List.class);
config = gson.fromJson(reader, List.class);
}

return config;
Expand Down

0 comments on commit 7b94c94

Please sign in to comment.