Skip to content

Commit 5a5054d

Browse files
authored
Merge 1d75370 into 5318bd9
2 parents 5318bd9 + 1d75370 commit 5a5054d

File tree

3 files changed

+2
-77
lines changed

3 files changed

+2
-77
lines changed

firebase-firestore/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Unreleased
22
* [feature] Add support for disjunctions in queries (`OR` queries).
3-
* [fixed] Fixed stack overflow caused by deeply nested server timestamps (#4702).
43

54
# 24.4.4
65
* [changed] Relaxed certain query validations performed by the SDK (#4231).

firebase-firestore/src/main/java/com/google/firebase/firestore/model/ServerTimestamps.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@ public static Value valueOf(Timestamp localWriteTime, @Nullable Value previousVa
6262
.putFields(TYPE_KEY, encodedType)
6363
.putFields(LOCAL_WRITE_TIME_KEY, encodeWriteTime);
6464

65-
Value actualPreviousValue = previousValue == null ? null : getPreviousValue(previousValue);
66-
if (actualPreviousValue != null) {
67-
mapRepresentation.putFields(PREVIOUS_VALUE_KEY, actualPreviousValue);
65+
if (previousValue != null) {
66+
mapRepresentation.putFields(PREVIOUS_VALUE_KEY, previousValue);
6867
}
6968

7069
return Value.newBuilder().setMapValue(mapRepresentation).build();

firebase-firestore/src/test/java/com/google/firebase/firestore/local/SQLiteLocalStoreTest.java

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,12 @@
3232
import static java.util.Collections.emptyList;
3333
import static java.util.Collections.singletonList;
3434

35-
import com.google.firebase.Timestamp;
3635
import com.google.firebase.firestore.FieldValue;
3736
import com.google.firebase.firestore.core.Query;
38-
import com.google.firebase.firestore.model.DocumentKey;
3937
import com.google.firebase.firestore.model.FieldIndex;
40-
import com.google.firebase.firestore.model.FieldPath;
41-
import com.google.firebase.firestore.model.ObjectValue;
42-
import com.google.firebase.firestore.model.ServerTimestamps;
43-
import com.google.firebase.firestore.model.mutation.FieldMask;
44-
import com.google.firebase.firestore.model.mutation.FieldTransform;
45-
import com.google.firebase.firestore.model.mutation.PatchMutation;
46-
import com.google.firebase.firestore.model.mutation.Precondition;
47-
import com.google.firebase.firestore.model.mutation.ServerTimestampOperation;
48-
import com.google.firestore.v1.Value;
49-
import java.util.ArrayList;
5038
import java.util.Arrays;
5139
import java.util.Collection;
5240
import java.util.Collections;
53-
import java.util.HashMap;
54-
import java.util.HashSet;
55-
import java.util.List;
56-
import java.util.Map;
57-
import java.util.concurrent.atomic.AtomicReference;
5841
import org.junit.Test;
5942
import org.junit.runner.RunWith;
6043
import org.robolectric.RobolectricTestRunner;
@@ -307,60 +290,4 @@ public void testIndexesServerTimestamps() {
307290
assertOverlayTypes(keyMap("coll/a", CountingQueryEngine.OverlayType.Set));
308291
assertQueryReturned("coll/a");
309292
}
310-
311-
@Test
312-
public void testDeeplyNestedServerTimestamps() {
313-
Timestamp timestamp = Timestamp.now();
314-
Value initialServerTimestamp = ServerTimestamps.valueOf(timestamp, null);
315-
Map<String, Value> fields =
316-
new HashMap<String, Value>() {
317-
{
318-
put("timestamp", ServerTimestamps.valueOf(timestamp, initialServerTimestamp));
319-
}
320-
};
321-
FieldPath path = FieldPath.fromSingleSegment("timestamp");
322-
FieldMask mask =
323-
FieldMask.fromSet(
324-
new HashSet<FieldPath>() {
325-
{
326-
add(path);
327-
}
328-
});
329-
FieldTransform fieldTransform =
330-
new FieldTransform(path, ServerTimestampOperation.getInstance());
331-
List<FieldTransform> fieldTransforms =
332-
new ArrayList<FieldTransform>() {
333-
{
334-
add(fieldTransform);
335-
}
336-
};
337-
AtomicReference<Throwable> error = new AtomicReference<>();
338-
Thread thread =
339-
new Thread(
340-
Thread.currentThread().getThreadGroup(),
341-
() -> {
342-
try {
343-
for (int i = 0; i < 1000; ++i) {
344-
writeMutation(
345-
new PatchMutation(
346-
DocumentKey.fromPathString("some/object/for/test"),
347-
ObjectValue.fromMap(fields),
348-
mask,
349-
Precondition.NONE,
350-
fieldTransforms));
351-
}
352-
} catch (Throwable e) {
353-
error.set(e);
354-
}
355-
},
356-
"test",
357-
1024 * 1024);
358-
try {
359-
thread.start();
360-
thread.join();
361-
} catch (InterruptedException e) {
362-
throw new AssertionError(e);
363-
}
364-
assertThat(error.get()).isNull();
365-
}
366293
}

0 commit comments

Comments
 (0)