You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/07/03 10:43:27 UTC
[GitHub] [camel] dk2k opened a new pull request #5787: Fixes based on the run of the static analysis tool Findbugs
dk2k opened a new pull request #5787:
URL: https://github.com/apache/camel/pull/5787
Reincarnation of the pull request https://github.com/apache/camel/pull/5757
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] dk2k commented on pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
dk2k commented on pull request #5787:
URL: https://github.com/apache/camel/pull/5787#issuecomment-880502574
Guys, thanks for review! Just in case: you can give this PR a go now ;)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r665462532
##########
File path: core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java
##########
@@ -207,7 +207,10 @@ protected void loadStore() throws IOException {
LOG.debug("Creating filestore: {}", fileStore);
File parent = fileStore.getParentFile();
if (parent != null) {
- parent.mkdirs();
+ boolean mkdirsResult = parent.mkdirs();
+ if (!mkdirsResult) {
+ LOG.error("mkdirs() failed for " + parent);
Review comment:
My .2 cents: I think it would be better to have a more descriptive log message here since this is in the core of Camel and also using log markers. I'd suggest something like `LOG.error(""Couldn't create the filestore at {} because creating the directory has failed", parent);`. Alternatively, we could also explore whether [Files.createDirectories](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createDirectories-java.nio.file.Path-java.nio.file.attribute.FileAttribute...-) could fulfill this gaps as, I believe, it provides better error descriptions.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r665465025
##########
File path: core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/FileIdempotentRepository.java
##########
@@ -462,7 +462,10 @@ protected void loadStore() throws IOException {
LOG.debug("Creating filestore: {}", fileStore);
File parent = fileStore.getParentFile();
if (parent != null) {
- parent.mkdirs();
+ boolean mkdirsResult = parent.mkdirs();
+ if (!mkdirsResult) {
+ LOG.error("mkdirs() failed for " + parent);
Review comment:
My .2 cents: for the log message on this part as well.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] oscerd commented on pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
oscerd commented on pull request #5787:
URL: https://github.com/apache/camel/pull/5787#issuecomment-880504268
Thanks for this. Merged.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] oscerd merged pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
oscerd merged pull request #5787:
URL: https://github.com/apache/camel/pull/5787
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r665462532
##########
File path: core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java
##########
@@ -207,7 +207,10 @@ protected void loadStore() throws IOException {
LOG.debug("Creating filestore: {}", fileStore);
File parent = fileStore.getParentFile();
if (parent != null) {
- parent.mkdirs();
+ boolean mkdirsResult = parent.mkdirs();
+ if (!mkdirsResult) {
+ LOG.error("mkdirs() failed for " + parent);
Review comment:
My .2 cents: I think it would be better to have a more descriptive log message here since this is in the core of Camel and also using log markers. I'd suggest something like `LOG.error(""Couldn't create the filestore at {} because creating the directory has f" + parent);`. Alternatively, we could also explore whether [Files.createDirectories](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createDirectories-java.nio.file.Path-java.nio.file.attribute.FileAttribute...-) could fulfill this gaps as, I believe, it provides better error descriptions.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] orpiske commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
orpiske commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r665462532
##########
File path: core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java
##########
@@ -207,7 +207,10 @@ protected void loadStore() throws IOException {
LOG.debug("Creating filestore: {}", fileStore);
File parent = fileStore.getParentFile();
if (parent != null) {
- parent.mkdirs();
+ boolean mkdirsResult = parent.mkdirs();
+ if (!mkdirsResult) {
+ LOG.error("mkdirs() failed for " + parent);
Review comment:
My .2 cents: I think it would be better to have a more descriptive log message here since this is in the core of Camel and also using log markers. I'd suggest something like `LOG.error(""Couldn't create the filestore at {} because creating the directory has failed", parent);`. Alternatively, we could also explore whether [Files.createDirectories](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createDirectories-java.nio.file.Path-java.nio.file.attribute.FileAttribute...-) could fulfill this gap as, I believe, it provides better error descriptions.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] oscerd commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
oscerd commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r742657378
##########
File path: core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
##########
@@ -316,7 +319,10 @@ private XMLOutputFactory getXMLOutputFactory() {
private void returnXMLOutputFactory(XMLOutputFactory factory) {
if (factory != outputFactory) {
- OUTPUT_FACTORY_POOL.offer(factory);
+ boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
+ if (!resultOfOffer) {
+ LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
Review comment:
We should trust static analysis tool
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [GitHub] [camel] PascalSchumacher commented on a change in pull
request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah lets revert this part it was a bad change. You are welcome to send a PR
On Thu, Nov 4, 2021 at 10:19 AM GitBox <gi...@apache.org> wrote:
>
>
> PascalSchumacher commented on a change in pull request #5787:
> URL: https://github.com/apache/camel/pull/5787#discussion_r742654582
>
>
>
> ##########
> File path: core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
> ##########
> @@ -316,7 +319,10 @@ private XMLOutputFactory getXMLOutputFactory() {
>
> private void returnXMLOutputFactory(XMLOutputFactory factory) {
> if (factory != outputFactory) {
> - OUTPUT_FACTORY_POOL.offer(factory);
> + boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
> + if (!resultOfOffer) {
> + LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
>
> Review comment:
> After updating to Camel `3.12.0` we started to see these errors in our logs (not sure if it is this change or the one above, maybe both).
>
> Are you sure this is an error? I believe it happens when multiple threads concurrently create more factories that the maximum pool capacity. Or am I missing something?
>
>
>
>
> --
> 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: commits-unsubscribe@camel.apache.org
>
> For queries about this service, please contact Infrastructure at:
> users@infra.apache.org
>
>
--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2
[GitHub] [camel] PascalSchumacher commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
PascalSchumacher commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r742654582
##########
File path: core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
##########
@@ -316,7 +319,10 @@ private XMLOutputFactory getXMLOutputFactory() {
private void returnXMLOutputFactory(XMLOutputFactory factory) {
if (factory != outputFactory) {
- OUTPUT_FACTORY_POOL.offer(factory);
+ boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
+ if (!resultOfOffer) {
+ LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
Review comment:
After updating to Camel `3.12.0` we started to see these errors in our logs (not sure if it is this change or the one above, maybe both).
Are you sure this is an error? I believe it happens when multiple threads concurrently create more factories that the maximum pool capacity. Or am I missing something?
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] PascalSchumacher commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
PascalSchumacher commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r743022066
##########
File path: core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
##########
@@ -316,7 +319,10 @@ private XMLOutputFactory getXMLOutputFactory() {
private void returnXMLOutputFactory(XMLOutputFactory factory) {
if (factory != outputFactory) {
- OUTPUT_FACTORY_POOL.offer(factory);
+ boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
+ if (!resultOfOffer) {
+ LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
Review comment:
Fixed by @davsclaus in https://github.com/apache/camel/commit/fb67852b8f5fbb525d7b2ecff71f78d18754080c and https://github.com/apache/camel/commit/fb67852b8f5fbb525d7b2ecff71f78d18754080c Thanks!
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] PascalSchumacher commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
PascalSchumacher commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r742663941
##########
File path: core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
##########
@@ -316,7 +319,10 @@ private XMLOutputFactory getXMLOutputFactory() {
private void returnXMLOutputFactory(XMLOutputFactory factory) {
if (factory != outputFactory) {
- OUTPUT_FACTORY_POOL.offer(factory);
+ boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
+ if (!resultOfOffer) {
+ LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
Review comment:
The static analyis tool found that a return value is ignored. This can of be a problem, but the static analysis tool does not know the context of it happening. If this was logged at debug or info level it would be the same for the static analyisis tool.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel] PascalSchumacher commented on a change in pull request #5787: Fixes based on the run of the static analysis tool Findbugs
Posted by GitBox <gi...@apache.org>.
PascalSchumacher commented on a change in pull request #5787:
URL: https://github.com/apache/camel/pull/5787#discussion_r743022066
##########
File path: core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
##########
@@ -316,7 +319,10 @@ private XMLOutputFactory getXMLOutputFactory() {
private void returnXMLOutputFactory(XMLOutputFactory factory) {
if (factory != outputFactory) {
- OUTPUT_FACTORY_POOL.offer(factory);
+ boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
+ if (!resultOfOffer) {
+ LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
Review comment:
Fixed by @davsclaus in https://github.com/apache/camel/commit/fb67852b8f5fbb525d7b2ecff71f78d18754080c and https://github.com/apache/camel/commit/fb67852b8f5fbb525d7b2ecff71f78d18754080c Thanks!
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org