Whoo..., Just finished upgrading the Sonar Installation from 4.3 to 4.5.2. In the process also fixed a small issue on SonarQube Server, which was causing OutOfMemoryError. Also changed the look & feel of the sonar. Here are few screen shots of the same.
Now the explanation for the bug. It was occurring as the local PREVIEW scan was trying to fetch the snapshot of the projects database from server and server code was actually reading the entire database in a byte array before handing it over to ruby templates for further streaming. The trick was to use send_file instead of data and make PreviewCache & JRubyFacade return the file name instead of byte array. The trick worked well. Submitted the patches to SonarQube mailing list.