Copilot commented on code in PR #10710:
URL: https://github.com/apache/ozone/pull/10710#discussion_r3557339877


##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/FSOperations.java:
##########
@@ -107,7 +106,7 @@ private static Map<String, Object> toJson(FileStatus[] 
fileStatuses,
       boolean isFile) {
     Map<String, Object> json = new LinkedHashMap<>();
     Map<String, Object> inner = new LinkedHashMap<>();
-    JSONArray statuses = new JSONArray();
+    List<Object> statuses = new ArrayList<>();

Review Comment:
   In `toJson(FileStatus[], ...)`, `statuses` is only populated with the 
`Map<String, Object>` results of `toJsonInner(...)`, but it is declared as 
`List<Object>`. Narrowing it to `List<Map<String, Object>>` improves 
readability/type-safety without changing the serialized JSON.



##########
hadoop-ozone/httpfsgateway/src/main/java/org/apache/ozone/fs/http/server/FSOperations.java:
##########
@@ -395,24 +393,22 @@ private static JSONObject 
storagePolicyToJSON(BlockStoragePolicySpi policy) {
     return policyJson;
   }
 
-  @SuppressWarnings("unchecked")
-  private static JSONArray toJsonArray(StorageType[] storageTypes) {
-    JSONArray jsonArray = new JSONArray();
+  private static List<Object> toJsonArray(StorageType[] storageTypes) {
+    List<Object> jsonArray = new ArrayList<>();

Review Comment:
   `toJsonArray(StorageType[])` builds a list of storage type names, but the 
method currently uses `List<Object>`, which loses type-safety and makes 
accidental non-string inserts harder to catch. Using `List<String>` better 
documents the JSON shape and avoids unnecessary `Object` typing.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to