Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ dependencies {
implementation("io.projectreactor.addons:reactor-extra")
implementation("io.projectreactor:reactor-tools")

def commonsVersion = "20251008-e3f795c"
def commonsVersion = "20251112-0a26247"

implementation("com.faforever.commons:data:${commonsVersion}") {
exclude module: 'guava'
Expand Down
7 changes: 3 additions & 4 deletions src/main/java/com/faforever/client/replay/ReplayService.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.faforever.commons.api.elide.ElideNavigatorOnId;
import com.faforever.commons.replay.ReplayDataParser;
import com.faforever.commons.replay.ReplayMetadata;
import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
Expand All @@ -49,11 +48,11 @@
import reactor.core.publisher.Mono;
import reactor.util.function.Tuple2;

import java.io.ByteArrayInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down Expand Up @@ -370,12 +369,12 @@ private void runOnlineReplay(int replayId) {

private void runFafReplayFile(Path path) throws IOException {
ReplayDataParser replayData = replayFileReader.parseReplay(path);
ByteBuffer rawReplayByteBuffer = replayData.getData();
byte[] rawReplayBytes = replayData.getRawReplayData();

Path tempSupComReplayFile = dataPrefs.getCacheDirectory().resolve(TEMP_SCFA_REPLAY_FILE_NAME);

Files.createDirectories(tempSupComReplayFile.getParent());
Files.copy(new ByteBufferBackedInputStream(rawReplayByteBuffer), tempSupComReplayFile,
Files.copy(new ByteArrayInputStream(rawReplayBytes), tempSupComReplayFile,
StandardCopyOption.REPLACE_EXISTING);

ReplayMetadata replayMetadata = replayData.getMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public void readReplayData() throws Exception {
try (InputStream inputStream = new BufferedInputStream(getClass().getResourceAsStream("/replay/test.fafreplay"))) {
Files.copy(inputStream, tempFile);
}
assertThat(instance.parseReplay(tempFile).getData().capacity(), is(197007));
assertThat(instance.parseReplay(tempFile).getRawReplayData().length, is(197007));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import reactor.util.function.Tuple2;
import reactor.util.function.Tuples;

import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Instant;
Expand Down Expand Up @@ -186,7 +185,7 @@ public void setUp() throws Exception {

lenient().when(replayFileReader.parseReplay(any())).thenReturn(replayDataParser);
lenient().when(replayDataParser.getMetadata()).thenReturn(replayMetadata);
lenient().when(replayDataParser.getData()).thenReturn(ByteBuffer.wrap(REPLAY_FIRST_BYTES));
lenient().when(replayDataParser.getRawReplayData()).thenReturn(REPLAY_FIRST_BYTES);
lenient().when(replayDataParser.getChatMessages()).thenReturn(List.of());
lenient().when(replayDataParser.getGameOptions()).thenReturn(List.of());
lenient().when(replayDataParser.getMods()).thenReturn(Map.of());
Expand Down