Error Prone Analysis Report

Static code analysis results for Java code quality and bug detection

Summary

Total issues found: 73

Errors: 5

Warnings: 68

Top Issues

JdkObsolete: 17 occurrences

JavaUtilDate: 9 occurrences

SynchronizeOnNonFinalField: 8 occurrences

EmptyBlockTag: 7 occurrences

Errors (Must Fix)

EqualsHashCode (1)
ERROR More Info
TartanHome.java
Line 649
Classes that override equals should also override hashCode.
public boolean equals(Object o) {
DoubleBraceInitialization (4)
ERROR More Info
TartanHomeService.java
Lines 507, 566, 603, 611
Prefer collection factory methods or builders to the double-brace initialization pattern.
controller.updateSettings(new Hashtable<String, Object>() {
Try: controller.updateSettings(new Hashtable<String, Object>(ImmutableMap.of(

Warnings (Should Consider Fixing)

JDK API Usage (26)
JdkObsolete More Info
Use of obsolete JDK classes like Hashtable, Vector, and StringBuffer that have been superseded by newer alternatives.

Replace:

  • Hashtable with LinkedHashMap (17 occurrences)
  • Vector with ArrayList (3 occurrences)
  • StringBuffer with StringBuilder (6 occurrences)
JavaUtilDate More Info
Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate.
Multiple files (9 occurrences)
JavaTimeDefaultTimeZone More Info
LocalDateTime.now() is not allowed because it silently uses the system default time-zone.
ReportScheduler.java
Use explicit timezone: LocalDateTime.now(ZoneId.systemDefault())
DateFormatConstant More Info
DateFormat is not thread-safe, and should not be used as a constant field.
UserReportGenerator.java (Line 17)
Use ThreadLocal: private static final ThreadLocal<SimpleDateFormat> dateFormat = ThreadLocal.withInitial(() -> new SimpleDateFormat("MMMM dd, yyyy"));
Concurrency Issues (9)
SynchronizeOnNonFinalField More Info
Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.
Multiple files (8 occurrences)
Make the field final or synchronize on a different, final object.
FutureReturnValueIgnored More Info
Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.
ReportScheduler.java (Line 62)
Use var unused = scheduler.scheduleAtFixedRate(
Code Quality Issues (8)
AlreadyChecked More Info
This condition is already known to be true/false; it (or its complement) has already been checked.
TartanHomeService.java (3 occurrences)
InconsistentHashCode More Info
hashCode includes fields that equals does not, which violates the hashCode contract.
TartanHomeData.java (Line 655)
StringSplitter More Info
String.split(String) has surprising behavior
Multiple files (3 occurrences)
Use Guava's Splitter: List<String> = Splitter.on(Pattern.compile(delimiter)).splitToList(input);
DefaultCharset More Info
Implicit use of the platform default charset, which can result in differing behaviour between JVM executions.
Multiple files (3 occurrences)
Specify charset explicitly: new InputStreamReader(stream, StandardCharsets.UTF_8)
Exception Handling (4)
CatchAndPrintStackTrace More Info
Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
Multiple files (2 occurrences)
EmptyCatch More Info
Caught exceptions should not be ignored
Multiple files (2 occurrences)
Documentation Issues (11)
EmptyBlockTag More Info
A block tag (@param, @return, @throws, @deprecated) has an empty description.
Multiple files (7 occurrences)
InvalidParam More Info
Parameter name is unknown.
Multiple files (4 occurrences)

Files with Most Issues

  1. 18 issues TartanHomeService.java
  2. 16 issues IoTControlManager.java
  3. 6 issues IoTConnectManager.java
  4. 6 issues TestReportGenerator.java
  5. 5 issues TartanHomeData.java

Recommendations

High Priority Issues

Medium Priority Issues

Lower Priority Issues