You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/12/21 19:41:20 UTC

(camel) branch main updated: (chores) camel-box: remove duplications

This is an automated email from the ASF dual-hosted git repository.

orpiske 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 14cb5a12acc (chores) camel-box: remove duplications
14cb5a12acc is described below

commit 14cb5a12acc7ee88198161b2bc58095242e1f2c8
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Dec 21 16:07:30 2023 -0300

    (chores) camel-box: remove duplications
    
    - remove string literal duplications
    - cleanup duplicated code
---
 .../box/api/BoxCollaborationsManager.java          |  57 +++------
 .../component/box/api/BoxCommentsManager.java      |  52 +++------
 .../component/box/api/BoxEventLogsManager.java     |  13 +--
 .../camel/component/box/api/BoxEventsManager.java  |   6 +-
 .../camel/component/box/api/BoxFilesManager.java   | 129 ++++++++++-----------
 .../camel/component/box/api/BoxFoldersManager.java | 104 +++++++----------
 .../camel/component/box/api/BoxGroupsManager.java  |  68 ++++-------
 .../apache/camel/component/box/api/BoxHelper.java  |  74 ++++++++++++
 .../camel/component/box/api/BoxSearchManager.java  |  13 +--
 .../camel/component/box/api/BoxTasksManager.java   |  74 +++++-------
 .../camel/component/box/api/BoxUsersManager.java   |  82 +++++--------
 11 files changed, 306 insertions(+), 366 deletions(-)

diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCollaborationsManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCollaborationsManager.java
index fcfaaa5a442..baca679d61c 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCollaborationsManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCollaborationsManager.java
@@ -27,6 +27,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box collaborations.
  */
