Damans227 commented on code in PR #13624:
URL: https://github.com/apache/cloudstack/pull/13624#discussion_r3595817162


##########
core/src/main/java/com/cloud/agent/transport/compat/AbstractTOAdaptor.java:
##########
@@ -0,0 +1,128 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.transport.compat;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.SecStorageFirewallCfgCommand;
+import com.cloud.agent.api.to.DataStoreTO;
+import com.cloud.agent.api.to.DataTO;
+import com.cloud.agent.transport.ArrayTypeAdaptor;
+import com.cloud.agent.transport.InterfaceTypeAdaptor;
+import com.cloud.agent.transport.LoggingExclusionStrategy;
+import com.cloud.agent.transport.Request;
+import com.cloud.agent.transport.StoragePoolTypeAdaptor;
+import com.cloud.hypervisor.Hypervisor;
+import com.cloud.storage.Storage;
+import com.cloud.utils.Pair;
+import com.cloud.utils.StringUtils;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
+import com.google.gson.reflect.TypeToken;
+import org.apache.cloudstack.transport.HypervisorTypeAdaptor;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+
+import java.lang.reflect.Type;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * JSON serializer adapter for transport classes (com.cloud.agent.api.to.*) 
that ensures backward compatibility
+ * with older Agent versions due to rename of the fields
+ * (see https://github.com/shapeblue/cloudstack-apple/pull/532/changes)
+ */
+
+public class AbstractTOAdaptor<T> implements JsonSerializer<T> {
+    private static final Logger LOGGER = 
LogManager.getLogger(AbstractTOAdaptor.class);
+    private static final Gson gson;
+
+    static {
+        GsonBuilder gsonBuilder = new GsonBuilder();
+        gson = setDefaultGsonConfig(gsonBuilder);
+        GsonBuilder loggerBuilder = new GsonBuilder();
+        loggerBuilder.disableHtmlEscaping();
+        loggerBuilder.setExclusionStrategies(new 
LoggingExclusionStrategy(LOGGER));
+    }

Review Comment:
   It looks like `loggerBuilder` is never used after being configured, and 
`LOGGER` is only used by these lines. Can these be removed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to