From adadf5971517009b8ea6acabf441d7b0ef3ad27c Mon Sep 17 00:00:00 2001 From: Max Shaposhnik Date: Mon, 20 Sep 2021 20:28:09 +0300 Subject: [PATCH] Revert exception type change due to its inconvenience for scm file resolving service (#126) Signed-off-by: Max Shaposhnik --- .../GithubPersonalAccessTokenFetcher.java | 2 +- .../scm/AuthorizingFileContentProvider.java | 23 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/wsmaster/che-core-api-factory-github/src/main/java/org/eclipse/che/api/factory/server/github/GithubPersonalAccessTokenFetcher.java b/wsmaster/che-core-api-factory-github/src/main/java/org/eclipse/che/api/factory/server/github/GithubPersonalAccessTokenFetcher.java index ab3ba025c3a..730040d7ec1 100644 --- a/wsmaster/che-core-api-factory-github/src/main/java/org/eclipse/che/api/factory/server/github/GithubPersonalAccessTokenFetcher.java +++ b/wsmaster/che-core-api-factory-github/src/main/java/org/eclipse/che/api/factory/server/github/GithubPersonalAccessTokenFetcher.java @@ -184,7 +184,7 @@ public PersonalAccessToken fetchPersonalAccessToken(Subject cheSubject, String s | ScmItemNotFoundException | ScmBadRequestException | ConflictException e) { - LOG.error(e.getMessage(), e); + LOG.error(e.getMessage()); throw new ScmCommunicationException(e.getMessage(), e); } } diff --git a/wsmaster/che-core-api-factory/src/main/java/org/eclipse/che/api/factory/server/scm/AuthorizingFileContentProvider.java b/wsmaster/che-core-api-factory/src/main/java/org/eclipse/che/api/factory/server/scm/AuthorizingFileContentProvider.java index 03fc33b92aa..a245bd404ac 100644 --- a/wsmaster/che-core-api-factory/src/main/java/org/eclipse/che/api/factory/server/scm/AuthorizingFileContentProvider.java +++ b/wsmaster/che-core-api-factory/src/main/java/org/eclipse/che/api/factory/server/scm/AuthorizingFileContentProvider.java @@ -87,18 +87,17 @@ public String fetchContent(String fileURL) throws IOException, DevfileException } catch (ScmUnauthorizedException | UnknownScmProviderException e) { throw new DevfileException(e.getMessage(), e); } catch (ScmCommunicationException e) { - throw new DevfileException( - e.getMessage(), - new ScmCommunicationException( - String.format( - "Failed to fetch a content from URL %s. Make sure the URL" - + " is correct. For private repository, make sure authentication is configured." - + " Additionally, if you're using " - + " relative form, make sure the referenced file are actually stored" - + " relative to the devfile on the same host," - + " or try to specify URL in absolute form. The current attempt to authenticate" - + " request, failed with the following error message: %s", - fileURL, e.getMessage()))); + throw new IOException( + String.format( + "Failed to fetch a content from URL %s. Make sure the URL" + + " is correct. For private repository, make sure authentication is configured." + + " Additionally, if you're using " + + " relative form, make sure the referenced file are actually stored" + + " relative to the devfile on the same host," + + " or try to specify URL in absolute form. The current attempt to authenticate" + + " request, failed with the following error message: %s", + fileURL, e.getMessage()), + e); } } }