Skip to content

Commit 76107ba

Browse files
committed
Address teamscale warnings
1 parent fe3b214 commit 76107ba

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathSerializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ public KeySpacePathSerializer(@Nonnull final KeySpacePath root) {
5555

5656
@Nonnull
5757
public ByteString serialize(@Nonnull DataInKeySpacePath data) {
58-
KeySpaceProto.DataInKeySpacePath.Builder builder = KeySpaceProto.DataInKeySpacePath.newBuilder();
5958
final List<KeySpacePath> dataPath = data.getPath().flatten();
6059
// two paths are only equal if their parents are equal, so we don't have to validate the whole prefix here
6160
if (dataPath.size() < root.size() ||
6261
!dataPath.get(root.size() - 1).equals(root.get(root.size() - 1))) {
6362
throw new RecordCoreArgumentException("Data is not contained within root path");
6463
}
64+
KeySpaceProto.DataInKeySpacePath.Builder builder = KeySpaceProto.DataInKeySpacePath.newBuilder();
6565
for (int i = root.size(); i < dataPath.size(); i++) {
6666
final KeySpacePath keySpacePath = dataPath.get(i);
6767
builder.addPath(serialize(keySpacePath));
@@ -138,8 +138,6 @@ private static Object deserializeValue(@Nonnull KeySpaceProto.KeySpacePathEntry
138138

139139
@Nonnull
140140
private static KeySpaceProto.KeySpacePathEntry serialize(@Nonnull final KeySpacePath keySpacePath) {
141-
KeySpaceProto.KeySpacePathEntry.Builder builder = KeySpaceProto.KeySpacePathEntry.newBuilder()
142-
.setName(keySpacePath.getDirectoryName());
143141
final Object value = keySpacePath.getValue();
144142
final KeySpaceDirectory.KeyType keyType = keySpacePath.getDirectory().getKeyType();
145143

@@ -158,6 +156,8 @@ private static KeySpaceProto.KeySpacePathEntry serialize(@Nonnull final KeySpace
158156
}
159157
}
160158

159+
KeySpaceProto.KeySpacePathEntry.Builder builder = KeySpaceProto.KeySpacePathEntry.newBuilder()
160+
.setName(keySpacePath.getDirectoryName());
161161
try {
162162
switch (keyType) {
163163
case NULL:

fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/provider/foundationdb/keyspace/KeySpacePathSerializerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ void testSerializeAndDeserializeMultiLevelPath() {
140140
assertArrayEquals(value, deserialized.getValue());
141141
}
142142

143-
private static Stream<Arguments> testSerializeDeserializeAllKeyTypes() {
144-
return KEY_TYPE_TEST_VALUES.entrySet().stream()
145-
.map(entry -> Arguments.of(entry.getKey(), entry.getValue()));
146-
}
147-
148143
@Test
149144
void testKeyTypeTestValuesIncludesAllKeyTypes() {
150145
// Verify that KEY_TYPE_TEST_VALUES contains all KeyType enum values
@@ -153,6 +148,11 @@ void testKeyTypeTestValuesIncludesAllKeyTypes() {
153148
assertEquals(allKeyTypes, coveredKeyTypes);
154149
}
155150

151+
static Stream<Arguments> testSerializeDeserializeAllKeyTypes() {
152+
return KEY_TYPE_TEST_VALUES.entrySet().stream()
153+
.map(entry -> Arguments.of(entry.getKey(), entry.getValue()));
154+
}
155+
156156
@ParameterizedTest
157157
@MethodSource
158158
void testSerializeDeserializeAllKeyTypes(KeyType keyType, Object value) {

0 commit comments

Comments
 (0)