Changeset 1359 in josm for trunk/src


Ignore:
Timestamp:
2009-01-31T22:58:40+01:00 (15 years ago)
Author:
stoecker
Message:

fix MOTD parsing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r1356 r1359  
    5252        }
    5353    }
    54    
     54
    5555    public class readMOTD implements Callable<String> {
    5656        private boolean isLocalized;
     
    5959        private String urlIntl;
    6060        private String urlBase;
    61        
     61
    6262        readMOTD(boolean isLocalized, String urlBase, String urlLoc, String urlIntl, boolean isHelp) {
    6363          this.isLocalized = isLocalized;
     
    8282                        content += message;
    8383                    else
    84                         content += "<ul><li>"+ message.substring(8)+"</li></ul>";
     84                        content += "<ul><li>"+ message.substring(8).replaceAll("\n *\\* +","</li><li>")+"</li></ul>";
    8585            } catch (IOException ioe) {
    8686                try {
     
    8888                        content += wr.read(urlIntl);
    8989                    else
    90                         content += "<ul><li>"+wr.read(urlIntl).substring(8)+"</li></ul>";
     90                        content += "<ul><li>"+wr.read(urlIntl).substring(8).replaceAll("\n *\\* +","</li><li>")+"</li></ul>";
    9191                } catch (IOException ioe2) {
    9292                }
    9393            }
    94            
     94
    9595            return content;
    9696        }
     
    135135            linksList += matcher.group(1)+matcher.group(2)+matcher.group(3)+": ";
    136136        }
    137        
     137
    138138        // We cannot use Main.worker here because it's single-threaded and
    139139        // setting it to multi-threading will cause problems elsewhere
    140140        ExecutorService slave = Executors.newCachedThreadPool();
    141        
     141
    142142        ArrayList<Future<String>> linkContent = new ArrayList<Future<String>>();
    143143        for(int i=0; i < links.size(); i++) {
     
    165165
    166166            if(!included) continue;
    167            
     167
    168168            boolean isHelp = targetVersion == 1;
    169169            String urlStart = baseurl + "/wiki/";
     
    171171            String urlLoc = urlStart + languageCode + urlEnd;
    172172            String urlIntl = urlStart + urlEnd;
    173            
     173
    174174            // This adds all links to the worker which will download them concurrently
    175175            linkContent.add(slave.submit(new readMOTD(isLocalized, baseurl, urlLoc, urlIntl, isHelp)));
    176176        }
    177        
     177
    178178        for(int i=0; i < linkContent.size(); i++) {
    179179            try {
     
    181181            } catch (Exception e) {}
    182182        }
    183        
     183
    184184        content = "<html>\n"+
    185185            styles +
Note: See TracChangeset for help on using the changeset viewer.