rhtyd commented on a change in pull request #4140:
URL: https://github.com/apache/cloudstack/pull/4140#discussion_r441239286



##########
File path: server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
##########
@@ -3423,12 +3432,22 @@ else if (!template.isPublicTemplate() && 
caller.getType() != Account.ACCOUNT_TYP
             return uniqueTmplPair;
         }
         List<TemplateJoinVO> uniqueTmpls = uniqueTmplPair.first();
-        String[] tzIds = new String[uniqueTmpls.size()];
         int i = 0;
-        for (TemplateJoinVO v : uniqueTmpls) {
-            tzIds[i++] = v.getTempZonePair();
+        List<TemplateJoinVO> vrs = null;
+        if (showUnique) {
+            Long[] tzIds = new Long[uniqueTmpls.size()];

Review comment:
       @davidjumani nit - let's refactor and use a more modern form of writing 
code, the current code looks less like Java, more like C/C++; can be written as:
   ```
   Long[] templateIds = uniqueTmpls.stream().map(template -> 
template.getId()).toArray(Long[]::new);
   ```




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

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


Reply via email to