You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pa...@apache.org on 2018/02/05 21:28:51 UTC
[camel] branch master updated: camel-mail: use placeholders instead
of string concatenation for log message where possible
This is an automated email from the ASF dual-hosted git repository.
pascalschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new 9a49e4b camel-mail: use placeholders instead of string concatenation for log message where possible
9a49e4b is described below
commit 9a49e4b618b3c4163d427d525c94c6d4b3be6d06
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Mon Feb 5 22:18:42 2018 +0100
camel-mail: use placeholders instead of string concatenation for log message where possible
---
.../org/apache/camel/component/mail/MailBinding.java | 20 ++++++++++----------
.../apache/camel/component/mail/MailConsumer.java | 2 +-
.../mime/multipart/MimeMultipartDataFormat.java | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
index 2220ac1..ac157ed 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java
@@ -186,7 +186,7 @@ public class MailBinding {
} else if (!configuration.isIgnoreUnsupportedCharset()) {
return charset;
} else if (configuration.isIgnoreUnsupportedCharset()) {
- LOG.warn("Charset: " + charset + " is not supported and cannot be used as charset in Content-Type header.");
+ LOG.warn("Charset: {} is not supported and cannot be used as charset in Content-Type header.", charset);
return null;
}
}
@@ -255,13 +255,13 @@ public class MailBinding {
// try to fix message in case it has an unsupported encoding in the Content-Type header
UnsupportedEncodingException uee = ObjectHelper.getException(UnsupportedEncodingException.class, e);
if (uee != null) {
- LOG.debug("Unsupported encoding detected: " + uee.getMessage());
+ LOG.debug("Unsupported encoding detected: {}", uee.getMessage());
try {
String contentType = message.getContentType();
String type = ObjectHelper.before(contentType, "charset=");
if (type != null) {
// try again with fixed content type
- LOG.debug("Trying to extract mail message again with fixed Content-Type: " + type);
+ LOG.debug("Trying to extract mail message again with fixed Content-Type: {}", type);
// Since message is read-only, we need to use a copy
MimeMessage messageCopy = new MimeMessage((MimeMessage) message);
messageCopy.setHeader("Content-Type", type);
@@ -296,7 +296,7 @@ public class MailBinding {
if (content instanceof Multipart) {
extractAttachmentsFromMultipart((Multipart) content, map);
} else if (content != null) {
- LOG.trace("No attachments to extract as content is not Multipart: " + content.getClass().getName());
+ LOG.trace("No attachments to extract as content is not Multipart: {}", content.getClass().getName());
}
LOG.trace("Extracting attachments +++ done +++");
@@ -307,10 +307,10 @@ public class MailBinding {
for (int i = 0; i < mp.getCount(); i++) {
Part part = mp.getBodyPart(i);
- LOG.trace("Part #" + i + ": " + part);
+ LOG.trace("Part #{}: {}", i , part);
if (part.isMimeType("multipart/*")) {
- LOG.trace("Part #" + i + ": is mimetype: multipart/*");
+ LOG.trace("Part #{}: is mimetype: multipart/*", i);
extractAttachmentsFromMultipart((Multipart) part.getContent(), map);
} else {
String disposition = part.getDisposition();
@@ -503,15 +503,15 @@ public class MailBinding {
messageBodyPart.setFileName(attachmentFilename);
}
- LOG.trace("Attachment #" + i + ": ContentType: " + messageBodyPart.getContentType());
+ LOG.trace("Attachment #{}: ContentType: {}", i, messageBodyPart.getContentType());
if (contentTypeResolver != null) {
String contentType = contentTypeResolver.resolveContentType(attachmentFilename);
- LOG.trace("Attachment #" + i + ": Using content type resolver: " + contentTypeResolver + " resolved content type as: " + contentType);
+ LOG.trace("Attachment #{}: Using content type resolver: {} resolved content type as: {}", i, contentTypeResolver, contentType);
if (contentType != null) {
String value = contentType + "; name=" + attachmentFilename;
messageBodyPart.setHeader("Content-Type", value);
- LOG.trace("Attachment #" + i + ": ContentType: " + messageBodyPart.getContentType());
+ LOG.trace("Attachment #{}: ContentType: {}", i, messageBodyPart.getContentType());
}
}
@@ -525,7 +525,7 @@ public class MailBinding {
LOG.trace("shouldAddAttachment: false");
}
} else {
- LOG.warn("Cannot add attachment: " + attachmentFilename + " as DataHandler is null");
+ LOG.warn("Cannot add attachment: {} as DataHandler is null", attachmentFilename);
}
i++;
}
diff --git a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
index 05047e8..aabac55 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
@@ -490,7 +490,7 @@ public class MailConsumer extends ScheduledBatchPollingConsumer {
if (cause != null) {
LOG.warn("Exchange failed, so rolling back message status: " + exchange, cause);
} else {
- LOG.warn("Exchange failed, so rolling back message status: " + exchange);
+ LOG.warn("Exchange failed, so rolling back message status: {}", exchange);
}
}
diff --git a/components/camel-mail/src/main/java/org/apache/camel/dataformat/mime/multipart/MimeMultipartDataFormat.java b/components/camel-mail/src/main/java/org/apache/camel/dataformat/mime/multipart/MimeMultipartDataFormat.java
index 73beac0..2e31d34 100644
--- a/components/camel-mail/src/main/java/org/apache/camel/dataformat/mime/multipart/MimeMultipartDataFormat.java
+++ b/components/camel-mail/src/main/java/org/apache/camel/dataformat/mime/multipart/MimeMultipartDataFormat.java
@@ -218,7 +218,7 @@ public class MimeMultipartDataFormat implements DataFormat {
return stream;
}
} catch (ParseException e) {
- LOG.warn("Invalid Content-Type " + contentType + " ignored");
+ LOG.warn("Invalid Content-Type {} ignored", contentType);
return stream;
}
camelMessage = exchange.getOut();
--
To stop receiving notification emails like this one, please contact
pascalschumacher@apache.org.