Hi

Thanks for reporting this.

java.lang.ClassCastException: uk.me.parabola.imgfmt.app.srt.MultiSortKey
cannot be cast to uk.me.parabola.imgfmt.app.srt.SrtSortKey
        at 
uk.me.parabola.imgfmt.app.srt.SrtSortKey.compareTo(SrtSortKey.java:39)
        at 
uk.me.parabola.imgfmt.app.srt.SrtSortKey.compareTo(SrtSortKey.java:22)

This is a bad bug, although I don't know why it doesn't show all the time. I have not observed it, but I believe that the attached patch will fix it.

Thanks

..Steve
Index: src/uk/me/parabola/imgfmt/app/net/NETFile.java
===================================================================
--- src/uk/me/parabola/imgfmt/app/net/NETFile.java	(revision 2103)
+++ src/uk/me/parabola/imgfmt/app/net/NETFile.java	(revision )
@@ -29,7 +29,7 @@
 import uk.me.parabola.imgfmt.app.ImgFileWriter;
 import uk.me.parabola.imgfmt.app.Label;
 import uk.me.parabola.imgfmt.app.lbl.City;
-import uk.me.parabola.imgfmt.app.srt.CombinedSortKey;
+import uk.me.parabola.imgfmt.app.srt.IntegerSortKey;
 import uk.me.parabola.imgfmt.app.srt.MultiSortKey;
 import uk.me.parabola.imgfmt.app.srt.Sort;
 import uk.me.parabola.imgfmt.app.srt.SortKey;
@@ -125,19 +125,21 @@
 
 				// Sort by name, city, region/country and subdivision number.
 				LabeledRoadDef lrd = new LabeledRoadDef(label, rd);
-				SortKey<LabeledRoadDef> sortKey = sort.createSortKey(lrd, label.getText(), 0, cache);
+				SortKey<LabeledRoadDef> nameKey = sort.createSortKey(lrd, label.getText(), 0, cache);
 
 				// If there is a city add it to the sort.
 				City city = rd.getCity();
+				SortKey<LabeledRoadDef> cityKey;
 				if (city != null) {
 					int region = city.getRegionNumber();
 					int country = city.getCountryNumber();
-					SortKey<LabeledRoadDef> cityKey = sort.createSortKey(null, city.getName(),
-							(region & 0xffff) << 16 | (country & 0xffff), cache);
-					sortKey = new MultiSortKey<LabeledRoadDef>(sortKey, cityKey, null);
+					cityKey = sort.createSortKey(null, city.getName(), (region & 0xffff) << 16 | (country & 0xffff), cache);
+				} else {
+					cityKey = sort.createSortKey(null, "", 0, cache);
 				}
 
-				sortKey = new CombinedSortKey<LabeledRoadDef>(sortKey, rd.getStartSubdivNumber(), 0);
+				SortKey<LabeledRoadDef> sortKey = new MultiSortKey<LabeledRoadDef>(nameKey, cityKey,
+						new IntegerSortKey<LabeledRoadDef>(null, rd.getStartSubdivNumber(), 0));
 				sortKeys.add(sortKey);
 			}
 		}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to