Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix possiable NPE #3832

Merged
merged 4 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Apollo 1.9.0
* [speed up the stale issue mark and close phase](https://github.com/ctripcorp/apollo/pull/3808)
* [feature: add the delegating password encoder for apollo-portal simple auth](https://github.com/ctripcorp/apollo/pull/3804)
* [support release apollo-client-config-data](https://github.com/ctripcorp/apollo/pull/3822)
* [Fix possiable NPE](https://github.com/ctripcorp/apollo/pull/3832)
------------------
All issues and pull requests are [here](https://github.com/ctripcorp/apollo/milestone/6?closed=1)

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.slf4j.Logger;
import org.slf4j.event.Level;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

/**
Expand All @@ -36,7 +35,6 @@ final class DeferredLogCache {
private static final AtomicInteger LOG_INDEX = new AtomicInteger(0);
private static final Cache<Integer, Line> LOG_CACHE = CacheBuilder.newBuilder()
.maximumSize(MAX_LOG_SIZE)
.expireAfterWrite(1, TimeUnit.MINUTES)
.build();

private DeferredLogCache() {
Expand Down Expand Up @@ -85,7 +83,9 @@ private static void add(Logger logger, Level level, String message, Object[] obj
static void replayTo() {
for (int i = 1; i <= LOG_INDEX.get(); i++) {
Line logLine = LOG_CACHE.getIfPresent(i);
assert logLine != null;
if (logLine == null) {
continue;
}
Logger logger = logLine.getLogger();
Level level = logLine.getLevel();
String message = logLine.getMessage();
Expand Down