mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 17:34:17 -04:00
Add XContentHelper shim for move to passing in deprecation handler (#28684)
In order to allow us to gradually move to passing the deprecation handler is, we need a shim that contains both the non-passed and passed version. Relates to #28504
This commit is contained in:
parent
3e846ab251
commit
d90a440bf7
1 changed files with 12 additions and 2 deletions
|
@ -40,10 +40,20 @@ public class XContentHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a parser based on the bytes provided
|
* Creates a parser based on the bytes provided
|
||||||
* @deprecated use {@link #createParser(NamedXContentRegistry, DeprecationHandler, BytesReference, XContentType)} to avoid content type auto-detection
|
* @deprecated this is a temporary shim and will be removed shortly
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static XContentParser createParser(NamedXContentRegistry xContentRegistry, BytesReference bytes) throws IOException {
|
public static XContentParser createParser(NamedXContentRegistry xContentRegistry, BytesReference bytes) throws IOException {
|
||||||
|
return createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a parser based on the bytes provided
|
||||||
|
* @deprecated use {@link #createParser(NamedXContentRegistry, DeprecationHandler, BytesReference, XContentType)} to avoid content type auto-detection
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static XContentParser createParser(NamedXContentRegistry xContentRegistry, DeprecationHandler deprecationHandler,
|
||||||
|
BytesReference bytes) throws IOException {
|
||||||
Compressor compressor = CompressorFactory.compressor(bytes);
|
Compressor compressor = CompressorFactory.compressor(bytes);
|
||||||
if (compressor != null) {
|
if (compressor != null) {
|
||||||
InputStream compressedInput = compressor.streamInput(bytes.streamInput());
|
InputStream compressedInput = compressor.streamInput(bytes.streamInput());
|
||||||
|
@ -51,7 +61,7 @@ public class XContentHelper {
|
||||||
compressedInput = new BufferedInputStream(compressedInput);
|
compressedInput = new BufferedInputStream(compressedInput);
|
||||||
}
|
}
|
||||||
final XContentType contentType = XContentFactory.xContentType(compressedInput);
|
final XContentType contentType = XContentFactory.xContentType(compressedInput);
|
||||||
return XContentFactory.xContent(contentType).createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, compressedInput);
|
return XContentFactory.xContent(contentType).createParser(xContentRegistry, deprecationHandler, compressedInput);
|
||||||
} else {
|
} else {
|
||||||
return XContentFactory.xContent(bytes).createParser(xContentRegistry, bytes.streamInput());
|
return XContentFactory.xContent(bytes).createParser(xContentRegistry, bytes.streamInput());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue