use of org.sonar.plugins.java.api.caching.JavaReadCache in project sonar-java by SonarSource.
the class ExcessiveContentRequestCheck method loadFromPreviousAnalysis.
private static Optional<CachedResult> loadFromPreviousAnalysis(CacheContext cacheContext, InputFile inputFile) {
JavaReadCache readCache = cacheContext.getReadCache();
String cacheKey = computeCacheKey(inputFile);
byte[] rawValue = readCache.readBytes(cacheKey);
if (rawValue == null) {
return Optional.empty();
}
try {
return Optional.ofNullable(CachedResult.fromBytes(rawValue));
} catch (IllegalArgumentException ignored) {
LOGGER.trace(() -> String.format("Cached entry is unreadable for rule java:S5693 on file %s", inputFile));
return Optional.empty();
}
}
Aggregations