You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2022/02/08 22:23:50 UTC

[GitHub] [activemq] winne42 opened a new pull request #760: Some issues from static code analysis

winne42 opened a new pull request #760:
URL: https://github.com/apache/activemq/pull/760


   Hi guys,
   
   I noticed some issues on lgtm.com and tried to fix them. Hope I didn't break anything.
   Main changes:
   
   - use try-with-resources, avoid leaking streams
   - use for-each
   - use diamond operator
   - replace anonymous class with lambda/method reference in some instances
   - catch Exception instead of Throwable
   - declare methods synchronized that inherit from synchronized methods
   - remove redundant null checks (OK, we can discuss this)
   - avoid some NPEs
   - remove unnecessary boxing/unboxing
   - remove unnecessary toString()
   - make private fields final if possible
   - fix invalid JavaDoc
   - remove unnecessary modifiers (e.g., private final, public on interface methods)
   - make constructors in abstract classes protected, not public
   - use recommended order of modifiers
   - use Collections.emptyList() instead of Collections.EMPTY_LIST
   - simplify some boolean expressions
   - combine nested ifs
   - use built-in string formatting of loggers instead of string concatenation
   - use Exception constructor with cause parameter instead of initCause()
   - use Java[] array syntax instead of C style
   - use StandardCharsets.UTF8 instead of "UTF8"
   - use .toArray() with empty instead of pre-sized array (recommended since late Java 6)
   
   Enjoy!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq] winne42 edited a comment on pull request #760: Some issues from static code analysis

Posted by GitBox <gi...@apache.org>.
winne42 edited a comment on pull request #760:
URL: https://github.com/apache/activemq/pull/760#issuecomment-1033451980


   @mattrpav OK, you are right and thanks for the context. I will split this in several PRs and get back to you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq] mattrpav commented on pull request #760: Some issues from static code analysis

Posted by GitBox <gi...@apache.org>.
mattrpav commented on pull request #760:
URL: https://github.com/apache/activemq/pull/760#issuecomment-1033138273


   This PR is not commit-able. Static code analysis tools work well for end-developer, but don't handle the context of infrastructure software such as messaging brokers and databases.
   
   1. Too many changes in on PR
   2. Missing context-- catching 'Throwable' is by design in many places
   3. This PR adds 'boxed' primitives back in
   4. other stuff.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq] winne42 closed pull request #760: Some issues from static code analysis

Posted by GitBox <gi...@apache.org>.
winne42 closed pull request #760:
URL: https://github.com/apache/activemq/pull/760


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq] winne42 commented on pull request #760: Some issues from static code analysis

Posted by GitBox <gi...@apache.org>.
winne42 commented on pull request #760:
URL: https://github.com/apache/activemq/pull/760#issuecomment-1033451980


   @mattrpav OK, you are right and thanks for the context. I will split this in several PRs and come back to you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org