I am using wikidata api to fetch a entity using its english title,
wdf = WikibaseDataFetcher.getWikidataDataFetcher();
eid = wdf.getEntityDocumentsByTitle("enwiki", entitle);
Earlier, with an older version of wikidata-api, I was able to run it smoothly. After updating to version 5.0.0, I always get the following error,
Exception in thread "main" java.lang.NullPointerException
at org.wikidata.wdtk.wikibaseapi.ApiConnection.fillCookies(ApiConnection.java:544)
at org.wikidata.wdtk.wikibaseapi.ApiConnection.sendRequest(ApiConnection.java:346)
at org.wikidata.wdtk.wikibaseapi.WbGetEntitiesAction.wbGetEntities(WbGetEntitiesAction.java:187)
How to fix this?
I get the same problem. I tried to use latest version from github and get the same exception. I execute the sample from documentation i.e the simple call:
Map<String, EntityDocument> results = wbdf.getEntityDocuments("Q80", "P31");
Seems code doesn't check for existence of a given cookie. I added the verification, recompiled and everything seems to work.
Go to ApiConnection.java:543
if (headerCookies != null)
for (String cookie : headerCookies) {
No warranty ! :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With