-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MARP-1059 market website rating does not work after login #140
Merged
ndkhanh-axonivy
merged 7 commits into
develop
from
bugfix/MARP-1059-Market-website-Rating-does-not-work-after-login
Sep 16, 2024
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
a6a4c65
Fix NPE when response a request
ndkhanh-axonivy 5185921
Merge branch 'develop' into bugfix/MARP-1059-Market-website-Rating-do…
ndkhanh-axonivy 9dadac6
Merge branch 'develop' into bugfix/MARP-1059-Market-website-Rating-do…
ndkhanh-axonivy c0f4a1b
Merge branch 'develop' into bugfix/MARP-1059-Market-website-Rating-do…
ndkhanh-axonivy 5022bf3
Handle feedbacks
ndkhanh-axonivy a7ff24f
Update GitHubServiceImpl.java
ndkhanh-axonivy f8f6dab
Add Unit Tests
ndkhanh-axonivy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
import com.axonivy.market.constants.ErrorMessageConstants; | ||
import com.axonivy.market.constants.CommonConstants; | ||
import org.kohsuke.github.GHContent; | ||
import org.kohsuke.github.GHOrganization; | ||
|
@@ -110,7 +111,8 @@ public GitHubAccessTokenResponse getAccessToken(String code, GitHubProperty gitH | |
GitHubAccessTokenResponse response = responseEntity.getBody(); | ||
|
||
if (response != null && response.getError() != null && !response.getError().isBlank()) { | ||
throw new Oauth2ExchangeCodeException(response.getError(), response.getErrorDescription()); | ||
String errorDescription = buildErrorDescription(response.getErrorDescription(), gitHubProperty.getOauth2ClientId()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should write a log and not throw exception with this info. |
||
throw new Oauth2ExchangeCodeException(response.getError(), errorDescription); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should write a test for this Exception with ExceptionHandlers. |
||
} | ||
|
||
return response; | ||
|
@@ -180,4 +182,8 @@ public List<Map<String, Object>> getUserOrganizations(String accessToken) throws | |
exception.getMessage())); | ||
} | ||
} | ||
|
||
private String buildErrorDescription(String errorDescription, String clientId) { | ||
return String.format(ErrorMessageConstants.WRONG_AUTHORIZED_CODE_ERROR_MESSAGE, errorDescription, clientId); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this block code to try {}