Skip to content

Commit

Permalink
fix code smell
Browse files Browse the repository at this point in the history
  • Loading branch information
f0rb committed Dec 8, 2023
1 parent 3c329f1 commit 0ca726b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ private static void nestedJson(JSONObject parent, String[] params, int deep, Obj
parent.put(params[deep], arg);
return;
}
if (!parent.containsKey(param)) {
parent.put(param, new JSONObject());
}
parent.computeIfAbsent(param, k -> new JSONObject());
nestedJson(parent.getJSONObject(param), params, deep + 1, arg);
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/win/doyto/i18n/module/i18n/I18nService.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public void saveTranslation(List<I18nView> i18nViewList) {
log.info("保存翻译完毕: {} / {}", ret, i18nViewList.size());
}

@SuppressWarnings("java:S6809")
@Transactional
public void saveTranslation(String user, String group, String locale, Map<String, String> translationMap) {
List<I18nView> i18nViewList = new ArrayList<>(translationMap.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public String getUserId() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication != null) {
Object principal = authentication.getPrincipal();
if (principal instanceof User) {
return ((User) principal).getUsername();
if (principal instanceof User user) {
return user.getUsername();
}
}
return null;
Expand Down

0 comments on commit 0ca726b

Please sign in to comment.