handling of a key without a value

https://www.openstreetmap.org/node/7278416985 That node seems to crash my style while trying to execute the following command: ele=* {echo 'ele=${ele}'; set ele_m='${ele|conv:"ft=>m"}'; echo 'ele_m=${ele}'; } The echo command produces "ele=" in the transcript, afterwards "java.lang.StringIndexOutOfBoundsException: String index out of range: -1" etc. The node contains any empty values. "ele" is the only of them my style uses. Observed in: mkgmap-r4478

Hi Joern, looks like the node was creaed in a bad import. I was sure that mkgmap drops all tags where the value is empty but this doesn't happen. The attached patch changes this. Anyway, it is probably also possible to create an empty tag in the style rules, so I think we have to decide if ele=* should match when ele has an empty tag value. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von J J <joern.de@gmail.com> Gesendet: Donnerstag, 9. April 2020 23:21 An: Development list for mkgmap Betreff: [mkgmap-dev] handling of a key without a value https://www.openstreetmap.org/node/7278416985 That node seems to crash my style while trying to execute the following command: ele=* {echo 'ele=${ele}'; set ele_m='${ele|conv:"ft=>m"}'; echo 'ele_m=${ele}'; } The echo command produces "ele=" in the transcript, afterwards "java.lang.StringIndexOutOfBoundsException: String index out of range: -1" etc. The node contains any empty values. "ele" is the only of them my style uses. Observed in: mkgmap-r4478

Hi Gerd, I'm not crafty enough to apply the patch, maybe a later release drops the tags empty values. Until this ist provided I code ele=*& ele!="" to compile my map. I don't blame the asterisk since it behaves as expected (* = any occurrences, including no occurence). I prefer to harden the called function as you suggested (if (val.isEmpty()) return null;) So my work-around is a formally correct (but inconvenient) way. Even the default style doesn't care about that. Thanks for solving, Joern Am Fr., 10. Apr. 2020 um 08:27 Uhr schrieb Gerd Petermann < gpetermann_muenchen@hotmail.com>:
Hi Joern,
looks like the node was creaed in a bad import. I was sure that mkgmap drops all tags where the value is empty but this doesn't happen. The attached patch changes this.
Anyway, it is probably also possible to create an empty tag in the style rules, so I think we have to decide if ele=* should match when ele has an empty tag value.
Gerd
________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von J J <joern.de@gmail.com> Gesendet: Donnerstag, 9. April 2020 23:21 An: Development list for mkgmap Betreff: [mkgmap-dev] handling of a key without a value
https://www.openstreetmap.org/node/7278416985 That node seems to crash my style while trying to execute the following command: ele=* {echo 'ele=${ele}'; set ele_m='${ele|conv:"ft=>m"}'; echo 'ele_m=${ele}'; } The echo command produces "ele=" in the transcript, afterwards "java.lang.StringIndexOutOfBoundsException: String index out of range: -1" etc. The node contains any empty values. "ele" is the only of them my style uses. Observed in: mkgmap-r4478 _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (2)
-
Gerd Petermann
-
J J