OpenRefine / OpenRefine/CommonsExtension

On uploading: `Exception in thread "Thread-5" java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null`

Open
#176 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
29
Forks
12
PR merge metrics
No merged PRs in 30d

Description

Exception in thread "Thread-5" java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
	at java.base/java.net.URLEncoder.encode(URLEncoder.java:223)
	at java.base/java.net.URLEncoder.encode(URLEncoder.java:194)
	at org.wikidata.wdtk.wikibaseapi.ApiConnection.getQueryString(ApiConnection.java:588)
	at org.wikidata.wdtk.wikibaseapi.ApiConnection.sendRequest(ApiConnection.java:434)
	at org.wikidata.wdtk.wikibaseapi.ApiConnection.sendJsonRequest(ApiConnection.java:399)
	at org.openrefine.wikibase.editing.MediaFileUtils.uploadFile(MediaFileUtils.java:349)
	at org.openrefine.wikibase.editing.MediaFileUtils.uploadRemoteFile(MediaFileUtils.java:254)
	at org.openrefine.wikibase.updates.MediaInfoEdit.uploadFile(MediaInfoEdit.java:288)
	at org.openrefine.wikibase.editing.EditBatchProcessor.performEdit(EditBatchProcessor.java:232)
	at org.openrefine.wikibase.operations.PerformWikibaseEditsOperation$PerformEditsProcess.run(PerformWikibaseEditsOperation.java:334)
	at java.base/java.lang.Thread.run(Thread.java:1583)

OpenRefine 3.9.3
CommonsExtension 0.1.3

java --version
openjdk 21.0.6 2025-01-21 LTS
OpenJDK Runtime Environment Temurin-21.0.6+7 (build 21.0.6+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.6+7 (build 21.0.6+7-LTS, mixed mode, sharing)

Maybe this is because my schema is invalid? Is it a correct way to upload changes back to Commons?

Image

Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MediaFileUtils.uploadFile line 349 and follow the request into ApiConnection.getQueryString line 588, where the stack trace shows the null value reaching URL encoding. Reproduce the Commons upload with the reported OpenRefine 3.9.3 and CommonsExtension 0.1.3 setup, then determine which upload input is missing and verify that the failure is handled or prevented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.