This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new e78ae4c (chores) camel-box: avoid using a generic runtime exception (#5781) e78ae4c is described below commit e78ae4c1dbead42553392c7a3effc97cf2ed0e26 Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com> AuthorDate: Fri Jul 2 06:16:46 2021 +0200 (chores) camel-box: avoid using a generic runtime exception (#5781) --- components/camel-box/camel-box-api/pom.xml | 6 +++ .../box/api/BoxCollaborationsManager.java | 15 ++++---- .../component/box/api/BoxCommentsManager.java | 13 ++++--- .../component/box/api/BoxEventLogsManager.java | 3 +- .../camel/component/box/api/BoxEventsManager.java | 3 +- .../camel/component/box/api/BoxFilesManager.java | 45 +++++++++++----------- .../camel/component/box/api/BoxFoldersManager.java | 25 ++++++------ .../camel/component/box/api/BoxGroupsManager.java | 21 +++++----- .../camel/component/box/api/BoxSearchManager.java | 3 +- .../camel/component/box/api/BoxTasksManager.java | 19 ++++----- .../camel/component/box/api/BoxUsersManager.java | 23 +++++------ 11 files changed, 96 insertions(+), 80 deletions(-) diff --git a/components/camel-box/camel-box-api/pom.xml b/components/camel-box/camel-box-api/pom.xml index 06140a3..b38bfb1 100644 --- a/components/camel-box/camel-box-api/pom.xml +++ b/components/camel-box/camel-box-api/pom.xml @@ -48,6 +48,12 @@ <artifactId>box-java-sdk</artifactId> <version>${box-java-sdk-version}</version> </dependency> + + <dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-api</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> <build> 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 d4f22a9..adbf47b 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 @@ -23,6 +23,7 @@ import com.box.sdk.BoxAPIException; import com.box.sdk.BoxCollaboration; import com.box.sdk.BoxCollaborator; import com.box.sdk.BoxFolder; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +64,7 @@ public class BoxCollaborationsManager { BoxFolder folder = new BoxFolder(boxConnection, folderId); return folder.getCollaborations(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -95,7 +96,7 @@ public class BoxCollaborationsManager { BoxFolder folder = new BoxFolder(boxConnection, folderId); return folder.collaborate(collaborator, role).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -126,7 +127,7 @@ public class BoxCollaborationsManager { BoxFolder folder = new BoxFolder(boxConnection, folderId); return folder.collaborate(email, role).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -148,7 +149,7 @@ public class BoxCollaborationsManager { return collaboration.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -172,7 +173,7 @@ public class BoxCollaborationsManager { collaboration.updateInfo(info); return collaboration; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -191,7 +192,7 @@ public class BoxCollaborationsManager { BoxCollaboration collaboration = new BoxCollaboration(boxConnection, collaborationId); collaboration.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -205,7 +206,7 @@ public class BoxCollaborationsManager { try { return BoxCollaboration.getPendingCollaborations(boxConnection); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 2f15796..eac5dff 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 @@ -22,6 +22,7 @@ import com.box.sdk.BoxAPIConnection; import com.box.sdk.BoxAPIException; import com.box.sdk.BoxComment; import com.box.sdk.BoxFile; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,7 +68,7 @@ public class BoxCommentsManager { fileToCommentOn.addComment(message); return fileToCommentOn; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -90,7 +91,7 @@ public class BoxCommentsManager { return file.getComments(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -112,7 +113,7 @@ public class BoxCommentsManager { return comment.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -136,7 +137,7 @@ public class BoxCommentsManager { BoxComment comment = new BoxComment(boxConnection, commentId); return comment.reply(message).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -160,7 +161,7 @@ public class BoxCommentsManager { BoxComment comment = new BoxComment(boxConnection, commentId); return comment.changeMessage(message).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -179,7 +180,7 @@ public class BoxCommentsManager { BoxComment comment = new BoxComment(boxConnection, commentId); comment.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 7554596..2a42909 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 @@ -25,6 +25,7 @@ import com.box.sdk.BoxAPIConnection; import com.box.sdk.BoxAPIException; import com.box.sdk.BoxEvent; import com.box.sdk.EventLog; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,7 +89,7 @@ public class BoxEventLogsManager { return results; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 855f749..e08369e 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 @@ -20,6 +20,7 @@ import com.box.sdk.BoxAPIConnection; import com.box.sdk.BoxAPIException; import com.box.sdk.EventListener; import com.box.sdk.EventStream; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,7 +72,7 @@ public class BoxEventsManager { eventStream.start(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 eac6231..e019fa7 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 @@ -35,6 +35,7 @@ import com.box.sdk.BoxSharedLink; import com.box.sdk.FileUploadParams; import com.box.sdk.Metadata; import com.box.sdk.ProgressListener; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -81,7 +82,7 @@ public class BoxFilesManager { return file.getInfo(fields); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -106,7 +107,7 @@ public class BoxFilesManager { file.updateInfo(info); return file; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -217,7 +218,7 @@ public class BoxFilesManager { } return boxFile; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -258,7 +259,7 @@ public class BoxFilesManager { return file; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -281,7 +282,7 @@ public class BoxFilesManager { return file.getVersions(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -327,7 +328,7 @@ public class BoxFilesManager { } return output; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -369,7 +370,7 @@ public class BoxFilesManager { } return output; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -399,7 +400,7 @@ public class BoxFilesManager { fileVersion.promote(); return fileVersion; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -432,7 +433,7 @@ public class BoxFilesManager { return fileToCopy.copy(destinationFolder, newName).getResource(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -465,7 +466,7 @@ public class BoxFilesManager { return (BoxFile) fileToMove.move(destinationFolder, newName).getResource(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -490,7 +491,7 @@ public class BoxFilesManager { fileToRename.rename(newFileName); return fileToRename; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -509,7 +510,7 @@ public class BoxFilesManager { BoxFile file = new BoxFile(boxConnection, fileId); file.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -537,7 +538,7 @@ public class BoxFilesManager { fileVersion.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -573,7 +574,7 @@ public class BoxFilesManager { BoxFile file = new BoxFile(boxConnection, fileId); return file.createSharedLink(access, unshareDate, permissions); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -597,7 +598,7 @@ public class BoxFilesManager { return file.getDownloadURL(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -620,7 +621,7 @@ public class BoxFilesManager { BoxFile file = new BoxFile(boxConnection, fileId); return file.getPreviewLink(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -667,7 +668,7 @@ public class BoxFilesManager { BoxFile file = new BoxFile(boxConnection, fileId); return file.getThumbnail(fileType, minWidth, minHeight, maxWidth, maxHeight); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -700,7 +701,7 @@ public class BoxFilesManager { return file.createMetadata(metadata); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -729,7 +730,7 @@ public class BoxFilesManager { return file.getMetadata(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } @@ -754,7 +755,7 @@ public class BoxFilesManager { BoxFile file = new BoxFile(boxConnection, fileId); return file.updateMetadata(metadata); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -773,7 +774,7 @@ public class BoxFilesManager { BoxFile file = new BoxFile(boxConnection, fileId); file.deleteMetadata(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -803,7 +804,7 @@ public class BoxFilesManager { BoxFolder parentFolder = new BoxFolder(boxConnection, parentFolderId); parentFolder.canUpload(fileName, size); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 b5a945c..d0c2f41 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 @@ -27,6 +27,7 @@ import com.box.sdk.BoxAPIException; import com.box.sdk.BoxFolder; import com.box.sdk.BoxItem; import com.box.sdk.BoxSharedLink; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +62,7 @@ public class BoxFoldersManager { LOG.debug("Getting root folder"); return BoxFolder.getRootFolder(boxConnection); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -95,7 +96,7 @@ public class BoxFoldersManager { } return folder; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -139,7 +140,7 @@ public class BoxFoldersManager { return folderItems; } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -163,7 +164,7 @@ public class BoxFoldersManager { BoxFolder parentFolder = new BoxFolder(boxConnection, parentFolderId); return parentFolder.createFolder(folderName).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -197,7 +198,7 @@ public class BoxFoldersManager { } return folder; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -229,7 +230,7 @@ public class BoxFoldersManager { return folderToCopy.copy(destinationFolder, newName).getResource(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -261,7 +262,7 @@ public class BoxFoldersManager { return (BoxFolder) folderToMove.move(destinationFolder, newName).getResource(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -286,7 +287,7 @@ public class BoxFoldersManager { folderToRename.rename(newFolderName); return folderToRename; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -305,7 +306,7 @@ public class BoxFoldersManager { BoxFolder folder = new BoxFolder(boxConnection, folderId); folder.delete(true); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -332,7 +333,7 @@ public class BoxFoldersManager { return folder.getInfo(fields); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -357,7 +358,7 @@ public class BoxFoldersManager { folder.updateInfo(info); return folder; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -393,7 +394,7 @@ public class BoxFoldersManager { BoxFolder folder = new BoxFolder(boxConnection, folderId); return folder.createSharedLink(access, unshareDate, permissions); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 7717085..c5b25c8 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 @@ -24,6 +24,7 @@ import com.box.sdk.BoxAPIException; import com.box.sdk.BoxGroup; import com.box.sdk.BoxGroupMembership; import com.box.sdk.BoxUser; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +64,7 @@ public class BoxGroupsManager { } return groups; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -93,7 +94,7 @@ public class BoxGroupsManager { return BoxGroup.createGroup(boxConnection, name, provenance, externalSyncIdentifier, description, invitabilityLevel, memberViewabilityLevel).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -113,7 +114,7 @@ public class BoxGroupsManager { BoxGroup group = new BoxGroup(boxConnection, groupId); group.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -135,7 +136,7 @@ public class BoxGroupsManager { return group.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -161,7 +162,7 @@ public class BoxGroupsManager { group.updateInfo(groupInfo); return group; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -183,7 +184,7 @@ public class BoxGroupsManager { return group.getMemberships(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -212,7 +213,7 @@ public class BoxGroupsManager { return group.addMembership(user, role).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -233,7 +234,7 @@ public class BoxGroupsManager { groupMembership.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -255,7 +256,7 @@ public class BoxGroupsManager { return group.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -282,7 +283,7 @@ public class BoxGroupsManager { groupMembership.updateInfo(info); return groupMembership; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } 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 306b797..f3445a0 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 @@ -26,6 +26,7 @@ import com.box.sdk.BoxItem; import com.box.sdk.BoxSearch; import com.box.sdk.BoxSearchParameters; import com.box.sdk.PartialCollection; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -89,7 +90,7 @@ public class BoxSearchManager { return result; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 8719df2..81a88c9 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 @@ -25,6 +25,7 @@ import com.box.sdk.BoxFile; import com.box.sdk.BoxTask; import com.box.sdk.BoxTaskAssignment; import com.box.sdk.BoxUser; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,7 +68,7 @@ public class BoxTasksManager { return file.getTasks(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -97,7 +98,7 @@ public class BoxTasksManager { BoxFile fileToAddTaskOn = new BoxFile(boxConnection, fileId); return fileToAddTaskOn.addTask(action, message, dueAt).getResource(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -116,7 +117,7 @@ public class BoxTasksManager { BoxTask task = new BoxTask(boxConnection, taskId); task.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -138,7 +139,7 @@ public class BoxTasksManager { return task.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -165,7 +166,7 @@ public class BoxTasksManager { return task; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -188,7 +189,7 @@ public class BoxTasksManager { return file.getAssignments(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -217,7 +218,7 @@ public class BoxTasksManager { return task; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -239,7 +240,7 @@ public class BoxTasksManager { return taskAssignment.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -294,7 +295,7 @@ public class BoxTasksManager { BoxTaskAssignment taskAssignment = new BoxTaskAssignment(boxConnection, taskAssignmentId); taskAssignment.delete(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), 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 5ea8eac..e23f34e 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 @@ -26,6 +26,7 @@ import com.box.sdk.BoxFolder; import com.box.sdk.BoxUser; import com.box.sdk.CreateUserParams; import com.box.sdk.EmailAlias; +import org.apache.camel.RuntimeCamelException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +62,7 @@ public class BoxUsersManager { return BoxUser.getCurrentUser(boxConnection); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -93,7 +94,7 @@ public class BoxUsersManager { } return users; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -122,7 +123,7 @@ public class BoxUsersManager { return BoxUser.createEnterpriseUser(boxConnection, login, name).getResource(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -147,7 +148,7 @@ public class BoxUsersManager { return BoxUser.createAppUser(boxConnection, name).getResource(); } } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -169,7 +170,7 @@ public class BoxUsersManager { return user.getInfo(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -195,7 +196,7 @@ public class BoxUsersManager { user.updateInfo(info); return user; } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -217,7 +218,7 @@ public class BoxUsersManager { BoxUser file = new BoxUser(boxConnection, userId); file.delete(notifyUser, force); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -243,7 +244,7 @@ public class BoxUsersManager { return user.addEmailAlias(email); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -265,7 +266,7 @@ public class BoxUsersManager { return user.getEmailAliases(); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -290,7 +291,7 @@ public class BoxUsersManager { user.deleteEmailAlias(emailAliasId); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } } @@ -315,7 +316,7 @@ public class BoxUsersManager { return user.transferContent(userId); } catch (BoxAPIException e) { - throw new RuntimeException( + throw new RuntimeCamelException( String.format("Box API returned the error code %d%n%n%s", e.getResponseCode(), e.getResponse()), e); } }