Changeset 6650 in josm for trunk


Ignore:
Timestamp:
2014-01-06T19:21:52+01:00 (11 years ago)
Author:
simon04
Message:

see #9414 see #9542 - MapCSS validator: handle BOM in config files

Location:
trunk/src/org/openstreetmap/josm
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r6649 r6650  
    4343import org.openstreetmap.josm.gui.widgets.EditableList;
    4444import org.openstreetmap.josm.io.MirroredInputStream;
     45import org.openstreetmap.josm.io.UTFInputStreamReader;
    4546import org.openstreetmap.josm.tools.CheckParameterUtil;
    4647import org.openstreetmap.josm.tools.GBC;
     
    429430            try {
    430431                Main.info(tr("Adding {0} to tag checker", i));
    431                 addMapCSS(new BufferedReader(new InputStreamReader(new MirroredInputStream(i), Utils.UTF_8)));
     432                addMapCSS(new BufferedReader(UTFInputStreamReader.create(new MirroredInputStream(i))));
    432433            } catch (Exception ex) {
    433434                Main.warn(new RuntimeException(tr("Failed to add {0} to tag checker", i), ex));
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r6644 r6650  
    167167            try {
    168168                MirroredInputStream s = new MirroredInputStream(source);
    169                 reader = new BufferedReader(UTFInputStreamReader.create(s, "UTF-8"));
     169                reader = new BufferedReader(UTFInputStreamReader.create(s));
    170170
    171171                String okValue = null;
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r6336 r6650  
    330330            protected byte[] updateData() throws IOException {
    331331                URL u = getAttributionUrl();
    332                 UTFInputStreamReader in = UTFInputStreamReader.create(Utils.openURL(u), "utf-8");
     332                UTFInputStreamReader in = UTFInputStreamReader.create(Utils.openURL(u));
    333333                String r = new Scanner(in).useDelimiter("\\A").next();
    334334                Utils.close(in);
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r6643 r6650  
    430430     */
    431431    public GpxReader(InputStream source) throws IOException {
    432         Reader utf8stream = UTFInputStreamReader.create(source, "UTF-8");
     432        Reader utf8stream = UTFInputStreamReader.create(source);
    433433        Reader filtered = new InvalidXmlCharacterFilter(utf8stream);
    434434        this.inputSource = new InputSource(filtered);
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r6621 r6650  
    589589            progressMonitor.indeterminateSubTask(tr("Parsing OSM data..."));
    590590
    591             InputStreamReader ir = UTFInputStreamReader.create(source, "UTF-8");
     591            InputStreamReader ir = UTFInputStreamReader.create(source);
    592592            XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(ir);
    593593            setParser(parser);
  • trunk/src/org/openstreetmap/josm/io/UTFInputStreamReader.java

    r6362 r6650  
    1414   
    1515    /**
    16      * converts input stream to reader
     16     * Creates a new {@link InputStreamReader} from the {@link InputStream} with UTF-8 as default encoding.
     17     * @return A reader with the correct encoding. Starts to read after the BOM.
     18     * @see #create(java.io.InputStream, String)
     19     */
     20    public static UTFInputStreamReader create(InputStream input) throws IOException {
     21        return create(input, "UTF-8");
     22    }
     23
     24    /**
     25     * Creates a new {@link InputStreamReader} from the {@link InputStream}.
    1726     * @param defaultEncoding Used, when no BOM was recognized. Can be null.
    1827     * @return A reader with the correct encoding. Starts to read after the BOM.
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r6643 r6650  
    5353            factory.setNamespaceAware(true);
    5454            InputStream in = new MirroredInputStream(source);
    55             InputSource is = new InputSource(UTFInputStreamReader.create(in, "UTF-8"));
     55            InputSource is = new InputSource(UTFInputStreamReader.create(in));
    5656            factory.newSAXParser().parse(is, parser);
    5757            return parser.entries;
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r6289 r6650  
    131131        URLConnection openConnection = Utils.openHttpConnection(getCapabilitiesUrl);
    132132        InputStream inputStream = openConnection.getInputStream();
    133         BufferedReader br = new BufferedReader(UTFInputStreamReader.create(inputStream, "UTF-8"));
     133        BufferedReader br = new BufferedReader(UTFInputStreamReader.create(inputStream));
    134134        String line;
    135135        StringBuilder ba = new StringBuilder();
Note: See TracChangeset for help on using the changeset viewer.