Changeset 5307 in josm for trunk/src/org


Ignore:
Timestamp:
2012-06-28T10:52:00+02:00 (12 years ago)
Author:
simon04
Message:

see #7818 - make plugin list parsing more robust.

In case of an error, resume with next item.

File:
1 edited

Legend:

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

    r5306 r5307  
    3232     * @throws PluginListParseException
    3333     */
    34     protected PluginInformation createInfo(String name, String url, String manifest) throws PluginListParseException{
     34    protected static PluginInformation createInfo(String name, String url, String manifest) throws PluginListParseException{
    3535        try {
    3636            return new PluginInformation(
     
    8484                    continue;
    8585                }
    86                 if (name != null) {
    87                     PluginInformation info = createInfo(name, url, manifest.toString());
    88                     if (info != null) {
    89                         for (PluginProxy plugin : PluginHandler.pluginList) {
    90                             if (plugin.getPluginInformation().name.equals(info.getName())) {
    91                                 info.localversion = plugin.getPluginInformation().localversion;
    92                             }
    93                         }
    94                         ret.add(info);
    95                     }
    96                 }
     86                addPluginInformation(ret, name, url, manifest.toString());
    9787                String x[] = line.split(";");
    9888                if(x.length != 2)
     
    10393
    10494            }
     95            addPluginInformation(ret, name, url, manifest.toString());
     96            return ret;
     97        } catch (IOException e) {
     98            throw new PluginListParseException(e);
     99        }
     100    }
     101
     102    private static void addPluginInformation(List<PluginInformation> ret, String name, String url, String manifest) {
     103        try {
    105104            if (name != null) {
    106105                PluginInformation info = createInfo(name, url, manifest.toString());
     
    114113                }
    115114            }
    116             return ret;
    117         } catch (IOException e) {
    118             throw new PluginListParseException(e);
     115        } catch (PluginListParseException ex) {
     116            ex.printStackTrace();
    119117        }
    120118    }
     119
    121120}
Note: See TracChangeset for help on using the changeset viewer.