src/org/openstreetmap/josm/plugins/opendata/core/modules/ReadRemoteModuleInformationTask.java
protected void downloadModuleIcons(String site, File destFile, ProgressMonitor monitor) {
        try {
            site = site.replaceAll("%<(.*)>", "");

            monitor.beginTask("");
            monitor.indeterminateSubTask(tr("Downloading module list from ''{0}''", site));

            URL url = new URL(site);
            synchronized (this) {
                connection = (HttpURLConnection) url.openConnection();
                connection.setRequestProperty("Cache-Control", "no-cache");
                connection.setRequestProperty("User-Agent", Version.getInstance().getAgentString());
                connection.setRequestProperty("Host", url.getHost());
            }
            try (
                    InputStream in = connection.getInputStream();
                    OutputStream out = new FileOutputStream(destFile)
                    ) {
                byte[] buffer = new byte[8192];
                for (int read = in.read(buffer); read != -1; read = in.read(buffer)) {
                    out.write(buffer, 0, read);
                }
            }
        } catch (MalformedURLException e) {
            if (canceled) return;
            e.printStackTrace();
            return;
        } catch (IOException e) {
            if (canceled) return;
            e.printStackTrace();
            return;
        } finally {
            synchronized (this) {
                if (connection != null) {
                    connection.disconnect();
                }
                connection = null;
            }
            monitor.finishTask();
        }
        for (ModuleInformation pi : availableModules) {
            if (pi.icon == null && pi.iconPath != null) {
                pi.icon = new ImageProvider(pi.name+".jar/"+pi.iconPath)
                        .setArchive(destFile)
                        .setMaxWidth(24)
                        .setMaxHeight(24)
                        .setOptional(true).get();
            }
        }
    }
/**
     * Downloads the icon archive from a remote location
     *
     * @param site the site URL
     * @param monitor a progress monitor
     */
Downloads the icon archive from a remote location

@param site the site URL
@param monitor a progress monitor
Downloads the icon archive from a remote location @param site the site URL @param monitor a progress monitor
protected void downloadModuleIcons(String site, File destFile, ProgressMonitor monitor) {
        try {
            site = site.replaceAll("%<(.*)>", "");
            monitor.beginTask("");
            monitor.indeterminateSubTask(tr("Downloading module list from ''{0}''", site));
            URL url = new URL(site);
            synchronized (this) {
                connection = (HttpURLConnection) url.openConnection();
                connection.setRequestProperty("Cache-Control", "no-cache");
                connection.setRequestProperty("User-Agent", Version.getInstance().getAgentString());
                connection.setRequestProperty("Host", url.getHost());
            }
            try (
                    InputStream in = connection.getInputStream();
                    OutputStream out = new FileOutputStream(destFile)
                    ) {
                byte[] buffer = new byte[8192];
                for (int read = in.read(buffer); read != -1; read = in.read(buffer)) {
                    out.write(buffer, 0, read);
                }
            }
        } catch (MalformedURLException e) {
            if (canceled) return;
            e.printStackTrace();
            return;
        } catch (IOException e) {
            if (canceled) return;
            e.printStackTrace();
            return;
        } finally {
            synchronized (this) {
                if (connection != null) {
                    connection.disconnect();
                }
                connection = null;
            }
            monitor.finishTask();
        }
        for (ModuleInformation pi : availableModules) {
            if (pi.icon == null && pi.iconPath != null) {
                pi.icon = new ImageProvider(pi.name+".jar/"+pi.iconPath)
                        .setArchive(destFile)
                        .setMaxWidth(24)
                        .setMaxHeight(24)
                        .setOptional(true).get();
            }
        }
    }
protected void downloadModuleIcons ( String site , File destFile , ProgressMonitor monitor ) { try { site = site . replaceAll ( "%<(.*)>" , "" ) ; monitor . beginTask ( "" ) ; monitor . indeterminateSubTask ( tr ( "Downloading module list from ''{0}''" , site ) ) ; URL url = new URL ( site ) ; synchronized ( this ) { connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . setRequestProperty ( "Cache-Control" , "no-cache" ) ; connection . setRequestProperty ( "User-Agent" , Version . getInstance ( ) . getAgentString ( ) ) ; connection . setRequestProperty ( "Host" , url . getHost ( ) ) ; } try ( InputStream in = connection . getInputStream ( ) ; OutputStream out = new FileOutputStream ( destFile ) ) { byte [ ] buffer = new byte [ 8192 ] ; for ( int read = in . read ( buffer ) ; read != - 1 ; read = in . read ( buffer ) ) { out . write ( buffer , 0 , read ) ; } } } catch ( MalformedURLException e ) { if ( canceled ) return ; e . printStackTrace ( ) ; return ; } catch ( IOException e ) { if ( canceled ) return ; e . printStackTrace ( ) ; return ; } finally { synchronized ( this ) { if ( connection != null ) { connection . disconnect ( ) ; } connection = null ; } monitor . finishTask ( ) ; } for ( ModuleInformation pi : availableModules ) { if ( pi . icon == null && pi . iconPath != null ) { pi . icon = new ImageProvider ( pi . name + ".jar/" + pi . iconPath ) . setArchive ( destFile ) . setMaxWidth ( 24 ) . setMaxHeight ( 24 ) . setOptional ( true ) . get ( ) ; } } }
Downloads the icon archive from a remote location
Downloads the icon archive from a remote location