[mkgmap-dev] [PATCH] splitter with Java 5, was: exception in --list-styles
From Thilo Hannemann thannema at gmx.de on Tue Apr 21 00:02:39 BST 2009
Below is a patch that allows the splitter to build against Java 5 (on MacOS 10.5). Only four lines of the code couldn't be compiled with Java 5 and those were easy to downgrade. Beware: It compiles, but that doesn't mean that it works correctly, there may be some difference between Java 5 and 6 that I missed. Having said that it seems to work ok for me. Try at your own risk. Index: src/uk/me/parabola/splitter/AreaList.java =================================================================== --- src/uk/me/parabola/splitter/AreaList.java (revision 31) +++ src/uk/me/parabola/splitter/AreaList.java (working copy) @@ -63,6 +63,8 @@ w = new FileWriter(filename); PrintWriter pw = new PrintWriter(w); + Locale rootlocale = new Locale("", "", ""); + pw.println("# List of areas"); pw.format("# Generated %s\n", new Date()); //pw.format("# Options: max-nodes=%d\n", main.getMaxNodes()); @@ -70,11 +72,11 @@ for (SubArea a : areas) { Area b = a.getBounds(); - pw.format(Locale.ROOT, "%d: %d,%d to %d,%d\n", + pw.format(rootlocale, "%d: %d,%d to %d,%d\n", a.getMapid(), b.getMinLat(), b.getMinLong(), b.getMaxLat(), b.getMaxLong()); - pw.format(Locale.ROOT, "# : %f,%f to %f,%f\n", + pw.format(rootlocale, "# : %f,%f to %f,%f\n", Utils.toDegrees(b.getMinLat()), Utils.toDegrees(b.getMinLong()), Utils.toDegrees(b.getMaxLat()), Utils.toDegrees(b.getMaxLong())); pw.println(); @@ -107,7 +109,7 @@ String line; while ((line = br.readLine()) != null) { line = line.trim(); - if (line.isEmpty() || line.charAt(0) == '#') + if ((line != null && line.length() == 0) || line.charAt(0) == '#') continue; Matcher matcher = pattern.matcher(line); Index: src/uk/me/parabola/splitter/SubArea.java =================================================================== --- src/uk/me/parabola/splitter/SubArea.java (revision 31) +++ src/uk/me/parabola/splitter/SubArea.java (working copy) @@ -90,7 +90,8 @@ bounds.getMaxLat() + extra, bounds.getMaxLong() + extra); - String filename = new Formatter().format(Locale.ROOT, "%08d.osm.gz", mapid).toString(); + Locale rootlocale = new Locale("", "", ""); + String filename = new Formatter().format(rootlocale, "%08d.osm.gz", mapid).toString(); try { FileOutputStream fos = new FileOutputStream(filename); OutputStream zos = new GZIPOutputStream(fos);
- Previous message: [mkgmap-dev] exception in --list-styles
- Next message: [mkgmap-dev] [PATCH] splitter with Java 5, was: exception in --list-styles
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list