summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/script/StoredScriptSource.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/java/org/elasticsearch/script/StoredScriptSource.java')
-rw-r--r--core/src/main/java/org/elasticsearch/script/StoredScriptSource.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/core/src/main/java/org/elasticsearch/script/StoredScriptSource.java b/core/src/main/java/org/elasticsearch/script/StoredScriptSource.java
index 69fc1ed34c..e6c5b09362 100644
--- a/core/src/main/java/org/elasticsearch/script/StoredScriptSource.java
+++ b/core/src/main/java/org/elasticsearch/script/StoredScriptSource.java
@@ -40,6 +40,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentParser.Token;
+import org.elasticsearch.common.xcontent.XContentType;
import java.io.IOException;
import java.io.UncheckedIOException;
@@ -231,8 +232,8 @@ public class StoredScriptSource extends AbstractDiffable<StoredScriptSource> imp
* @param content The content from the request to be parsed as described above.
* @return The parsed {@link StoredScriptSource}.
*/
- public static StoredScriptSource parse(String lang, BytesReference content) {
- try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, content)) {
+ public static StoredScriptSource parse(String lang, BytesReference content, XContentType xContentType) {
+ try (XContentParser parser = xContentType.xContent().createParser(NamedXContentRegistry.EMPTY, content)) {
Token token = parser.nextToken();
if (token != Token.START_OBJECT) {