You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/11/04 11:46:10 UTC
[camel] branch main updated: camel-core - Avoid ERROR logs due to
false positives from static code analytics report.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new fb67852 camel-core - Avoid ERROR logs due to false positives from static code analytics report.
fb67852 is described below
commit fb67852b8f5fbb525d7b2ecff71f78d18754080c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Nov 4 12:38:21 2021 +0100
camel-core - Avoid ERROR logs due to false positives from static code analytics report.
---
.../main/java/org/apache/camel/impl/engine/FileStateRepository.java | 4 ++--
.../camel-main/src/main/java/org/apache/camel/main/MainSupport.java | 2 +-
.../support/processor/idempotent/FileIdempotentRepository.java | 4 ++--
.../main/java/org/apache/camel/converter/jaxp/StaxConverter.java | 2 +-
.../camel/language/xtokenizer/XMLTokenExpressionIterator.java | 6 ++----
5 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java
index 04eaac6..b379ed7 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/FileStateRepository.java
@@ -206,10 +206,10 @@ public class FileStateRepository extends ServiceSupport implements StateReposito
if (!fileStore.exists()) {
LOG.debug("Creating filestore: {}", fileStore);
File parent = fileStore.getParentFile();
- if (parent != null) {
+ if (parent != null && !parent.exists()) {
boolean mkdirsResult = parent.mkdirs();
if (!mkdirsResult) {
- LOG.error("Couldn't create the filestore at {} because creating the directory has failed", parent);
+ LOG.warn("Cannot create the filestore directory at: {}", parent);
}
}
boolean created = FileUtil.createNewFile(fileStore);
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
index ab01908..86229ca 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/MainSupport.java
@@ -74,7 +74,7 @@ public abstract class MainSupport extends BaseMainSupport {
stop();
afterStop();
} catch (Exception e) {
- // however while running then just log errors
+ // while running then just log errors
LOG.error("Failed: {}", e, e);
}
}
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/FileIdempotentRepository.java b/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/FileIdempotentRepository.java
index 73bfeb0..ec18b19 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/FileIdempotentRepository.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/FileIdempotentRepository.java
@@ -461,10 +461,10 @@ public class FileIdempotentRepository extends ServiceSupport implements Idempote
if (!fileStore.exists()) {
LOG.debug("Creating filestore: {}", fileStore);
File parent = fileStore.getParentFile();
- if (parent != null) {
+ if (parent != null && !parent.exists()) {
boolean mkdirsResult = parent.mkdirs();
if (!mkdirsResult) {
- LOG.error("Couldn't create the filestore at {} because creating the directory has failed", parent);
+ LOG.warn("Cannot create the filestore directory at: {}", parent);
}
}
boolean created = FileUtil.createNewFile(fileStore);
diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
index 2c14379..8c69c35 100644
--- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
+++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/converter/jaxp/StaxConverter.java
@@ -321,7 +321,7 @@ public class StaxConverter {
if (factory != outputFactory) {
boolean resultOfOffer = OUTPUT_FACTORY_POOL.offer(factory);
if (!resultOfOffer) {
- LOG.error("factory wasn't added into OUTPUT_FACTORY_POOL");
+ LOG.debug("Ignore returning XMLOutputFactory: {} as the pool is full", factory);
}
}
}
diff --git a/core/camel-xml-jaxp/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java b/core/camel-xml-jaxp/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java
index e77cbde..14ac056 100644
--- a/core/camel-xml-jaxp/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java
+++ b/core/camel-xml-jaxp/src/main/java/org/apache/camel/language/xtokenizer/XMLTokenExpressionIterator.java
@@ -212,8 +212,7 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam
// perform the first offset compliance test
int coff = reader.getLocation().getCharacterOffset();
if (coff != 0) {
- LOG.error("XMLStreamReader {} not supporting Location", reader);
- throw new XMLStreamException("reader not supporting Location");
+ throw new XMLStreamException("XMLStreamReader does not supporting getting location");
}
this.path = new ArrayList<>();
@@ -465,8 +464,7 @@ public class XMLTokenExpressionIterator extends ExpressionAdapter implements Nam
// perform the second compliance test
if (!compliant) {
if (token != null && token.startsWith("<") && !token.startsWith("<?")) {
- LOG.error("XMLStreamReader not supporting Location");
- throw new XMLStreamException("reader not supporting Location");
+ throw new XMLStreamException("XMLStreamReader does not supporting getting location");
}
compliant = true;
}