[rfc][icedtea-web] get rid of commit id in splashscreen

Jiri Vanek jvanek at redhat.com
Mon Apr 22 02:39:15 PDT 2013


ping
On 04/19/2013 01:35 PM, Jiri Vanek wrote:
> hI!
>
> Splash screen is using version+commit id as "version". It is not nice. This is striping the commit
> id from most visible case. But kept for bug reporting and soon...

Maybe improvement would be to strip it only when it is released version -
  +    static String stripCommitFromVersion(String version) {
  +        if (version.contains("pre+")) {
  +            return version;
  +        }
tehn rest as is in original patch

>
> J.
>
> stripCommitFromVersion.patch
>
>
> diff -r fbb6b3605538 netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java
> --- a/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java	Thu Apr 04 11:21:04 2013 +0200
> +++ b/netx/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainter.java	Fri Apr 19 13:24:17 2013 +0200
> @@ -371,6 +371,14 @@
>           return tt;
>       }
>
> +    static String stripCommitFromVersion(String version) {
> +        int i = version.indexOf("+");
> +        if (i < 0) {
> +            return version;
> +        }
> +        return version.substring(0, version.indexOf("+"));
> +    }
> +
>       private final class MovingTextRunner extends Observable implements Runnable {
>
>           private static final int MAX_ANIMATION_VALUE = 10000;
> @@ -499,11 +507,12 @@
>           g2d.setColor(plainTextColor);
>           FontMetrics fm = g2d.getFontMetrics();
>           if (version != null) {
> -            int y = master.getSplashWidth() - fm.stringWidth(version + " ");
> +            String niceVersion=stripCommitFromVersion(version);
> +            int y = master.getSplashWidth() - fm.stringWidth(niceVersion + " ");
>               if (y < 0) {
>                   y = 0;
>               }
> -            g2d.drawString(version, y, fm.getHeight());
> +            g2d.drawString(niceVersion, y, fm.getHeight());
>           }
>           return fm;
>       }
> diff -r fbb6b3605538 tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainterTest.java
> --- a/tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainterTest.java	Thu Apr 04 11:21:04 2013 +0200
> +++ b/tests/netx/unit/net/sourceforge/jnlp/splashscreen/impls/defaultsplashscreen2012/BasePainterTest.java	Fri Apr 19 13:24:17 2013 +0200
> @@ -105,4 +105,14 @@
>
>
>       }
> +
> +    @Test
> +    public void stripCommitFromVersion() {
> +        Assert.assertEquals("1.4", BasePainter.stripCommitFromVersion("1.4"));
> +        Assert.assertEquals("1.4.2", BasePainter.stripCommitFromVersion("1.4.2"));
> +        Assert.assertEquals("1.4pre", BasePainter.stripCommitFromVersion("1.4pre"));
> +        Assert.assertEquals("1.4", BasePainter.stripCommitFromVersion("1.4+657tgkhyu4iy5"));
> +        Assert.assertEquals("1.4.2", BasePainter.stripCommitFromVersion("1.4.2+887tgjh07tftvhjj"));
> +        Assert.assertEquals("1.4pre", BasePainter.stripCommitFromVersion("1.4pre+0977tyugg"));
> +    }
>   }
>




More information about the distro-pkg-dev mailing list