Review Request #6608 - Created Aug. 14, 2012 and submitted
When a viewer is launched, the images are getting stored in AjaxImageFifoCache class. When request for thumbnail, we need to pass "key" param to retreive the image and its not getting passed so thumbnail is requested its failing with NPE. Issue is fixed by passing key param with default value 0 and Image is retrieved with the current key value.
Posted (Aug. 14, 2012, 9:14 p.m.)
Please specify which NPE exception you are trying to fix. The change of "getKey() - 1" make the code logic obstacle and hard to understand, why original key does not work?
Posted (Aug. 15, 2012, 2:03 p.m.)
in composeThumbnailUrl, we are not passing "key" param. in ConsoleProxyAjaxImage Handler we are checking for the "key" value. As it is empty we are throwing exception. The key is the value/index to get the console image from the AjaxFIFOImageCache. So I had written getter method to get the current key value from the image cache and pass it to imageCache to get the image. If my approach is wrong please let correct me.
Posted (Aug. 15, 2012, 4:58 p.m.)
The fix of "getKey() - 1" does not make sense to me. Make the check of key parameter in URL optional, add a method to AjaxFIFOImageCache.java to return the most recent image in the cache, and if key is omitted from request, return the most recent image from cache. don't manipulate semantics of "key" from outside of AjaxFIFOImageCache
Review request changed
Updated (Aug. 16, 2012, 10:25 a.m.)
I had removed getKey() method. Am passing key as "0" from the thumbnail request. In the AjaxFIFOImageCache , getImage method if the key is "0" am assigning the key value as current key value and sending the image from the cache with the key which will be the current image stored in the cache.
Posted (Aug. 16, 2012, 5:27 p.m.)
It would be better not to use hard-coded 0 here, byte img = imageCache.getImage(0); in stead, when key is missing, just default the key value to 0, and make the above expression to still get image by key
Posted (Aug. 17, 2012, 11:08 p.m.)
I can't apply the patch as git throws errors, could you double check if your patch is properly generated (for example, no unresolved conflicts, use space in place of tabs and don't mix space and tabs)
Review request changed
Updated (Sept. 10, 2012, 9:48 a.m.)
- changed from pending to submitted