vishesh92 commented on code in PR #8756:
URL: https://github.com/apache/cloudstack/pull/8756#discussion_r1815997799


##########
core/src/main/java/com/cloud/agent/transport/ArrayTypeAdaptor.java:
##########
@@ -75,13 +75,17 @@ public T[] deserialize(JsonElement json, Type typeOfT, 
JsonDeserializationContex
             try {
                 clazz = Class.forName(name);
             } catch (ClassNotFoundException e) {
-                throw new CloudRuntimeException("can't find " + name);
+                throw new JsonParseException("can't find " + name);
             }
             T cmd = (T)_gson.fromJson(entry.getValue(), clazz);
             cmds.add(cmd);
         }
-        Class<?> type = ((Class<?>)typeOfT).getComponentType();
-        T[] ts = (T[])Array.newInstance(type, cmds.size());
-        return cmds.toArray(ts);
+        try {
+            Class<?> type =  Class.forName(typeOfT.getTypeName().replace("[]", 
""));

Review Comment:
   ```suggestion
               Class<?> type = 
Class.forName(typeOfT.getTypeName().replace("[]", ""));
   ```



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to