Changeset 19375 in josm


Ignore:
Timestamp:
2025-04-02T18:14:21+02:00 (4 weeks ago)
Author:
stoecker
Message:

drop commons3 usage in sync script

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r19367 r19375  
    802802                <pathelement path="${build.dir}"/>
    803803                <pathelement path="${test.dir}/build/unit"/>
    804                 <pathelement path="${commons-lang3.jar}"/>
    805804            </classpath>
    806805        </javac>
     
    817816                    <pathelement path="${build.dir}"/>
    818817                    <pathelement path="${script-build.dir}"/>
    819                     <pathelement path="${commons-lang3.jar}"/>
    820818                </classpath>
    821819                <arg value="--type"/>
     
    842840                <pathelement path="${build.dir}"/>
    843841                <pathelement path="${script-build.dir}"/>
    844                 <pathelement path="${commons-lang3.jar}"/>
    845842            </classpath>
    846843            <arg value="--noeli"/>
  • trunk/pom.xml

    r19368 r19375  
    205205      <groupId>org.apache.commons</groupId>
    206206      <artifactId>commons-lang3</artifactId>
     207      <scope>test</scope>
    207208    </dependency>
    208209    <dependency>
     
    300301                <argument>${basedir}</argument>
    301302              </arguments>
    302               <!-- We need commons-lang3, which isn't needed elsewhere in core (besides a test or two) -->
    303               <classpathScope>test</classpathScope>
    304303            </configuration>
    305304            <goals>
  • trunk/scripts/SyncEditorLayerIndex.java

    r19275 r19375  
    22
    33import static java.nio.charset.StandardCharsets.UTF_8;
    4 import static org.apache.commons.lang3.StringUtils.isBlank;
    5 import static org.apache.commons.lang3.StringUtils.isNotBlank;
    64
    75import java.io.BufferedReader;
     
    454452                + ">\n");
    455453            String t;
    456             if (isNotBlank(t = getName(e)))
     454            if (!Utils.isStripEmpty(t = getName(e)))
    457455                stream.write("        <name>"+cdata(t, true)+"</name>\n");
    458             if (isNotBlank(t = getId(e)))
     456            if (!Utils.isStripEmpty(t = getId(e)))
    459457                stream.write("        <id>"+t+"</id>\n");
    460             if (isNotBlank(t = getCategory(e)))
     458            if (!Utils.isStripEmpty(t = getCategory(e)))
    461459                stream.write("        <category>"+t+"</category>\n");
    462             if (isNotBlank(t = getDate(e)))
     460            if (!Utils.isStripEmpty(t = getDate(e)))
    463461                stream.write("        <date>"+t+"</date>\n");
    464             if (isNotBlank(t = getCountryCode(e)))
     462            if (!Utils.isStripEmpty(t = getCountryCode(e)))
    465463                stream.write("        <country-code>"+t+"</country-code>\n");
    466464            if ((getDefault(e)))
    467465                stream.write("        <default>true</default>\n");
    468466            stream.write(maininfo(e, "        "));
    469             if (isNotBlank(t = getAttributionText(e)))
     467            if (!Utils.isStripEmpty(t = getAttributionText(e)))
    470468                stream.write("        <attribution-text mandatory=\"true\">"+cdata(t, true)+"</attribution-text>\n");
    471             if (isNotBlank(t = getAttributionUrl(e)))
     469            if (!Utils.isStripEmpty(t = getAttributionUrl(e)))
    472470                stream.write("        <attribution-url>"+cdata(t)+"</attribution-url>\n");
    473             if (isNotBlank(t = getLogoImage(e)))
     471            if (!Utils.isStripEmpty(t = getLogoImage(e)))
    474472                stream.write("        <logo-image>"+cdata(t, true)+"</logo-image>\n");
    475             if (isNotBlank(t = getLogoUrl(e)))
     473            if (!Utils.isStripEmpty(t = getLogoUrl(e)))
    476474                stream.write("        <logo-url>"+cdata(t)+"</logo-url>\n");
    477             if (isNotBlank(t = getTermsOfUseText(e)))
     475            if (!Utils.isStripEmpty(t = getTermsOfUseText(e)))
    478476                stream.write("        <terms-of-use-text>"+cdata(t, true)+"</terms-of-use-text>\n");
    479             if (isNotBlank(t = getTermsOfUseUrl(e)))
     477            if (!Utils.isStripEmpty(t = getTermsOfUseUrl(e)))
    480478                stream.write("        <terms-of-use-url>"+cdata(t)+"</terms-of-use-url>\n");
    481             if (isNotBlank(t = getPermissionReferenceUrl(e)))
     479            if (!Utils.isStripEmpty(t = getPermissionReferenceUrl(e)))
    482480                stream.write("        <permission-ref>"+cdata(t)+"</permission-ref>\n");
    483             if (isNotBlank(t = getPrivacyPolicyUrl(e)))
     481            if (!Utils.isStripEmpty(t = getPrivacyPolicyUrl(e)))
    484482                stream.write("        <privacy-policy-url>"+cdata(t)+"</privacy-policy-url>\n");
    485483            if ((getValidGeoreference(e)))
    486484                stream.write("        <valid-georeference>true</valid-georeference>\n");
    487             if (isNotBlank(t = getIcon(e)))
     485            if (!Utils.isStripEmpty(t = getIcon(e)))
    488486                stream.write("        <icon>"+cdata(t)+"</icon>\n");
    489487            for (Entry<String, String> d : getDescriptions(e).entrySet()) {
     
    542540                myprintln("~~~ JOSM-Entry missing fields (" + String.join(", ", e.getMissingFields()) + "): " + getDescription(e));
    543541            }
    544             if (isBlank(getUrl(e))) {
     542            if (Utils.isStripEmpty(getUrl(e))) {
    545543                myprintln("~~~ JOSM-Entry without URL: " + getDescription(e));
    546544                continue;
    547545            }
    548             if (isBlank(e.getDate()) && e.getDate() != null) {
     546            if (Utils.isStripEmpty(e.getDate()) && e.getDate() != null) {
    549547                myprintln("~~~ JOSM-Entry with empty Date: " + getDescription(e));
    550548                continue;
    551549            }
    552             if (isBlank(getName(e))) {
     550            if (Utils.isStripEmpty(getName(e))) {
    553551                myprintln("~~~ JOSM-Entry without Name: " + getDescription(e));
    554552                continue;
     
    625623                    le.remove(urle);
    626624                    lj.remove(urlhttps);
    627                 } else if (isNotBlank(ide)) {
     625                } else if (!Utils.isStripEmpty(ide)) {
    628626                    checkUrlsEquality(ide, e, urle, le, lj);
    629627                }
     
    885883        String jt = getPrivacyPolicyUrl(j);
    886884        if (!Objects.equals(et, jt)) {
    887             if (isBlank(jt)) {
     885            if (Utils.isStripEmpty(jt)) {
    888886                myprintln("- Missing JOSM privacy policy URL ("+et+"): "+getDescription(j));
    889             } else if (isNotBlank(et)) {
     887            } else if (!Utils.isStripEmpty(et)) {
    890888                myprintln("* Privacy policy URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j));
    891889            } else if (!optionNoEli) {
     
    899897        String jt = getPermissionReferenceUrl(j);
    900898        String jt2 = getTermsOfUseUrl(j);
    901         if (isBlank(jt)) jt = jt2;
     899        if (Utils.isStripEmpty(jt)) jt = jt2;
    902900        if (!Objects.equals(et, jt)) {
    903             if (isBlank(jt)) {
     901            if (Utils.isStripEmpty(jt)) {
    904902                myprintln("- Missing JOSM license URL ("+et+"): "+getDescription(j));
    905             } else if (isNotBlank(et)) {
     903            } else if (!Utils.isStripEmpty(et)) {
    906904                String ethttps = et.replace("http:", "https:");
    907                 if (isBlank(jt2) || !(jt2.equals(ethttps) || jt2.equals(et+"/") || jt2.equals(ethttps+"/"))) {
     905                if (Utils.isStripEmpty(jt2) || !(jt2.equals(ethttps) || jt2.equals(et+"/") || jt2.equals(ethttps+"/"))) {
    908906                    if (jt.equals(ethttps) || jt.equals(et+"/") || jt.equals(ethttps+"/")) {
    909907                        myprintln("+ License URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j));
     
    927925        String jt = getAttributionUrl(j);
    928926        if (!Objects.equals(et, jt)) {
    929             if (isBlank(jt)) {
     927            if (Utils.isStripEmpty(jt)) {
    930928                myprintln("- Missing JOSM attribution URL ("+et+"): "+getDescription(j));
    931             } else if (isNotBlank(et)) {
     929            } else if (!Utils.isStripEmpty(et)) {
    932930                String ethttps = et.replace("http:", "https:");
    933931                if (jt.equals(ethttps) || jt.equals(et+"/") || jt.equals(ethttps+"/")) {
     
    946944        String jt = getAttributionText(j);
    947945        if (!Objects.equals(et, jt)) {
    948             if (isBlank(jt)) {
     946            if (Utils.isStripEmpty(jt)) {
    949947                myprintln("- Missing JOSM attribution text ("+et+"): "+getDescription(j));
    950             } else if (isNotBlank(et)) {
     948            } else if (!Utils.isStripEmpty(et)) {
    951949                myprintln("* Attribution text differs ('"+et+"' != '"+jt+"'): "+getDescription(j));
    952950            } else if (!optionNoEli) {
     
    960958        String jt = getProjections(j).stream().sorted().collect(Collectors.joining(" "));
    961959        if (!Objects.equals(et, jt)) {
    962             if (isBlank(jt)) {
     960            if (Utils.isStripEmpty(jt)) {
    963961                String t = getType(e);
    964962                if ("wms_endpoint".equals(t) || "tms".equals(t)) {
     
    967965                    myprintln("- Missing JOSM projections ("+et+"): "+getDescription(j));
    968966                }
    969             } else if (isNotBlank(et)) {
     967            } else if (!Utils.isStripEmpty(et)) {
    970968                if ("EPSG:3857 EPSG:4326".equals(et) || "EPSG:3857".equals(et) || "EPSG:4326".equals(et)) {
    971969                    myprintln("+ ELI has minimal projections ('"+et+"' != '"+jt+"'): "+getDescription(j));
     
    11671165        String ij = getIcon(j);
    11681166        String ie = getIcon(e);
    1169         boolean ijok = isNotBlank(ij);
    1170         boolean ieok = isNotBlank(ie);
     1167        boolean ijok = !Utils.isStripEmpty(ij);
     1168        boolean ieok = !Utils.isStripEmpty(ie);
    11711169        if (ijok && !ieok) {
    11721170            if (!optionNoEli) {
     
    11911189        String cj = getCategory(j);
    11921190        String ce = getCategory(e);
    1193         boolean cjok = isNotBlank(cj);
    1194         boolean ceok = isNotBlank(ce);
     1191        boolean cjok = !Utils.isStripEmpty(cj);
     1192        boolean ceok = !Utils.isStripEmpty(ce);
    11951193        if (cjok && !ceok) {
    11961194            if (!optionNoEli) {
     
    12491247            }
    12501248            String jt = getPermissionReferenceUrl(j);
    1251             if (isNotBlank(jt) && !"Public Domain".equalsIgnoreCase(jt))
     1249            if (!Utils.isStripEmpty(jt) && !"Public Domain".equalsIgnoreCase(jt))
    12521250                urls.add(jt);
    12531251            jt = getTermsOfUseUrl(j);
    1254             if (isNotBlank(jt))
     1252            if (!Utils.isStripEmpty(jt))
    12551253                urls.add(jt);
    12561254            jt = getAttributionUrl(j);
    1257             if (isNotBlank(jt))
     1255            if (!Utils.isStripEmpty(jt))
    12581256                urls.add(jt);
    12591257            jt = getIcon(j);
    1260             if (isNotBlank(jt)) {
     1258            if (!Utils.isStripEmpty(jt)) {
    12611259                if (!jt.startsWith("data:image/"))
    12621260                    urls.add(jt);
     
    12921290                continue;
    12931291            }
    1294             if (isBlank(id)) {
     1292            if (Utils.isStripEmpty(id)) {
    12951293                myprintln("~ No JOSM-ID: "+getDescription(j));
    12961294            } else if (josmIds.containsKey(id)) {
     
    13001298            }
    13011299            String d = getDate(j);
    1302             if (isNotBlank(d)) {
     1300            if (!Utils.isStripEmpty(d)) {
    13031301                Pattern patternD = Pattern.compile("^(-|(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?)(;(-|(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?))?$");
    13041302                Matcher m = patternD.matcher(d);
     
    13171315                }
    13181316            }
    1319             if (isNotBlank(getAttributionUrl(j)) && isBlank(getAttributionText(j))) {
     1317            if (!Utils.isStripEmpty(getAttributionUrl(j)) && Utils.isStripEmpty(getAttributionText(j))) {
    13201318                myprintln("~ Attribution link without text: "+getDescription(j));
    13211319            }
    1322             if (isNotBlank(getLogoUrl(j)) && isBlank(getLogoImage(j))) {
     1320            if (!Utils.isStripEmpty(getLogoUrl(j)) && Utils.isStripEmpty(getLogoImage(j))) {
    13231321                myprintln("~ Logo link without image: "+getDescription(j));
    13241322            }
    1325             if (isNotBlank(getTermsOfUseText(j)) && isBlank(getTermsOfUseUrl(j))) {
     1323            if (!Utils.isStripEmpty(getTermsOfUseText(j)) && Utils.isStripEmpty(getTermsOfUseUrl(j))) {
    13261324                myprintln("~ Terms of Use text without link: "+getDescription(j));
    13271325            }
     
    13551353                    "photo", "elevation", "map", "historicmap", "osmbasedmap", "historicphoto", "qa", "other");
    13561354            String cat = getCategory(j);
    1357             if (isBlank(cat)) {
     1355            if (Utils.isStripEmpty(cat)) {
    13581356                myprintln("~ No category: "+getDescription(j));
    13591357            } else if (!knownCategories.contains(cat)) {
Note: See TracChangeset for help on using the changeset viewer.