Fix some unnecessary use of boxed types and incorrect format strings spotted by lgtm.#4474
Conversation
|
@chrisgavin thanks for your patch. Please check the compilation error. |
57bc4ae to
1f659c5
Compare
1f659c5 to
dc014e6
Compare
dc014e6 to
7e9a322
Compare
|
Thanks. I have fixed it. :) |
|
@chrisgavin please in the future, don't amend commits in your PR, always add new commits on top, including merge commits. |
|
@leventov Sorry about that. I could revert to the previous HEAD of this PR and then make the compilation fix as a new commit if that would be helpful. |
|
@chrisgavin not needed now, it's for the future. Also could you please add inspections for this kind of errors?
|
|
Or more generally, you may prohibit any non-druid loggers by regex like But a few exceptions will be needed, that you may guard with |
|
@chrisgavin it wasn't supposed to be clean, please fix inspection and checkstyle failures now. |
…er is not simple.
… to format strings.
| import com.google.common.util.concurrent.ListenableFuture; | ||
| import com.google.common.util.concurrent.ListeningExecutorService; | ||
| import com.google.common.util.concurrent.MoreExecutors; | ||
| //CHECKSTYLE.OFF: Regexp |
| import com.google.common.util.concurrent.ListenableFuture; | ||
| import com.google.common.util.concurrent.ListeningExecutorService; | ||
| import com.google.common.util.concurrent.MoreExecutors; | ||
| //CHECKSTYLE.OFF: Regexp |
| log.warn(message); | ||
| } | ||
|
|
||
| /** @noinspection MalformedFormatString */ |
|
|
||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||
| import com.google.common.collect.ImmutableMap; | ||
| //CHECKSTYLE.OFF: Regexp |
| import com.google.common.collect.Sets; | ||
| import com.google.common.util.concurrent.ListeningExecutorService; | ||
| import com.google.common.util.concurrent.MoreExecutors; | ||
| //CHECKSTYLE.OFF: Regexp |
|
@leventov The places that still use the old logger do so because the logger is passed into a |
|
@chrisgavin 16 more malformed string format violations reported: https://teamcity.jetbrains.com/viewLog.html?buildId=1108816&tab=Inspection&buildTypeId=OpenSourceProjects_Druid_InspectionsPullRequests |
| public Result<T> apply(Cursor input) | ||
| { | ||
| log.debug("Running over cursor[%s]", adapter.getInterval(), input.getTime()); | ||
| log.debug("Running over cursor[%s]", input.getTime()); |
There was a problem hiding this comment.
Strange logging "cursor[input.getTime()]". Also maybe just remove this debugging line
| } | ||
| catch (Exception e) { | ||
| log.warn(e, "Could not close aggregator, skipping.", aggregator); | ||
| log.warn(e, "Could not close aggregator, skipping."); |
| public Result<TopNResultValue> apply(Cursor input) | ||
| { | ||
| log.debug("Running over cursor[%s]", adapter.getInterval(), input.getTime()); | ||
| log.debug("Running over cursor[%s]", input.getTime()); |
|
@chrisgavin also please fill the CLA http://druid.io/community/cla.html |
This pull request fixes some small problems identified by lgtm. You can find more details here.
The first commit changes some boxed types which can never be null to unboxed types.
The second commit fixes some format strings where the number of arguments doesn't match the number of placeholders in the format string.