logo separator

[mkgmap-dev] rules test

From Steve Ratcliffe steve at parabola.me.uk on Tue Mar 30 12:27:43 BST 2021

On 29/03/2021 22:47, Mike Baggaley wrote:
> I have been having difficulties with the mkgmap test  code which uses the
> discontinued javax.xml.bind.DatatypeConverter for a single function
> printHexBinary. Despite downloading a copy of the library and telling
> Eclipse to use it, it doesn't seem to want to work. I found a replacement
> bit of code on the Internet, but as I can't compare the two outputs I can't
> confirm its output is identical. Can you take a look at the attached patch
> which does away with the dependency on javax and allows the tests to run
> under the latest version of Eclipse?
> 

So java 1.11 has removed all of the javax.* classes, so we need a 
replacement.

The patch is fine and gives the same results, but since we are
now using java 1.8 you can do this in one line like so:

    String s = String.format("%032x", new BigInteger(1, 
digest)).substring(0, 8);

[You can add '.toUpperCase(Locale.ROOT)' if you want to preserve the 
uppercase names which I don't think is important.]

Cheers,
Steve


More information about the mkgmap-dev mailing list