Changeset 2819 in josm for trunk/src/org


Ignore:
Timestamp:
2010-01-12T06:49:00+01:00 (14 years ago)
Author:
Gubaer
Message:

fixed #4349: Upgrading to 2818 hangs on processing plugins

File:
1 edited

Legend:

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

    r2817 r2819  
    7676                }
    7777        );
    78         if (siteCacheFiles != null || siteCacheFiles.length > 0) {
    79             monitor.subTask(tr("Processing plugin site cache files..."));
    80             monitor.setTicksCount(siteCacheFiles.length);
    81             for (File f: siteCacheFiles) {
    82                 String fname = f.getName();
    83                 monitor.setCustomText(tr("Processing file ''{0}''", fname));
    84                 try {
    85                     processLocalPluginInformationFile(f);
    86                 } catch(PluginListParseException e) {
    87                     System.err.println(tr("Warning: Failed to scan file ''{0}'' for plugin information. Skipping.", fname));
    88                     e.printStackTrace();
    89                 }
    90                 monitor.worked(1);
    91             }
     78        if (siteCacheFiles == null || siteCacheFiles.length == 0)
     79            return;
     80        monitor.subTask(tr("Processing plugin site cache files..."));
     81        monitor.setTicksCount(siteCacheFiles.length);
     82        for (File f: siteCacheFiles) {
     83            String fname = f.getName();
     84            monitor.setCustomText(tr("Processing file ''{0}''", fname));
     85            try {
     86                processLocalPluginInformationFile(f);
     87            } catch(PluginListParseException e) {
     88                System.err.println(tr("Warning: Failed to scan file ''{0}'' for plugin information. Skipping.", fname));
     89                e.printStackTrace();
     90            }
     91            monitor.worked(1);
    9292        }
    9393    }
     
    101101                }
    102102        );
    103         if (pluginFiles != null || pluginFiles.length > 0) {
    104             monitor.subTask(tr("Processing plugin files..."));
    105             monitor.setTicksCount(pluginFiles.length);
    106             for (File f: pluginFiles) {
    107                 String fname = f.getName();
    108                 monitor.setCustomText(tr("Processing file ''{0}''", fname));
    109                 try {
    110                     if (fname.endsWith(".jar")) {
    111                         String pluginName = fname.substring(0, fname.length() - 4);
    112                         processJarFile(f, pluginName);
    113                     } else if (fname.endsWith(".jar.new")) {
    114                         String pluginName = fname.substring(0, fname.length() - 8);
    115                         processJarFile(f, pluginName);
    116                     }
    117                 } catch(PluginException e){
    118                     System.err.println(tr("Warning: Failed to scan file ''{0}'' for plugin information. Skipping.", fname));
    119                     e.printStackTrace();
     103        if (pluginFiles == null || pluginFiles.length == 0)
     104            return;
     105        monitor.subTask(tr("Processing plugin files..."));
     106        monitor.setTicksCount(pluginFiles.length);
     107        for (File f: pluginFiles) {
     108            String fname = f.getName();
     109            monitor.setCustomText(tr("Processing file ''{0}''", fname));
     110            try {
     111                if (fname.endsWith(".jar")) {
     112                    String pluginName = fname.substring(0, fname.length() - 4);
     113                    processJarFile(f, pluginName);
     114                } else if (fname.endsWith(".jar.new")) {
     115                    String pluginName = fname.substring(0, fname.length() - 8);
     116                    processJarFile(f, pluginName);
    120117                }
    121                 monitor.worked(1);
    122             }
     118            } catch(PluginException e){
     119                System.err.println(tr("Warning: Failed to scan file ''{0}'' for plugin information. Skipping.", fname));
     120                e.printStackTrace();
     121            }
     122            monitor.worked(1);
    123123        }
    124124    }
Note: See TracChangeset for help on using the changeset viewer.