Ignore:
Timestamp:
2019-05-02T04:33:57+02:00 (5 years ago)
Author:
Don-vip
Message:

checkstyle/PMD

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/SyncEditorLayerIndex.java

    r15033 r15034  
    11// License: GPL. For details, see LICENSE file.
     2import static java.nio.charset.StandardCharsets.UTF_8;
    23import static org.apache.commons.lang3.StringUtils.isBlank;
    34import static org.apache.commons.lang3.StringUtils.isNotBlank;
    45
    56import java.io.BufferedReader;
    6 import java.io.FileInputStream;
    7 import java.io.FileNotFoundException;
    8 import java.io.FileOutputStream;
    97import java.io.IOException;
    108import java.io.InputStreamReader;
     9import java.io.OutputStream;
    1110import java.io.OutputStreamWriter;
    12 import java.io.UnsupportedEncodingException;
    1311import java.lang.reflect.Field;
     12import java.nio.file.Files;
     13import java.nio.file.Paths;
    1414import java.text.DecimalFormat;
    1515import java.text.ParseException;
     
    5050import org.openstreetmap.josm.io.imagery.ImageryReader;
    5151import org.openstreetmap.josm.spi.preferences.Config;
     52import org.openstreetmap.josm.tools.Logging;
    5253import org.openstreetmap.josm.tools.OptionParser;
    5354import org.openstreetmap.josm.tools.OptionParser.OptionCount;
     
    7475public class SyncEditorLayerIndex {
    7576
     77    private static final int MAXLEN = 140;
     78
    7679    private List<ImageryInfo> josmEntries;
    7780    private JsonArray eliEntries;
    7881
    79     private Map<String, JsonObject> eliUrls = new HashMap<>();
    80     private Map<String, ImageryInfo> josmUrls = new HashMap<>();
    81     private Map<String, ImageryInfo> josmMirrors = new HashMap<>();
    82     private static Map<String, String> oldproj = new HashMap<>();
    83     private static List<String> ignoreproj = new LinkedList<>();
     82    private final Map<String, JsonObject> eliUrls = new HashMap<>();
     83    private final Map<String, ImageryInfo> josmUrls = new HashMap<>();
     84    private final Map<String, ImageryInfo> josmMirrors = new HashMap<>();
     85    private static final Map<String, String> oldproj = new HashMap<>();
     86    private static final List<String> ignoreproj = new LinkedList<>();
    8487
    8588    private static String eliInputFile = "imagery_eli.geojson";
    8689    private static String josmInputFile = "imagery_josm.imagery.xml";
    8790    private static String ignoreInputFile = "imagery_josm.ignores.txt";
    88     private static FileOutputStream outputFile = null;
    89     private static OutputStreamWriter outputStream = null;
     91    private static OutputStream outputFile;
     92    private static OutputStreamWriter outputStream;
    9093    private static String optionOutput;
    9194    private static boolean optionShorten;
     
    108111    public static void main(String[] args) throws IOException, SAXException, ReflectiveOperationException {
    109112        Locale.setDefault(Locale.ROOT);
    110         parse_command_line_arguments(args);
     113        parseCommandLineArguments(args);
    111114        Preferences pref = new Preferences(JosmBaseDirectories.getInstance());
    112115        Config.setPreferencesInstance(pref);
     
    118121        script.loadJosmEntries();
    119122        if (optionJosmXml != null) {
    120             FileOutputStream file = new FileOutputStream(optionJosmXml);
    121             OutputStreamWriter stream = new OutputStreamWriter(file, "UTF-8");
    122             script.printentries(script.josmEntries, stream);
    123             stream.close();
    124             file.close();
     123            try (OutputStreamWriter stream = new OutputStreamWriter(Files.newOutputStream(Paths.get(optionJosmXml)), UTF_8)) {
     124                script.printentries(script.josmEntries, stream);
     125            }
    125126        }
    126127        script.loadELIEntries();
    127128        if (optionEliXml != null) {
    128             FileOutputStream file = new FileOutputStream(optionEliXml);
    129             OutputStreamWriter stream = new OutputStreamWriter(file, "UTF-8");
    130             script.printentries(script.eliEntries, stream);
    131             stream.close();
    132             file.close();
     129            try (OutputStreamWriter stream = new OutputStreamWriter(Files.newOutputStream(Paths.get(optionEliXml)), UTF_8)) {
     130                script.printentries(script.eliEntries, stream);
     131            }
    133132        }
    134133        script.checkInOneButNotTheOther();
     
    154153        return "usage: java -cp build SyncEditorLayerIndex\n" +
    155154        "-c,--encoding <encoding>           output encoding (defaults to UTF-8 or cp850 on Windows)\n" +
    156         "-e,--eli_input <eli_input>         Input file for the editor layer index (geojson). Default is imagery_eli.geojson (current directory).\n" +
     155        "-e,--eli_input <eli_input>         Input file for the editor layer index (geojson). " +
     156                                            "Default is imagery_eli.geojson (current directory).\n" +
    157157        "-h,--help                          show this help\n" +
    158158        "-i,--ignore_input <ignore_input>   Input file for the ignore list. Default is imagery_josm.ignores.txt (current directory).\n" +
    159         "-j,--josm_input <josm_input>       Input file for the JOSM imagery list (xml). Default is imagery_josm.imagery.xml (current directory).\n" +
     159        "-j,--josm_input <josm_input>       Input file for the JOSM imagery list (xml). " +
     160                                            "Default is imagery_josm.imagery.xml (current directory).\n" +
    160161        "-m,--noeli                         don't show output for ELI problems\n" +
    161162        "-n,--noskip                        don't skip known entries\n" +
     
    171172     * Parse command line arguments.
    172173     * @param args program arguments
    173      * @throws FileNotFoundException if a file can't be found
    174      * @throws UnsupportedEncodingException  if the given encoding can't be found
     174     * @throws IOException in case of I/O error
    175175     */
    176     static void parse_command_line_arguments(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
     176    static void parseCommandLineArguments(String[] args) throws IOException {
    177177        new OptionParser("JOSM/ELI synchronization script")
    178178                .addFlagParameter("help", SyncEditorLayerIndex::showHelp)
     
    204204                .parseOptionsOrExit(Arrays.asList(args));
    205205
    206         if (optionOutput != null && optionOutput != "-") {
    207             outputFile = new FileOutputStream(optionOutput);
     206        if (optionOutput != null && !"-".equals(optionOutput)) {
     207            outputFile = Files.newOutputStream(Paths.get(optionOutput));
    208208            outputStream = new OutputStreamWriter(outputFile, optionEncoding != null ? optionEncoding : "UTF-8");
    209209        } else if (optionEncoding != null) {
     
    233233    void loadSkip() throws IOException {
    234234        final Pattern pattern = Pattern.compile("^\\|\\| *(ELI|Ignore) *\\|\\| *\\{\\{\\{(.+)\\}\\}\\} *\\|\\|");
    235         try (BufferedReader fr = new BufferedReader(new InputStreamReader(new FileInputStream(ignoreInputFile), "UTF-8"))) {
     235        try (BufferedReader fr = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get(ignoreInputFile)), UTF_8))) {
    236236            String line;
    237237
     
    262262            skip.remove(s);
    263263            if (optionXhtmlBody || optionXhtml) {
    264                 s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")+"</pre>";
     264                s = "<pre style=\"margin:3px;color:"+color+"\">"
     265                        + s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")+"</pre>";
    265266            }
    266267            if (!optionNoSkip) {
    267268                return;
    268269            }
    269         } else if(optionXhtmlBody || optionXhtml) {
     270        } else if (optionXhtmlBody || optionXhtml) {
    270271            String color =
    271272                    s.startsWith("***") ? "black" :
     
    273274                            (s.startsWith("#") ? "indigo" :
    274275                                (s.startsWith("!") ? "orange" : "red")));
    275             s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;")+"</pre>";
     276            s = "<pre style=\"margin:3px;color:"+color+"\">"+s.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;")+"</pre>";
    276277        }
    277278        if ((s.startsWith("+ ") || s.startsWith("+++ ELI") || s.startsWith("#")) && optionNoEli) {
     
    283284    void start() throws IOException {
    284285        if (optionXhtml) {
    285             myprintlnfinal("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
    286             myprintlnfinal("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><title>JOSM - ELI differences</title></head><body>\n");
     286            myprintlnfinal(
     287                    "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
     288            myprintlnfinal(
     289                    "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>"+
     290                    "<title>JOSM - ELI differences</title></head><body>\n");
    287291        }
    288292    }
     
    298302
    299303    void loadELIEntries() throws IOException {
    300         try (JsonReader jr = Json.createReader(new InputStreamReader(new FileInputStream(eliInputFile), "UTF-8"))) {
     304        try (JsonReader jr = Json.createReader(new InputStreamReader(Files.newInputStream(Paths.get(eliInputFile)), UTF_8))) {
    301305            eliEntries = jr.readObject().getJsonArray("features");
    302306        }
     
    306310            if (url.contains("{z}")) {
    307311                myprintln("+++ ELI-URL uses {z} instead of {zoom}: "+url);
    308                 url = url.replace("{z}","{zoom}");
     312                url = url.replace("{z}", "{zoom}");
    309313            }
    310314            if (eliUrls.containsKey(url)) {
     
    355359            if (p != null) {
    356360                res += offset + "<projections>\n";
    357                 for (String c : p)
     361                for (String c : p) {
    358362                    res += offset + "    <code>"+c+"</code>\n";
     363                }
    359364                res += offset + "</projections>\n";
    360365            }
     
    370375        for (Object e : entries) {
    371376            stream.write("    <entry"
    372                 + ("eli-best".equals(getQuality(e)) ? " eli-best=\"true\"" : "" )
    373                 + (getOverlay(e) ? " overlay=\"true\"" : "" )
     377                + ("eli-best".equals(getQuality(e)) ? " eli-best=\"true\"" : "")
     378                + (getOverlay(e) ? " overlay=\"true\"" : "")
    374379                + ">\n");
    375380            String t;
     
    428433                        if (lat < minlat) minlat = lat;
    429434                        if (lon < minlon) minlon = lon;
    430                         if ((i++%3) == 0) {
     435                        if ((i++ % 3) == 0) {
    431436                            shapes += sep + "    ";
    432437                        }
     
    435440                    shapes += sep + "</shape>\n";
    436441                }
    437             } catch(IllegalArgumentException ignored) {
     442            } catch (IllegalArgumentException ignored) {
     443                Logging.trace(ignored);
    438444            }
    439445            if (!shapes.isEmpty()) {
    440                 stream.write("        <bounds min-lat='"+df.format(minlat)+"' min-lon='"+df.format(minlon)+"' max-lat='"+df.format(maxlat)+"' max-lon='"+df.format(maxlon)+"'>\n");
     446                stream.write("        <bounds min-lat='"+df.format(minlat)
     447                                          +"' min-lon='"+df.format(minlon)
     448                                          +"' max-lat='"+df.format(maxlat)
     449                                          +"' max-lon='"+df.format(maxlon)+"'>\n");
    441450                stream.write(shapes + "        </bounds>\n");
    442451            }
     
    464473            if (url.contains("{z}")) {
    465474                myprintln("+++ JOSM-URL uses {z} instead of {zoom}: "+url);
    466                 url = url.replace("{z}","{zoom}");
     475                url = url.replace("{z}", "{zoom}");
    467476            }
    468477            if (josmUrls.containsKey(url)) {
     
    475484                Field origNameField = ImageryInfo.class.getDeclaredField("origName");
    476485                ReflectionUtils.setObjectsAccessible(origNameField);
    477                 origNameField.set(m, m.getOriginalName().replaceAll(" mirror server( \\d+)?",""));
     486                origNameField.set(m, m.getOriginalName().replaceAll(" mirror server( \\d+)?", ""));
    478487                if (josmUrls.containsKey(url)) {
    479488                    myprintln("+++ JOSM-Mirror-URL is not unique: "+url);
     
    504513                JsonObject e = eliUrls.get(urle);
    505514                String ide = getId(e);
    506                 String urlhttps = urle.replace("http:","https:");
     515                String urlhttps = urle.replace("http:", "https:");
    507516                if (lj.contains(urlhttps)) {
    508517                    myprintln("+ Missing https: "+getDescription(e));
     
    523532                            // replace key for this entry with JOSM URL
    524533                            eliUrls.remove(urle);
    525                             eliUrls.put(urlj,e);
     534                            eliUrls.put(urlj, e);
    526535                            break;
    527536                        }
     
    548557
    549558    void checkCommonEntries() throws IOException {
     559        doSameUrlButDifferentName();
     560        doSameUrlButDifferentId();
     561        doSameUrlButDifferentType();
     562        doSameUrlButDifferentZoomBounds();
     563        doSameUrlButDifferentCountryCode();
     564        doSameUrlButDifferentQuality();
     565        doSameUrlButDifferentDates();
     566        doSameUrlButDifferentInformation();
     567        doMismatchingShapes();
     568        doMismatchingIcons();
     569        doMiscellaneousChecks();
     570    }
     571
     572    void doSameUrlButDifferentName() throws IOException {
    550573        myprintln("*** Same URL, but different name: ***");
    551574        for (String url : eliUrls.keySet()) {
     
    553576            if (!josmUrls.containsKey(url)) continue;
    554577            ImageryInfo j = josmUrls.get(url);
    555             String ename = getName(e).replace("'","\u2019");
    556             String jname = getName(j).replace("'","\u2019");
     578            String ename = getName(e).replace("'", "\u2019");
     579            String jname = getName(j).replace("'", "\u2019");
    557580            if (!ename.equals(jname)) {
    558581                myprintln("* Name differs ('"+getName(e)+"' != '"+getName(j)+"'): "+getUrl(j));
    559582            }
    560583        }
    561 
     584    }
     585
     586    void doSameUrlButDifferentId() throws IOException {
    562587        myprintln("*** Same URL, but different Id: ***");
    563588        for (String url : eliUrls.keySet()) {
     
    571596            }
    572597        }
    573 
     598    }
     599
     600    void doSameUrlButDifferentType() throws IOException {
    574601        myprintln("*** Same URL, but different type: ***");
    575602        for (String url : eliUrls.keySet()) {
     
    581608            }
    582609        }
    583 
     610    }
     611
     612    void doSameUrlButDifferentZoomBounds() throws IOException {
    584613        myprintln("*** Same URL, but different zoom bounds: ***");
    585614        for (String url : eliUrls.keySet()) {
     
    605634            }
    606635        }
    607 
     636    }
     637
     638    void doSameUrlButDifferentCountryCode() throws IOException {
    608639        myprintln("*** Same URL, but different country code: ***");
    609640        for (String url : eliUrls.keySet()) {
     
    619650            }
    620651        }
     652    }
     653
     654    void doSameUrlButDifferentQuality() throws IOException {
    621655        myprintln("*** Same URL, but different quality: ***");
    622656        for (String url : eliUrls.keySet()) {
     
    634668            }
    635669        }
     670    }
     671
     672    void doSameUrlButDifferentDates() throws IOException {
    636673        myprintln("*** Same URL, but different dates: ***");
    637674        Pattern pattern = Pattern.compile("^(.*;)(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?$");
     
    642679            String jd = getDate(j);
    643680            // The forms 2015;- or -;2015 or 2015;2015 are handled equal to 2015
    644             String ef = ed.replaceAll("\\A-;","").replaceAll(";-\\z","").replaceAll("\\A([0-9-]+);\\1\\z", "$1");
     681            String ef = ed.replaceAll("\\A-;", "").replaceAll(";-\\z", "").replaceAll("\\A([0-9-]+);\\1\\z", "$1");
    645682            // ELI has a strange and inconsistent used end_date definition, so we try again with subtraction by one
    646683            String ed2 = ed;
     
    658695                    ed2 += "-" + String.format("%02d", cal.get(Calendar.DAY_OF_MONTH));
    659696            }
    660             String ef2 = ed2.replaceAll("\\A-;","").replaceAll(";-\\z","").replaceAll("\\A([0-9-]+);\\1\\z", "$1");
     697            String ef2 = ed2.replaceAll("\\A-;", "").replaceAll(";-\\z", "").replaceAll("\\A([0-9-]+);\\1\\z", "$1");
    661698            if (!ed.equals(jd) && !ef.equals(jd) && !ed2.equals(jd) && !ef2.equals(jd)) {
    662699                String t = "'"+ed+"'";
     
    673710            }
    674711        }
     712    }
     713
     714    void doSameUrlButDifferentInformation() throws IOException {
    675715        myprintln("*** Same URL, but different information: ***");
    676716        for (String url : eliUrls.keySet()) {
     
    723763                    myprintln("- Missing JOSM attribution URL ("+et+"): "+getDescription(j));
    724764                } else if (isNotBlank(et)) {
    725                     String ethttps = et.replace("http:","https:");
     765                    String ethttps = et.replace("http:", "https:");
    726766                    if (jt.equals(ethttps) || jt.equals(et+"/") || jt.equals(ethttps+"/")) {
    727767                        myprintln("+ Attribution URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j));
     
    786826            }
    787827        }
     828    }
     829
     830    void doMismatchingShapes() throws IOException {
    788831        myprintln("*** Mismatching shapes: ***");
    789832        for (String url : josmUrls.keySet()) {
     
    792835            for (Shape shape : getShapes(j)) {
    793836                List<Coordinate> p = shape.getPoints();
    794                 if(!p.get(0).equals(p.get(p.size()-1))) {
     837                if (!p.get(0).equals(p.get(p.size()-1))) {
    795838                    myprintln("+++ JOSM shape "+num+" unclosed: "+getDescription(j));
    796839                }
     
    811854                for (Shape shape : s) {
    812855                    List<Coordinate> p = shape.getPoints();
    813                     if(!p.get(0).equals(p.get(p.size()-1)) && !optionNoEli) {
     856                    if (!p.get(0).equals(p.get(p.size()-1)) && !optionNoEli) {
    814857                        myprintln("+++ ELI shape "+num+" unclosed: "+getDescription(e));
    815858                    }
     
    834877                    myprintln("+ No ELI shape: "+getDescription(j));
    835878                }
    836             } else if(js.isEmpty() && !s.isEmpty()) {
     879            } else if (js.isEmpty() && !s.isEmpty()) {
    837880                // don't report boundary like 5 point shapes as difference
    838881                if (s.size() != 1 || s.get(0).getPoints().size() != 5) {
    839882                    myprintln("- No JOSM shape: "+getDescription(j));
    840883                }
    841             } else if(s.size() != js.size()) {
     884            } else if (s.size() != js.size()) {
    842885                myprintln("* Different number of shapes ("+s.size()+" != "+js.size()+"): "+getDescription(j));
    843886            } else {
     
    850893                        if (ep.size() == jp.size() && !jdone[jnums]) {
    851894                            boolean err = false;
    852                             for(int nump = 0; nump < ep.size() && !err; ++nump) {
     895                            for (int nump = 0; nump < ep.size() && !err; ++nump) {
    853896                                Coordinate ept = ep.get(nump);
    854897                                Coordinate jpt = jp.get(nump);
    855                                 if(Math.abs(ept.getLat()-jpt.getLat()) > 0.00001 || Math.abs(ept.getLon()-jpt.getLon()) > 0.00001)
     898                                if (Math.abs(ept.getLat()-jpt.getLat()) > 0.00001 || Math.abs(ept.getLon()-jpt.getLon()) > 0.00001)
    856899                                    err = true;
    857900                            }
    858                             if(!err) {
     901                            if (!err) {
    859902                                edone[enums] = true;
    860903                                jdone[jnums] = true;
     
    897940                                numtxt += '/' + Integer.toString(jnums+1);
    898941                            }
    899                             myprintln("* Different number of points for shape "+numtxt+" ("+ep.size()+" ! = "+jp.size()+")): "+getDescription(j));
     942                            myprintln("* Different number of points for shape "+numtxt+" ("+ep.size()+" ! = "+jp.size()+")): "
     943                                    + getDescription(j));
    900944                            edone[enums] = true;
    901945                            jdone[jnums] = true;
     
    906950            }
    907951        }
     952    }
     953
     954    void doMismatchingIcons() throws IOException {
    908955        myprintln("*** Mismatching icons: ***");
    909956        for (String url : eliUrls.keySet()) {
     
    927974              || ie.startsWith("https://raw.githubusercontent.com/osmlab/editor-layer-index/")) &&
    928975              ij.startsWith("data:"))) {
    929                 String iehttps = ie.replace("http:","https:");
     976                String iehttps = ie.replace("http:", "https:");
    930977                if (ij.equals(iehttps)) {
    931978                    myprintln("+ Different icons: "+getDescription(j));
     
    935982            }
    936983        }
     984    }
     985
     986    void doMiscellaneousChecks() throws IOException {
    937987        myprintln("*** Miscellaneous checks: ***");
    938988        Map<String, ImageryInfo> josmIds = new HashMap<>();
     
    9641014                    }
    9651015                    for (String o : old) {
    966                         myprintln("* Projection "+o+" is an old unsupported code and has been replaced by "+oldproj.get(o)+": "+getDescription(j));
     1016                        myprintln("* Projection "+o+" is an old unsupported code and has been replaced by "+oldproj.get(o)+": "
     1017                                + getDescription(j));
    9671018                    }
    9681019                }
     
    9951046                    myprintln("* Strange URL '"+u+"': "+getDescription(j));
    9961047                } else {
    997                     String domain = m.group(1).replaceAll("\\{switch:.*\\}","x");
     1048                    String domain = m.group(1).replaceAll("\\{switch:.*\\}", "x");
    9981049                    String port = m.group(2);
    9991050                    if (!(domain.matches("^\\d+\\.\\d+\\.\\d+\\.\\d+$")) && !dv.isValid(domain))
     
    10281079                            myprintln("* JOSM-Date '"+d+"' is strange (second earlier than first): "+getDescription(j));
    10291080                        }
    1030                     }
    1031                     catch (Exception e) {
     1081                    } catch (Exception e) {
    10321082                        myprintln("* JOSM-Date '"+d+"' is strange ("+e.getMessage()+"): "+getDescription(j));
    10331083                    }
     
    10531103                        double lat = p.getLat();
    10541104                        double lon = p.getLon();
    1055                         if(lat > maxlat) maxlat = lat;
    1056                         if(lon > maxlon) maxlon = lon;
    1057                         if(lat < minlat) minlat = lat;
    1058                         if(lon < minlon) minlon = lon;
     1105                        if (lat > maxlat) maxlat = lat;
     1106                        if (lon > maxlon) maxlon = lon;
     1107                        if (lat < minlat) minlat = lat;
     1108                        if (lon < minlon) minlon = lon;
    10591109                    }
    10601110                }
     
    10621112                if (b.getMinLat() != minlat || b.getMinLon() != minlon || b.getMaxLat() != maxlat || b.getMaxLon() != maxlon) {
    10631113                    myprintln("* Bounds do not match shape (is "+b.getMinLat()+","+b.getMinLon()+","+b.getMaxLat()+","+b.getMaxLon()
    1064                         + ", calculated <bounds min-lat='"+minlat+"' min-lon='"+minlon+"' max-lat='"+maxlat+"' max-lon='"+maxlon+"'>): "+getDescription(j));
     1114                        + ", calculated <bounds min-lat='"+minlat+"' min-lon='"+minlon+"' max-lat='"+maxlat+"' max-lon='"+maxlon+"'>): "
     1115                        + getDescription(j));
    10651116                }
    10661117            }
     
    10851136
    10861137    static String getUrlStripped(Object e) {
    1087         return getUrl(e).replaceAll("\\?(apikey|access_token)=.*","");
     1138        return getUrl(e).replaceAll("\\?(apikey|access_token)=.*", "");
    10881139    }
    10891140
     
    10931144        String start = p.containsKey("start_date") ? p.getString("start_date") : "";
    10941145        String end = p.containsKey("end_date") ? p.getString("end_date") : "";
    1095         if(!start.isEmpty() && !end.isEmpty())
     1146        if (!start.isEmpty() && !end.isEmpty())
    10961147            return start+";"+end;
    1097         else if(!start.isEmpty())
     1148        else if (!start.isEmpty())
    10981149            return start+";-";
    1099         else if(!end.isEmpty())
     1150        else if (!end.isEmpty())
    11001151            return "-;"+end;
    11011152        return "";
     
    11041155    static Date verifyDate(String year, String month, String day) throws ParseException {
    11051156        String date;
    1106         if(year == null) {
     1157        if (year == null) {
    11071158            date = "3000-01-01";
    11081159        } else {
     
    11611212        if (e instanceof ImageryInfo) {
    11621213            ImageryBounds bounds = ((ImageryInfo) e).getBounds();
    1163             if(bounds != null) {
     1214            if (bounds != null) {
    11641215                return bounds.getShapes();
    11651216            }
     
    12831334    }
    12841335
    1285     static Map<String,String> getDescriptions(Object e) {
    1286         Map<String,String> res = new HashMap<String, String>();
     1336    static Map<String, String> getDescriptions(Object e) {
     1337        Map<String, String> res = new HashMap<String, String>();
    12871338        if (e instanceof ImageryInfo) {
    12881339            String a = ((ImageryInfo) e).getDescription();
     
    12901341        } else {
    12911342            String a = ((Map<String, JsonObject>) e).get("properties").getString("description", null);
    1292             if (a != null) res.put("en", a.replaceAll("''","'"));
     1343            if (a != null) res.put("en", a.replaceAll("''", "'"));
    12931344        }
    12941345        return res;
     
    13231374        String d = cc + getName(o) + " - " + getUrl(o);
    13241375        if (optionShorten) {
    1325             final int MAXLEN = 140;
    13261376            if (d.length() > MAXLEN) d = d.substring(0, MAXLEN-1) + "...";
    13271377        }
Note: See TracChangeset for help on using the changeset viewer.