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 2019/12/25 11:40:44 UTC
[camel] 01/02: Use primitive types for variables that are never
assigned null (as suggested by lgtm.com).
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
commit abbf817f05971772ac0744d807c8a7dc539e68f7
Author: Pascal Schumacher <pa...@gmx.net>
AuthorDate: Wed Dec 25 12:33:19 2019 +0100
Use primitive types for variables that are never assigned null (as suggested by lgtm.com).
---
.../apache/camel/component/cxf/jaxrs/CxfRsProducer.java | 8 ++++----
.../org/apache/camel/component/file/FileEndpoint.java | 16 ++++++++--------
.../apache/camel/component/file/GenericFileProducer.java | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
index 175635e..c3c1c95 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsProducer.java
@@ -361,7 +361,7 @@ public class CxfRsProducer extends DefaultAsyncProducer {
//http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
if (throwException) {
if (response instanceof Response) {
- Integer respCode = ((Response) response).getStatus();
+ int respCode = ((Response) response).getStatus();
if (respCode > 207) {
throw populateCxfRsProducerException(exchange, (Response) response, respCode);
}
@@ -455,7 +455,7 @@ public class CxfRsProducer extends DefaultAsyncProducer {
saveCookies(exchange, target, cookieHandler);
if (throwException) {
if (response instanceof Response) {
- Integer respCode = ((Response) response).getStatus();
+ int respCode = ((Response) response).getStatus();
if (respCode > 207) {
throw populateCxfRsProducerException(exchange, (Response) response, respCode);
}
@@ -737,7 +737,7 @@ public class CxfRsProducer extends DefaultAsyncProducer {
//Throw exception on a response > 207
//http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
if (response != null && throwException) {
- Integer respCode = response.getStatus();
+ int respCode = response.getStatus();
if (respCode > 207) {
return true;
}
@@ -833,7 +833,7 @@ public class CxfRsProducer extends DefaultAsyncProducer {
//Throw exception on a response > 207
//http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
if (response != null && throwException) {
- Integer respCode = response.getStatus();
+ int respCode = response.getStatus();
if (respCode > 207) {
return true;
}
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
index 29fe0a1..e1b70f5 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
@@ -350,8 +350,8 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
}
String permissionsString = chmod.trim().substring(chmod.length() - 3); // if 4 digits chop off leading one
for (int i = 0; i < permissionsString.length(); i++) {
- Character c = permissionsString.charAt(i);
- if (!Character.isDigit(c) || Integer.parseInt(c.toString()) > 7) {
+ char c = permissionsString.charAt(i);
+ if (!Character.isDigit(c) || c > 7) {
return false;
}
}
@@ -366,9 +366,9 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
String chmodString = chmod.substring(chmod.length() - 3); // if 4 digits chop off leading one
- Integer ownerValue = Integer.parseInt(chmodString.substring(0, 1));
- Integer groupValue = Integer.parseInt(chmodString.substring(1, 2));
- Integer othersValue = Integer.parseInt(chmodString.substring(2, 3));
+ int ownerValue = Integer.parseInt(chmodString.substring(0, 1));
+ int groupValue = Integer.parseInt(chmodString.substring(1, 2));
+ int othersValue = Integer.parseInt(chmodString.substring(2, 3));
if ((ownerValue & CHMOD_WRITE_MASK) > 0) {
permissions.add(PosixFilePermission.OWNER_WRITE);
@@ -427,9 +427,9 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
String chmodString = chmodDirectory.substring(chmodDirectory.length() - 3); // if 4 digits chop off leading one
- Integer ownerValue = Integer.parseInt(chmodString.substring(0, 1));
- Integer groupValue = Integer.parseInt(chmodString.substring(1, 2));
- Integer othersValue = Integer.parseInt(chmodString.substring(2, 3));
+ int ownerValue = Integer.parseInt(chmodString.substring(0, 1));
+ int groupValue = Integer.parseInt(chmodString.substring(1, 2));
+ int othersValue = Integer.parseInt(chmodString.substring(2, 3));
if ((ownerValue & CHMOD_WRITE_MASK) > 0) {
permissions.add(PosixFilePermission.OWNER_WRITE);
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProducer.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
index 8b76aa3..8e187db 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
@@ -112,7 +112,7 @@ public class GenericFileProducer<T> extends DefaultProducer {
boolean writeAsTempAndRename = ObjectHelper.isNotEmpty(endpoint.getTempFileName());
String tempTarget = null;
// remember if target exists to avoid checking twice
- Boolean targetExists;
+ boolean targetExists;
if (writeAsTempAndRename) {
// compute temporary name with the temp prefix
tempTarget = createTempFileName(exchange, target);