Changeset 5874 in josm


Ignore:
Timestamp:
2013-04-16T19:57:43+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8570, #7406 - I/O refactorization:

  • Move different file copy functions to Utils.copyFile (to be replaced later by Files.copy when switching to Java 7)
  • Replace all Utils.close(XXX) by Utils.close(Closeable) -> impacted plugins: commandline, mirrored_download, opendata, piclayer
  • Add new Utils.close(ZipFile)
  • Use of Utils.close almost everywhere
  • Javadoc fixes
Location:
trunk/src/org/openstreetmap/josm
Files:
54 edited

Legend:

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

    r4996 r5874  
    3838import org.openstreetmap.josm.tools.MultiMap;
    3939import org.openstreetmap.josm.tools.Shortcut;
     40import org.openstreetmap.josm.tools.Utils;
    4041import org.xml.sax.SAXException;
    4142
     
    4849public class OpenFileAction extends DiskAccessAction {
    4950
     51    /**
     52     * The {@link ExtensionFileFilter} matching .url files
     53     */
    5054    public static final ExtensionFileFilter urlFileFilter = new ExtensionFileFilter("url", "url", tr("URL Files") + " (*.url)");
    5155
     
    5761                Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.CTRL));
    5862        putValue("help", ht("/Action/Open"));
    59 
    6063    }
    6164
     
    296299                            }
    297300                        }
    298                         reader.close();
     301                        Utils.close(reader);
    299302                    } catch (Exception e) {
    300303                        System.err.println(e.getMessage());
     
    333336        }
    334337
     338        /**
     339         * Replies the list of files that have been successfully opened.
     340         * @return The list of files that have been successfully opened.
     341         */
    335342        public List<File> getSuccessfullyOpenedFiles() {
    336343            return successfullyOpenedFiles;
  • trunk/src/org/openstreetmap/josm/data/AutosaveTask.java

    r5566 r5874  
    3838import org.openstreetmap.josm.io.OsmExporter;
    3939import org.openstreetmap.josm.io.OsmImporter;
     40import org.openstreetmap.josm.tools.Utils;
    4041
    4142/**
     
    156157                        PrintStream ps = new PrintStream(pidFile);
    157158                        ps.println(ManagementFactory.getRuntimeMXBean().getName());
    158                         ps.close();
     159                        Utils.close(ps);
    159160                    } catch (Throwable t) {
    160161                        System.err.println(t.getMessage());
     
    299300                            System.err.println(t.getClass()+":"+t.getMessage());
    300301                        } finally {
    301                             reader.close();
     302                            Utils.close(reader);
    302303                        }
    303304                    } catch (Throwable t) {
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r5590 r5874  
    11package org.openstreetmap.josm.data;
    22
    3 import javax.script.ScriptException;
    4 import org.openstreetmap.josm.Main;
    5 import org.openstreetmap.josm.data.Preferences.Setting;
    63import static org.openstreetmap.josm.tools.I18n.tr;
    74
     
    129import java.io.File;
    1310import java.io.FileInputStream;
    14 import java.io.IOException;
    1511import java.io.InputStream;
    16 
    1712import java.util.ArrayList;
    18 import java.util.Arrays;
    1913import java.util.Collection;
    2014import java.util.Collections;
     
    3024import java.util.regex.Matcher;
    3125import java.util.regex.Pattern;
     26
    3227import javax.script.ScriptEngine;
    3328import javax.script.ScriptEngineManager;
     29import javax.script.ScriptException;
    3430import javax.swing.JOptionPane;
    3531import javax.swing.SwingUtilities;
     
    4238import javax.xml.transform.stream.StreamResult;
    4339
     40import org.openstreetmap.josm.Main;
     41import org.openstreetmap.josm.data.Preferences.Setting;
    4442import org.openstreetmap.josm.gui.io.DownloadFileTask;
    4543import org.openstreetmap.josm.plugins.PluginDownloadTask;
     
    4745import org.openstreetmap.josm.plugins.ReadLocalPluginInformationTask;
    4846import org.openstreetmap.josm.tools.LanguageInfo;
     47import org.openstreetmap.josm.tools.Utils;
    4948import org.w3c.dom.Document;
    5049import org.w3c.dom.Element;
     
    441440                log("Error reading custom preferences: "+ex.getMessage());
    442441            } finally {
    443                 try {
    444                     if (is != null) {
    445                         is.close();
    446                     }
    447                 } catch (IOException ex) {         }
     442                Utils.close(is);
    448443            }
    449444            log("-- Reading complete --");
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r5871 r5874  
    1818import java.lang.annotation.RetentionPolicy;
    1919import java.lang.reflect.Field;
    20 import java.nio.channels.FileChannel;
    2120import java.util.ArrayList;
    2221import java.util.Arrays;
     
    137136    }
    138137
     138    /**
     139     * Base abstract class of all settings, holding the setting value.
     140     *
     141     * @param <T> The setting type
     142     */
    139143    abstract public static class AbstractSetting<T> implements Setting<T> {
    140         private T value;
     144        private final T value;
     145        /**
     146         * Constructs a new {@code AbstractSetting} with the given value
     147         * @param value The setting value
     148         */
    141149        public AbstractSetting(T value) {
    142150            this.value = value;
    143151        }
    144         @Override
    145         public T getValue() {
     152        @Override public T getValue() {
    146153            return value;
    147154        }
    148         @Override
    149         public String toString() {
     155        @Override public String toString() {
    150156            return value != null ? value.toString() : "null";
    151157        }
    152158    }
    153159
     160    /**
     161     * Setting containing a {@link String} value.
     162     */
    154163    public static class StringSetting extends AbstractSetting<String> {
     164        /**
     165         * Constructs a new {@code StringSetting} with the given value
     166         * @param value The setting value
     167         */
    155168        public StringSetting(String value) {
    156169            super(value);
    157170        }
    158         public void visit(SettingVisitor visitor) {
     171        @Override public void visit(SettingVisitor visitor) {
    159172            visitor.visit(this);
    160173        }
    161         public StringSetting getNullInstance() {
     174        @Override public StringSetting getNullInstance() {
    162175            return new StringSetting(null);
    163176        }
    164177    }
    165178
     179    /**
     180     * Setting containing a {@link List} of {@link String} values.
     181     */
    166182    public static class ListSetting extends AbstractSetting<List<String>> {
     183        /**
     184         * Constructs a new {@code ListSetting} with the given value
     185         * @param value The setting value
     186         */
    167187        public ListSetting(List<String> value) {
    168188            super(value);
    169189        }
    170         public void visit(SettingVisitor visitor) {
     190        @Override public void visit(SettingVisitor visitor) {
    171191            visitor.visit(this);
    172192        }
    173         public ListSetting getNullInstance() {
     193        @Override public ListSetting getNullInstance() {
    174194            return new ListSetting(null);
    175195        }
    176196    }
    177197
     198    /**
     199     * Setting containing a {@link List} of {@code List}s of {@link String} values.
     200     */
    178201    public static class ListListSetting extends AbstractSetting<List<List<String>>> {
     202        /**
     203         * Constructs a new {@code ListListSetting} with the given value
     204         * @param value The setting value
     205         */
    179206        public ListListSetting(List<List<String>> value) {
    180207            super(value);
    181208        }
    182         public void visit(SettingVisitor visitor) {
     209        @Override public void visit(SettingVisitor visitor) {
    183210            visitor.visit(this);
    184211        }
    185         public ListListSetting getNullInstance() {
     212        @Override public ListListSetting getNullInstance() {
    186213            return new ListListSetting(null);
    187214        }
    188215    }
    189216
     217    /**
     218     * Setting containing a {@link List} of {@link Map}s of {@link String} values.
     219     */
    190220    public static class MapListSetting extends AbstractSetting<List<Map<String, String>>> {
     221        /**
     222         * Constructs a new {@code MapListSetting} with the given value
     223         * @param value The setting value
     224         */
    191225        public MapListSetting(List<Map<String, String>> value) {
    192226            super(value);
    193227        }
    194         public void visit(SettingVisitor visitor) {
     228        @Override public void visit(SettingVisitor visitor) {
    195229            visitor.visit(this);
    196230        }
    197         public MapListSetting getNullInstance() {
     231        @Override public MapListSetting getNullInstance() {
    198232            return new MapListSetting(null);
    199233        }
     
    265299
    266300    /**
    267      * Return the location of the user defined preferences file
     301     * Returns the location of the user defined preferences directory
     302     * @return The location of the user defined preferences directory
    268303     */
    269304    public String getPreferencesDir() {
     
    274309    }
    275310
     311    /**
     312     * Returns the user defined preferences directory
     313     * @return The user defined preferences directory
     314     */
    276315    public File getPreferencesDirFile() {
    277316        if (preferencesDirFile != null)
     
    292331    }
    293332
     333    /**
     334     * Returns the user preferences file
     335     * @return The user preferences file
     336     */
    294337    public File getPreferenceFile() {
    295338        return new File(getPreferencesDirFile(), "preferences.xml");
    296339    }
    297340
     341    /**
     342     * Returns the user plugin directory
     343     * @return The user plugin directory
     344     */
    298345    public File getPluginsDirectory() {
    299346        return new File(getPreferencesDirFile(), "plugins");
     
    551598
    552599        // Backup old preferences if there are old preferences
    553         if(prefFile.exists()) {
    554             copyFile(prefFile, backupFile);
     600        if (prefFile.exists()) {
     601            Utils.copyFile(prefFile, backupFile);
    555602        }
    556603
     
    558605                new FileOutputStream(prefFile + "_tmp"), "utf-8"), false);
    559606        out.print(toXML(false));
    560         out.close();
     607        Utils.close(out);
    561608
    562609        File tmpFile = new File(prefFile + "_tmp");
    563         copyFile(tmpFile, prefFile);
     610        Utils.copyFile(tmpFile, prefFile);
    564611        tmpFile.delete();
    565612
     
    575622        file.setReadable(true, true);
    576623        file.setWritable(true, true);
    577     }
    578 
    579     /**
    580      * Simple file copy function that will overwrite the target file
    581      * Taken from http://www.rgagnon.com/javadetails/java-0064.html (CC-NC-BY-SA)
    582      * @param in
    583      * @param out
    584      * @throws IOException
    585      */
    586     public static void copyFile(File in, File out) throws IOException  {
    587         FileChannel inChannel = new FileInputStream(in).getChannel();
    588         FileChannel outChannel = new FileOutputStream(out).getChannel();
    589         try {
    590             inChannel.transferTo(0, inChannel.size(),
    591                     outChannel);
    592         }
    593         catch (IOException e) {
    594             throw e;
    595         }
    596         finally {
    597             if (inChannel != null) {
    598                 inChannel.close();
    599             }
    600             if (outChannel != null) {
    601                 outChannel.close();
    602             }
    603         }
    604624    }
    605625
     
    615635                fromXML(in);
    616636            } finally {
    617                 in.close();
     637                Utils.close(in);
    618638            }
    619639        }
  • trunk/src/org/openstreetmap/josm/data/ServerSidePreferences.java

    r4874 r5874  
    2222import org.openstreetmap.josm.io.OsmConnection;
    2323import org.openstreetmap.josm.tools.Base64;
     24import org.openstreetmap.josm.tools.Utils;
    2425
    2526/**
     
    9192                PrintWriter out = new PrintWriter(new OutputStreamWriter(con.getOutputStream()));
    9293                out.println(s);
    93                 out.close();
    94                 con.getInputStream().close();
     94                Utils.close(out);
     95                Utils.close(con.getInputStream());
    9596                con.disconnect();
    9697                JOptionPane.showMessageDialog(
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r5868 r5874  
    4444                }
    4545            } finally {
    46                 in.close();
     46                Utils.close(in);
    4747            }
    4848            s = sb.toString();
  • trunk/src/org/openstreetmap/josm/data/imagery/WmsCache.java

    r5763 r5874  
    156156            }
    157157        } finally {
    158             try {
    159                 if (fis != null) {
    160                     fis.close();
    161                 }
    162                 if (fos != null) {
    163                     fos.close();
    164                 }
    165             } catch (IOException e) {
    166                 e.printStackTrace();
    167             }
     158            Utils.close(fos);
     159            Utils.close(fis);
    168160        }
    169161
     
    532524                totalFileSize += Utils.copyStream(imageData, os);
    533525            } finally {
    534                 os.close();
     526                Utils.close(os);
    535527            }
    536528        }
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java

    r5073 r5874  
    2525import java.util.ArrayList;
    2626import java.util.HashMap;
     27
     28import org.openstreetmap.josm.tools.Utils;
    2729
    2830/**
     
    151153        lastSubGrid = topLevelSubGrid[0];
    152154
    153         in.close();
     155        Utils.close(in);
    154156    }
    155157
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r5644 r5874  
    5757import org.openstreetmap.josm.gui.preferences.ValidatorPreference;
    5858import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
     59import org.openstreetmap.josm.tools.Utils;
    5960
    6061/**
     
    167168
    168169    public static void saveIgnoredErrors() {
     170        PrintWriter out = null;
    169171        try {
    170             final PrintWriter out = new PrintWriter(new FileWriter(getValidatorDir() + "ignorederrors"), false);
     172            out = new PrintWriter(new FileWriter(getValidatorDir() + "ignorederrors"), false);
    171173            for (String e : ignoredErrors) {
    172174                out.println(e);
    173175            }
    174             out.close();
    175         } catch (final IOException e) {
     176        } catch (IOException e) {
    176177            e.printStackTrace();
     178        } finally {
     179            Utils.close(out);
    177180        }
    178181    }
  • trunk/src/org/openstreetmap/josm/gui/BookmarkList.java

    r3697 r5874  
    3232import org.openstreetmap.josm.data.Bounds;
    3333import org.openstreetmap.josm.tools.ImageProvider;
     34import org.openstreetmap.josm.tools.Utils;
    3435
    3536/**
     
    151152                        bookmarks.add(b);
    152153                    }
    153                     in.close();
     154                    Utils.close(in);
    154155                    Collections.sort(bookmarks);
    155156                    for (Bookmark b : bookmarks) {
  • trunk/src/org/openstreetmap/josm/gui/MultiSplitLayout.java

    r5698 r5874  
    4444
    4545import javax.swing.UIManager;
     46
     47import org.openstreetmap.josm.tools.Utils;
    4648
    4749/**
     
    12591261        }
    12601262        finally {
    1261             try { r.close(); } catch (IOException ignore) {}
     1263            Utils.close(r);
    12621264        }
    12631265        return null;
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r5816 r5874  
    5151import org.openstreetmap.josm.tools.ImageProvider;
    5252import org.openstreetmap.josm.tools.OpenBrowser;
     53import org.openstreetmap.josm.tools.Utils;
    5354import org.openstreetmap.josm.tools.WindowGeometry;
    5455
     
    141142                css.append("\n");
    142143            }
    143             reader.close();
    144144        } catch(Exception e) {
    145145            System.err.println(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
    146146            e.printStackTrace();
    147147            return ss;
     148        } finally {
     149            Utils.close(reader);
    148150        }
    149151        ss.addRule(css.toString());
  • trunk/src/org/openstreetmap/josm/gui/help/HelpContentReader.java

    r5868 r5874  
    6262            throw ex;
    6363        } finally {
    64             if (in != null) {
    65                 try {
    66                     in.close();
    67                 } catch(IOException e) {
    68                     // ignore
    69                 }
    70             }
     64            Utils.close(in);
    7165        }
    7266    }
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java

    r5587 r5874  
    2323import org.xml.sax.SAXException;
    2424
    25 
    2625/**
    2726 * Asynchronous task for downloading and unpacking arbitrary file lists
     
    3837     *
    3938     * @param parent the parent component relative to which the {@link PleaseWaitDialog} is displayed
    40      * @param title the title to display in the {@link PleaseWaitDialog}
    41      * @throws IllegalArgumentException thrown if toUpdate is null
     39     * @param address the URL to download
     40     * @param file The destination file
     41     * @param mkdir {@code true} if the destination directory must be created, {@code false} otherwise
     42     * @param unpack {@code true} if zip archives must be unpacked recursively, {@code false} otherwise
     43     * @throws IllegalArgumentException if {@code parent} is null
    4244     */
    4345    public DownloadFileTask(Component parent, String address, File file, boolean mkdir, boolean unpack) {
     
    4749        this.mkdir = mkdir;
    4850        this.unpack = unpack;
    49                
    5051    }   
    5152   
     
    7677    protected void finish() {}
    7778
     79    /**
     80     * Performs download.
     81     * @throws DownloadException if the URL is invalid or if any I/O error occurs.
     82     */
    7883    public void download() throws DownloadException {
    7984        OutputStream out = null;
     
    107112                out.write(buffer, 0, read);
    108113                count+=read;
    109                 if (canceled) return;                           
     114                if (canceled) break;                           
    110115                p2 = 100 * count / size;
    111116                if (p2!=p1) {
     
    114119                }
    115120            }
    116             out.close();
    117             System.out.println(tr("Download finished"));
    118             if (unpack) {
    119                 System.out.println(tr("Unpacking {0} into {1}", file.getAbsolutePath(), file.getParent()));
    120                 unzipFileRecursively(file, file.getParent());
    121                 file.delete();
     121            Utils.close(out);
     122            if (!canceled) {
     123                System.out.println(tr("Download finished"));
     124                if (unpack) {
     125                    System.out.println(tr("Unpacking {0} into {1}", file.getAbsolutePath(), file.getParent()));
     126                    unzipFileRecursively(file, file.getParent());
     127                    file.delete();
     128                }
    122129            }
    123130        } catch(MalformedURLException e) {
     
    148155     * Replies true if the task was canceled by the user
    149156     *
    150      * @return
     157     * @return {@code true} if the task was canceled by the user, {@code false} otherwise
    151158     */
    152159    public boolean isCanceled() {
     
    182189                        os.write(buffer, 0, read);
    183190                    }
    184                     os.close();
    185                     is.close();
    186                 }
    187             }
    188             zf.close();
     191                    Utils.close(os);
     192                    Utils.close(is);
     193                }
     194            }
    189195        } finally {
    190             if (zf!=null) zf.close();
     196            Utils.close(zf);
    191197        }
    192198    }
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r5868 r5874  
    324324                UTFInputStreamReader in = UTFInputStreamReader.create(Utils.openURL(u), "utf-8");
    325325                String r = new Scanner(in).useDelimiter("\\A").next();
    326                 in.close();
     326                Utils.close(in);
    327327                System.out.println("Successfully loaded Bing attribution data.");
    328328                return r.getBytes("utf-8");
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r5399 r5874  
    3131import org.openstreetmap.josm.io.MirroredInputStream;
    3232import org.openstreetmap.josm.tools.ImageProvider;
     33import org.openstreetmap.josm.tools.Utils;
    3334
    3435/**
     
    247248            e.printStackTrace();
    248249        } finally {
    249             try {
    250                 if (in != null) {
    251                     in.close();
    252                 }
    253             } catch (IOException ex) {
    254             }
     250            Utils.close(in);
    255251        }
    256252        return null;
  • trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java

    r5587 r5874  
    405405            dout.writeBytes(request);
    406406            dout.flush();
    407             dout.close();
     407            Utils.close(dout);
    408408
    409409            // after a successful login the OSM website sends a redirect to a follow up page. Everything
     
    419419            throw new OsmLoginFailedException(e);
    420420        } finally {
    421             if (dout != null) {
    422                 try {
    423                     dout.close();
    424                 } catch(IOException e) { /* ignore */ }
    425             }
     421            Utils.close(dout);
    426422            synchronized(this) {
    427423                connection = null;
     
    496492            dout.writeBytes(request);
    497493            dout.flush();
    498             dout.close();
    499494
    500495            int retCode = connection.getResponseCode();
     
    506501            throw new OsmOAuthAuthorizationException(e);
    507502        } finally {
    508             if (dout != null) {
    509                 try {
    510                     dout.close();
    511                 } catch(IOException e) { /* ignore */ }
    512             }
     503            Utils.close(dout);
    513504            synchronized(this) {
    514505                connection = null;
  • trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java

    r5784 r5874  
    11741174        protected void cancel() {
    11751175            canceled = true;
    1176             if (reader!= null) {
    1177                 try {
    1178                     reader.close();
    1179                 } catch(IOException e) {
    1180                     // ignore
    1181                 }
    1182             }
    1183         }
    1184 
     1176            Utils.close(reader);
     1177        }
    11851178
    11861179        protected void warn(Exception e) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java

    r5587 r5874  
    216216            return;
    217217        } finally {
    218             if (bin != null) {
    219                 try {
    220                     bin.close();
    221                 } catch(IOException e){/* ignore */}
    222             }
     218            Utils.close(bin);
    223219        }
    224220    }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPreset.java

    r5866 r5874  
    15901590                tp = TaggingPreset.readAll(new BufferedReader(r), validate);
    15911591            } finally {
    1592                 r.close();
     1592                Utils.close(r);
    15931593            }
    15941594        } finally {
    1595             s.close();
     1595            Utils.close(s);
    15961596        }
    15971597        return tp;
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r5679 r5874  
    1111import org.openstreetmap.josm.data.osm.DataSet;
    1212import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     13import org.openstreetmap.josm.tools.Utils;
    1314import org.xml.sax.SAXException;
    1415
     
    5253                done = true;
    5354            }
    54             in.close();
     55            Utils.close(in);
    5556            activeConnection = null;
    5657        }
     
    145146        } finally {
    146147            progressMonitor.finishTask();
    147             if (in != null) {
    148                 try {in.close();} catch(IOException e) {}
    149             }
     148            Utils.close(in);
    150149            activeConnection = null;
    151150        }
  • trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java

    r4810 r5874  
    1212
    1313import org.openstreetmap.josm.Main;
     14import org.openstreetmap.josm.tools.Utils;
    1415
    1516/**
     
    159160            this.data = updateForce();
    160161        else {
     162            BufferedInputStream input = null;
    161163            try {
    162                 BufferedInputStream input = new BufferedInputStream(new FileInputStream(path));
     164                input = new BufferedInputStream(new FileInputStream(path));
    163165                this.data = new byte[input.available()];
    164166                input.read(this.data);
    165                 input.close();
    166167            } catch (IOException e) {
    167168                this.data = updateForce();
     169            } finally {
     170                Utils.close(input);
    168171            }
    169172        }
     
    176179        if (Main.applet)
    177180            return;
     181        BufferedOutputStream output = null;
    178182        try {
    179             BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(path));
     183            output = new BufferedOutputStream(new FileOutputStream(path));
    180184            output.write(this.data);
    181185            output.flush();
    182             output.close();
    183186        } catch(Exception e) {
    184187            e.printStackTrace();
     188        } finally {
     189            Utils.close(output);
    185190        }
    186191    }
  • trunk/src/org/openstreetmap/josm/io/GeoJSONExporter.java

    r5749 r5874  
    1414import org.openstreetmap.josm.gui.layer.Layer;
    1515import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     16import org.openstreetmap.josm.tools.Utils;
    1617
    1718public class GeoJSONExporter extends FileExporter {
     
    3233                out.write(json);
    3334            } finally {
    34                 out.close();
     35                Utils.close(out);
    3536            }
    3637        } else {
  • trunk/src/org/openstreetmap/josm/io/GpxExporter.java

    r5681 r5874  
    3636import org.openstreetmap.josm.tools.CheckParameterUtil;
    3737import org.openstreetmap.josm.tools.GBC;
     38import org.openstreetmap.josm.tools.Utils;
    3839
    3940public class GpxExporter extends FileExporter implements GpxConstants {
     
    169170        }
    170171
     172        FileOutputStream fo = null;
    171173        try {
    172             FileOutputStream fo = new FileOutputStream(file);
     174            fo = new FileOutputStream(file);
    173175            new GpxWriter(fo).write(gpxData);
    174176            fo.flush();
    175             fo.close();
    176177        } catch (IOException x) {
    177178            x.printStackTrace();
    178179            JOptionPane.showMessageDialog(Main.parent, tr("Error while exporting {0}:\n{1}", fn, x.getMessage()),
    179180                    tr("Error"), JOptionPane.ERROR_MESSAGE);
    180         }
    181 
     181        } finally {
     182            Utils.close(fo);
     183        }
    182184    }
    183185
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r5684 r5874  
    3838    }
    3939
    40     public GpxWriter() {
    41         super(null);
    42         //sorry for this one here, this will be cleaned up once the new scheme works
    43     }
    44 
    4540    private GpxData data;
    4641    private String indent = "";
    47     public String creator = "JOSM GPX export";
    4842
    4943    private final static int WAY_POINT = 0;
  • trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java

    r5868 r5874  
    124124                res = zipFile.getInputStream(resentry);
    125125            } else {
    126                 zipFile.close();
     126                Utils.close(zipFile);
    127127            }
    128128        } catch (Exception e) {
     
    224224                bos.write(buffer, 0, length);
    225225            }
    226             bos.close();
     226            Utils.close(bos);
    227227            bos = null;
    228228            /* close fos as well to be sure! */
    229             fos.close();
     229            Utils.close(fos);
    230230            fos = null;
    231231            localFile = new File(destDir, localPath);
     
    304304    @Override
    305305    public void close() throws IOException
    306     { fs.close(); }
     306    { Utils.close(fs); }
    307307    @Override
    308308    public int read() throws IOException
  • trunk/src/org/openstreetmap/josm/io/NmeaReader.java

    r5108 r5874  
    2020import org.openstreetmap.josm.data.gpx.WayPoint;
    2121import org.openstreetmap.josm.tools.DateUtils;
     22import org.openstreetmap.josm.tools.Utils;
    2223
    2324/**
     
    176177        Collection<Collection<WayPoint>> currentTrack = new ArrayList<Collection<WayPoint>>();
    177178
     179        BufferedReader rd = null;
    178180        try {
    179             BufferedReader rd =
    180                 new BufferedReader(new InputStreamReader(source));
     181            rd = new BufferedReader(new InputStreamReader(source));
    181182
    182183            StringBuffer sb = new StringBuffer(1024);
     
    206207                }
    207208            }
    208             rd.close();
    209209            currentTrack.add(ps.waypoints);
    210210            data.tracks.add(new ImmutableGpxTrack(currentTrack, Collections.<String, Object>emptyMap()));
    211211
    212         } catch (final IOException e) {
     212        } catch (IOException e) {
    213213            // TODO tell user about the problem?
     214        } finally {
     215            Utils.close(rd);
    214216        }
    215217    }
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r5635 r5874  
    625625                        bwr.flush();
    626626                    }
    627                     out.close();
     627                    Utils.close(out);
    628628                }
    629629
  • trunk/src/org/openstreetmap/josm/io/OsmExporter.java

    r5361 r5874  
    2121import org.openstreetmap.josm.gui.layer.Layer;
    2222import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     23import org.openstreetmap.josm.tools.Utils;
    2324
    2425public class OsmExporter extends FileExporter {
     
    6465            if (file.exists()) {
    6566                tmpFile = new File(file.getPath() + "~");
    66                 copy(file, tmpFile);
     67                Utils.copyFile(file, tmpFile);
    6768            }
    6869
     
    7576            try {
    7677                w.writeLayer(layer);
    77                 w.close();
    7878            } finally {
     79                Utils.close(w);
    7980                layer.data.getReadLock().unlock();
    8081            }
     
    99100                // be deleted.  So, restore the backup if we made one.
    100101                if (tmpFile != null && tmpFile.exists()) {
    101                     copy(tmpFile, file);
     102                    Utils.copyFile(tmpFile, file);
    102103                }
    103104            } catch (IOException e2) {
     
    112113        }
    113114    }
    114 
    115     private void copy(File src, File dst) throws IOException {
    116         FileInputStream srcStream;
    117         FileOutputStream dstStream;
    118         try {
    119             srcStream = new FileInputStream(src);
    120             dstStream = new FileOutputStream(dst);
    121         } catch (FileNotFoundException e) {
    122             JOptionPane.showMessageDialog(Main.parent, tr("Could not back up file. Exception is: {0}", e
    123                     .getMessage()), tr("Error"), JOptionPane.ERROR_MESSAGE);
    124             return;
    125         }
    126         byte buf[] = new byte[1 << 16];
    127         int len;
    128         while ((len = srcStream.read(buf)) != -1) {
    129             dstStream.write(buf, 0, len);
    130         }
    131         srcStream.close();
    132         dstStream.close();
    133     }
    134 
    135115}
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r5863 r5874  
    1919import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    2020import org.openstreetmap.josm.gui.util.GuiHelper;
     21import org.openstreetmap.josm.tools.Utils;
    2122
    2223public class OsmImporter extends FileImporter {
     
    6768            throw new IOException(tr("File ''{0}'' does not exist.", file.getName()));
    6869        } finally {
    69             if (in != null) {
    70                 in.close();
    71             }
     70            Utils.close(in);
    7271        }
    7372    }
  • trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java

    r5266 r5874  
    1818import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1919import org.openstreetmap.josm.tools.CheckParameterUtil;
     20import org.openstreetmap.josm.tools.Utils;
    2021
    2122/**
    2223 * OsmServerBackreferenceReader fetches the primitives from the OSM server which
    23  * refer to a specific primitive. For a {@link Node}, ways and relations are retrieved
     24 * refer to a specific primitive. For a {@link org.openstreetmap.josm.data.osm.Node Node}, ways and relations are retrieved
    2425 * which refer to the node. For a {@link Way} or a {@link Relation}, only relations are
    2526 * read.
     
    150151        } finally {
    151152            progressMonitor.finishTask();
    152             if (in != null) {
    153                 try {
    154                     in.close();
    155                 } catch(Exception e) {}
    156                 activeConnection = null;
    157             }
     153            Utils.close(in);
     154            activeConnection = null;
    158155        }
    159156    }
     
    188185        } finally {
    189186            progressMonitor.finishTask();
    190             if (in != null) {
    191                 try {
    192                     in.close();
    193                 } catch(Exception e) {}
    194                 activeConnection = null;
    195             }
     187            Utils.close(in);
     188            activeConnection = null;
    196189        }
    197190    }
  • trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java

    r5835 r5874  
    1212import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1313import org.openstreetmap.josm.tools.CheckParameterUtil;
     14import org.openstreetmap.josm.tools.Utils;
    1415
    1516/**
     
    7879        } finally {
    7980            progressMonitor.finishTask();
    80             if (in != null) {
    81                 try {
    82                     in.close();
    83                 } catch(Exception e) {}
    84                 activeConnection = null;
    85             }
     81            Utils.close(in);
     82            activeConnection = null;
    8683        }
    8784    }
  • trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java

    r5745 r5874  
    1313import org.openstreetmap.josm.data.osm.DataSet;
    1414import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     15import org.openstreetmap.josm.tools.Utils;
    1516import org.xml.sax.SAXException;
    1617
     
    4041        } finally {
    4142            progressMonitor.finishTask();
    42             try {
    43                 activeConnection = null;
    44                 if (parser.in != null) {
    45                     parser.in.close();
    46                     parser.in = null;
    47                 }
    48             } catch(Exception e) {/* ignore it */}
     43            activeConnection = null;
     44            Utils.close(parser.in);
     45            parser.in = null;
    4946        }
    5047    }
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r5266 r5874  
    1515import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1616import org.openstreetmap.josm.tools.CheckParameterUtil;
     17import org.openstreetmap.josm.tools.Utils;
    1718import org.xml.sax.SAXException;
    1819
     
    144145        } finally {
    145146            progressMonitor.finishTask();
    146             if (in!=null) {
    147                 try {
    148                     in.close();
    149                 } catch(Exception e) {/* ignore this exception */}
    150             }
     147            Utils.close(in);
    151148            activeConnection = null;
    152149        }
  • trunk/src/org/openstreetmap/josm/io/OsmWriter.java

    r5737 r5874  
    7171        header(null);
    7272    }
     73   
    7374    public void header(Boolean upload) {
    7475        out.println("<?xml version='1.0' encoding='UTF-8'?>");
     
    8182        out.println("' generator='JOSM'>");
    8283    }
     84   
    8385    public void footer() {
    8486        out.println("</osm>");
     
    313315        }
    314316    }
    315 
    316     public void close() {
    317         out.close();
    318     }
    319 
    320     @Override
    321     public void flush() {
    322         out.flush();
    323     }
    324317}
  • trunk/src/org/openstreetmap/josm/io/ProgressInputStream.java

    r3005 r5874  
    4949
    5050    @Override public void close() throws IOException {
    51         in.close();
    52         progressMonitor.finishTask();
     51        try {
     52            in.close();
     53        } finally {
     54            progressMonitor.finishTask();
     55        }
    5356    }
    5457
  • trunk/src/org/openstreetmap/josm/io/WMSLayerExporter.java

    r5459 r5874  
    1010import org.openstreetmap.josm.gui.layer.WMSLayer;
    1111import org.openstreetmap.josm.tools.CheckParameterUtil;
     12import org.openstreetmap.josm.tools.Utils;
    1213
    1314/**
     
    3435                ((WMSLayer)layer).writeExternal(oos);
    3536            } finally {
    36                 oos.close();
     37                Utils.close(oos);
    3738            }
    3839        }
  • trunk/src/org/openstreetmap/josm/io/WMSLayerImporter.java

    r5459 r5874  
    1515import org.openstreetmap.josm.gui.util.GuiHelper;
    1616import org.openstreetmap.josm.tools.CheckParameterUtil;
     17import org.openstreetmap.josm.tools.Utils;
    1718
    1819/**
     
    5556            throw new IllegalDataException(e);
    5657        } finally {
    57             ois.close();
     58            Utils.close(ois);
    5859        }
    5960       
  • trunk/src/org/openstreetmap/josm/io/XmlWriter.java

    r5146 r5874  
    22package org.openstreetmap.josm.io;
    33
     4import java.io.Closeable;
     5import java.io.IOException;
    46import java.io.PrintWriter;
    57import java.util.HashMap;
     
    1012 * @author imi
    1113 */
    12 public class XmlWriter {
     14public class XmlWriter implements Closeable {
    1315
    14     protected PrintWriter out;
     16    protected final PrintWriter out;
    1517
    1618    public XmlWriter(PrintWriter out) {
     
    1820    }
    1921
     22    /**
     23     * Flushes the stream.
     24     */
    2025    public void flush() {
    21         out.flush();
     26        if (out != null) {
     27            out.flush();
     28        }
    2229    }
    2330
     
    6976        encoding.put('\t', "&#x9;");
    7077    }
     78   
     79    @Override
     80    public void close() throws IOException {
     81        if (out != null) {
     82            out.close();
     83        }
     84    }
    7185}
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java

    r5819 r5874  
    178178            Utils.copyStream(is, baos);
    179179        } finally {
    180             is.close();
     180            Utils.close(is);
    181181        }
    182182
     
    201201            return exception.toString();
    202202        } finally {
    203             br.close();
     203            Utils.close(br);
    204204        }
    205205    }
  • trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java

    r5684 r5874  
    101101        public MarkerWriter(PrintWriter out) {
    102102            super(out);
    103             creator = "JOSM Marker export";
    104103        }
    105104
  • trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java

    r5684 r5874  
    247247            zipOut.putNextEntry(entry);
    248248            writeJos(doc, zipOut);
    249             zipOut.close();
     249            Utils.close(zipOut);
    250250        } else {
    251251            writeJos(doc, new BufferedOutputStream(out));
  • trunk/src/org/openstreetmap/josm/plugins/Plugin.java

    r5836 r5874  
    1515import org.openstreetmap.josm.gui.download.DownloadSelection;
    1616import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
     17import org.openstreetmap.josm.tools.Utils;
    1718
    1819/**
     
    110111            pluginDir.mkdirs();
    111112        }
    112         FileOutputStream out = new FileOutputStream(new File(pluginDirName, to));
    113         InputStream in = getClass().getResourceAsStream(from);
    114         byte[] buffer = new byte[8192];
    115         for(int len = in.read(buffer); len > 0; len = in.read(buffer)) {
    116             out.write(buffer, 0, len);
     113        FileOutputStream out = null;
     114        InputStream in = null;
     115        try {
     116            out = new FileOutputStream(new File(pluginDirName, to));
     117            in = getClass().getResourceAsStream(from);
     118            byte[] buffer = new byte[8192];
     119            for(int len = in.read(buffer); len > 0; len = in.read(buffer)) {
     120                out.write(buffer, 0, len);
     121            }
     122        } finally {
     123            Utils.close(in);
     124            Utils.close(out);
    117125        }
    118         in.close();
    119         out.close();
    120126    }
    121127
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r5836 r5874  
    129129                out.write(buffer, 0, read);
    130130            }
    131             out.close();
    132             in.close();
    133131        } catch(MalformedURLException e) {
    134132            String msg = tr("Warning: Cannot download plugin ''{0}''. Its download link ''{1}'' is not a valid URL. Skipping download.", pi.name, pi.downloadlink);
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r5836 r5874  
    2929import org.openstreetmap.josm.tools.ImageProvider;
    3030import org.openstreetmap.josm.tools.LanguageInfo;
     31import org.openstreetmap.josm.tools.Utils;
    3132
    3233/**
     
    100101            throw new PluginException(name, e);
    101102        } finally {
    102             if (jar != null) {
    103                 try {
    104                     jar.close();
    105                 } catch(IOException e) { /* ignore */ }
    106             }
    107             if (fis != null) {
    108                 try {
    109                     fis.close();
    110                 } catch(IOException e) { /* ignore */ }
    111             }
     103            Utils.close(jar);
     104            Utils.close(fis);
    112105        }
    113106    }
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r5836 r5874  
    218218                out.write(buffer, 0, read);
    219219            }
    220             out.close();
    221             in.close();
    222220        } catch(MalformedURLException e) {
    223221            if (canceled) return;
     
    229227            return;
    230228        } finally {
     229            Utils.close(out);
    231230            synchronized(this) {
    232231                if (connection != null) {
     
    274273            if (writer != null) {
    275274                writer.flush();
    276                 writer.close();
     275                Utils.close(writer);
    277276            }
    278277        }
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r5871 r5874  
    256256                        audioOutputLine.close();
    257257                        audioOutputLine = null;
    258                         audioInputStream.close();
     258                        Utils.close(audioInputStream);
    259259                        audioInputStream = null;
    260260                        playingUrl = null;
     
    277277                            {
    278278                                if (audioInputStream != null) {
    279                                     audioInputStream.close();
     279                                    Utils.close(audioInputStream);
    280280                                    audioInputStream = null;
    281281                                }
  • trunk/src/org/openstreetmap/josm/tools/AudioUtil.java

    r5871 r5874  
    3333                * audioFormat.getFrameSize() /* bytes per frame */;
    3434            double naturalLength = filesize / bytesPerSecond;
    35             audioInputStream.close();
     35            Utils.close(audioInputStream);
    3636            double calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);
    3737            return naturalLength / calibration;
  • trunk/src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java

    r5849 r5874  
    4444
    4545    //http://stuffthathappens.com/blog/2007/10/15/one-more-note-on-uncaught-exception-handlers/
     46    /**
     47     * Handles the given throwable object
     48     * @param t The throwable object
     49     */
    4650    public void handle(Throwable t) {
    4751        handleException(t);
    4852    }
    4953
     54    /**
     55     * Handles the given exception
     56     * @param e the exception
     57     */
    5058    public static void handleException(final Throwable e) {
    5159        if (handlingInProgress)
     
    165173        }
    166174    }
     175   
     176    /**
     177     * Determines if an exception is currently being handled
     178     * @return {@code true} if an exception is currently being handled, {@code false} otherwise
     179     */
    167180    public static boolean exceptionHandlingInProgress() {
    168181        return handlingInProgress;
     
    180193            GZIPOutputStream gzip = new GZIPOutputStream(out);
    181194            gzip.write(debugText.getBytes("UTF-8"));
    182             gzip.close();
     195            Utils.close(gzip);
    183196   
    184197            return new URL("http://josm.openstreetmap.de/josmticket?" +
  • trunk/src/org/openstreetmap/josm/tools/I18n.java

    r5839 r5874  
    422422                    load(jar, jarTrans, true);
    423423            }
    424         }
    425         catch(IOException e)
    426         {
    427         }
    428         finally
    429         {
    430             try
    431             {
    432                 if(jar != null)
    433                     jar.close();
    434                 if(fis != null)
    435                     fis.close();
    436                 if(jarTrans != null)
    437                     jarTrans.close();
    438                 if(fisTrans != null)
    439                     fisTrans.close();
    440             }
    441             catch(IOException e)
    442             {
    443             }
     424        } catch(IOException e) {
     425            // Ignore
     426        } finally {
     427            Utils.close(jar);
     428            Utils.close(fis);
     429            Utils.close(jarTrans);
     430            Utils.close(fisTrans);
    444431        }
    445432    }
     
    482469            // Ignore exception
    483470        } finally {
    484             if (trStream != null) try {trStream.close();} catch(IOException e) {}
    485             if (enStream != null) try {enStream.close();} catch(IOException e) {}
     471            Utils.close(trStream);
     472            Utils.close(enStream);
    486473        }
    487474        return false;
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r5863 r5874  
    556556                    }
    557557                } finally {
    558                     if (is != null) {
    559                         is.close();
    560                     }
     558                    Utils.close(is);
    561559                }
    562560            }
     
    564562            System.err.println(tr("Warning: failed to handle zip file ''{0}''. Exception was: {1}", archive.getName(), e.toString()));
    565563        } finally {
    566             if (zipFile != null) {
    567                 try {
    568                     zipFile.close();
    569                 } catch (IOException ex) {
    570                 }
    571             }
     564            Utils.close(zipFile);
    572565        }
    573566        return null;
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r5867 r5874  
    9494                BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    9595                String line = Utils.strip(input.readLine());
    96                 input.close();
     96                Utils.close(input);
    9797                if (line != null && !line.isEmpty()) {
    9898                    line = line.replaceAll("\"+","");
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r5868 r5874  
    1111import java.awt.datatransfer.UnsupportedFlavorException;
    1212import java.io.BufferedReader;
     13import java.io.Closeable;
    1314import java.io.File;
     15import java.io.FileInputStream;
     16import java.io.FileOutputStream;
    1417import java.io.IOException;
    1518import java.io.InputStream;
    1619import java.io.InputStreamReader;
    1720import java.io.OutputStream;
    18 import java.io.Reader;
    1921import java.io.UnsupportedEncodingException;
    2022import java.net.HttpURLConnection;
    2123import java.net.URL;
    2224import java.net.URLConnection;
     25import java.nio.channels.FileChannel;
    2326import java.security.MessageDigest;
    2427import java.security.NoSuchAlgorithmException;
     
    3033import java.util.Iterator;
    3134import java.util.List;
     35import java.util.zip.ZipFile;
    3236
    3337import org.openstreetmap.josm.Main;
     
    237241    }
    238242
     243    /**
     244     * Simple file copy function that will overwrite the target file.<br/>
     245     * Taken from <a href="http://www.rgagnon.com/javadetails/java-0064.html">this article</a> (CC-NC-BY-SA)
     246     * @param in The source file
     247     * @param out The destination file
     248     * @throws IOException If any I/O error occurs
     249     */
     250    public static void copyFile(File in, File out) throws IOException  {
     251        // TODO: remove this function when we move to Java 7 (use Files.copy instead)
     252        FileInputStream inStream = null;
     253        FileOutputStream outStream = null;
     254        try {
     255            inStream = new FileInputStream(in);
     256            outStream = new FileOutputStream(out);
     257            FileChannel inChannel = inStream.getChannel();
     258            inChannel.transferTo(0, inChannel.size(), outStream.getChannel());
     259        }
     260        catch (IOException e) {
     261            throw e;
     262        }
     263        finally {
     264            close(outStream);
     265            close(inStream);
     266        }
     267    }
     268   
    239269    public static int copyStream(InputStream source, OutputStream destination) throws IOException {
    240270        int count = 0;
     
    264294
    265295    /**
    266      * <p>Utility method for closing an input stream.</p>
     296     * <p>Utility method for closing a {@link Closeable} object.</p>
    267297     *
    268      * @param is the input stream. May be null.
    269      */
    270     public static void close(InputStream is){
    271         if (is == null) return;
     298     * @param c the closeable object. May be null.
     299     */
     300    public static void close(Closeable c) {
     301        if (c == null) return;
    272302        try {
    273             is.close();
    274         } catch(IOException e){
     303            c.close();
     304        } catch(IOException e) {
    275305            // ignore
    276306        }
    277307    }
    278 
    279     /**
    280      * <p>Utility method for closing an output stream.</p>
     308   
     309    /**
     310     * <p>Utility method for closing a {@link ZipFile}.</p>
    281311     *
    282      * @param os the output stream. May be null.
    283      */
    284     public static void close(OutputStream os){
    285         if (os == null) return;
     312     * @param zip the zip file. May be null.
     313     */
     314    public static void close(ZipFile zip) {
     315        if (zip == null) return;
    286316        try {
    287             os.close();
    288         } catch(IOException e){
    289             // ignore
    290         }
    291     }
    292 
    293     /**
    294      * <p>Utility method for closing a reader.</p>
    295      *
    296      * @param reader the reader. May be null.
    297      */
    298     public static void close(Reader reader){
    299         if (reader == null) return;
    300         try {
    301             reader.close();
    302         } catch(IOException e){
     317            zip.close();
     318        } catch(IOException e) {
    303319            // ignore
    304320        }
  • trunk/src/org/openstreetmap/josm/tools/WikiReader.java

    r5868 r5874  
    44import java.io.BufferedReader;
    55import java.io.IOException;
    6 import java.io.InputStream;
    76import java.net.URL;
    87
     
    4140            return readNormal(in);
    4241        } finally {
    43             in.close();
     42            Utils.close(in);
    4443        }
    4544    }
     
    6362            return readFromTrac(in);
    6463        } finally {
    65             in.close();
     64            Utils.close(in);
    6665        }
    6766    }
Note: See TracChangeset for help on using the changeset viewer.