From 7ff4a453d369267c618cf32959e0f5afad404713 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Sat, 1 Dec 2018 23:38:08 +0000 Subject: [PATCH] Temporary deserialization bug fix for extension operations --- .../PerformWikibaseEditsOperation.java | 22 +++++++++++++++++++ .../SaveWikibaseSchemaOperation.java | 20 +++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/extensions/wikidata/src/org/openrefine/wikidata/operations/PerformWikibaseEditsOperation.java b/extensions/wikidata/src/org/openrefine/wikidata/operations/PerformWikibaseEditsOperation.java index 218d331ac..3154b4fbc 100644 --- a/extensions/wikidata/src/org/openrefine/wikidata/operations/PerformWikibaseEditsOperation.java +++ b/extensions/wikidata/src/org/openrefine/wikidata/operations/PerformWikibaseEditsOperation.java @@ -75,6 +75,28 @@ public class PerformWikibaseEditsOperation extends EngineDependentOperation { Validate.notEmpty(summary, "An edit summary must be provided."); this.summary = summary; } + + /* The constructor above should be enough for deserialization, + * but for some unknown reason it can fail in certain cases + * (might be due to caching deserializers across threads?) + * + * So we sadly add a default constructor and a setter below. + * + * TODO delete the default constructor and setter, make summary final + */ + public PerformWikibaseEditsOperation() { + super(null); + } + + @JsonProperty("engineConfig") + public void setEngineConfig(EngineConfig config) { + this._engineConfig = config; + } + + @JsonProperty("summary") + public void setSummary(String summary) { + this.summary = summary; + } @Override protected String getBriefDescription(Project project) { diff --git a/extensions/wikidata/src/org/openrefine/wikidata/operations/SaveWikibaseSchemaOperation.java b/extensions/wikidata/src/org/openrefine/wikidata/operations/SaveWikibaseSchemaOperation.java index 3d7aa938c..0ab7fe934 100644 --- a/extensions/wikidata/src/org/openrefine/wikidata/operations/SaveWikibaseSchemaOperation.java +++ b/extensions/wikidata/src/org/openrefine/wikidata/operations/SaveWikibaseSchemaOperation.java @@ -46,14 +46,30 @@ public class SaveWikibaseSchemaOperation extends AbstractOperation { @JsonIgnore final public static String operationDescription = "Save Wikibase schema"; @JsonProperty("schema") - final protected WikibaseSchema _schema; + protected WikibaseSchema _schema; @JsonCreator public SaveWikibaseSchemaOperation( @JsonProperty("schema") WikibaseSchema schema) { this._schema = schema; - + } + + /* The constructor above should be enough for deserialization, + * but for some unknown reason it can fail in certain cases + * (might be due to caching deserializers across threads?) + * + * So we sadly add a default constructor and a setter below. + * + * TODO delete the default constructor and setter, make schema final + */ + public SaveWikibaseSchemaOperation() { + + } + + @JsonProperty("schema") + public void setSchema(WikibaseSchema schema) { + this._schema = schema; } @Override