Skip to content

Commit

Permalink
Fix possiable NPE (#3832)
Browse files Browse the repository at this point in the history
* Fix possiable NPE

* Update CHANGES.md
  • Loading branch information
lonre authored Jul 24, 2021
1 parent f9c69db commit b2d666f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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)
* [Reduce bootstrap time in the situation with large properties](https://github.com/ctripcorp/apollo/pull/3816)
* [docs: English catalog in sidebar](https://github.com/ctripcorp/apollo/pull/3831)
* [fix the issue that release messages might be missed in certain scenarios](https://github.com/ctripcorp/apollo/pull/3819)
Expand Down
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

0 comments on commit b2d666f

Please sign in to comment.