History log of /libcore/luni/src/main/java/java/nio/charset/CharsetEncoderICU.java
Revision Date Author Comments
e31b37859051d3902e06e4ba384995df7188917f 02-Dec-2017 Hans Boehm <hboehm@google.com> Add reachabilityFence, ReachabilitySensitive

Add the @ReachabilitySensitive annotation itself, and use it
in libcore itself, where needed.

Import OpenJDK9+181's reachabilityFence, so that it can be used in
preference to the annotation where it makes sense. Java 9's
stopgap reachabilityFence implementation doesn't work for us,
so replace it with a different stopgap.

The libcore changes correct many situations in which finalizers
could previously run prematurely according to the JLS. Or they
would correct them if we had a real implementation for
@ReachabilitySensitive.

The ZipFile constructor could close the file before notifying the
CloseGuard that it was open.

Aside from the ZipFile change, there should be no functional
change, yet.

Note that the ExemptionMechanism.java fix is the same as upstream.

Conspicuously missing:

- Any code, e.g. in ART or D8, that actually looks for the annotation.
- Uses in frameworks code, where it's probably most critical.

Bug: 63934467
Bug: 70906684
Bug: 28342794
Test: Build & boot AOSP
Change-Id: I652f0625b39b2ba9ac901d4f63e6aa6cf3b74af5
59b140db4c4bd7617792256cd5d52713409137bc 12-Jan-2018 Hans Boehm <hboehm@google.com> Avoid duplicate free in CharsetXcoderICU on OOME

NativeAllocationRegistry registration attempts that throw should
immediately deallocate, and not register a Cleaner.

CharsetEncoder/CharsetDecoder should not deallocate the native
object on OOME when NativeAllocationRegistry already did.

Bug: 71750393
Bug: 70631114

Test: Build & boot AOSP, run art host tests,
vogar --mode host libcore/luni/src/test/java/libcore/libcore/util/NativeAllocationRegistryTest.java

Change-Id: If35db36387b53f14ce1eeba09029f7a10fd7bbb5
de1819e35f05acf0acbbaace42c2e54797383ad7 24-Apr-2017 Narayan Kamath <narayan@google.com> CharsetEncoderICU: Don't call updateCallback from <init>.

Changed for correctness and for consistency with CharsetDecoderICU.
The existing code is incorrect because we'd end up deleting the same
allocation twice (once from NativeAllocationRegistry's reference queue,
and once from the finally block) if updateCallback throws.

Related to b/37315864.

Test: run cts -m CtsLibcoreTestCases

Change-Id: I5425093ed7fbdc4aa69f5b9108428399b3c8c555
1bdc6bc1c72b033ed860360e69fc9f1f1121579b 22-Apr-2016 Narayan Kamath <narayan@google.com> CharsetEncoder/Decoder: Use NativeAllocationRegistry.

Works around issues with finalizer ordering.

bug: 26076560

(cherry picked from commit c672ce800bbc27cb79f78d9204a51ec06ef1ec3d)

Change-Id: I434842966fe2cda70aa955250162c562ce0f8991
c672ce800bbc27cb79f78d9204a51ec06ef1ec3d 22-Apr-2016 Narayan Kamath <narayan@google.com> CharsetEncoder/Decoder: Use NativeAllocationRegistry.

Works around issues with finalizer ordering.

bug: 26076560
Change-Id: I4977ff9e2f6234283bd23dfc39a574d4854f6655
4e4b93ffe988b0a597835d852489573b57e0f3fe 30-Jul-2014 Narayan Kamath <narayan@google.com> Don't account buffer.arrayOffset() twice.

data[OUTPUT_OFFSET] from the perspective of native
code must always be the offset from the start of the
buffer passed in to it.

Change-Id: I4a5c9595aebd105c57ce2239dc95cf85d5bd6256
41c3d56dfdc92bd5710bdaf901f45d6c4da8fd0d 30-Jul-2014 Narayan Kamath <narayan@google.com> Don't account buffer.arrayOffset() twice.

data[OUTPUT_OFFSET] from the perspective of native
code must always be the offset from the start of the
buffer passed in to it.

bug: 16449607

(cherry picked from commit 4e4b93ffe988b0a597835d852489573b57e0f3fe)

Change-Id: Iddd3a835b72ae122c10e802bad92baffd0a85283
91bb19d2ef9822cfb50fd1191cdb3ee06e2939b9 27-Nov-2013 Narayan Kamath <narayan@google.com> Fix a CharsetEncoder bug.

When malformed or unmappable characters span input
buffers, we'd end up setting a negative position on the
buffer.

Also fix up a few test cases which were wrong in
several ways.
- One test was simply checking for the wrong sort
of exception (unmappable vs malformed)
- Another test was expecting encode() to throw an
error (and ignoring flush) but the API allows flush
to throw an error instead of encode.

bug: 10729779

Change-Id: I6560b749ca2445651d61ca651f8a5e388cf1c1b0
f15b280ac1c2e32f7becdb314440c2999dc8d204 26-Nov-2013 Narayan Kamath <narayan@google.com> Fix an ASCIICharsetEncoderTest testcase.

Deal with truncated char sequences correctly.

bug: 10729779
Change-Id: I232b0ec899084270a6d621e6c7292ef8b94f8f7d
5ec6bf8d033754e06a463adb091d2c0afd0755ac 08-Aug-2013 Elliott Hughes <enh@google.com> Fix various Charset tests, clean up the implementation.

Bug: 10211558
Bug: 10211378
Change-Id: Ib3f97430f62163c0459c53e0c282ae0ca840e0af
5ec69b20ab9b3e2dcbe225d548168b09afbbbac2 24-Jul-2012 Elliott Hughes <enh@google.com> Clean up ICU error reporting.

Throw all ICU exceptions from the native side, and include the name of the
function that failed.

Bug: 5037042
Change-Id: I49b5493a7e7365226d612479294b5b8f47ec4e8c
4fd8ac297725190c6d81e9538b1faf7cfb0f5bb8 08-Feb-2011 Elliott Hughes <enh@google.com> Fix build.

The *ICU classes shouldn't be public.

Change-Id: I1ca75c696c52f75b70d6aef29888a5a48ef7b32a
3664d8839f0ba794f428119ee7f7304a66861da5 08-Feb-2011 Elliott Hughes <enh@google.com> Clean up the CharsetDecoder/CharsetEncoder implementation a bit more.

Moving CharsetEncoderICU into java.nio.charset lets us use a cleaner workaround
for the constructor-calling-abstract method API bug.

Change-Id: I2312580b2c27711e9d4c88fe4dc057eec13c12e0