Skip to content

Commit

Permalink
Migrate deprecated API calls to their replacements
Browse files Browse the repository at this point in the history
  • Loading branch information
aldaris committed Nov 27, 2024
1 parent 74a0b27 commit 92505c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.commons.lang3.RandomUtils;
Expand Down Expand Up @@ -534,6 +533,6 @@ public IManageablePage getPage(IPageContext context, int id) {

private long around(long target)
{
return RandomUtils.nextLong((long)(target * .9), (long)(target * 1.1));
return RandomUtils.secure().randomLong((long)(target * .9), (long)(target * 1.1));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public MockHttpSession getHttpSession()
};

Callable<Void> serializeSessionTask = () -> {
final NullOutputStream nullOutputStream = NullOutputStream.NULL_OUTPUT_STREAM;
final NullOutputStream nullOutputStream = NullOutputStream.INSTANCE;
try(final ObjectOutputStream objectOutputStream = new ObjectOutputStream(nullOutputStream))
{
objectOutputStream.writeObject(wicketTester.getSession());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ public void writeData(Attributes attributes) throws IOException
{
// Stream is going to be read from the starting point next to the skipped bytes
// till the end byte computed by the range between startbyte / endbyte
boundedInputStream = new BoundedInputStream(inputStream,
(endbyte - startbyte) + 1);

// The original input stream is going to be closed by the end of the request
// so set propagate close to false
boundedInputStream.setPropagateClose(false);
boundedInputStream = BoundedInputStream.builder()
.setInputStream(inputStream)
.setMaxCount((endbyte - startbyte) + 1)
// The original input stream is going to be closed by the end of the request
// so set propagate close to false
.setPropagateClose(false)
.get();

// The read bytes in the current buffer
int readBytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static void dumpSingleThread(Logger logger, Thread thread, StackTraceEle
variables.put("name", thread.getName());
variables.put("isDaemon", thread.isDaemon() ? " daemon" : "");
variables.put("priority", thread.getPriority());
variables.put("threadIdDec", thread.getId());
variables.put("threadIdDec", thread.threadId());
variables.put("state", thread.getState());

ThreadDump throwable = new ThreadDump();
Expand Down

0 comments on commit 92505c9

Please sign in to comment.