error-prone icon indicating copy to clipboard operation
error-prone copied to clipboard

JavaTimeDefaultTimeZone throws NullPointerException

Open kshchepanovskyi opened this issue 7 years ago • 1 comments

Description of the problem:

JavaTimeDefaultTimeZone check throws NullPointerException:

00:02:45.686 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project table-streaming-events-aggregator: Compilation failure
00:02:45.687 [ERROR] /opt/local/jenkins/workspace/Base/refactoring-cleanup-poms/set-version/table-streaming/table-streaming-events-aggregator/src/test/java/com/playtech/live/streaming/service/TableEventsAggregatorApplicationTest.java:[292,96] An unhandled exception was thrown by the Error Prone static analysis plugin.
00:02:45.688 [ERROR] Please report this at https://github.com/google/error-prone/issues/new and include the following:
00:02:45.688 [ERROR] 
00:02:45.688 [ERROR] error-prone version: 2.3.3
00:02:45.692 [ERROR] BugPattern: JavaTimeDefaultTimeZone
00:02:45.692 [ERROR] Stack Trace:
00:02:45.693 [ERROR] java.lang.NullPointerException
00:02:45.693 [ERROR] at com.google.errorprone.VisitorState.getEndPosition(VisitorState.java:532)
00:02:45.694 [ERROR] at com.google.errorprone.bugpatterns.time.JavaTimeDefaultTimeZone.matchMethodInvocation(JavaTimeDefaultTimeZone.java:123)
00:02:45.695 [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.processMatchers(ErrorProneScanner.java:433)
00:02:45.695 [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:732)
00:02:45.696 [ERROR] at com.google.errorprone.scanner.ErrorProneScanner.visitMethodInvocation(ErrorProneScanner.java:150)
00:02:45.696 [ERROR] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1650)
00:02:45.697 [ERROR] at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
00:02:45.698 [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:71)
00:02:45.698 [ERROR] at com.google.errorprone.scanner.Scanner.scan(Scanner.java:45)
00:02:45.699 [ERROR] at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
00:02:45.699 [ERROR] at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)

...

00:02:45.734 [ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
00:02:45.734 [ERROR] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
00:02:45.735 [ERROR] at java.base/java.lang.Thread.run(Thread.java:834)
00:02:45.735 [ERROR] -> [Help 1]

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Java class where this check thrown exception contains following code related to Java Date/Time API usage:

import static java.time.LocalDateTime.now;

class TableEventsAggregatorApplicationTest {

... 

    @SuppressWarnings("unused")
    static class TableEventsUtils {

        static TableEvent emptyEvent() {
            return TableEvent.of(TableStreamingTestConfiguration.PHYSICAL_TABLE_ID, 0L, "", now());
        }

What version of Error Prone are you using?

2.3.3

Have you found anything relevant by searching the web?

No results (2019-03-28).

kshchepanovskyi avatar Mar 28 '19 16:03 kshchepanovskyi

Which release of error prone has this fix.

chethan avatar Aug 22 '19 05:08 chethan