Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress [removal] AccessController in java.security has been deprecated and marked for removal #2195

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Set;

@Log4j2
@SuppressWarnings("removal")
public class MLCommonsClassLoader {

private static Map<Enum<?>, Class<?>> parameterClassMap = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ static Connector createConnector(XContentBuilder builder, String connectorProtoc
}
}

@SuppressWarnings("removal")
static Connector createConnector(XContentParser parser) throws IOException {
Map<String, Object> connectorMap = parser.map();
String jsonStr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ public ModelTensor(StreamInput in) throws IOException {
}
}

@SuppressWarnings("removal")
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public static Map<String, Object> fromJson(String jsonStr, String defaultKey) {
return result;
}

@SuppressWarnings("removal")
public static Map<String, String> getParameterMap(Map<String, ?> parameterObjs) {
Map<String, String> parameters = new HashMap<>();
for (String key : parameterObjs.keySet()) {
Expand All @@ -114,6 +115,7 @@ public static Map<String, String> getParameterMap(Map<String, ?> parameterObjs)
return parameters;
}

@SuppressWarnings("removal")
public static String toJson(Object value) {
try {
return AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {
Expand All @@ -128,6 +130,7 @@ public static String toJson(Object value) {
}
}

@SuppressWarnings("removal")
public static Map<String, String> convertScriptStringToJsonString(Map<String, Object> processedInput) {
Map<String, String> parameterStringMap = new HashMap<>();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.opensearch.ml.engine.annotation.Function;
import org.reflections.Reflections;

@SuppressWarnings("removal")
public class MLEngineClassLoader {

private static final Logger logger = LogManager.getLogger(MLEngineClassLoader.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public ModelHelper(MLEngine mlEngine) {
this.mlEngine = mlEngine;
}

@SuppressWarnings("removal")
public void downloadPrebuiltModelConfig(
String taskId,
MLRegisterModelInput registerModelInput,
Expand Down Expand Up @@ -182,6 +183,7 @@ public boolean isModelAllowed(MLRegisterModelInput registerModelInput, List mode
return false;
}

@SuppressWarnings("removal")
public List downloadPrebuiltModelMetaList(String taskId, MLRegisterModelInput registerModelInput) throws PrivilegedActionException {
String modelName = registerModelInput.getModelName();
String version = registerModelInput.getVersion();
Expand Down Expand Up @@ -215,6 +217,7 @@ public List downloadPrebuiltModelMetaList(String taskId, MLRegisterModelInput re
* @param modelContentHash model content hash value
* @param listener action listener
*/
@SuppressWarnings("removal")
public void downloadAndSplit(
MLModelFormat modelFormat,
String taskId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public MLOutput predict(MLInput mlInput, MLModel model) {
throw new IllegalArgumentException("model not deployed");
}

@SuppressWarnings("removal")
@Override
public MLOutput predict(MLInput mlInput) {
if (modelHelper == null || modelId == null) {
Expand Down Expand Up @@ -233,6 +234,7 @@ protected void doLoadModel(
log.info("Model {} is successfully deployed on {} devices", modelId, devices.length);
}

@SuppressWarnings("removal")
protected void loadModel(
File modelZipFile,
String modelId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void close() {
* @param version version of the model
* @param engine engine where model will be run. For now, we are supporting only pytorch engine only.
*/
@SuppressWarnings("removal")
private void loadModel(File modelZipFile, String modelId, String modelName, String version, String engine) {
try {
List<Predictor<ai.djl.modality.Input, ai.djl.modality.Output>> predictorList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ public static String findMatchedPart(String text, List<String> patternList) {
return null;
}

@SuppressWarnings("removal")
public static String outputToOutputString(Object output) throws PrivilegedActionException {
String outputString;
if (output instanceof ModelTensorOutput) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ private void executeAgent(RemoteInferenceInputDataSet inputDataSet, MLAgent mlAg
mlAgentRunner.run(mlAgent, inputDataSet.getParameters(), agentActionListener);
}

@SuppressWarnings("removal")
private ActionListener<Object> createAgentActionListener(
ActionListener<Output> listener,
List<ModelTensors> outputs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ private void runAgent(
}
}

@SuppressWarnings("removal")
private void processOutput(
Map<String, String> params,
ActionListener<Object> listener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public MLFlowAgentRunner(
this.memoryFactoryMap = memoryFactoryMap;
}

@SuppressWarnings("removal")
@Override
public void run(MLAgent mlAgent, Map<String, String> params, ActionListener<Object> listener) {
List<MLToolSpec> toolSpecs = getMlToolSpecs(mlAgent, params);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import lombok.experimental.UtilityClass;

@UtilityClass
@SuppressWarnings("removal")
public class RCFModelSerDeSer {
private static final int SERIALIZATION_BUFFER_BYTES = 512;
private static final Schema<RandomCutForestState> rcfSchema = AccessController
Expand Down Expand Up @@ -55,12 +56,14 @@ public static ThresholdedRandomCutForestState deserializeTRCF(byte[] bytes) {
return deserialize(bytes, trcfSchema);
}

@SuppressWarnings("removal")
private static <T> byte[] serialize(T model, Schema<T> schema) {
LinkedBuffer buffer = LinkedBuffer.allocate(SERIALIZATION_BUFFER_BYTES);
byte[] bytes = AccessController.doPrivileged((PrivilegedAction<byte[]>) () -> ProtostuffIOUtil.toByteArray(model, schema, buffer));
return bytes;
}

@SuppressWarnings("removal")
private static <T> T deserialize(byte[] bytes, Schema<T> schema) {
T model = schema.newMessage();
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public AwsConnectorExecutor(Connector connector) {
}
}

@SuppressWarnings("removal")
@Override
public void invokeRemoteModel(MLInput mlInput, Map<String, String> parameters, String payload, List<ModelTensors> tensorOutputs) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public HttpJsonConnectorExecutor(Connector connector, CloseableHttpClient httpCl
this.httpClient = httpClient;
}

@SuppressWarnings("removal")
@Override
public void invokeRemoteModel(MLInput mlInput, Map<String, String> parameters, String payload, List<ModelTensors> tensorOutputs) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public static void deleteFileQuietly(Path path) {
deleteFileQuietly(new File(path.toUri()));
}

@SuppressWarnings("removal")
public static void deleteFileQuietly(File file) {
if (file.exists()) {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public String getName() {
return ML_DISK_CB;
}

@SuppressWarnings("removal")
@Override
public boolean isOpen() {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public static User getUserContext(Client client) {
}

// TODO: Integration test needs to be added (MUST)
@SuppressWarnings("removal")
public static boolean isSuperAdminUser(ClusterService clusterService, Client client) {

final List<String> adminDnsA = clusterService.getSettings().getAsList(SECURITY_AUTHCZ_ADMIN_DN, Collections.emptyList());
Expand Down
Loading