Skip to content

Commit

Permalink
minor: fix some sonar and IDEA warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
strkkk committed May 13, 2019
1 parent 142b67b commit 6f5257e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 20 deletions.
Expand Up @@ -141,7 +141,7 @@ private LoadExternalDtdFeatureProvider() {
public static void setFeaturesBySystemProperty(SAXParserFactory factory)
throws SAXException, ParserConfigurationException {

final boolean enableExternalDtdLoad = Boolean.valueOf(
final boolean enableExternalDtdLoad = Boolean.parseBoolean(
System.getProperty(ENABLE_EXTERNAL_DTD_LOAD, "false"));

factory.setFeature(LOAD_EXTERNAL_DTD, enableExternalDtdLoad);
Expand Down
Expand Up @@ -260,10 +260,8 @@ public void finishProcessing() {
* @param bundle resource bundle.
*/
private void checkExistenceOfDefaultTranslation(ResourceBundle bundle) {
final Optional<String> fileName = getMissingFileName(bundle, null);
if (fileName.isPresent()) {
logMissingTranslation(bundle.getPath(), fileName.get());
}
getMissingFileName(bundle, null)
.ifPresent(fileName -> logMissingTranslation(bundle.getPath(), fileName));
}

/**
Expand All @@ -275,10 +273,8 @@ private void checkExistenceOfDefaultTranslation(ResourceBundle bundle) {
*/
private void checkExistenceOfRequiredTranslations(ResourceBundle bundle) {
for (String languageCode : requiredTranslations) {
final Optional<String> fileName = getMissingFileName(bundle, languageCode);
if (fileName.isPresent()) {
logMissingTranslation(bundle.getPath(), fileName.get());
}
getMissingFileName(bundle, languageCode)
.ifPresent(fileName -> logMissingTranslation(bundle.getPath(), fileName));
}
}

Expand Down
Expand Up @@ -188,12 +188,7 @@ public void visitToken(DetailAST ast) {
if (!isInIgnoreOccurrenceContext(ast)) {
final String currentString = ast.getText();
if (ignoreStringsRegexp == null || !ignoreStringsRegexp.matcher(currentString).find()) {
List<DetailAST> hitList = stringMap.get(currentString);
if (hitList == null) {
hitList = new ArrayList<>();
stringMap.put(currentString, hitList);
}
hitList.add(ast);
stringMap.computeIfAbsent(currentString, key -> new ArrayList<>()).add(ast);
}
}
}
Expand Down
Expand Up @@ -272,11 +272,6 @@ public final void beginTree(DetailAST rootAST) {
TREE_CACHE.get().clear();
}

@Override
public final void finishTree(DetailAST rootAST) {
// No code by default
}

@Override
public final void visitToken(DetailAST blockCommentNode) {
if (JavadocUtil.isJavadocComment(blockCommentNode)) {
Expand Down

0 comments on commit 6f5257e

Please sign in to comment.