Changeset 7082 in josm for trunk


Ignore:
Timestamp:
2014-05-09T05:32:37+02:00 (10 years ago)
Author:
Don-vip
Message:

see #8465 - replace Utils.UTF_8 by StandardCharsets.UTF_8, new in Java 7

Location:
trunk
Files:
54 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r7037 r7082  
    1313import java.io.IOException;
    1414import java.io.InputStreamReader;
     15import java.nio.charset.StandardCharsets;
    1516import java.util.ArrayList;
    1617import java.util.Arrays;
     
    3940import org.openstreetmap.josm.tools.MultiMap;
    4041import org.openstreetmap.josm.tools.Shortcut;
    41 import org.openstreetmap.josm.tools.Utils;
    4242import org.xml.sax.SAXException;
    4343
     
    292292
    293293                for (File urlFile: urlFiles) {
    294                     try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), Utils.UTF_8))) {
     294                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), StandardCharsets.UTF_8))) {
    295295                        String line;
    296296                        while ((line = reader.readLine()) != null) {
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r7037 r7082  
    1212import java.io.PrintStream;
    1313import java.lang.management.ManagementFactory;
     14import java.nio.charset.StandardCharsets;
    1415import java.util.ArrayList;
    1516import java.util.Date;
     
    4041import org.openstreetmap.josm.io.OsmExporter;
    4142import org.openstreetmap.josm.io.OsmImporter;
    42 import org.openstreetmap.josm.tools.Utils;
    4343
    4444/**
     
    303303                File pidFile = getPidFile(file);
    304304                if (pidFile.exists()) {
    305                     try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), Utils.UTF_8))) {
     305                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), StandardCharsets.UTF_8))) {
    306306                        String jvmId = reader.readLine();
    307307                        if (jvmId != null) {
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r7033 r7082  
    1111import java.io.FileInputStream;
    1212import java.io.InputStream;
     13import java.nio.charset.StandardCharsets;
    1314import java.util.ArrayList;
    1415import java.util.Collection;
     
    236237        try {
    237238            String toXML = Main.pref.toXML(true);
    238             InputStream is = new ByteArrayInputStream(toXML.getBytes(Utils.UTF_8));
     239            InputStream is = new ByteArrayInputStream(toXML.getBytes(StandardCharsets.UTF_8));
    239240            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
    240241            builderFactory.setValidating(false);
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r7033 r7082  
    1919import java.lang.annotation.RetentionPolicy;
    2020import java.lang.reflect.Field;
     21import java.nio.charset.StandardCharsets;
    2122import java.util.ArrayList;
    2223import java.util.Collection;
     
    737738
    738739        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(
    739                 new FileOutputStream(prefFile + "_tmp"), Utils.UTF_8), false)) {
     740                new FileOutputStream(prefFile + "_tmp"), StandardCharsets.UTF_8), false)) {
    740741            out.print(toXML(false));
    741742        }
     
    760761        settingsMap.clear();
    761762        File pref = getPreferenceFile();
    762         try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8))) {
     763        try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), StandardCharsets.UTF_8))) {
    763764            validateXML(in);
    764765        }
    765         try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), Utils.UTF_8))) {
     766        try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(pref), StandardCharsets.UTF_8))) {
    766767            fromXML(in);
    767768        }
  • trunk/src/org/openstreetmap/josm/data/projection/Projections.java

    r7048 r7082  
    66import java.io.InputStream;
    77import java.io.InputStreamReader;
     8import java.nio.charset.StandardCharsets;
    89import java.util.Collection;
    910import java.util.Collections;
     
    3334import org.openstreetmap.josm.io.MirroredInputStream;
    3435import org.openstreetmap.josm.tools.Pair;
    35 import org.openstreetmap.josm.tools.Utils;
    3636
    3737/**
     
    134134        try (
    135135            InputStream in = new MirroredInputStream("resource://data/projection/epsg");
    136             BufferedReader r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8));
     136            BufferedReader r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
    137137        ) {
    138138            String line, lastline = "";
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r7037 r7082  
    2323import java.io.InputStream;
    2424import java.io.Serializable;
     25import java.nio.charset.StandardCharsets;
    2526import java.util.ArrayList;
    2627import java.util.HashMap;
    2728import java.util.List;
    28 
    29 import org.openstreetmap.josm.tools.Utils;
    3029
    3130/**
     
    104103        topLevelSubGrid = null;
    105104        in.read(b8);
    106         String overviewHeaderCountId = new String(b8, Utils.UTF_8);
     105        String overviewHeaderCountId = new String(b8, StandardCharsets.UTF_8);
    107106        if (!"NUM_OREC".equals(overviewHeaderCountId))
    108107            throw new IllegalArgumentException("Input file is not an NTv2 grid shift file");
     
    127126        in.read(b8);
    128127        in.read(b8);
    129         shiftType = new String(b8, Utils.UTF_8);
     128        shiftType = new String(b8, StandardCharsets.UTF_8);
    130129        in.read(b8);
    131130        in.read(b8);
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java

    r7025 r7082  
    2323import java.io.InputStream;
    2424import java.io.Serializable;
     25import java.nio.charset.StandardCharsets;
    2526
    2627import org.openstreetmap.josm.Main;
     
    7576        in.read(b8);
    7677        in.read(b8);
    77         subGridName = new String(b8, Utils.UTF_8).trim();
    78         in.read(b8);
    79         in.read(b8);
    80         parentSubGridName = new String(b8, Utils.UTF_8).trim();
    81         in.read(b8);
    82         in.read(b8);
    83         created = new String(b8, Utils.UTF_8);
    84         in.read(b8);
    85         in.read(b8);
    86         updated = new String(b8, Utils.UTF_8);
     78        subGridName = new String(b8, StandardCharsets.UTF_8).trim();
     79        in.read(b8);
     80        in.read(b8);
     81        parentSubGridName = new String(b8, StandardCharsets.UTF_8).trim();
     82        in.read(b8);
     83        in.read(b8);
     84        created = new String(b8, StandardCharsets.UTF_8);
     85        in.read(b8);
     86        in.read(b8);
     87        updated = new String(b8, StandardCharsets.UTF_8);
    8788        in.read(b8);
    8889        in.read(b8);
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r7033 r7082  
    1313import java.io.OutputStreamWriter;
    1414import java.io.PrintWriter;
     15import java.nio.charset.StandardCharsets;
    1516import java.util.ArrayList;
    1617import java.util.Arrays;
     
    171172            File file = new File(getValidatorDir() + "ignorederrors");
    172173            if (file.exists()) {
    173                 try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF_8))) {
     174                try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
    174175                    for (String line = in.readLine(); line != null; line = in.readLine()) {
    175176                        ignoredErrors.add(line);
     
    194195    public static void saveIgnoredErrors() {
    195196        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(
    196                 new FileOutputStream(getValidatorDir() + "ignorederrors"), Utils.UTF_8), false)) {
     197                new FileOutputStream(getValidatorDir() + "ignorederrors"), StandardCharsets.UTF_8), false)) {
    197198            for (String e : ignoredErrors) {
    198199                out.println(e);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r7046 r7082  
    66import java.io.InputStreamReader;
    77import java.io.Reader;
     8import java.nio.charset.StandardCharsets;
    89import java.util.ArrayList;
    910import java.util.Arrays;
     
    2425import org.openstreetmap.josm.data.validation.TestError;
    2526import org.openstreetmap.josm.io.MirroredInputStream;
    26 import org.openstreetmap.josm.tools.Utils;
    2727
    2828/**
     
    5353        if (ENGINE != null) {
    5454            try (Reader reader = new InputStreamReader(
    55                     new MirroredInputStream("resource://data/validator/opening_hours.js"), Utils.UTF_8)) {
     55                    new MirroredInputStream("resource://data/validator/opening_hours.js"), StandardCharsets.UTF_8)) {
    5656                ENGINE.eval(reader);
    5757                // fake country/state to not get errors on holidays
     
    218218        return errors;
    219219    }
    220    
     220
    221221    /**
    222222     * Translates and shortens the error/warning message.
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r7075 r7082  
    1212import java.io.IOException;
    1313import java.net.URL;
     14import java.nio.charset.StandardCharsets;
    1415import java.util.regex.Matcher;
    1516import java.util.regex.Pattern;
     
    3132import org.openstreetmap.josm.tools.LanguageInfo;
    3233import org.openstreetmap.josm.tools.OpenBrowser;
    33 import org.openstreetmap.josm.tools.Utils;
    3434import org.openstreetmap.josm.tools.WikiReader;
    3535
     
    9292            Main.pref.put("cache.motd.html.java", myJava);
    9393            Main.pref.put("cache.motd.html.lang", myLang);
    94             return motd.getBytes(Utils.UTF_8);
     94            return motd.getBytes(StandardCharsets.UTF_8);
    9595        }
    9696
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r7005 r7082  
    99import java.awt.geom.AffineTransform;
    1010import java.awt.geom.Point2D;
     11import java.nio.charset.StandardCharsets;
    1112import java.util.ArrayList;
    1213import java.util.Collection;
     
    13281329                getWidth() + "_" + getHeight() + "_" + getProjection().toString();
    13291330        CRC32 id = new CRC32();
    1330         id.update(x.getBytes(Utils.UTF_8));
     1331        id.update(x.getBytes(StandardCharsets.UTF_8));
    13311332        return (int)id.getValue();
    13321333    }
     
    13701371
    13711372    private LinkedList<CursorInfo> cursors = new LinkedList<>();
    1372    
     1373
    13731374    /**
    13741375     * Set new cursor.
     
    13841385        setCursor(cursor);
    13851386    }
    1386    
     1387
    13871388    public void setNewCursor(int cursor, Object reference) {
    13881389        setNewCursor(Cursor.getPredefinedCursor(cursor), reference);
    13891390    }
    1390    
     1391
    13911392    /**
    13921393     * Remove the new cursor and reset to previous
  • trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java

    r7033 r7082  
    2525import java.io.InputStreamReader;
    2626import java.io.OutputStream;
     27import java.nio.charset.StandardCharsets;
    2728import java.util.ArrayList;
    2829import java.util.Arrays;
     
    655656            try {
    656657                InputStream is = s.getSourceInputStream();
    657                 try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))) {
     658                try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
    658659                    String line;
    659660                    while ((line = reader.readLine()) != null) {
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r7033 r7082  
    1818import java.net.HttpURLConnection;
    1919import java.net.URL;
     20import java.nio.charset.StandardCharsets;
    2021import java.text.DecimalFormat;
    2122import java.util.ArrayList;
     
    371372                try (
    372373                    InputStream inputStream = connection.getInputStream();
    373                     Reader reader = new InputStreamReader(inputStream, Utils.UTF_8);
     374                    Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
    374375                ) {
    375376                    InputSource inputSource = new InputSource(reader);
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r7033 r7082  
    1616import java.io.InputStreamReader;
    1717import java.io.StringReader;
     18import java.nio.charset.StandardCharsets;
    1819import java.util.Locale;
    1920import java.util.Observable;
     
    5253import org.openstreetmap.josm.tools.LanguageInfo.LocaleType;
    5354import org.openstreetmap.josm.tools.OpenBrowser;
    54 import org.openstreetmap.josm.tools.Utils;
    5555import org.openstreetmap.josm.tools.WindowGeometry;
    5656
     
    138138        try (BufferedReader reader = new BufferedReader(
    139139                new InputStreamReader(
    140                         getClass().getResourceAsStream("/data/help-browser.css"), Utils.UTF_8
     140                        getClass().getResourceAsStream("/data/help-browser.css"), StandardCharsets.UTF_8
    141141                )
    142142        )) {
  • trunk/src/org/openstreetmap/josm/gui/help/HelpContentReader.java

    r7037 r7082  
    88import java.net.MalformedURLException;
    99import java.net.URL;
     10import java.nio.charset.StandardCharsets;
    1011
    1112import org.openstreetmap.josm.tools.Utils;
     
    4950            con = Utils.openHttpConnection(u);
    5051            con.connect();
    51             try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), Utils.UTF_8))) {
     52            try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8))) {
    5253                return prepareHelpContent(in, dotest, u);
    5354            }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r7030 r7082  
    77import java.io.IOException;
    88import java.io.InputStreamReader;
     9import java.nio.charset.StandardCharsets;
    910import java.util.ArrayList;
    1011import java.util.Arrays;
     
    235236                return new XmlStyleSource(entry);
    236237            else {
    237                 try (InputStreamReader reader = new InputStreamReader(in, Utils.UTF_8)) {
     238                try (InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) {
    238239                    WHILE: while (true) {
    239240                        int c = reader.read();
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactory.java

    r7022 r7082  
    1414import java.lang.reflect.Method;
    1515import java.net.URLEncoder;
     16import java.nio.charset.StandardCharsets;
    1617import java.util.ArrayList;
    1718import java.util.Arrays;
     
    579580        public static long CRC32_checksum(String s) {
    580581            CRC32 cs = new CRC32();
    581             cs.update(s.getBytes(Utils.UTF_8));
     582            cs.update(s.getBytes(StandardCharsets.UTF_8));
    582583            return cs.getValue();
    583584        }
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSource.java

    r7081 r7082  
    99import java.io.IOException;
    1010import java.io.InputStream;
     11import java.nio.charset.StandardCharsets;
    1112import java.util.ArrayList;
    1213import java.util.List;
     
    5354    public final List<MapCSSRule> multipolygonRules = new ArrayList<>();
    5455    public final List<MapCSSRule> canvasRules = new ArrayList<>();
    55    
     56
    5657    private Color backgroundColorOverride;
    5758    private String css = null;
     
    9394                MapCSSParser preprocessor = new MapCSSParser(in, "UTF-8", MapCSSParser.LexicalState.PREPROCESSOR);
    9495                String mapcss = preprocessor.pp_root(this);
    95                
     96
    9697                // do the actual mapcss parsing
    97                 InputStream in2 = new ByteArrayInputStream(mapcss.getBytes(Utils.UTF_8));
     98                InputStream in2 = new ByteArrayInputStream(mapcss.getBytes(StandardCharsets.UTF_8));
    9899                MapCSSParser parser = new MapCSSParser(in2, "UTF-8", MapCSSParser.LexicalState.DEFAULT);
    99100                parser.sheet(this);
    100                
     101
    101102                loadMeta();
    102103                loadCanvas();
     
    155156    public InputStream getSourceInputStream() throws IOException {
    156157        if (css != null) {
    157             return new ByteArrayInputStream(css.getBytes(Utils.UTF_8));
     158            return new ByteArrayInputStream(css.getBytes(StandardCharsets.UTF_8));
    158159        }
    159160        MirroredInputStream in = getMirroredInputStream();
     
    250251            }
    251252        }
    252        
     253
    253254        // the declaration indices are sorted, so it suffices to save the
    254255        // last used index
    255256        int lastDeclUsed = -1;
    256        
     257
    257258        for (MapCSSRule r : matchingRules) {
    258259            env.clearSelectorMatchingInformation();
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r7081 r7082  
    77import java.io.InputStream;
    88import java.io.InputStreamReader;
     9import java.nio.charset.StandardCharsets;
    910import java.util.Collection;
    1011import java.util.Collections;
     
    7778            try (
    7879                InputStream in = getSourceInputStream();
    79                 InputStreamReader reader = new InputStreamReader(in, Utils.UTF_8)
     80                InputStreamReader reader = new InputStreamReader(in, StandardCharsets.UTF_8)
    8081            ) {
    8182                XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this));
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r7037 r7082  
    1515import java.net.URL;
    1616import java.net.URLEncoder;
     17import java.nio.charset.StandardCharsets;
    1718import java.util.HashMap;
    1819import java.util.Iterator;
     
    200201        try (
    201202            InputStream is = connection.getInputStream();
    202             BufferedReader r = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))
     203            BufferedReader r = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))
    203204        ) {
    204205            String c;
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r7025 r7082  
    2626import java.net.MalformedURLException;
    2727import java.net.URL;
     28import java.nio.charset.StandardCharsets;
    2829import java.util.ArrayList;
    2930import java.util.Arrays;
     
    124125        this.sourceType = sourceType;
    125126        this.canEnable = sourceType.equals(SourceType.MAP_PAINT_STYLE) || sourceType.equals(SourceType.TAGCHECKER_RULE);
    126        
     127
    127128        DefaultListSelectionModel selectionModel = new DefaultListSelectionModel();
    128129        this.availableSourcesModel = new AvailableSourcesListModel(selectionModel);
     
    718719            fileChooser.setMargin(new Insets(0, 0, 0, 0));
    719720            p.add(fileChooser, GBC.eol().insets(0, 0, 5, 5));
    720            
     721
    721722            if (e != null) {
    722723                if (e.title != null) {
     
    12121213    static class SourceEntryListCellRenderer extends JLabel implements ListCellRenderer<ExtendedSourceEntry> {
    12131214        @Override
    1214         public Component getListCellRendererComponent(JList<? extends ExtendedSourceEntry> list, ExtendedSourceEntry value, 
     1215        public Component getListCellRendererComponent(JList<? extends ExtendedSourceEntry> list, ExtendedSourceEntry value,
    12151216                int index, boolean isSelected, boolean cellHasFocus) {
    12161217            String s = value.toString();
     
    12801281
    12811282                MirroredInputStream stream = new MirroredInputStream(url);
    1282                 reader = new BufferedReader(new InputStreamReader(stream, Utils.UTF_8));
     1283                reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8));
    12831284
    12841285                String line;
     
    16051606        }
    16061607    }
    1607    
     1608
    16081609    /**
    16091610     * Defers loading of sources to the first time the adequate tab is selected.
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java

    r7037 r7082  
    1111import java.net.MalformedURLException;
    1212import java.net.URL;
     13import java.nio.charset.StandardCharsets;
    1314
    1415import javax.swing.JOptionPane;
     
    194195            }
    195196            StringBuilder changesets = new StringBuilder();
    196             try (BufferedReader bin = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8))) {
     197            try (BufferedReader bin = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
    197198                String line;
    198199                while ((line = bin.readLine()) != null) {
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetReader.java

    r7033 r7082  
    1010import java.io.InputStreamReader;
    1111import java.io.Reader;
     12import java.nio.charset.StandardCharsets;
    1213import java.util.ArrayList;
    1314import java.util.Collection;
     
    2526import org.openstreetmap.josm.gui.preferences.map.TaggingPresetPreference;
    2627import org.openstreetmap.josm.io.MirroredInputStream;
    27 import org.openstreetmap.josm.tools.Utils;
    2828import org.openstreetmap.josm.tools.XmlObjectParser;
    2929import org.xml.sax.SAXException;
     
    4040     */
    4141    public static final String PRESET_MIME_TYPES = "application/xml, text/xml, text/plain; q=0.8, application/zip, application/octet-stream; q=0.5";
    42    
     42
    4343    private TaggingPresetReader() {
    4444        // Hide default constructor for utils classes
    4545    }
    46    
     46
    4747    private static File zipIcons = null;
    48    
     48
    4949    /**
    5050     * Returns the set of preset source URLs.
     
    7070        public String ref;
    7171    }
    72    
     72
    7373    public static List<TaggingPreset> readAll(Reader in, boolean validate) throws SAXException {
    7474        XmlObjectParser parser = new XmlObjectParser();
     
    222222        return all;
    223223    }
    224    
     224
    225225    public static Collection<TaggingPreset> readAll(String source, boolean validate) throws SAXException, IOException {
    226226        Collection<TaggingPreset> tp;
     
    233233                zipIcons = s.getFile();
    234234            }
    235             try (InputStreamReader r = new InputStreamReader(zip == null ? s : zip, Utils.UTF_8)) {
     235            try (InputStreamReader r = new InputStreamReader(zip == null ? s : zip, StandardCharsets.UTF_8)) {
    236236                tp = readAll(new BufferedReader(r), validate);
    237237            }
     
    289289        return allPresets;
    290290    }
    291    
     291
    292292    /**
    293293     * Reads all tagging presets from sources stored in preferences.
     
    299299        return readAll(getPresetSources(), validate, displayErrMsg);
    300300    }
    301    
     301
    302302    public static File getZipIcons() {
    303303        return zipIcons;
  • trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java

    r7033 r7082  
    88import java.io.FileOutputStream;
    99import java.io.IOException;
     10import java.nio.charset.StandardCharsets;
    1011
    1112import org.openstreetmap.josm.Main;
    12 import org.openstreetmap.josm.tools.Utils;
    1313
    1414/**
     
    119119    public String updateForceString() throws T {
    120120        updateForce();
    121         return new String(data, Utils.UTF_8);
     121        return new String(data, StandardCharsets.UTF_8);
    122122    }
    123123
     
    138138     */
    139139    public String getDataString() throws T {
    140         return new String(getData(), Utils.UTF_8);
     140        return new String(getData(), StandardCharsets.UTF_8);
    141141    }
    142142
  • trunk/src/org/openstreetmap/josm/io/CacheFiles.java

    r7033 r7082  
    66import java.io.RandomAccessFile;
    77import java.math.BigInteger;
     8import java.nio.charset.StandardCharsets;
    89import java.security.MessageDigest;
    910import java.util.Iterator;
     
    1415
    1516import org.openstreetmap.josm.Main;
    16 import org.openstreetmap.josm.tools.Utils;
    1717
    1818/**
     
    321321        try {
    322322            MessageDigest md = MessageDigest.getInstance("MD5");
    323             BigInteger number = new BigInteger(1, md.digest(ident.getBytes(Utils.UTF_8)));
     323            BigInteger number = new BigInteger(1, md.digest(ident.getBytes(StandardCharsets.UTF_8)));
    324324            return number.toString(16);
    325325        } catch(Exception e) {
  • trunk/src/org/openstreetmap/josm/io/GeoJSONExporter.java

    r7033 r7082  
    1010import java.io.OutputStreamWriter;
    1111import java.io.Writer;
     12import java.nio.charset.StandardCharsets;
    1213
    1314import org.openstreetmap.josm.actions.ExtensionFileFilter;
    1415import org.openstreetmap.josm.gui.layer.Layer;
    1516import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    16 import org.openstreetmap.josm.tools.Utils;
    1717
    1818public class GeoJSONExporter extends FileExporter {
     
    3232        if (layer instanceof OsmDataLayer) {
    3333            String json = new GeoJSONWriter((OsmDataLayer) layer).write();
    34             try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Utils.UTF_8))) {
     34            try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8))) {
    3535                out.write(json);
    3636            }
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r7033 r7082  
    88import java.io.OutputStreamWriter;
    99import java.io.PrintWriter;
     10import java.nio.charset.StandardCharsets;
    1011import java.util.Collection;
    1112import java.util.Map;
     
    2526import org.openstreetmap.josm.data.gpx.IWithAttributes;
    2627import org.openstreetmap.josm.data.gpx.WayPoint;
    27 import org.openstreetmap.josm.tools.Utils;
    2828
    2929/**
     
    3737
    3838    public GpxWriter(OutputStream out) {
    39         super(new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, Utils.UTF_8))));
     39        super(new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8))));
    4040    }
    4141
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r7049 r7082  
    55import java.io.InputStream;
    66import java.io.InputStreamReader;
     7import java.nio.charset.StandardCharsets;
    78import java.text.ParsePosition;
    89import java.text.SimpleDateFormat;
     
    1819import org.openstreetmap.josm.data.gpx.WayPoint;
    1920import org.openstreetmap.josm.tools.DateUtils;
    20 import org.openstreetmap.josm.tools.Utils;
    2121
    2222/**
     
    170170        Collection<Collection<WayPoint>> currentTrack = new ArrayList<>();
    171171
    172         try (BufferedReader rd = new BufferedReader(new InputStreamReader(source, Utils.UTF_8))) {
     172        try (BufferedReader rd = new BufferedReader(new InputStreamReader(source, StandardCharsets.UTF_8))) {
    173173            StringBuilder sb = new StringBuilder(1024);
    174174            int loopstart_char = rd.read();
     
    235235            if(chkstrings.length > 1)
    236236            {
    237                 byte[] chb = chkstrings[0].getBytes(Utils.UTF_8);
     237                byte[] chb = chkstrings[0].getBytes(StandardCharsets.UTF_8);
    238238                int chk=0;
    239239                for (int i = 1; i < chb.length; i++) {
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r7081 r7082  
    2020import java.net.SocketTimeoutException;
    2121import java.net.URL;
     22import java.nio.charset.StandardCharsets;
    2223import java.util.Collection;
    2324import java.util.Collections;
     
    190191        @Override
    191192        protected byte[] updateData() throws OsmTransferException {
    192             return sendRequest("GET", "capabilities", null, monitor, false, fastFail).getBytes(Utils.UTF_8);
     193            return sendRequest("GET", "capabilities", null, monitor, false, fastFail).getBytes(StandardCharsets.UTF_8);
    193194        }
    194195    }
     
    638639                        // even if there is no payload.
    639640                        if (requestBody != null) {
    640                             try (BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, Utils.UTF_8))) {
     641                            try (BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8))) {
    641642                                bwr.write(requestBody);
    642643                                bwr.flush();
     
    670671                    //
    671672                    String s;
    672                     try (BufferedReader in = new BufferedReader(new InputStreamReader(i, Utils.UTF_8))) {
     673                    try (BufferedReader in = new BufferedReader(new InputStreamReader(i, StandardCharsets.UTF_8))) {
    673674                        while((s = in.readLine()) != null) {
    674675                            responseBody.append(s);
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java

    r7033 r7082  
    88import java.io.InputStreamReader;
    99import java.io.StringReader;
     10import java.nio.charset.StandardCharsets;
    1011
    1112import javax.xml.parsers.ParserConfigurationException;
     
    1819import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1920import org.openstreetmap.josm.tools.CheckParameterUtil;
    20 import org.openstreetmap.josm.tools.Utils;
    2121import org.openstreetmap.josm.tools.XmlParsingException;
    2222import org.xml.sax.Attributes;
     
    3939        private ChangesetDataSet.ChangesetModificationType currentModificationType;
    4040
     41        @Override
    4142        protected void throwException(String message) throws XmlParsingException {
    4243            throw new XmlParsingException(message).rememberLocation(locator);
     
    5354                return;
    5455            }
    55             switch (qName) { 
     56            switch (qName) {
    5657            case "osmChange":
    5758                // do nothing
     
    6768                break;
    6869            default:
    69                 Main.warn(tr("Unsupported start element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 
     70                Main.warn(tr("Unsupported start element ''{0}'' in changeset content at position ({1},{2}). Skipping.",
    7071                        qName, locator.getLineNumber(), locator.getColumnNumber()));
    7172            }
     
    101102                break;
    102103            default:
    103                 Main.warn(tr("Unsupported end element ''{0}'' in changeset content at position ({1},{2}). Skipping.", 
     104                Main.warn(tr("Unsupported end element ''{0}'' in changeset content at position ({1},{2}). Skipping.",
    104105                        qName, locator.getLineNumber(), locator.getColumnNumber()));
    105106            }
     
    126127    public OsmChangesetContentParser(InputStream source) {
    127128        CheckParameterUtil.ensureParameterNotNull(source, "source");
    128         this.source = new InputSource(new InputStreamReader(source, Utils.UTF_8));
     129        this.source = new InputSource(new InputStreamReader(source, StandardCharsets.UTF_8));
    129130    }
    130131
  • trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java

    r7033 r7082  
    66import java.io.InputStream;
    77import java.io.InputStreamReader;
     8import java.nio.charset.StandardCharsets;
    89import java.text.MessageFormat;
    910import java.util.LinkedList;
     
    1819import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1920import org.openstreetmap.josm.tools.DateUtils;
    20 import org.openstreetmap.josm.tools.Utils;
    2121import org.openstreetmap.josm.tools.XmlParsingException;
    2222import org.xml.sax.Attributes;
     
    225225            progressMonitor.beginTask("");
    226226            progressMonitor.indeterminateSubTask(tr("Parsing list of changesets..."));
    227             InputSource inputSource = new InputSource(new InvalidXmlCharacterFilter(new InputStreamReader(source, Utils.UTF_8)));
     227            InputSource inputSource = new InputSource(new InvalidXmlCharacterFilter(new InputStreamReader(source, StandardCharsets.UTF_8)));
    228228            SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser.new Parser());
    229229            return parser.getChangesets();
  • trunk/src/org/openstreetmap/josm/io/OsmConnection.java

    r7012 r7082  
    1010import java.nio.charset.CharacterCodingException;
    1111import java.nio.charset.CharsetEncoder;
     12import java.nio.charset.StandardCharsets;
    1213
    1314import oauth.signpost.OAuthConsumer;
     
    2122import org.openstreetmap.josm.io.auth.CredentialsManager;
    2223import org.openstreetmap.josm.tools.Base64;
    23 import org.openstreetmap.josm.tools.Utils;
    2424
    2525/**
     
    7676     */
    7777    protected void addBasicAuthorizationHeader(HttpURLConnection con) throws OsmTransferException {
    78         CharsetEncoder encoder = Utils.UTF_8.newEncoder();
     78        CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder();
    7979        CredentialsAgentResponse response;
    8080        String token;
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r7033 r7082  
    1111import java.io.PrintWriter;
    1212import java.io.Writer;
     13import java.nio.charset.StandardCharsets;
    1314import java.text.MessageFormat;
    1415
     
    7273            try (
    7374                OutputStream out = getOutputStream(file);
    74                 Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     75                Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
    7576                OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion());
    7677            ) {
  • trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java

    r7012 r7082  
    77import java.io.InputStream;
    88import java.io.InputStreamReader;
     9import java.nio.charset.StandardCharsets;
    910
    1011import javax.xml.parsers.ParserConfigurationException;
     
    1718import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1819import org.openstreetmap.josm.tools.CheckParameterUtil;
    19 import org.openstreetmap.josm.tools.Utils;
    2020import org.xml.sax.Attributes;
    2121import org.xml.sax.InputSource;
     
    8383     */
    8484    public HistoryDataSet parse(ProgressMonitor progressMonitor) throws SAXException, IOException {
    85         InputSource inputSource = new InputSource(new InputStreamReader(in, Utils.UTF_8));
     85        InputSource inputSource = new InputSource(new InputStreamReader(in, StandardCharsets.UTF_8));
    8686        progressMonitor.beginTask(tr("Parsing OSM history data ..."));
    8787        try {
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r7033 r7082  
    1111import java.net.MalformedURLException;
    1212import java.net.URL;
     13import java.nio.charset.StandardCharsets;
    1314import java.util.List;
    1415import java.util.Map;
     
    175176                        InputStream i = fixEncoding(activeConnection.getErrorStream(), encoding);
    176177                        if (i != null) {
    177                             BufferedReader in = new BufferedReader(new InputStreamReader(i, Utils.UTF_8));
     178                            BufferedReader in = new BufferedReader(new InputStreamReader(i, StandardCharsets.UTF_8));
    178179                            String s;
    179180                            while((s = in.readLine()) != null) {
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java

    r7033 r7082  
    1313import java.net.URL;
    1414import java.net.URLConnection;
     15import java.nio.charset.StandardCharsets;
    1516import java.text.DecimalFormat;
    1617import java.text.DecimalFormatSymbols;
     
    187188        StringBuilder exception = new StringBuilder();
    188189        InputStream in = conn.getInputStream();
    189         try (BufferedReader br = new BufferedReader(new InputStreamReader(in, Utils.UTF_8))) {
     190        try (BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))) {
    190191            String line = null;
    191192            while( (line = br.readLine()) != null) {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r7030 r7082  
    1212import java.io.Writer;
    1313import java.net.Socket;
     14import java.nio.charset.StandardCharsets;
    1415import java.util.Arrays;
    1516import java.util.Date;
     
    143144        try {
    144145            OutputStream raw = new BufferedOutputStream(request.getOutputStream());
    145             out = new OutputStreamWriter(raw, Utils.UTF_8);
     146            out = new OutputStreamWriter(raw, StandardCharsets.UTF_8);
    146147            BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), "ASCII"));
    147148
     
    394395                return null;
    395396            }
    396    
     397
    397398            printJsonInfo(cmd, r, handler);
    398399            return w.toString();
  • trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java

    r7071 r7082  
    2121import java.net.URI;
    2222import java.net.URL;
     23import java.nio.charset.StandardCharsets;
    2324import java.util.Collection;
    2425import java.util.Collections;
     
    3839import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
    3940import org.openstreetmap.josm.tools.GBC;
    40 import org.openstreetmap.josm.tools.Utils;
    4141import org.w3c.dom.Element;
    4242
     
    181181    @SuppressWarnings("resource")
    182182    protected void addDataFile(OutputStream out) {
    183         Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     183        Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
    184184        GpxWriter w = new GpxWriter(new PrintWriter(writer));
    185185        w.write(layer.data);
  • trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java

    r7071 r7082  
    99import java.io.PrintWriter;
    1010import java.io.Writer;
     11import java.nio.charset.StandardCharsets;
    1112import java.util.Collection;
    1213import java.util.Collections;
     
    2526import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
    2627import org.openstreetmap.josm.tools.GBC;
    27 import org.openstreetmap.josm.tools.Utils;
    2828import org.w3c.dom.Element;
    2929
     
    8686    @SuppressWarnings("resource")
    8787    protected void addDataFile(OutputStream out) {
    88         Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     88        Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
    8989        MarkerWriter w = new MarkerWriter(new PrintWriter(writer));
    9090        w.write(layer);
  • trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java

    r7071 r7082  
    2121import java.net.URI;
    2222import java.net.URL;
     23import java.nio.charset.StandardCharsets;
    2324import java.util.Collection;
    2425import java.util.Collections;
     
    4344import org.openstreetmap.josm.tools.GBC;
    4445import org.openstreetmap.josm.tools.ImageProvider;
    45 import org.openstreetmap.josm.tools.Utils;
    4646import org.w3c.dom.Element;
    4747
     
    210210
    211211    protected void addDataFile(OutputStream out) {
    212         Writer writer = new OutputStreamWriter(out, Utils.UTF_8);
     212        Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
    213213        OsmWriter w = OsmWriterFactory.createOsmWriter(new PrintWriter(writer), false, layer.data.getVersion());
    214214        layer.data.getReadLock().lock();
  • trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java

    r7070 r7082  
    1010import java.io.OutputStreamWriter;
    1111import java.lang.reflect.Constructor;
     12import java.nio.charset.StandardCharsets;
    1213import java.util.ArrayList;
    1314import java.util.HashMap;
     
    223224    public void writeJos(Document doc, OutputStream out) throws IOException {
    224225        try {
    225             OutputStreamWriter writer = new OutputStreamWriter(out, Utils.UTF_8);
     226            OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8);
    226227            writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
    227228            TransformerFactory transfac = TransformerFactory.newInstance();
  • trunk/src/org/openstreetmap/josm/plugins/PluginListParser.java

    r7005 r7082  
    99import java.io.InputStream;
    1010import java.io.InputStreamReader;
     11import java.nio.charset.StandardCharsets;
    1112import java.util.LinkedList;
    1213import java.util.List;
    1314
    1415import org.openstreetmap.josm.Main;
    15 import org.openstreetmap.josm.tools.Utils;
    1616
    1717/**
     
    3737        try {
    3838            return new PluginInformation(
    39                     new ByteArrayInputStream(manifest.getBytes(Utils.UTF_8)),
     39                    new ByteArrayInputStream(manifest.getBytes(StandardCharsets.UTF_8)),
    4040                    name.substring(0, name.length() - 4),
    4141                    url
     
    6161        BufferedReader r = null;
    6262        try {
    63             r = new BufferedReader(new InputStreamReader(in, Utils.UTF_8));
     63            r = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8));
    6464            String name = null;
    6565            String url = null;
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r7037 r7082  
    2020import java.net.MalformedURLException;
    2121import java.net.URL;
     22import java.nio.charset.StandardCharsets;
    2223import java.util.ArrayList;
    2324import java.util.Arrays;
     
    172173                connection.setRequestProperty("Accept-Charset", "utf-8");
    173174            }
    174             try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), Utils.UTF_8))) {
     175            try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
    175176                StringBuilder sb = new StringBuilder();
    176177                String line;
     
    204205        try (InputStream errStream = connection.getErrorStream()) {
    205206            if (errStream != null) {
    206                 try (BufferedReader err = new BufferedReader(new InputStreamReader(errStream, Utils.UTF_8))) {
     207                try (BufferedReader err = new BufferedReader(new InputStreamReader(errStream, StandardCharsets.UTF_8))) {
    207208                    String line;
    208209                    while ((line = err.readLine()) != null) {
     
    323324        File cacheFile = createSiteCacheFile(pluginDir, site, CacheType.PLUGIN_LIST);
    324325        getProgressMonitor().subTask(tr("Writing plugin list to local cache ''{0}''", cacheFile.toString()));
    325         try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), Utils.UTF_8))) {
     326        try (PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(cacheFile), StandardCharsets.UTF_8))) {
    326327            writer.write(list);
    327328            writer.flush();
     
    363364        try {
    364365            getProgressMonitor().subTask(tr("Parsing plugin list from site ''{0}''", site));
    365             InputStream in = new ByteArrayInputStream(doc.getBytes(Utils.UTF_8));
     366            InputStream in = new ByteArrayInputStream(doc.getBytes(StandardCharsets.UTF_8));
    366367            List<PluginInformation> pis = new PluginListParser().parse(in);
    367368            availablePlugins.addAll(filterDeprecatedPlugins(pis));
  • trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r7060 r7082  
    1212import java.net.URL;
    1313import java.nio.ByteBuffer;
     14import java.nio.charset.StandardCharsets;
    1415import java.util.zip.GZIPOutputStream;
    1516
     
    4243    private static int exceptionCounter = 0;
    4344    private static boolean suppressExceptionDialogs = false;
    44    
     45
    4546    private static class BugReporterThread extends Thread {
    46        
     47
    4748        final Throwable e;
    48        
     49
    4950        public BugReporterThread(Throwable t) {
    5051            super("Bug Reporter");
     
    139140        }
    140141    }
    141    
     142
    142143    private static void askForBugReport(final Throwable e) {
    143144        try {
     
    215216            GZIPOutputStream gzip = new GZIPOutputStream(out)
    216217        ) {
    217             gzip.write(debugText.getBytes(Utils.UTF_8));
     218            gzip.write(debugText.getBytes(StandardCharsets.UTF_8));
    218219            gzip.finish();
    219220
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r7033 r7082  
    88import java.io.InputStream;
    99import java.net.URL;
     10import java.nio.charset.StandardCharsets;
    1011import java.text.MessageFormat;
    1112import java.util.ArrayList;
     
    532533                        if(rval != val) /* file corrupt */
    533534                            return false;
    534                         enstrings[i] = new String(str, 0, val, Utils.UTF_8);
     535                        enstrings[i] = new String(str, 0, val, StandardCharsets.UTF_8);
    535536                    }
    536537                    for(int i = 0; i < trnum; ++i)
     
    546547                        if(rval != val) /* file corrupt */
    547548                            return false;
    548                         trstrings[i] = new String(str, 0, val, Utils.UTF_8);
     549                        trstrings[i] = new String(str, 0, val, StandardCharsets.UTF_8);
    549550                    }
    550551                    if(trnum > 0 && !p.containsKey(enstrings[0])) {
     
    572573                        if(trval != 0xFFFF) /* files do not match */
    573574                            return false;
    574                     }
    575                     else
    576                     {
    577                         if(enval > str.length) {
     575                    } else {
     576                        if (enval > str.length) {
    578577                            str = new byte[enval];
    579578                        }
    580                         if(trval > str.length) {
     579                        if (trval > str.length) {
    581580                            str = new byte[trval];
    582581                        }
     
    584583                        if(val != enval) /* file corrupt */
    585584                            return false;
    586                         String enstr = new String(str, 0, enval, Utils.UTF_8);
    587                         if(trval != 0)
    588                         {
     585                        String enstr = new String(str, 0, enval, StandardCharsets.UTF_8);
     586                        if (trval != 0) {
    589587                            val = trs.read(str, 0, trval);
    590588                            if(val != trval) /* file corrupt */
    591589                                return false;
    592                             String trstr = new String(str, 0, trval, Utils.UTF_8);
     590                            String trstr = new String(str, 0, trval, StandardCharsets.UTF_8);
    593591                            if(!s.containsKey(enstr))
    594592                                s.put(enstr, trstr);
     
    598596            }
    599597        }
    600         catch(IOException e)
    601         {
     598        catch (IOException e) {
    602599            return false;
    603600        }
    604         if(!s.isEmpty())
    605         {
     601        if (!s.isEmpty()) {
    606602            strings = s;
    607603            pstrings = p;
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r7075 r7082  
    2424import java.net.URLDecoder;
    2525import java.net.URLEncoder;
     26import java.nio.charset.StandardCharsets;
    2627import java.util.ArrayList;
    2728import java.util.Arrays;
     
    537538                } else {
    538539                    try {
    539                         bytes = URLDecoder.decode(data, "UTF-8").getBytes(Utils.UTF_8);
     540                        bytes = URLDecoder.decode(data, "UTF-8").getBytes(StandardCharsets.UTF_8);
    540541                    } catch (IllegalArgumentException ex) {
    541542                        Main.warn("Unable to decode URL data part: "+ex.getMessage() + " (" + data + ")");
     
    544545                }
    545546                if (mediatype != null && mediatype.contains("image/svg+xml")) {
    546                     String s = new String(bytes, Utils.UTF_8);
     547                    String s = new String(bytes, StandardCharsets.UTF_8);
    547548                    URI uri = getSvgUniverse().loadSVG(new StringReader(s), URLEncoder.encode(s, "UTF-8"));
    548549                    SVGDiagram svg = getSvgUniverse().getDiagram(uri);
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r7075 r7082  
    1515import java.net.URI;
    1616import java.net.URISyntaxException;
     17import java.nio.charset.StandardCharsets;
    1718import java.util.Arrays;
    1819
     
    201202                // Try lsb_release (only available on LSB-compliant Linux systems, see https://www.linuxbase.org/lsb-cert/productdir.php?by_prod )
    202203                Process p = Runtime.getRuntime().exec("lsb_release -ds");
    203                 try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), Utils.UTF_8))) {
     204                try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) {
    204205                    String line = Utils.strip(input.readLine());
    205206                    if (line != null && !line.isEmpty()) {
     
    284285                File file = new File(path);
    285286                if (file.exists()) {
    286                     try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Utils.UTF_8))) {
     287                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) {
    287288                        String id = null;
    288289                        String release = null;
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r7037 r7082  
    2727import java.net.URLConnection;
    2828import java.net.URLEncoder;
    29 import java.nio.charset.Charset;
     29import java.nio.charset.StandardCharsets;
    3030import java.nio.file.Files;
    3131import java.nio.file.Path;
     
    6363    }
    6464
    65     /**
    66      * UTF-8 (UCS Transformation Format—8-bit).
    67      *
    68      * <p>Every implementation of the Java platform is required to support UTF-8 (see {@link Charset}).</p>
    69      */
    70     public static final Charset UTF_8 = Charset.forName("UTF-8");
    71 
    7265    private static final int MILLIS_OF_SECOND = 1000;
    7366    private static final int MILLIS_OF_MINUTE = 60000;
     
    476469     */
    477470    public static String md5Hex(String data) {
    478         byte[] byteData = data.getBytes(UTF_8);
     471        byte[] byteData = data.getBytes(StandardCharsets.UTF_8);
    479472        MessageDigest md = null;
    480473        try {
     
    726719     */
    727720    public static BufferedReader openURLReaderAndDecompress(final URL url, final boolean decompress) throws IOException {
    728         return new BufferedReader(new InputStreamReader(openURLAndDecompress(url, decompress), UTF_8));
     721        return new BufferedReader(new InputStreamReader(openURLAndDecompress(url, decompress), StandardCharsets.UTF_8));
    729722    }
    730723
     
    801794        }
    802795        Process p = new ProcessBuilder(command).start();
    803         try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), UTF_8))) {
     796        try (BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8))) {
    804797            StringBuilder all = null;
    805798            String line;
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r7081 r7082  
    1414import java.io.OutputStreamWriter;
    1515import java.io.PrintWriter;
     16import java.nio.charset.StandardCharsets;
    1617import java.text.MessageFormat;
    1718import java.util.ArrayList;
     
    3536import org.openstreetmap.josm.gui.io.UploadStrategySpecification;
    3637import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    37 import org.openstreetmap.josm.tools.Utils;
    3838
    3939public class MultiFetchServerObjectReaderTest {
     
    167167        try (
    168168            PrintWriter pw = new PrintWriter(
    169                     new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), Utils.UTF_8)
     169                    new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), StandardCharsets.UTF_8)
    170170        )) {
    171171            logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r7068 r7082  
    1212import java.io.OutputStreamWriter;
    1313import java.io.PrintWriter;
     14import java.nio.charset.StandardCharsets;
    1415import java.text.MessageFormat;
    1516import java.util.ArrayList;
     
    3637import org.openstreetmap.josm.gui.io.UploadStrategySpecification;
    3738import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    38 import org.openstreetmap.josm.tools.Utils;
    3939
    4040/**
     
    173173        try (
    174174            PrintWriter pw = new PrintWriter(
    175                     new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), Utils.UTF_8)
     175                    new OutputStreamWriter(new FileOutputStream(dataSetCacheOutputFile), StandardCharsets.UTF_8)
    176176        )) {
    177177            logger.info(MessageFormat.format("caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString()));
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r7033 r7082  
    77import java.io.IOException;
    88import java.io.InputStreamReader;
     9import java.nio.charset.StandardCharsets;
    910import java.util.Collection;
    1011import java.util.HashMap;
     
    1718import org.openstreetmap.josm.gui.preferences.projection.ProjectionChoice;
    1819import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    19 import org.openstreetmap.josm.tools.Utils;
    2020
    2121/**
    2222 * Test projections using reference data. (Currently provided by proj.4)
    23  * 
     23 *
    2424 * The data file data_nodist/projection-reference-data.csv can be created like this:
    2525 *      Fist run this file's main method to collect epsg codes and bounds data.
     
    4646        }
    4747    }
    48  
     48
    4949    @Test
    5050    public void test() throws IOException, FileNotFoundException {
    5151        try (BufferedReader in = new BufferedReader(new InputStreamReader(
    52                 new FileInputStream("data_nodist/projection-reference-data.csv"), Utils.UTF_8))) {
     52                new FileInputStream("data_nodist/projection-reference-data.csv"), StandardCharsets.UTF_8))) {
    5353            StringBuilder fail = new StringBuilder();
    5454            String line;
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r7081 r7082  
    1111import java.io.InputStreamReader;
    1212import java.io.OutputStreamWriter;
     13import java.nio.charset.StandardCharsets;
    1314import java.util.ArrayList;
    1415import java.util.Collection;
     
    3031import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    3132import org.openstreetmap.josm.tools.Pair;
    32 import org.openstreetmap.josm.tools.Utils;
    3333
    3434/**
     
    8989
    9090        Random rand = new Random();
    91         try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(PROJECTION_DATA_FILE), Utils.UTF_8))) {
     91        try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(PROJECTION_DATA_FILE), StandardCharsets.UTF_8))) {
    9292            out.write("# Data for test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java\n");
    9393            out.write("# Format: 1. Projection code; 2. lat/lon; 3. lat/lon projected -> east/north; 4. east/north (3.) inverse projected\n");
     
    112112
    113113    private static List<TestData> readData() throws IOException, FileNotFoundException {
    114         try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE), Utils.UTF_8))) {
     114        try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(PROJECTION_DATA_FILE), StandardCharsets.UTF_8))) {
    115115            List<TestData> result = new ArrayList<>();
    116116            String line;
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java

    r7081 r7082  
    1212import java.net.MalformedURLException;
    1313import java.net.URL;
     14import java.nio.charset.StandardCharsets;
    1415import java.security.GeneralSecurityException;
    1516import java.security.SecureRandom;
     
    2829import org.openstreetmap.josm.JOSMFixture;
    2930import org.openstreetmap.josm.Main;
    30 import org.openstreetmap.josm.tools.Utils;
    3131
    3232/**
     
    125125            // TODO this code should be refactored somewhere in Utils as it is used in several JOSM classes
    126126            StringBuilder responseBody = new StringBuilder();
    127             try (BufferedReader in = new BufferedReader(new InputStreamReader(is, Utils.UTF_8))) {
     127            try (BufferedReader in = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
    128128                String s;
    129129                while((s = in.readLine()) != null) {
  • trunk/test/unit/org/openstreetmap/josm/tools/BugReportExceptionHandlerTest.java

    r7081 r7082  
    77import java.io.ByteArrayInputStream;
    88import java.io.IOException;
     9import java.nio.charset.StandardCharsets;
    910import java.util.zip.GZIPInputStream;
    1011
     
    4950            StringBuilder sb = new StringBuilder();
    5051            for (int n = is.read(buff); n > 0; n = is.read(buff)) {
    51                 sb.append(new String(buff, 0, n, Utils.UTF_8));
     52                sb.append(new String(buff, 0, n, StandardCharsets.UTF_8));
    5253            }
    5354            assertEquals(report, sb.toString());
Note: See TracChangeset for help on using the changeset viewer.