diff --git a/src/main/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBuffer.java b/src/main/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBuffer.java index 34d35a9..1c6c05d 100644 --- a/src/main/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBuffer.java +++ b/src/main/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBuffer.java @@ -306,7 +306,8 @@ private void checkReadBuffer() { diskBufferRead = readBuffer(dataDir, diskBufferReadPosition, numberOfChunks); } catch (IOException e) { throw new IllegalStateException("Could not fetch buffer for reading at position " + - diskBufferReadPosition + " from " + dataDir, e); + diskBufferReadPosition + " from " + dataDir + " with nextGet: " + nextGet + + " and numberOfChunks " + numberOfChunks, e); } } } diff --git a/src/test/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBufferTest.java b/src/test/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBufferTest.java index 841d2ad..dc3b716 100644 --- a/src/test/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBufferTest.java +++ b/src/test/java/org/dstadler/audio/buffer/DiskBasedBlockingSeekableRingBufferTest.java @@ -5,7 +5,6 @@ import org.apache.commons.lang3.exception.ExceptionUtils; import org.dstadler.audio.stream.Stream; import org.dstadler.commons.logging.jdk.LoggerFactory; -import org.dstadler.commons.testing.TestHelpers; import org.dstadler.commons.testing.ThreadTestHelper; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -205,15 +204,15 @@ public void testLargeBuffer() throws IOException { try (DiskBasedBlockingSeekableRingBuffer localBuffer = new DiskBasedBlockingSeekableRingBuffer(1000, 33, getDataDir())) { for (int i = 0; i < 5000; i++) { - localBuffer.add(new Chunk(RandomUtils.nextBytes(1), "", 0)); + localBuffer.add(new Chunk(RandomUtils.insecure().randomBytes(1), "", 0)); - if (RandomUtils.nextBoolean()) { + if (RandomUtils.insecure().randomBoolean()) { assertNotNull(localBuffer.peek()); assertNotNull(localBuffer.next()); } - if (RandomUtils.nextBoolean()) { - int seek = localBuffer.seek(RandomUtils.nextInt(0, 5000) - 2500); + if (RandomUtils.insecure().randomBoolean()) { + int seek = localBuffer.seek(RandomUtils.insecure().randomInt(0, 5000) - 2500); assertTrue(seek > -1000 && seek < 1000, "Had: " + seek + " with " + buffer); } @@ -318,8 +317,7 @@ public void testFailingWrite() throws IOException { try { localBuffer.add(new Chunk(new byte[0], "", 1)); } catch (IllegalStateException e) { - assertTrue(e.getCause() instanceof FileNotFoundException, - "Had: " + ExceptionUtils.getStackTrace(e)); + assertInstanceOf(FileNotFoundException.class, e.getCause(), "Had: " + ExceptionUtils.getStackTrace(e)); assertTrue(e.getMessage().contains("Could not update current buffers for writing at position") || e.getMessage().contains("Could not fetch buffer for reading at position"), "Had: " + ExceptionUtils.getStackTrace(e));