-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: plugin might fail the server startup with IndexOutOfBoundsException #31
Comments
Hi Fabrice, The problem occurs when none of the fonts specified as "preferred" in the plugin's code are available on the machine running SQ. It seems that none of "DejaVu Sans", "Verdana", "Tahoma", "Helvetica", "Arial", "sans-serif", is available on Nemo (which is quite odd as Helvetica is available on most Mac OS X / Linux boxes, and Arial is available on Windows ones). As discussed per email, please compile this little program, execute it then send me back the file it produces: FontLister.java.gz It will allow me to improve font selection.
For now, I fixed the NPE in f51f79c, but the width of produced SVG images is probably wrong if the plugin cannot use a font that is available. Thanks and sorry for the inconvenience. Michel |
I had the same error on our RHEL server (2.6.32-573.22.1.el6.x86_64) Available fonts: |
Hi, thanks for your feedback. As it seems that the problem isn't isolated, I'll change the way the plugin generates SVG files in order to use CSS style sheets. This will remove the need to have fonts installed on the machine running SQ. |
👍 :-) |
I spent the whole evening trying to use CSS instead of fixed widths and my conclusions are the following:
Unless someone has a brilliant idea in order to generate easily SVG with CSS, I won't spend more time on trying to fix this issue using CSS until SVG generation is made easier / until someone contributes a SVG image template that uses CSS I could use (instead of having to generate SVG images, I would then fill the template with data such as label text, value text, colors and background colors). Until then, instead of using CSS, I fixed the issue as follows:
The result is the following:
There are two shortcomings:
I'll release the plugin with version 2.0.1-RC1, it would be great if you could try it and send me a feedback. Thanks in advance, Michel |
Sorry a little out of my depth; I hear good things on D3 if that's not something you came across in your travels. I can try the RC tomorrow and report back. Thanks Sent with Good (www.good.com) From: Michel Pawlak I spent the whole evening trying to use CSS instead of fixed widths and my conclusions are the following:
Unless someone has a brilliant idea in order to generate easily SVG with CSS, I won't spend more time on trying to fix this issue using CSS until SVG generation is made easier / until someone contributes a SVG image template that uses CSS I could use (instead of having to generate SVG images, I would then fill the template with data such as label text, value text, colors and background colors). Until then, instead of using CSS, I fixed the issue as follows:
The result is the following:
There are two shortcomings:
I'll release the plugin with version 2.0.1-RC1, it would be great if you could try it and send me a feedback. Thanks in advance, Michel — |
@mdiskin unfortunately javascript / D3 is not an option here as for instance Javascript cannot be added as markdown / added to GitHub I finally decided to adopt another strategy based on Font properties.
Result:
Can you please test release 2.0.1-RC2 ? Thanks in advance ! Michel |
I cannot see the RC2 jar just source zip. Did you look at shields.io they use SVG images for MD pages and maybe see how they did it. |
I uploaded the jar meantime: https://github.com/QualInsight/qualinsight-plugins-sonarqube-badges/releases/download/qualinsight-plugins-sonarqube-badges-2.0.1-RC2/qualinsight-sonarqube-badges-2.0.1-RC2.jar I'll have a look at shields.io, thanks |
Ok, thanks, the image (label width) isn't perfect, but it's better. There is still room for improvement ^^' I had a look at shields.io, it provides a standalone service that needs to be deployed along with (or needs to be accessible to) the service using it. This is a heavier solution (install shields.io server, or configure network to be able to call the service) than just having a plugin that does the job. At my company this approach wouldn't be accepted (they would not accept to have to install and maintain a "badges" server that requires npm, nor would accept to open ports.) I'll continue thus trying to improve the plugin. Concerning the images that are generated by shields.io, they provide the templates they use. I saw that they used some smart tricks to lower the weight. Food for the brain ;-) Side note: they are facing exactly the same issue I'm facing: they base their width computation on Verdana.ttf, and, if not found, they use Helvetica.ttf for width approximation. The problem is that they do not embed these fonts in their application as these are paid fonts (that's why I decided to use and embed an open source font in my plugin) and unlike what they argue, font width will always be an approximation, unless both server and client have verdana.ttf installed (which exclude all *nix users). Cheers and thanks for your help. |
FYI, I released version 2.0.1-RC3. It uses a template based approach similar to what shields.io is doing, instead of using Apache Batik for SVG image generation. As a result, the images are nicer (text positioning), the weight of generated images is < 1KB and the plugin weights 3 MB less. As the reported bug is now fixed I close this issue. I'll proceed with a vote for release soon. Again thanks for your help. |
We got this error while trying to install the latest 2.0.0 version of the plugin on Nemo. Root cause is:
You can find the full log here: http://pastebin.com/8nUvbdAE
The text was updated successfully, but these errors were encountered: