Changeset 19375 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r19367 r19375 802 802 <pathelement path="${build.dir}"/> 803 803 <pathelement path="${test.dir}/build/unit"/> 804 <pathelement path="${commons-lang3.jar}"/>805 804 </classpath> 806 805 </javac> … … 817 816 <pathelement path="${build.dir}"/> 818 817 <pathelement path="${script-build.dir}"/> 819 <pathelement path="${commons-lang3.jar}"/>820 818 </classpath> 821 819 <arg value="--type"/> … … 842 840 <pathelement path="${build.dir}"/> 843 841 <pathelement path="${script-build.dir}"/> 844 <pathelement path="${commons-lang3.jar}"/>845 842 </classpath> 846 843 <arg value="--noeli"/> -
trunk/pom.xml
r19368 r19375 205 205 <groupId>org.apache.commons</groupId> 206 206 <artifactId>commons-lang3</artifactId> 207 <scope>test</scope> 207 208 </dependency> 208 209 <dependency> … … 300 301 <argument>${basedir}</argument> 301 302 </arguments> 302 <!-- We need commons-lang3, which isn't needed elsewhere in core (besides a test or two) -->303 <classpathScope>test</classpathScope>304 303 </configuration> 305 304 <goals> -
trunk/scripts/SyncEditorLayerIndex.java
r19275 r19375 2 2 3 3 import 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;6 4 7 5 import java.io.BufferedReader; … … 454 452 + ">\n"); 455 453 String t; 456 if ( isNotBlank(t = getName(e)))454 if (!Utils.isStripEmpty(t = getName(e))) 457 455 stream.write(" <name>"+cdata(t, true)+"</name>\n"); 458 if ( isNotBlank(t = getId(e)))456 if (!Utils.isStripEmpty(t = getId(e))) 459 457 stream.write(" <id>"+t+"</id>\n"); 460 if ( isNotBlank(t = getCategory(e)))458 if (!Utils.isStripEmpty(t = getCategory(e))) 461 459 stream.write(" <category>"+t+"</category>\n"); 462 if ( isNotBlank(t = getDate(e)))460 if (!Utils.isStripEmpty(t = getDate(e))) 463 461 stream.write(" <date>"+t+"</date>\n"); 464 if ( isNotBlank(t = getCountryCode(e)))462 if (!Utils.isStripEmpty(t = getCountryCode(e))) 465 463 stream.write(" <country-code>"+t+"</country-code>\n"); 466 464 if ((getDefault(e))) 467 465 stream.write(" <default>true</default>\n"); 468 466 stream.write(maininfo(e, " ")); 469 if ( isNotBlank(t = getAttributionText(e)))467 if (!Utils.isStripEmpty(t = getAttributionText(e))) 470 468 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))) 472 470 stream.write(" <attribution-url>"+cdata(t)+"</attribution-url>\n"); 473 if ( isNotBlank(t = getLogoImage(e)))471 if (!Utils.isStripEmpty(t = getLogoImage(e))) 474 472 stream.write(" <logo-image>"+cdata(t, true)+"</logo-image>\n"); 475 if ( isNotBlank(t = getLogoUrl(e)))473 if (!Utils.isStripEmpty(t = getLogoUrl(e))) 476 474 stream.write(" <logo-url>"+cdata(t)+"</logo-url>\n"); 477 if ( isNotBlank(t = getTermsOfUseText(e)))475 if (!Utils.isStripEmpty(t = getTermsOfUseText(e))) 478 476 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))) 480 478 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))) 482 480 stream.write(" <permission-ref>"+cdata(t)+"</permission-ref>\n"); 483 if ( isNotBlank(t = getPrivacyPolicyUrl(e)))481 if (!Utils.isStripEmpty(t = getPrivacyPolicyUrl(e))) 484 482 stream.write(" <privacy-policy-url>"+cdata(t)+"</privacy-policy-url>\n"); 485 483 if ((getValidGeoreference(e))) 486 484 stream.write(" <valid-georeference>true</valid-georeference>\n"); 487 if ( isNotBlank(t = getIcon(e)))485 if (!Utils.isStripEmpty(t = getIcon(e))) 488 486 stream.write(" <icon>"+cdata(t)+"</icon>\n"); 489 487 for (Entry<String, String> d : getDescriptions(e).entrySet()) { … … 542 540 myprintln("~~~ JOSM-Entry missing fields (" + String.join(", ", e.getMissingFields()) + "): " + getDescription(e)); 543 541 } 544 if ( isBlank(getUrl(e))) {542 if (Utils.isStripEmpty(getUrl(e))) { 545 543 myprintln("~~~ JOSM-Entry without URL: " + getDescription(e)); 546 544 continue; 547 545 } 548 if ( isBlank(e.getDate()) && e.getDate() != null) {546 if (Utils.isStripEmpty(e.getDate()) && e.getDate() != null) { 549 547 myprintln("~~~ JOSM-Entry with empty Date: " + getDescription(e)); 550 548 continue; 551 549 } 552 if ( isBlank(getName(e))) {550 if (Utils.isStripEmpty(getName(e))) { 553 551 myprintln("~~~ JOSM-Entry without Name: " + getDescription(e)); 554 552 continue; … … 625 623 le.remove(urle); 626 624 lj.remove(urlhttps); 627 } else if ( isNotBlank(ide)) {625 } else if (!Utils.isStripEmpty(ide)) { 628 626 checkUrlsEquality(ide, e, urle, le, lj); 629 627 } … … 885 883 String jt = getPrivacyPolicyUrl(j); 886 884 if (!Objects.equals(et, jt)) { 887 if ( isBlank(jt)) {885 if (Utils.isStripEmpty(jt)) { 888 886 myprintln("- Missing JOSM privacy policy URL ("+et+"): "+getDescription(j)); 889 } else if ( isNotBlank(et)) {887 } else if (!Utils.isStripEmpty(et)) { 890 888 myprintln("* Privacy policy URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j)); 891 889 } else if (!optionNoEli) { … … 899 897 String jt = getPermissionReferenceUrl(j); 900 898 String jt2 = getTermsOfUseUrl(j); 901 if ( isBlank(jt)) jt = jt2;899 if (Utils.isStripEmpty(jt)) jt = jt2; 902 900 if (!Objects.equals(et, jt)) { 903 if ( isBlank(jt)) {901 if (Utils.isStripEmpty(jt)) { 904 902 myprintln("- Missing JOSM license URL ("+et+"): "+getDescription(j)); 905 } else if ( isNotBlank(et)) {903 } else if (!Utils.isStripEmpty(et)) { 906 904 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+"/"))) { 908 906 if (jt.equals(ethttps) || jt.equals(et+"/") || jt.equals(ethttps+"/")) { 909 907 myprintln("+ License URL differs ('"+et+"' != '"+jt+"'): "+getDescription(j)); … … 927 925 String jt = getAttributionUrl(j); 928 926 if (!Objects.equals(et, jt)) { 929 if ( isBlank(jt)) {927 if (Utils.isStripEmpty(jt)) { 930 928 myprintln("- Missing JOSM attribution URL ("+et+"): "+getDescription(j)); 931 } else if ( isNotBlank(et)) {929 } else if (!Utils.isStripEmpty(et)) { 932 930 String ethttps = et.replace("http:", "https:"); 933 931 if (jt.equals(ethttps) || jt.equals(et+"/") || jt.equals(ethttps+"/")) { … … 946 944 String jt = getAttributionText(j); 947 945 if (!Objects.equals(et, jt)) { 948 if ( isBlank(jt)) {946 if (Utils.isStripEmpty(jt)) { 949 947 myprintln("- Missing JOSM attribution text ("+et+"): "+getDescription(j)); 950 } else if ( isNotBlank(et)) {948 } else if (!Utils.isStripEmpty(et)) { 951 949 myprintln("* Attribution text differs ('"+et+"' != '"+jt+"'): "+getDescription(j)); 952 950 } else if (!optionNoEli) { … … 960 958 String jt = getProjections(j).stream().sorted().collect(Collectors.joining(" ")); 961 959 if (!Objects.equals(et, jt)) { 962 if ( isBlank(jt)) {960 if (Utils.isStripEmpty(jt)) { 963 961 String t = getType(e); 964 962 if ("wms_endpoint".equals(t) || "tms".equals(t)) { … … 967 965 myprintln("- Missing JOSM projections ("+et+"): "+getDescription(j)); 968 966 } 969 } else if ( isNotBlank(et)) {967 } else if (!Utils.isStripEmpty(et)) { 970 968 if ("EPSG:3857 EPSG:4326".equals(et) || "EPSG:3857".equals(et) || "EPSG:4326".equals(et)) { 971 969 myprintln("+ ELI has minimal projections ('"+et+"' != '"+jt+"'): "+getDescription(j)); … … 1167 1165 String ij = getIcon(j); 1168 1166 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); 1171 1169 if (ijok && !ieok) { 1172 1170 if (!optionNoEli) { … … 1191 1189 String cj = getCategory(j); 1192 1190 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); 1195 1193 if (cjok && !ceok) { 1196 1194 if (!optionNoEli) { … … 1249 1247 } 1250 1248 String jt = getPermissionReferenceUrl(j); 1251 if ( isNotBlank(jt) && !"Public Domain".equalsIgnoreCase(jt))1249 if (!Utils.isStripEmpty(jt) && !"Public Domain".equalsIgnoreCase(jt)) 1252 1250 urls.add(jt); 1253 1251 jt = getTermsOfUseUrl(j); 1254 if ( isNotBlank(jt))1252 if (!Utils.isStripEmpty(jt)) 1255 1253 urls.add(jt); 1256 1254 jt = getAttributionUrl(j); 1257 if ( isNotBlank(jt))1255 if (!Utils.isStripEmpty(jt)) 1258 1256 urls.add(jt); 1259 1257 jt = getIcon(j); 1260 if ( isNotBlank(jt)) {1258 if (!Utils.isStripEmpty(jt)) { 1261 1259 if (!jt.startsWith("data:image/")) 1262 1260 urls.add(jt); … … 1292 1290 continue; 1293 1291 } 1294 if ( isBlank(id)) {1292 if (Utils.isStripEmpty(id)) { 1295 1293 myprintln("~ No JOSM-ID: "+getDescription(j)); 1296 1294 } else if (josmIds.containsKey(id)) { … … 1300 1298 } 1301 1299 String d = getDate(j); 1302 if ( isNotBlank(d)) {1300 if (!Utils.isStripEmpty(d)) { 1303 1301 Pattern patternD = Pattern.compile("^(-|(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?)(;(-|(\\d\\d\\d\\d)(-(\\d\\d)(-(\\d\\d))?)?))?$"); 1304 1302 Matcher m = patternD.matcher(d); … … 1317 1315 } 1318 1316 } 1319 if ( isNotBlank(getAttributionUrl(j)) &&isBlank(getAttributionText(j))) {1317 if (!Utils.isStripEmpty(getAttributionUrl(j)) && Utils.isStripEmpty(getAttributionText(j))) { 1320 1318 myprintln("~ Attribution link without text: "+getDescription(j)); 1321 1319 } 1322 if ( isNotBlank(getLogoUrl(j)) &&isBlank(getLogoImage(j))) {1320 if (!Utils.isStripEmpty(getLogoUrl(j)) && Utils.isStripEmpty(getLogoImage(j))) { 1323 1321 myprintln("~ Logo link without image: "+getDescription(j)); 1324 1322 } 1325 if ( isNotBlank(getTermsOfUseText(j)) &&isBlank(getTermsOfUseUrl(j))) {1323 if (!Utils.isStripEmpty(getTermsOfUseText(j)) && Utils.isStripEmpty(getTermsOfUseUrl(j))) { 1326 1324 myprintln("~ Terms of Use text without link: "+getDescription(j)); 1327 1325 } … … 1355 1353 "photo", "elevation", "map", "historicmap", "osmbasedmap", "historicphoto", "qa", "other"); 1356 1354 String cat = getCategory(j); 1357 if ( isBlank(cat)) {1355 if (Utils.isStripEmpty(cat)) { 1358 1356 myprintln("~ No category: "+getDescription(j)); 1359 1357 } else if (!knownCategories.contains(cat)) {
Note:
See TracChangeset
for help on using the changeset viewer.