Retain source data for prepared dictionary. Unlike pure-java prepared dictionary, in native prepared dictionaries source data is not copied, but referenced. Likely because of copy-paste, `raw_data` field was not populated. PiperOrigin-RevId: 944339020
diff --git a/java/org/brotli/wrapper/enc/EncoderJNI.java b/java/org/brotli/wrapper/enc/EncoderJNI.java index 2f7ef30..888d537 100644 --- a/java/org/brotli/wrapper/enc/EncoderJNI.java +++ b/java/org/brotli/wrapper/enc/EncoderJNI.java
@@ -35,6 +35,8 @@ private PreparedDictionaryImpl(ByteBuffer data, ByteBuffer rawData) { this.data = data; + // Retain a reference to the raw data to prevent it from being garbage collected. + this.rawData = rawData; } @Override