Ticket #8218: 8218.patch

File 8218.patch, 3.4 KB (added by simon04, 13 years ago)
  • src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    diff --git a/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java b/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
    index 1bd2c8a..5707381 100644
    a b public class TagChecker extends Test  
    148148     * Constructor
    149149     */
    150150    public TagChecker() {
    151         super(tr("Properties checker :"),
     151        super(tr("Properties checker:"),
    152152                tr("This plugin checks for errors in property keys and values."));
    153153    }
    154154
    public class TagChecker extends Test  
    213213                BufferedReader reader = new BufferedReader(r);
    214214
    215215                String okValue = null;
    216                 boolean tagcheckerfile = false;
    217                 boolean ignorefile = false;
     216                boolean tagcheckerFile = false;
     217                boolean ignoreFile = false;
    218218                String line;
    219                 while ((line = reader.readLine()) != null && (tagcheckerfile || line.length() != 0)) {
     219                while ((line = reader.readLine()) != null && (tagcheckerFile || line.length() != 0)) {
     220                    System.out.println(line + tagcheckerFile + ignoreFile);
    220221                    if (line.startsWith("#")) {
    221222                        if (line.startsWith("# JOSM TagChecker")) {
    222                             tagcheckerfile = true;
    223                         }
    224                         if (line.startsWith("# JOSM IgnoreTags")) {
    225                             ignorefile = true;
     223                            tagcheckerFile = true;
     224                            ignoreFile = false;
     225                        } else if (line.startsWith("# JOSM IgnoreTags")) {
     226                            ignoreFile = true;
     227                            tagcheckerFile = false;
     228                        } else if (!tagcheckerFile && !ignoreFile) {
     229                            System.err.println(tr("Missing/invalid header line (either ''{0}'' or ''{1}'') in line {2}", "# JOSM TagChecker", "# JOSM IgnoreTags", line));
    226230                        }
    227231                        continue;
    228                     } else if (ignorefile) {
     232                    } else if (ignoreFile) {
    229233                        line = line.trim();
    230234                        if (line.length() < 4) {
    231235                            continue;
    public class TagChecker extends Test  
    248252                            ignoreDataKeyPair.add(tmp);
    249253                        }
    250254                        continue;
    251                     } else if (tagcheckerfile) {
     255                    } else if (tagcheckerFile) {
    252256                        if (line.length() > 0) {
    253257                            CheckerData d = new CheckerData();
    254258                            String err = d.getData(line);
    public class TagChecker extends Test  
    263267                        okValue = line.substring(1);
    264268                    } else if (line.charAt(0) == '-' && okValue != null) {
    265269                        spellCheckKeyData.put(line.substring(1), okValue);
     270                    } else if (!tagcheckerFile && !ignoreFile) {
     271                        System.err.println(tr("Missing/invalid header line (either ''{0}'' or ''{1}'') in line {2}", "# JOSM TagChecker", "# JOSM IgnoreTags", line));
    266272                    } else {
    267273                        System.err.println(tr("Invalid spellcheck line: {0}", line));
    268274                    }