Skip to content

Commit

Permalink
refactor: remove parameter assertion (halo-dev#1787)
Browse files Browse the repository at this point in the history
  • Loading branch information
guqing authored Mar 29, 2022
1 parent 489ffc8 commit a7825f3
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import run.halo.app.exception.ServiceException;
import run.halo.app.utils.JsonUtils;

Expand All @@ -20,7 +21,9 @@
public abstract class AbstractStringCacheStore extends AbstractCacheStore<String, String> {

protected Optional<CacheWrapper<String>> jsonToCacheWrapper(String json) {
Assert.hasText(json, "json value must not be null");
if (!StringUtils.hasText(json)) {
return Optional.empty();
}
CacheWrapper<String> cacheWrapper = null;
try {
cacheWrapper = JsonUtils.jsonToObject(json, new TypeReference<>() {});
Expand Down

0 comments on commit a7825f3

Please sign in to comment.