-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/5930/#review9203
-----------------------------------------------------------


1) Always use Dao methods instead of raw PreparedStatement:

 private final String COUNT_ISO ="SELECT COUNT(*) FROM vm_template t INNER JOIN 
template_zone_ref tzr on (t.id = tzr.template_id) WHERE t.format = 'ISO' AND 
tzr.removed is null AND t.removed IS NULL ";
               pstmt = txn.prepareStatement(COUNT_ISO);


Prepared statements are used only when the query can't be constructed using Dao 
method, and this is def not the case. Please re-write.

2) Rewrite this piece of code

int i=0;

if (startIndex <=isoCount) {
i=0;

               }else {
                   i=(int) (startIndex - isoCount);
               }

- Alena Prokharchyk


On July 16, 2012, 5:53 a.m., Saksham Srivastava wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/5930/
> -----------------------------------------------------------
> 
> (Updated July 16, 2012, 5:53 a.m.)
> 
> 
> Review request for cloudstack and Alena Prokharchyk.
> 
> 
> Description
> -------
> 
> Changes done: Added the restriction on listing ISOs by not allowing total no. 
> of ISOs on a page to exceed the page size.
> Made a check on the total public ISOs on a page not to repeat infinetly.
> 
> 
> This addresses bug CS-12707.
> 
> 
> Diffs
> -----
> 
>   server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java 1db12aa 
> 
> Diff: https://reviews.apache.org/r/5930/diff/
> 
> 
> Testing
> -------
> 
> Verified the fix from both UI and API calls.UI does not show repeating ISOs 
> and API does not list any ISOs for a invalid page request-parameter.
> 
> 
> Thanks,
> 
> Saksham Srivastava
> 
>

Reply via email to