2626import org .wikipedia .api .wikidata_action .WikidataActionApiQuery ;
2727import org .wikipedia .api .wikidata_action .json .SitematrixResult ;
2828import org .wikipedia .data .WikipediaEntry ;
29- import org .wikipedia .tools .FunctionalUtil ;
3029import org .wikipedia .tools .OsmTagConstants ;
3130
3231public class WikipediaValueFormat extends Test .TagTest {
@@ -59,15 +58,13 @@ public WikipediaValueFormat() {
5958 @ Override
6059 public void check (OsmPrimitive p ) {
6160 Optional .of (OsmTagConstants .Key .WIKIPEDIA ).flatMap (k -> Optional .ofNullable (p .get (k )).map (v -> new Tag (k , v ))).flatMap (tag ->
62- FunctionalUtil .or (
63- getFullUrlCheckError (p , tag .getKey (), tag .getValue ()),
61+ getFullUrlCheckError (p , tag .getKey (), tag .getValue ()).or (
6462 () -> getLanguageArticleFormatError (p , tag .getKey (), tag .getValue ())
6563 )
6664 // checkUrlDecode() is tested by core
6765 ).ifPresent (it -> errors .add (it .build ()));
6866 p .keySet ().stream ().filter (Objects ::nonNull ).filter (it -> it .endsWith (":wikipedia" )).collect (Collectors .toMap (it -> it , p ::get )).forEach ((key , value ) -> {
69- FunctionalUtil .or (
70- getFullUrlCheckError (p , key , value ),
67+ getFullUrlCheckError (p , key , value ).or (
7168 () -> getLanguageArticleFormatError (p , key , value )
7269 ).ifPresent (it -> errors .add (it .build ()));
7370 checkUrlDecode (p , key , value );
@@ -130,8 +127,7 @@ private Optional<TestError.Builder> getFullUrlCheckError(final OsmPrimitive p, f
130127 }
131128
132129 private Optional <TestError .Builder > getFullUrlCheckError (final OsmPrimitive p , final String key , final String value , final String message , final Function <WikipediaEntry , Optional <Tag >> newTagGetter ) {
133- return FunctionalUtil .or (
134- WikipediaEntry .fromUrl (value ).map (newTagGetter ).flatMap (newTag ->
130+ return WikipediaEntry .fromUrl (value ).map (newTagGetter ).flatMap (newTag ->
135131 Optional .of (
136132 AllValidationTests .WIKIPEDIA_TAG_VALUE_IS_FULL_URL .getBuilder (this )
137133 .primitives (p )
@@ -144,7 +140,7 @@ private Optional<TestError.Builder> getFullUrlCheckError(final OsmPrimitive p, f
144140 newTag .map (it -> it .getKey () + "=" + it .getValue ()).orElse (I18n .tr ("a new value (manual intervention needed due to language conflict)" ))
145141 )
146142 )
147- ),
143+ ). or (
148144 () -> Optional .ofNullable (
149145 CONTAINS_URL_PATTERN .matcher (value ).matches ()
150146 ? AllValidationTests .WIKIPEDIA_TAG_VALUE_CONTAINS_URL .getBuilder (this )
0 commit comments