Changeset 2342 in josm for trunk/src


Ignore:
Timestamp:
2009-10-28T19:37:10+01:00 (14 years ago)
Author:
Gubaer
Message:

applied #1100: patch by bastikK: Tolerate minor errors in GPX loader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r2211 r2342  
    5858        private StringBuffer accumulator = new StringBuffer();
    5959
     60        private boolean nokiaSportsTrackerBug = false;
     61
    6062        @Override public void startDocument() {
    6163            accumulator = new StringBuffer();
     
    99101                        states.push(currentState);
    100102                        currentState = state.ext;
     103                    } else if (qName.equals("gpx") && atts.getValue("creator").startsWith("Nokia Sports Tracker")) {
     104                        nokiaSportsTrackerBug = true;
    101105                    }
    102106                    break;
     
    178182
    179183        @Override public void characters(char[] ch, int start, int length) {
     184            /**
     185             * Remove illegal characters generated by the Nokia Sports Tracker device.
     186             * Don't do this crude substitution for all files, since it would destroy
     187             * certain unicode characters.
     188             */
     189            if (nokiaSportsTrackerBug) {
     190                for (int i=0; i<ch.length; ++i) {
     191                    if (ch[i] == 1) {
     192                        ch[i] = 32;
     193                    }
     194                }
     195                nokiaSportsTrackerBug = false;
     196            }
     197
    180198            accumulator.append(ch, start, length);
    181199        }
Note: See TracChangeset for help on using the changeset viewer.