Changeset 1591 in josm


Ignore:
Timestamp:
2009-05-15T09:38:39+02:00 (15 years ago)
Author:
stoecker
Message:

improved plugin information download

Location:
trunk/src/org/openstreetmap/josm/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloader.java

    r1588 r1591  
    8383        /* TODO: remove old site files (everything except .jar) */
    8484            try {
    85                 BufferedReader r = new BufferedReader(new InputStreamReader(new URL(site).openStream()));
     85                BufferedReader r = new BufferedReader(new InputStreamReader(new URL(site).openStream(), "utf-8"));
    8686                StringBuilder b = new StringBuilder();
    8787                for (String line = r.readLine(); line != null; line = r.readLine())
  • trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java

    r1588 r1591  
    1313import java.io.ByteArrayInputStream;
    1414import java.io.File;
    15 import java.io.FileReader;
     15import java.io.FileInputStream;
     16import java.io.InputStreamReader;
    1617import java.io.IOException;
    1718import java.util.Arrays;
     
    270271                        }
    271272                    } else if (fname.matches("^[0-9]+-site.*\\.txt$")) {
     273                        int err = 0;
    272274                        try {
    273                             BufferedReader r = new BufferedReader(new FileReader(f));
     275                            BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(f), "utf-8"));
    274276                            String name = null;
    275277                            String url = null;
     
    291293                                    if(name != null)
    292294                                    {
    293                                         PluginInformation info = new PluginInformation(null, name.substring(0,name.length()-4),
    294                                         new ByteArrayInputStream(manifest.getBytes()));
    295                                         info.downloadlink = url;
    296                                         if(!availablePlugins.containsKey(info.name))
    297                                             availablePlugins.put(info.name, info);
    298                                         manifest = null;
     295                                        try
     296                                        {
     297                                            PluginInformation info = new PluginInformation(null, name.substring(0,name.length()-4),
     298                                            new ByteArrayInputStream(manifest.getBytes()));
     299                                            info.downloadlink = url;
     300                                            if(!availablePlugins.containsKey(info.name))
     301                                                availablePlugins.put(info.name, info);
     302                                        }
     303                                        catch (Exception e)
     304                                        {
     305                                            e.printStackTrace();
     306                                            ++err;
     307                                        }
    299308                                    }
    300309                                    String x[] = line.split(";");
    301310                                    name = x[0];
    302311                                    url = x[1];
     312                                    manifest = null;
    303313                                }
    304314                            }
     
    314324                        } catch (Exception e) {
    315325                            e.printStackTrace();
    316                             JOptionPane.showMessageDialog(Main.parent, tr("Error reading plugin information file: {0}", f.getName()));
     326                            ++err;
     327                        }
     328                        if(err > 0)
     329                        {
     330                          JOptionPane.showMessageDialog(Main.parent, tr("Error reading plugin information file: {0}", f.getName()));
    317331                        }
    318332                    }
Note: See TracChangeset for help on using the changeset viewer.