Ignore:
Timestamp:
2014-05-01T02:34:43+02:00 (6 years ago)
Author:
Don-vip
Message:

see #8465 - global use of try-with-resources, according to

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
3 edited

Legend:

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

    r6890 r7033  
    1717import java.awt.event.MouseListener;
    1818import java.awt.event.MouseMotionListener;
     19import java.util.Formatter;
     20import java.util.Locale;
    1921
    2022import javax.swing.JLabel;
     
    236238            int precision = Main.getProjection().getDefaultZoomInPPD() >= 1.0 ? 2 : 7;
    237239            // US locale to force decimal separator to be '.'
    238             tOffset.setText(new java.util.Formatter(java.util.Locale.US).format(
     240            try (Formatter us = new Formatter(Locale.US)) {
     241                tOffset.setText(us.format(
    239242                    "%1." + precision + "f; %1." + precision + "f",
    240243                    layer.getDx(), layer.getDy()).toString());
     244            }
    241245        }
    242246
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r7026 r7033  
    292292
    293293                for (File urlFile: urlFiles) {
    294                     try {
    295                         BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), Utils.UTF_8));
     294                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(urlFile), Utils.UTF_8))) {
    296295                        String line;
    297296                        while ((line = reader.readLine()) != null) {
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r7004 r7033  
    153153                        file = File.createTempFile("session_", ".joz", Utils.getJosmTempDir());
    154154                        tempFile = true;
    155                         FileOutputStream out = new FileOutputStream(file);
    156                         try {
     155                        try (FileOutputStream out = new FileOutputStream(file)) {
    157156                            Utils.copyStream(is, out);
    158                         } finally {
    159                             Utils.close(out);
    160157                        }
    161158                    }
Note: See TracChangeset for help on using the changeset viewer.