Skip to content

Commit

Permalink
Merge "Revert "Override versioned tzdata file path."" into main am: 4…
Browse files Browse the repository at this point in the history
…dde005

Original change: https://android-review.googlesource.com/c/platform/external/robolectric/+/3112091

Change-Id: I9821b905ffadf33005b49c083c2c05464a5905ac
Signed-off-by: Automerger Merge Worker <[email protected]>
  • Loading branch information
Priyanka Advani authored and android-build-merge-worker-robot committed Jun 4, 2024
2 parents 981b1fe + 4dde005 commit 0b79b63
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.regex.Pattern;
import libcore.io.Streams;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
Expand All @@ -24,15 +23,13 @@ public class ShadowMemoryMappedFileS {
private static final String TZ_DATA_2 = "/usr/share/zoneinfo/tzdata";
private static final String TZ_DATA_3 = "/misc/zoneinfo/current/tzdata";
private static final String TZ_DATA_4 = "/etc/tz/tzdata";
private static final Pattern VERSIONED_TZDATA = Pattern.compile(".*/tz/versioned/\\d+/tzdata");

@Implementation
public static MemoryMappedFile mmapRO(String path) throws Throwable {
if (path.endsWith(TZ_DATA_1)
|| path.endsWith(TZ_DATA_2)
|| path.endsWith(TZ_DATA_3)
|| path.endsWith(TZ_DATA_4)
|| VERSIONED_TZDATA.matcher(path).matches()) {
|| path.endsWith(TZ_DATA_4)) {
InputStream is = MemoryMappedFile.class.getResourceAsStream(TZ_DATA_2);
if (is == null) {
throw new ErrnoException("open", -1);
Expand Down

0 comments on commit 0b79b63

Please sign in to comment.