Ericsson / CodeCheckerEclipsePlugin

This is an Eclipse plugin that shows C/C++ static analysis results found by Clang Static Analyzer and Clang Tidy
Eclipse Public License 1.0
32 stars 13 forks source link

Handle misconfigured CodeChecker plugin #141

Open gyorb opened 5 years ago

gyorb commented 5 years ago

Until CodeChecker is not configured properly in the plugin an exception is thrown.

We should handle this exception and give an error message to the users that the plugin failed to detect CodeChecker and the user should check the plugin configuration. In the console log in eclipse:

CodeChecker Plugin Started
tmux2: Failed to start server [Ljava.lang.StackTraceElement;@5296649

In the terminal where Eclipse was started:

java.lang.IllegalArgumentException: Couldn't run the specified CodeChecker for environment testing!
        at cc.codechecker.plugin.runtime.CodeCheckEnvironmentChecker.getCheckerEnvironment(CodeCheckEnvironmentChecker.java:100)
        at cc.codechecker.plugin.runtime.CodeCheckEnvironmentChecker.<init>(CodeCheckEnvironmentChecker.java:65)
        at cc.codechecker.plugin.config.CcConfiguration.updateServer(CcConfiguration.java:299)
        at cc.codechecker.plugin.config.CodeCheckerContext.getServerObject(CodeCheckerContext.java:180)
        at cc.codechecker.plugin.init.StartupJob.projectOpened(StartupJob.java:230)
        at cc.codechecker.plugin.init.StartupJob.runInUIThread(StartupJob.java:148)
        at cc.codechecker.plugin.init.StartupJob.run(StartupJob.java:48)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
vodorok commented 5 years ago

In #140 large part of that stack trace got cut out. I think this issue implicitly got fixed in that PR. In details: The method call that throws the IllegalArgumentException has been removed from the CodeCheckEnvironmentChecker constructor, and the method itself is now static and is only being called from try-catch blocks. This method was (and still is) used to set the preferences page warning info, that the path to CodeChecker binaries are not properly set up.