mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Parser.Wikibase: Return null instead of empty string if invalid title passed to getEntityId [#415]
This commit is contained in:
parent
8c1f30039b
commit
581aa5123c
@ -142,9 +142,9 @@ public class Scrib_lib_wikibase implements Scrib_lib {
|
||||
byte[] rv = null;
|
||||
if (ttl != null) // must check for null; PAGE:en.w:Water_treader DATE:2018-07-01
|
||||
rv = wiki.Appe().Wiki_mgr().Wdata_mgr().Qid_mgr.Get_qid_or_null(wiki, ttl);
|
||||
if (rv == null) // can be null if ttl is invalid or doesn't exist
|
||||
rv = Bry_.Empty;
|
||||
return rslt.Init_obj(rv);
|
||||
return rv == null
|
||||
? rslt.Init_null() // null if ttl is invalid or doesn't exist; NOTE: must be null, not ""; PAGE:en.w:Nicoletella; ISSUE#:415 DATE:2019-03-31
|
||||
: rslt.Init_obj(rv);
|
||||
}
|
||||
// REF: https://github.com/wikimedia/mediawiki-extensions-Wikibase/blob/master/client/config/WikibaseClient.default.php
|
||||
private static final int ReferencedEntityIdMaxDepth = 4, ReferencedEntityIdMaxReferencedEntityVisits = 50;
|
||||
|
@ -55,8 +55,8 @@ public class Basic__tst {
|
||||
);
|
||||
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_getEntityId, Object_.Ary("Earth" ), "Q2");
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_getEntityId, Object_.Ary("missing_page" ), "");
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_getEntityId, Object_.Ary("" ), ""); // PAGE:en.w:Water_treader DATE:2018-07-01
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_getEntityId, Object_.Ary("missing_page" ), null);
|
||||
fxt.Test_scrib_proc_str(lib, Scrib_lib_wikibase.Invk_getEntityId, Object_.Ary("" ), null); // PAGE:en.w:Water_treader DATE:2018-07-01
|
||||
}
|
||||
@Test public void GetReferencedEntityId() {
|
||||
wdata_fxt.Init__docs__add(wdata_fxt.Wdoc_bldr("Q1").Xto_wdoc());
|
||||
|
Loading…
Reference in New Issue
Block a user