@@ -58,14 +60,12 @@ public class BoxCollaborationsManager {
     public Collection<BoxCollaboration.Info> getFolderCollaborations(String folderId) {
         try {
             LOG.debug("Getting collaborations for folder(id={})", folderId);
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
+            BoxHelper.notNull(folderId, BoxHelper.FOLDER_ID);
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             return folder.getCollaborations();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -82,22 +82,15 @@ public class BoxCollaborationsManager {
             String folderId, BoxCollaborator collaborator,
             BoxCollaboration.Role role) {
         try {
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (collaborator == null) {
-                throw new IllegalArgumentException("Parameter 'collaborator' can not be null");
-            }
+            BoxHelper.notNull(folderId, BoxHelper.FOLDER_ID);
+            BoxHelper.notNull(collaborator, BoxHelper.COLLABORATOR);
             LOG.debug("Creating  collaborations for folder(id={}) with collaborator({})", folderId, collaborator.getID());
-            if (role == null) {
-                throw new IllegalArgumentException("Parameter 'role' can not be null");
-            }
-
+            BoxHelper.notNull(role, BoxHelper.ROLE);
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             return folder.collaborate(collaborator, role).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -114,21 +107,15 @@ public class BoxCollaborationsManager {
     public BoxCollaboration addFolderCollaborationByEmail(String folderId, String email, BoxCollaboration.Role role) {
         try {
             LOG.debug("Creating  collaborations for folder(id={}) with collaborator({})", folderId, email);
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (email == null) {
-                throw new IllegalArgumentException("Parameter 'email' can not be null");
-            }
-            if (role == null) {
-                throw new IllegalArgumentException("Parameter 'role' can not be null");
-            }
+            BoxHelper.notNull(folderId, BoxHelper.FOLDER_ID);
+            BoxHelper.notNull(email, BoxHelper.EMAIL);
+            BoxHelper.notNull(role, BoxHelper.ROLE);
 
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             return folder.collaborate(email, role).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -141,16 +128,14 @@ public class BoxCollaborationsManager {
     public BoxCollaboration.Info getCollaborationInfo(String collaborationId) {
         try {
             LOG.debug("Getting info for collaboration(id={})", collaborationId);
-            if (collaborationId == null) {
-                throw new IllegalArgumentException("Parameter 'collaborationId' can not be null");
-            }
+            BoxHelper.notNull(collaborationId, BoxHelper.COLLABORATION_ID);
 
             BoxCollaboration collaboration = new BoxCollaboration(boxConnection, collaborationId);
 
             return collaboration.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -164,9 +149,7 @@ public class BoxCollaborationsManager {
     public BoxCollaboration updateCollaborationInfo(String collaborationId, BoxCollaboration.Info info) {
         try {
             LOG.debug("Updating info for collaboration(id={})", collaborationId);
-            if (collaborationId == null) {
-                throw new IllegalArgumentException("Parameter 'collaborationId' can not be null");
-            }
+            BoxHelper.notNull(collaborationId, BoxHelper.COLLABORATION_ID);
 
             BoxCollaboration collaboration = new BoxCollaboration(boxConnection, collaborationId);
 
@@ -174,7 +157,7 @@ public class BoxCollaborationsManager {
             return collaboration;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -186,14 +169,12 @@ public class BoxCollaborationsManager {
     public void deleteCollaboration(String collaborationId) {
         try {
             LOG.debug("Deleting collaboration(id={})", collaborationId);
-            if (collaborationId == null) {
-                throw new IllegalArgumentException("Parameter 'collaborationId' can not be null");
-            }
+            BoxHelper.notNull(collaborationId, BoxHelper.COLLABORATION_ID);
             BoxCollaboration collaboration = new BoxCollaboration(boxConnection, collaborationId);
             collaboration.delete();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -207,7 +188,7 @@ public class BoxCollaborationsManager {
             return BoxCollaboration.getPendingCollaborations(boxConnection);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCommentsManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCommentsManager.java
index f1e02c7e761..aad05cd438a 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCommentsManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCommentsManager.java
@@ -26,6 +26,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box comments.
  */
@@ -57,19 +59,15 @@ public class BoxCommentsManager {
     public BoxFile addFileComment(String fileId, String message) {
         try {
             LOG.debug("Adding comment to file(id={}) to '{}'", fileId, message);
-            if (fileId == null) {
-                throw new IllegalArgumentException("Parameter 'fileId' can not be null");
-            }
-            if (message == null) {
-                throw new IllegalArgumentException("Parameter 'message' can not be null");
-            }
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(message, BoxHelper.MESSAGE);
 
             BoxFile fileToCommentOn = new BoxFile(boxConnection, fileId);
             fileToCommentOn.addComment(message);
             return fileToCommentOn;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -82,9 +80,7 @@ public class BoxCommentsManager {
     public List<BoxComment.Info> getFileComments(String fileId) {
         try {
             LOG.debug("Getting comments of file(id={})", fileId);
-            if (fileId == null) {
-                throw new IllegalArgumentException("Parameter 'fileId' can not be null");
-            }
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -92,7 +88,7 @@ public class BoxCommentsManager {
 
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -105,16 +101,14 @@ public class BoxCommentsManager {
     public BoxComment.Info getCommentInfo(String commentId) {
         try {
             LOG.debug("Getting info for comment(id={})", commentId);
-            if (commentId == null) {
-                throw new IllegalArgumentException("Parameter 'commentId' can not be null");
-            }
+            BoxHelper.notNull(commentId, BoxHelper.COMMENT_ID);
 
             BoxComment comment = new BoxComment(boxConnection, commentId);
 
             return comment.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -128,17 +122,14 @@ public class BoxCommentsManager {
     public BoxComment replyToComment(String commentId, String message) {
         try {
             LOG.debug("Replying to comment(id={}) with message={}", commentId, message);
-            if (commentId == null) {
-                throw new IllegalArgumentException("Parameter 'commentId' can not be null");
-            }
-            if (message == null) {
-                throw new IllegalArgumentException("Parameter 'message' can not be null");
-            }
+            BoxHelper.notNull(commentId, BoxHelper.COMMENT_ID);
+            BoxHelper.notNull(message, BoxHelper.MESSAGE);
+
             BoxComment comment = new BoxComment(boxConnection, commentId);
             return comment.reply(message).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -152,17 +143,14 @@ public class BoxCommentsManager {
     public BoxComment changeCommentMessage(String commentId, String message) {
         try {
             LOG.debug("Changing comment(id={}) message={}", commentId, message);
-            if (commentId == null) {
-                throw new IllegalArgumentException("Parameter 'commentId' can not be null");
-            }
-            if (message == null) {
-                throw new IllegalArgumentException("Parameter 'message' can not be null");
-            }
+            BoxHelper.notNull(commentId, BoxHelper.COMMENT_ID);
+            BoxHelper.notNull(message, BoxHelper.MESSAGE);
+
             BoxComment comment = new BoxComment(boxConnection, commentId);
             return comment.changeMessage(message).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -174,14 +162,12 @@ public class BoxCommentsManager {
     public void deleteComment(String commentId) {
         try {
             LOG.debug("Deleting comment(id={})", commentId);
-            if (commentId == null) {
-                throw new IllegalArgumentException("Parameter 'commentId' can not be null");
-            }
+            BoxHelper.notNull(commentId, BoxHelper.COMMENT_ID);
             BoxComment comment = new BoxComment(boxConnection, commentId);
             comment.delete();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventLogsManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventLogsManager.java
index 51ca88b47da..094e42585b0 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventLogsManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventLogsManager.java
@@ -30,6 +30,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to read Box enterprise (admin) event logs.
  */
@@ -70,12 +72,8 @@ public class BoxEventLogsManager {
                     before == null ? "unspecified date" : DateFormat.getDateTimeInstance().format(before),
                     position == null ? "" : (" starting at " + position));
 
-            if (after == null) {
-                throw new IllegalArgumentException("Parameter 'after' can not be null");
-            }
-            if (before == null) {
-                throw new IllegalArgumentException("Parameter 'before' can not be null");
-            }
+            BoxHelper.notNull(after, "after");
+            BoxHelper.notNull(before, "before");
 
             if (types == null) {
                 types = new BoxEvent.EventType[0];
@@ -93,8 +91,7 @@ public class BoxEventLogsManager {
             return results;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
-
 }
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventsManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventsManager.java
index bdc95d104b5..5181dcafb35 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventsManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxEventsManager.java
@@ -24,6 +24,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box events.
  */
@@ -57,7 +59,7 @@ public class BoxEventsManager {
     public void listen(EventListener listener, Long startingPosition) {
         try {
             if (listener == null) {
-                LOG.debug("Parameter 'listener' is null: will not listen for events");
+                LOG.debug(BoxHelper.MISSING_LISTENER);
                 return;
             }
             LOG.debug("Listening for events with listener={} at startingPosition={}", listener, startingPosition);
@@ -73,7 +75,7 @@ public class BoxEventsManager {
             eventStream.start();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java
index 90e20235c24..aa219a8797d 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java
@@ -46,7 +46,6 @@ import org.slf4j.LoggerFactory;
  */
 public class BoxFilesManager {
 
-    public static final String BASE_ERROR_MESSAGE = "Box API returned the error code %d%n%n%s";
     private static final Logger LOG = LoggerFactory.getLogger(BoxFilesManager.class);
 
     /**
@@ -63,12 +62,6 @@ public class BoxFilesManager {
         this.boxConnection = boxConnection;
     }
 
-    private static <T> void notNull(T value, String name) {
-        if (value == null) {
-            throw new IllegalArgumentException("Parameter '" + name + "' cannot be null");
-        }
-    }
-
     /**
      * Get file information.
      *
@@ -79,7 +72,7 @@ public class BoxFilesManager {
     public BoxFile.Info getFileInfo(String fileId, String... fields) {
         try {
             LOG.debug("Getting info for file(id={})", fileId);
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -89,7 +82,7 @@ public class BoxFilesManager {
                 return file.getInfo(fields);
             }
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -103,15 +96,15 @@ public class BoxFilesManager {
     public BoxFile updateFileInfo(String fileId, BoxFile.Info info) {
         try {
             LOG.debug("Updating info for file(id={})", fileId);
-            notNull(fileId, "fileId");
-            notNull(info, "info");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(info, BoxHelper.INFO);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
             file.updateInfo(info);
             return file;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    buildErrorMessage(e), e);
+                    BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -133,9 +126,9 @@ public class BoxFilesManager {
             Long size, Boolean check, ProgressListener listener) {
         try {
             LOG.debug("Uploading file with name '{}}' to parent_folder(id={}})", fileName, parentFolderId);
-            notNull(parentFolderId, "parentFolderId");
-            notNull(content, "content");
-            notNull(fileName, "fileName");
+            BoxHelper.notNull(parentFolderId, BoxHelper.PARENT_FOLDER_ID);
+            BoxHelper.notNull(content, BoxHelper.CONTENT);
+            BoxHelper.notNull(fileName, BoxHelper.FILE_NAME);
             BoxFile boxFile = null;
             boolean uploadNewFile = true;
             if (check != null && check) {
@@ -215,7 +208,7 @@ public class BoxFilesManager {
             return boxFile;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    buildErrorMessage(e), e);
+                    BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -234,8 +227,8 @@ public class BoxFilesManager {
             ProgressListener listener) {
         try {
             LOG.debug("Uploading new version of file(id={})", fileId);
-            notNull(fileId, "fileId");
-            notNull(fileContent, "fileContent");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(fileContent, BoxHelper.FILE_CONTENT);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -251,7 +244,7 @@ public class BoxFilesManager {
 
             return file;
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -264,7 +257,7 @@ public class BoxFilesManager {
     public Collection<BoxFileVersion> getFileVersions(String fileId) {
         try {
             LOG.debug("Getting versions of file(id={})", fileId);
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -272,14 +265,10 @@ public class BoxFilesManager {
 
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    buildErrorMessage(e), e);
+                    BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
-    private static String buildErrorMessage(BoxAPIException e) {
-        return String.format(BASE_ERROR_MESSAGE, e.getResponseCode(), e.getResponse());
-    }
-
     /**
      * Download a file.
      *
@@ -298,8 +287,8 @@ public class BoxFilesManager {
             ProgressListener listener) {
         try {
             LOG.debug("Downloading file(id={})", fileId);
-            notNull(fileId, "fileId");
-            notNull(output, "output");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(output, "output");
             BoxFile file = new BoxFile(boxConnection, fileId);
 
             if (listener != null) {
@@ -317,7 +306,7 @@ public class BoxFilesManager {
             }
             return output;
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -337,9 +326,9 @@ public class BoxFilesManager {
             ProgressListener listener) {
         try {
             LOG.debug("Downloading file(id={}, version={})", fileId, version);
-            notNull(fileId, "fileId");
-            notNull(version, "version");
-            notNull(output, "output");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(version, BoxHelper.VERSION);
+            BoxHelper.notNull(output, "output");
             BoxFile file = new BoxFile(boxConnection, fileId);
 
             List<BoxFileVersion> fileVersions = (List<BoxFileVersion>) file.getVersions();
@@ -352,7 +341,7 @@ public class BoxFilesManager {
             }
             return output;
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -367,8 +356,8 @@ public class BoxFilesManager {
     public BoxFileVersion promoteFileVersion(String fileId, Integer version) {
         try {
             LOG.debug("Promoting file(id={}, version={})", fileId, version);
-            notNull(fileId, "fileId");
-            notNull(version, "version");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(version, BoxHelper.VERSION);
             BoxFile file = new BoxFile(boxConnection, fileId);
 
             List<BoxFileVersion> fileVersions = (List<BoxFileVersion>) file.getVersions();
@@ -377,7 +366,7 @@ public class BoxFilesManager {
             fileVersion.promote();
             return fileVersion;
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -395,8 +384,8 @@ public class BoxFilesManager {
             LOG.debug("Copying file(id={}) to destination_folder(id={}) {}",
                     fileId, destinationFolderId,
                     newName == null ? "" : " with new name '" + newName + "'");
-            notNull(fileId, "fileId");
-            notNull(destinationFolderId, "version");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(destinationFolderId, BoxHelper.VERSION);
             BoxFile fileToCopy = new BoxFile(boxConnection, fileId);
             BoxFolder destinationFolder = new BoxFolder(boxConnection, destinationFolderId);
             if (newName == null) {
@@ -405,7 +394,7 @@ public class BoxFilesManager {
                 return fileToCopy.copy(destinationFolder, newName).getResource();
             }
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -423,8 +412,8 @@ public class BoxFilesManager {
             LOG.debug("Moving file(id={}) to destination_folder(id={}) {}",
                     fileId, destinationFolderId,
                     newName == null ? "" : " with new name '" + newName + "'");
-            notNull(fileId, "fileId");
-            notNull(destinationFolderId, "version");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(destinationFolderId, BoxHelper.VERSION);
             BoxFile fileToMove = new BoxFile(boxConnection, fileId);
             BoxFolder destinationFolder = new BoxFolder(boxConnection, destinationFolderId);
             if (newName == null) {
@@ -433,7 +422,7 @@ public class BoxFilesManager {
                 return (BoxFile) fileToMove.move(destinationFolder, newName).getResource();
             }
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -447,13 +436,13 @@ public class BoxFilesManager {
     public BoxFile renameFile(String fileId, String newFileName) {
         try {
             LOG.debug("Renaming file(id={}) to '{}'", fileId, newFileName);
-            notNull(fileId, "fileId");
-            notNull(newFileName, "version");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(newFileName, BoxHelper.VERSION);
             BoxFile fileToRename = new BoxFile(boxConnection, fileId);
             fileToRename.rename(newFileName);
             return fileToRename;
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -465,11 +454,11 @@ public class BoxFilesManager {
     public void deleteFile(String fileId) {
         try {
             LOG.debug("Deleting file(id={})", fileId);
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
             BoxFile file = new BoxFile(boxConnection, fileId);
             file.delete();
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -483,8 +472,8 @@ public class BoxFilesManager {
     public void deleteFileVersion(String fileId, Integer version) {
         try {
             LOG.debug("Deleting file(id={}, version={})", fileId, version);
-            notNull(fileId, "fileId");
-            notNull(version, "version");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(version, BoxHelper.VERSION);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
             List<BoxFileVersion> versions = (List<BoxFileVersion>) file.getVersions();
@@ -492,7 +481,7 @@ public class BoxFilesManager {
 
             fileVersion.delete();
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -517,8 +506,8 @@ public class BoxFilesManager {
                             : " unsharedDate=" + DateFormat.getDateTimeInstance().format(unshareDate)
                               + " permissions=" + permissions);
 
-            notNull(fileId, "fileId");
-            notNull(access, "access");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(access, "access");
 
             BoxFile file = new BoxFile(boxConnection, fileId);
             BoxSharedLinkRequest request = new BoxSharedLinkRequest();
@@ -526,7 +515,7 @@ public class BoxFilesManager {
                     .permissions(permissions.getCanDownload(), permissions.getCanPreview(), permissions.getCanEdit());
             return file.createSharedLink(request);
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -540,14 +529,14 @@ public class BoxFilesManager {
     public URL getDownloadURL(String fileId) {
         try {
             LOG.debug("Getting download URL for file(id={})", fileId);
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
             return file.getDownloadURL();
 
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -562,12 +551,12 @@ public class BoxFilesManager {
         try {
             LOG.debug("Getting preview link for file(id={})", fileId);
 
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
             return file.getPreviewLink();
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -584,8 +573,8 @@ public class BoxFilesManager {
         try {
             LOG.debug("Creating metadata for file(id={})", fileId);
 
-            notNull(fileId, "fileId");
-            notNull(metadata, "metadata");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(metadata, BoxHelper.METADATA);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -595,7 +584,7 @@ public class BoxFilesManager {
                 return file.createMetadata(metadata);
             }
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -611,7 +600,7 @@ public class BoxFilesManager {
         try {
             LOG.debug("Get metadata for file(id={})", fileId);
 
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -621,7 +610,7 @@ public class BoxFilesManager {
                 return file.getMetadata();
             }
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
 
     }
@@ -636,12 +625,12 @@ public class BoxFilesManager {
     public Metadata updateFileMetadata(String fileId, Metadata metadata) {
         try {
             LOG.debug("Updating metadata for file(id={})", fileId);
-            notNull(fileId, "fileId");
-            notNull(metadata, "metadata");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(metadata, BoxHelper.METADATA);
             BoxFile file = new BoxFile(boxConnection, fileId);
             return file.updateMetadata(metadata);
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -653,11 +642,11 @@ public class BoxFilesManager {
     public void deleteFileMetadata(String fileId) {
         try {
             LOG.debug("Deleting metadata for file(id={})", fileId);
-            notNull(fileId, "fileId");
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
             BoxFile file = new BoxFile(boxConnection, fileId);
             file.deleteMetadata();
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -673,14 +662,14 @@ public class BoxFilesManager {
     public void checkUpload(String fileName, String parentFolderId, Long size) {
         try {
             LOG.debug("Preflight check file with name '{}' to parent_folder(id={})", fileName, parentFolderId);
-            notNull(parentFolderId, "parentFolderId");
-            notNull(fileName, "fileName");
-            notNull(size, "size");
+            BoxHelper.notNull(parentFolderId, BoxHelper.PARENT_FOLDER_ID);
+            BoxHelper.notNull(fileName, BoxHelper.FILE_NAME);
+            BoxHelper.notNull(size, BoxHelper.SIZE);
 
             BoxFolder parentFolder = new BoxFolder(boxConnection, parentFolderId);
             parentFolder.canUpload(fileName, size);
         } catch (BoxAPIException e) {
-            throw new RuntimeCamelException(buildErrorMessage(e), e);
+            throw new RuntimeCamelException(BoxHelper.buildBoxApiErrorMessage(e), e);
         }
     }
 }
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
index c196d672c6f..23f298e6a7d 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
@@ -32,6 +32,9 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.FOLDER_ID;
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box folders.
  */
@@ -64,7 +67,7 @@ public class BoxFoldersManager {
             return BoxFolder.getRootFolder(boxConnection);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -100,7 +103,7 @@ public class BoxFoldersManager {
             return folder;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -121,9 +124,7 @@ public class BoxFoldersManager {
                 LOG.debug("Getting folder items in folder(id={}) at offset={} and limit={} with fields={}",
                         folderId, offset, limit, Arrays.toString(fields));
             }
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
+            BoxHelper.notNull(folderId, FOLDER_ID);
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             if (fields == null) {
                 fields = new String[0];
@@ -146,7 +147,7 @@ public class BoxFoldersManager {
             }
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -160,17 +161,14 @@ public class BoxFoldersManager {
     public BoxFolder createFolder(String parentFolderId, String folderName) {
         try {
             LOG.debug("Creating folder with name '{}' in parent_folder(id={})", folderName, parentFolderId);
-            if (parentFolderId == null) {
-                throw new IllegalArgumentException("Parameter 'parentFolderId' can not be null");
-            }
-            if (folderName == null) {
-                throw new IllegalArgumentException("Parameter 'folderName' can not be null");
-            }
+            BoxHelper.notNull(parentFolderId, BoxHelper.PARENT_FOLDER_ID);
+            BoxHelper.notNull(folderName, BoxHelper.FOLDER_NAME);
+
             BoxFolder parentFolder = new BoxFolder(boxConnection, parentFolderId);
             return parentFolder.createFolder(folderName).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -189,12 +187,9 @@ public class BoxFoldersManager {
                 LOG.debug("Creating folder with path '{}' in parent_folder(id={})", Arrays.toString(path), parentFolderId);
             }
 
-            if (parentFolderId == null) {
-                throw new IllegalArgumentException("Parameter 'parentFolderId' can not be null");
-            }
-            if (path == null) {
-                throw new IllegalArgumentException("Paramerer 'path' can not be null");
-            }
+            BoxHelper.notNull(parentFolderId, BoxHelper.PARENT_FOLDER_ID);
+            BoxHelper.notNull(path, BoxHelper.PATH);
+
             BoxFolder folder = new BoxFolder(boxConnection, parentFolderId);
             searchPath: for (int folderIndex = 0; folderIndex < path.length; folderIndex++) {
                 for (BoxItem.Info itemInfo : folder) {
@@ -208,7 +203,7 @@ public class BoxFoldersManager {
             return folder;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -225,12 +220,10 @@ public class BoxFoldersManager {
         try {
             LOG.debug("Copying folder(id={}) to destination_folder(id={}) {}",
                     folderId, destinationFolderId, newName == null ? "" : " with new name '" + newName + "'");
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (destinationFolderId == null) {
-                throw new IllegalArgumentException("Parameter 'destinationFolderId' can not be null");
-            }
+
+            BoxHelper.notNull(folderId, FOLDER_ID);
+            BoxHelper.notNull(destinationFolderId, BoxHelper.DESTINATION_FOLDER_ID);
+
             BoxFolder folderToCopy = new BoxFolder(boxConnection, folderId);
             BoxFolder destinationFolder = new BoxFolder(boxConnection, destinationFolderId);
             if (newName == null) {
@@ -240,7 +233,7 @@ public class BoxFoldersManager {
             }
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -257,12 +250,9 @@ public class BoxFoldersManager {
         try {
             LOG.debug("Moving folder(id={}) to destination_folder(id={}) {}",
                     folderId, destinationFolderId, newName == null ? "" : " with new name '" + newName + "'");
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (destinationFolderId == null) {
-                throw new IllegalArgumentException("Parameter 'destinationFolderId' can not be null");
-            }
+            BoxHelper.notNull(folderId, FOLDER_ID);
+            BoxHelper.notNull(destinationFolderId, BoxHelper.DESTINATION_FOLDER_ID);
+
             BoxFolder folderToMove = new BoxFolder(boxConnection, folderId);
             BoxFolder destinationFolder = new BoxFolder(boxConnection, destinationFolderId);
             if (newName == null) {
@@ -272,7 +262,7 @@ public class BoxFoldersManager {
             }
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -286,18 +276,16 @@ public class BoxFoldersManager {
     public BoxFolder renameFolder(String folderId, String newFolderName) {
         try {
             LOG.debug("Renaming folder(id={}}) to '{}'", folderId, newFolderName);
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (newFolderName == null) {
-                throw new IllegalArgumentException("Parameter 'newFolderName' can not be null");
-            }
+
+            BoxHelper.notNull(folderId, FOLDER_ID);
+            BoxHelper.notNull(newFolderName, BoxHelper.NEW_FOLDER_NAME);
+
             BoxFolder folderToRename = new BoxFolder(boxConnection, folderId);
             folderToRename.rename(newFolderName);
             return folderToRename;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -309,14 +297,13 @@ public class BoxFoldersManager {
     public void deleteFolder(String folderId) {
         try {
             LOG.debug("Deleting folder(id={})", folderId);
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
+            BoxHelper.notNull(folderId, FOLDER_ID);
+
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             folder.delete(true);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -330,9 +317,7 @@ public class BoxFoldersManager {
     public BoxFolder.Info getFolderInfo(String folderId, String... fields) {
         try {
             LOG.debug("Getting info for folder(id={})", folderId);
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
+            BoxHelper.notNull(folderId, FOLDER_ID);
 
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
 
@@ -343,7 +328,7 @@ public class BoxFoldersManager {
             }
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -357,18 +342,15 @@ public class BoxFoldersManager {
     public BoxFolder updateFolderInfo(String folderId, BoxFolder.Info info) {
         try {
             LOG.debug("Updating info for folder(id={})", folderId);
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (info == null) {
-                throw new IllegalArgumentException("Parameter 'info' can not be null");
-            }
+            BoxHelper.notNull(folderId, FOLDER_ID);
+            BoxHelper.notNull(info, "info");
+
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             folder.updateInfo(info);
             return folder;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -393,12 +375,8 @@ public class BoxFoldersManager {
                             : " unsharedDate=" + DateFormat.getDateTimeInstance().format(unshareDate)
                               + " permissions=" + permissions);
 
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (access == null) {
-                throw new IllegalArgumentException("Parameter 'access' can not be null");
-            }
+            BoxHelper.notNull(folderId, FOLDER_ID);
+            BoxHelper.notNull(access, BoxHelper.ACCESS);
 
             BoxFolder folder = new BoxFolder(boxConnection, folderId);
             BoxSharedLinkRequest request = new BoxSharedLinkRequest();
@@ -407,7 +385,7 @@ public class BoxFoldersManager {
             return folder.createSharedLink(request);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxGroupsManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxGroupsManager.java
index 16455b95b3a..91b14fa9149 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxGroupsManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxGroupsManager.java
@@ -65,10 +65,14 @@ public class BoxGroupsManager {
             return groups;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
+    private static String buildBoxApiErrorMessage(BoxAPIException e) {
+        return String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse());
+    }
+
     /**
      * Create a new group with a specified name and optional additional parameters. Optional parameters may be null.
      *
@@ -95,7 +99,7 @@ public class BoxGroupsManager {
                     invitabilityLevel, memberViewabilityLevel).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -107,15 +111,13 @@ public class BoxGroupsManager {
     public void deleteGroup(String groupId) {
         try {
             LOG.debug("Deleting group({})", groupId);
-            if (groupId == null) {
-                throw new IllegalArgumentException("Parameter 'groupId' can not be null");
-            }
+            BoxHelper.notNull(groupId, BoxHelper.GROUP_ID);
 
             BoxGroup group = new BoxGroup(boxConnection, groupId);
             group.delete();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -128,16 +130,14 @@ public class BoxGroupsManager {
     public BoxGroup.Info getGroupInfo(String groupId) {
         try {
             LOG.debug("Getting info for group(id={})", groupId);
-            if (groupId == null) {
-                throw new IllegalArgumentException("Parameter 'groupId' can not be null");
-            }
+            BoxHelper.notNull(groupId, BoxHelper.GROUP_ID);
 
             BoxGroup group = new BoxGroup(boxConnection, groupId);
 
             return group.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -151,19 +151,15 @@ public class BoxGroupsManager {
     public BoxGroup updateGroupInfo(String groupId, BoxGroup.Info groupInfo) {
         try {
             LOG.debug("Updating info for group(id={})", groupId);
-            if (groupId == null) {
-                throw new IllegalArgumentException("Parameter 'groupId' can not be null");
-            }
-            if (groupInfo == null) {
-                throw new IllegalArgumentException("Parameter 'groupInfo' can not be null");
-            }
+            BoxHelper.notNull(groupId, BoxHelper.GROUP_ID);
+            BoxHelper.notNull(groupInfo, BoxHelper.GROUP_INFO);
 
             BoxGroup group = new BoxGroup(boxConnection, groupId);
             group.updateInfo(groupInfo);
             return group;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -176,16 +172,14 @@ public class BoxGroupsManager {
     public Collection<BoxGroupMembership.Info> getGroupMemberships(String groupId) {
         try {
             LOG.debug("Getting information about all memberships for group(id={})", groupId);
-            if (groupId == null) {
-                throw new IllegalArgumentException("Parameter 'groupId' can not be null");
-            }
+            BoxHelper.notNull(groupId, BoxHelper.GROUP_ID);
 
             BoxGroup group = new BoxGroup(boxConnection, groupId);
 
             return group.getMemberships();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -201,12 +195,8 @@ public class BoxGroupsManager {
         try {
             LOG.debug("Adding user(id={}) as member to group(id={} {})",
                     userId, groupId, role == null ? "" : "with role=" + role.name());
-            if (groupId == null) {
-                throw new IllegalArgumentException("Parameter 'groupId' can not be null");
-            }
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
+            BoxHelper.notNull(groupId, BoxHelper.GROUP_ID);
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
 
             BoxGroup group = new BoxGroup(boxConnection, groupId);
             BoxUser user = new BoxUser(boxConnection, userId);
@@ -214,7 +204,7 @@ public class BoxGroupsManager {
             return group.addMembership(user, role).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -226,16 +216,14 @@ public class BoxGroupsManager {
     public void deleteGroupMembership(String groupMembershipId) {
         try {
             LOG.debug("Deleting groupMembership(id={})", groupMembershipId);
-            if (groupMembershipId == null) {
-                throw new IllegalArgumentException("Parameter 'groupMembershipId' can not be null");
-            }
+            BoxHelper.notNull(groupMembershipId, BoxHelper.GROUP_MEMBERSHIP_ID);
 
             BoxGroupMembership groupMembership = new BoxGroupMembership(boxConnection, groupMembershipId);
 
             groupMembership.delete();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -248,16 +236,14 @@ public class BoxGroupsManager {
     public BoxGroupMembership.Info getGroupMembershipInfo(String groupMembershipId) {
         try {
             LOG.debug("Getting info for groupMemebership(id={})", groupMembershipId);
-            if (groupMembershipId == null) {
-                throw new IllegalArgumentException("Parameter 'groupMembershipId' can not be null");
-            }
+            BoxHelper.notNull(groupMembershipId, BoxHelper.GROUP_MEMBERSHIP_ID);
 
             BoxGroupMembership group = new BoxGroupMembership(boxConnection, groupMembershipId);
 
             return group.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -271,12 +257,8 @@ public class BoxGroupsManager {
     public BoxGroupMembership updateGroupMembershipInfo(String groupMembershipId, BoxGroupMembership.Info info) {
         try {
             LOG.debug("Updating info for groupMembership(id={})", groupMembershipId);
-            if (groupMembershipId == null) {
-                throw new IllegalArgumentException("Parameter 'groupMembershipId' can not be null");
-            }
-            if (info == null) {
-                throw new IllegalArgumentException("Parameter 'info' can not be null");
-            }
+            BoxHelper.notNull(groupMembershipId, BoxHelper.GROUP_MEMBERSHIP_ID);
+            BoxHelper.notNull(info, BoxHelper.INFO);
 
             BoxGroupMembership groupMembership = new BoxGroupMembership(boxConnection, groupMembershipId);
 
@@ -284,7 +266,7 @@ public class BoxGroupsManager {
             return groupMembership;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 }
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxHelper.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxHelper.java
new file mode 100644
index 00000000000..433f6cea518
--- /dev/null
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxHelper.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.box.api;
+
+import com.box.sdk.BoxAPIException;
+
+public final class BoxHelper {
+    public static final String BASE_ERROR_MESSAGE = "Box API returned the error code %d%n%n%s";
+    public static final String MISSING_LISTENER = "Parameter 'listener' is null: will not listen for events";
+    public static final String COLLABORATION_ID = "collaborationId";
+    public static final String FOLDER_ID = "folderId";
+    public static final String MESSAGE = "message";
+    public static final String FILE_ID = "fileId";
+    public static final String COMMENT_ID = "commentId";
+    public static final String INFO = "info";
+    public static final String PARENT_FOLDER_ID = "parentFolderId";
+    public static final String CONTENT = "content";
+    public static final String FILE_NAME = "fileName";
+    public static final String FILE_CONTENT = "fileContent";
+    public static final String VERSION = "version";
+    public static final String METADATA = "metadata";
+    public static final String SIZE = "size";
+    public static final String DESTINATION_FOLDER_ID = "destinationFolderId";
+    public static final String NEW_FOLDER_NAME = "newFolderName";
+    public static final String ACCESS = "access";
+    public static final String FOLDER_NAME = "folderName";
+    public static final String PATH = "path";
+    public static final String GROUP_ID = "groupId";
+    public static final String GROUP_INFO = "groupInfo";
+    public static final String USER_ID = "userId";
+    public static final String GROUP_MEMBERSHIP_ID = "groupMembershipId";
+    public static final String QUERY = "query";
+    public static final String ACTION = "action";
+    public static final String DUE_AT = "dueAt";
+    public static final String TASK_ID = "taskId";
+    public static final String ASSIGN_TO = "assignTo";
+    public static final String TASK_ASSIGNMENT_ID = "taskAssignmentId";
+    public static final String LOGIN = "login";
+    public static final String NAME = "name";
+    public static final String EMAIL = "email";
+    public static final String EMAIL_ALIAS_ID = "emailAliasId";
+    public static final String SOURCE_USER_ID = "sourceUserId";
+    public static final String COLLABORATOR = "collaborator";
+    public static final String ROLE = "role";
+
+    private BoxHelper() {
+
+    }
+
+    static String buildBoxApiErrorMessage(BoxAPIException e) {
+        return String.format(BASE_ERROR_MESSAGE, e.getResponseCode(), e.getResponse());
+    }
+
+    static <T> void notNull(T value, String name) {
+        if (value == null) {
+            throw new IllegalArgumentException("Parameter '" + name + "' cannot be null");
+        }
+    }
+}
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxSearchManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxSearchManager.java
index 9cf5aee05da..ad73b3d9985 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxSearchManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxSearchManager.java
@@ -30,6 +30,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box searches.
  */
@@ -64,13 +66,8 @@ public class BoxSearchManager {
     public Collection<BoxItem> searchFolder(String folderId, String query) {
         try {
             LOG.debug("Searching folder(id={}) with query={}", folderId, query);
-
-            if (folderId == null) {
-                throw new IllegalArgumentException("Parameter 'folderId' can not be null");
-            }
-            if (query == null) {
-                throw new IllegalArgumentException("Parameter 'query' can not be null");
-            }
+            BoxHelper.notNull(folderId, BoxHelper.FOLDER_ID);
+            BoxHelper.notNull(query, BoxHelper.QUERY);
 
             // New box API for search requires offset and limit as parameters.
             // To preserve api from previous functionality fro previous version, we will execute more searches if needed and merge results
@@ -91,7 +88,7 @@ public class BoxSearchManager {
             return result;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 }
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxTasksManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxTasksManager.java
index 1d374315bba..08820055841 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxTasksManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxTasksManager.java
@@ -29,6 +29,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box tasks.
  */
@@ -59,9 +61,7 @@ public class BoxTasksManager {
     public List<BoxTask.Info> getFileTasks(String fileId) {
         try {
             LOG.debug("Getting tasks of file(id={})", fileId);
-            if (fileId == null) {
-                throw new IllegalArgumentException("Parameter 'fileId' can not be null");
-            }
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
 
             BoxFile file = new BoxFile(boxConnection, fileId);
 
@@ -69,7 +69,7 @@ public class BoxTasksManager {
 
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -85,21 +85,15 @@ public class BoxTasksManager {
     public BoxTask addFileTask(String fileId, BoxTask.Action action, Date dueAt, String message) {
         try {
             LOG.debug("Adding task to file(id={}) to '{}'", fileId, message);
-            if (fileId == null) {
-                throw new IllegalArgumentException("Parameter 'fileId' can not be null");
-            }
-            if (action == null) {
-                throw new IllegalArgumentException("Parameter 'action' can not be null");
-            }
-            if (dueAt == null) {
-                throw new IllegalArgumentException("Parameter 'dueAt' can not be null");
-            }
+            BoxHelper.notNull(fileId, BoxHelper.FILE_ID);
+            BoxHelper.notNull(action, BoxHelper.ACTION);
+            BoxHelper.notNull(dueAt, BoxHelper.DUE_AT);
 
             BoxFile fileToAddTaskOn = new BoxFile(boxConnection, fileId);
             return fileToAddTaskOn.addTask(action, message, dueAt).getResource();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -111,14 +105,12 @@ public class BoxTasksManager {
     public void deleteTask(String taskId) {
         try {
             LOG.debug("Deleting task(id={})", taskId);
-            if (taskId == null) {
-                throw new IllegalArgumentException("Parameter 'taskId' can not be null");
-            }
+            BoxHelper.notNull(taskId, BoxHelper.TASK_ID);
             BoxTask task = new BoxTask(boxConnection, taskId);
             task.delete();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -131,16 +123,14 @@ public class BoxTasksManager {
     public BoxTask.Info getTaskInfo(String taskId) {
         try {
             LOG.debug("Getting info for task(id={})", taskId);
-            if (taskId == null) {
-                throw new IllegalArgumentException("Parameter 'taskId' can not be null");
-            }
+            BoxHelper.notNull(taskId, BoxHelper.TASK_ID);
 
             BoxTask task = new BoxTask(boxConnection, taskId);
 
             return task.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -154,12 +144,8 @@ public class BoxTasksManager {
     public BoxTask updateTaskInfo(String taskId, BoxTask.Info info) {
         try {
             LOG.debug("Updating info for task(id={})", taskId);
-            if (taskId == null) {
-                throw new IllegalArgumentException("Parameter 'taskId' can not be null");
-            }
-            if (info == null) {
-                throw new IllegalArgumentException("Parameter 'info' can not be null");
-            }
+            BoxHelper.notNull(taskId, BoxHelper.TASK_ID);
+            BoxHelper.notNull(info, BoxHelper.INFO);
 
             BoxTask task = new BoxTask(boxConnection, taskId);
             task.updateInfo(info);
@@ -167,7 +153,7 @@ public class BoxTasksManager {
             return task;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -180,9 +166,7 @@ public class BoxTasksManager {
     public List<BoxTaskAssignment.Info> getTaskAssignments(String taskId) {
         try {
             LOG.debug("Getting assignments for task(id={})", taskId);
-            if (taskId == null) {
-                throw new IllegalArgumentException("Parameter 'taskId' can not be null");
-            }
+            BoxHelper.notNull(taskId, BoxHelper.TASK_ID);
 
             BoxTask file = new BoxTask(boxConnection, taskId);
 
@@ -190,7 +174,7 @@ public class BoxTasksManager {
 
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -205,12 +189,9 @@ public class BoxTasksManager {
                                // == null)' clause is dead code.
     public BoxTask addAssignmentToTask(String taskId, BoxUser assignTo) {
         try {
-            if (taskId == null) {
-                throw new IllegalArgumentException("Parameter 'commentId' can not be null");
-            }
-            if (assignTo == null) {
-                throw new IllegalArgumentException("Parameter 'assignTo' can not be null");
-            }
+            BoxHelper.notNull(taskId, BoxHelper.TASK_ID);
+            BoxHelper.notNull(assignTo, BoxHelper.ASSIGN_TO);
+
             LOG.debug("Assigning task(id={}) to user(id={})", taskId, assignTo.getID());
 
             BoxTask task = new BoxTask(boxConnection, taskId);
@@ -219,7 +200,7 @@ public class BoxTasksManager {
             return task;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -232,16 +213,14 @@ public class BoxTasksManager {
     public BoxTaskAssignment.Info getTaskAssignmentInfo(String taskAssignmentId) {
         try {
             LOG.debug("Getting info for task(id={})", taskAssignmentId);
-            if (taskAssignmentId == null) {
-                throw new IllegalArgumentException("Parameter 'taskAssignmentId' can not be null");
-            }
+            BoxHelper.notNull(taskAssignmentId, BoxHelper.TASK_ASSIGNMENT_ID);
 
             BoxTaskAssignment taskAssignment = new BoxTaskAssignment(boxConnection, taskAssignmentId);
 
             return taskAssignment.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -289,14 +268,13 @@ public class BoxTasksManager {
     public void deleteTaskAssignment(String taskAssignmentId) {
         try {
             LOG.debug("Deleting task(id={})", taskAssignmentId);
-            if (taskAssignmentId == null) {
-                throw new IllegalArgumentException("Parameter 'taskAssignmentId' can not be null");
-            }
+            BoxHelper.notNull(taskAssignmentId, BoxHelper.TASK_ASSIGNMENT_ID);
+
             BoxTaskAssignment taskAssignment = new BoxTaskAssignment(boxConnection, taskAssignmentId);
             taskAssignment.delete();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 }
diff --git a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxUsersManager.java b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxUsersManager.java
index fd833c77cf8..d8ed0e504de 100644
--- a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxUsersManager.java
+++ b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxUsersManager.java
@@ -30,6 +30,8 @@ import org.apache.camel.RuntimeCamelException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.component.box.api.BoxHelper.buildBoxApiErrorMessage;
+
 /**
  * Provides operations to manage Box users.
  */
@@ -63,7 +65,7 @@ public class BoxUsersManager {
             return BoxUser.getCurrentUser(boxConnection);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -95,7 +97,7 @@ public class BoxUsersManager {
             return users;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -110,12 +112,9 @@ public class BoxUsersManager {
     public BoxUser createEnterpriseUser(String login, String name, CreateUserParams params) {
         try {
             LOG.debug("Creating enterprise user with login={} name={}", login, name);
-            if (login == null) {
-                throw new IllegalArgumentException("Parameter 'login' can not be null");
-            }
-            if (name == null) {
-                throw new IllegalArgumentException("Parameter 'name' can not be null");
-            }
+
+            BoxHelper.notNull(login, BoxHelper.LOGIN);
+            BoxHelper.notNull(name, BoxHelper.NAME);
 
             if (params != null) {
                 return BoxUser.createEnterpriseUser(boxConnection, login, name, params).getResource();
@@ -124,7 +123,7 @@ public class BoxUsersManager {
             }
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -138,9 +137,7 @@ public class BoxUsersManager {
     public BoxUser createAppUser(String name, CreateUserParams params) {
         try {
             LOG.debug("Creating app user with name={}", name);
-            if (name == null) {
-                throw new IllegalArgumentException("Parameter 'name' can not be null");
-            }
+            BoxHelper.notNull(name, BoxHelper.NAME);
 
             if (params != null) {
                 return BoxUser.createAppUser(boxConnection, name, params).getResource();
@@ -149,7 +146,7 @@ public class BoxUsersManager {
             }
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -162,16 +159,14 @@ public class BoxUsersManager {
     public BoxUser.Info getUserInfo(String userId) {
         try {
             LOG.debug("Getting info for user(id={})", userId);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
 
             BoxUser user = new BoxUser(boxConnection, userId);
 
             return user.getInfo();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -185,19 +180,15 @@ public class BoxUsersManager {
     public BoxUser updateUserInfo(String userId, BoxUser.Info info) {
         try {
             LOG.debug("Updating info for user(id={})", userId);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
-            if (info == null) {
-                throw new IllegalArgumentException("Parameter 'info' can not be null");
-            }
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
+            BoxHelper.notNull(info, BoxHelper.INFO);
 
             BoxUser user = new BoxUser(boxConnection, userId);
             user.updateInfo(info);
             return user;
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -211,15 +202,13 @@ public class BoxUsersManager {
     public void deleteUser(String userId, boolean notifyUser, boolean force) {
         try {
             LOG.debug("Deleting user(id={}) notifyUser={} force={}", userId, notifyUser, force);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'fileId' can not be null");
-            }
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
 
             BoxUser file = new BoxUser(boxConnection, userId);
             file.delete(notifyUser, force);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -233,19 +222,15 @@ public class BoxUsersManager {
     public EmailAlias addUserEmailAlias(String userId, String email) {
         try {
             LOG.debug("Adding email alias '{}' to user(id={})", email, userId);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
-            if (email == null) {
-                throw new IllegalArgumentException("Paramerer 'email' can not be null");
-            }
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
+            BoxHelper.notNull(email, BoxHelper.EMAIL);
 
             BoxUser user = new BoxUser(boxConnection, userId);
 
             return user.addEmailAlias(email);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -258,16 +243,14 @@ public class BoxUsersManager {
     public Collection<EmailAlias> getUserEmailAlias(String userId) {
         try {
             LOG.debug("Get email aliases for user(id={})", userId);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
 
             BoxUser user = new BoxUser(boxConnection, userId);
 
             return user.getEmailAliases();
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -280,19 +263,15 @@ public class BoxUsersManager {
     public void deleteUserEmailAlias(String userId, String emailAliasId) {
         try {
             LOG.debug("Deleting email_alias({}) for user(id={})", emailAliasId, userId);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
-            if (emailAliasId == null) {
-                throw new IllegalArgumentException("Parameter 'emailAliasId' can not be null");
-            }
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
+            BoxHelper.notNull(emailAliasId, BoxHelper.EMAIL_ALIAS_ID);
 
             BoxUser user = new BoxUser(boxConnection, userId);
 
             user.deleteEmailAlias(emailAliasId);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 
@@ -305,19 +284,16 @@ public class BoxUsersManager {
     public BoxFolder.Info moveFolderToUser(String userId, String sourceUserId) {
         try {
             LOG.debug("Moving root folder for user(id={}) to user(id={})", sourceUserId, userId);
-            if (userId == null) {
-                throw new IllegalArgumentException("Parameter 'userId' can not be null");
-            }
-            if (sourceUserId == null) {
-                throw new IllegalArgumentException("Parameter 'sourceUserId' can not be null");
-            }
+
+            BoxHelper.notNull(userId, BoxHelper.USER_ID);
+            BoxHelper.notNull(sourceUserId, BoxHelper.SOURCE_USER_ID);
 
             BoxUser user = new BoxUser(boxConnection, sourceUserId);
 
             return user.transferContent(userId);
         } catch (BoxAPIException e) {
             throw new RuntimeCamelException(
-                    String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e);
+                    buildBoxApiErrorMessage(e), e);
         }
     }
 }