Skip to content

Commit

Permalink
Fix warnings and sonar findings
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Aug 16, 2023
1 parent 8fd188d commit 7eef9a2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import lombok.Data;
import lombok.EqualsAndHashCode;
Expand Down Expand Up @@ -107,7 +106,7 @@ private String getJoined(final List<String> values) {
if (isEmpty(values)) {
return null;
}
List<String> filtered = values.stream().filter(element -> !isEmpty(element)).collect(Collectors.toList());
List<String> filtered = values.stream().filter(element -> !isEmpty(element)).toList();
if (isEmpty(filtered)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ private Builder(final ExpressionLanguage expLanguage) {
}

private static Brackets getBracketsTypeFor(final ExpressionLanguage expl) {
final Brackets type = switch (expl) {
return switch (expl) {
case SIMPLE_SQUARED_BRACKTES -> Brackets.SQUARED_BRACKETS;
case SIMPLE_CURLY_BRACKETS -> Brackets.CURLY_BRACKETS;
case SIMPLE_ANGLE_BRACKET -> Brackets.ANGLE_BRACKET;
default -> throw new IllegalArgumentException(expl + " doesn't belongs to Simple expression language.");
};
return type;
}

/**
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/de/cuioss/tools/io/FilenameUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,8 @@ public static String normalizeNoEndSeparator(final String filename, final boolea
* @param keepSeparator true to keep the final separator
* @return the normalized filename. Null bytes inside string will be removed.
*/
@SuppressWarnings({ "squid:S3776", "squid:LabelsShouldNotBeUsedCheck", "squid:ForLoopCounterChangedCheck" }) // owolff:
// original
// code
@SuppressWarnings({ "squid:S3776", "squid:LabelsShouldNotBeUsedCheck", "squid:ForLoopCounterChangedCheck",
"java:S6541" }) // owolff: original code
private static String doNormalize(final String filename, final char separator, final boolean keepSeparator) {
if (filename == null) {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/cuioss/tools/reflect/MoreReflection.java
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ public static Optional<Class<?>> extractGenericTypeCovariantly(final Type type)
log.trace("No KeyStoreType given, returning empty");
return Optional.empty();
}
if (type instanceof Class class1) {
if (type instanceof Class<?> class1) {
log.debug("Found actual class returning as result {}", type);
return Optional.of(class1);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/de/cuioss/tools/string/MoreStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ public static boolean isPresent(final CharSequence cs) {
* MoreStrings.isNumeric("123") = true
* MoreStrings.isNumeric("१२३") = true MoreStrings.isNumeric("12 3") = false MoreStrings.isNumeric("ab2c") = false MoreStrings.isNumeric("12-3") = false MoreStrings.isNumeric("12.3") = false MoreStrings.isNumeric("-123") = false MoreStrings.isNumeric("+123") = false
* </pre >
*
*
* @param csthe CharSequence to check, may be null@return{@codetrue if only
* contains digits, and is non-null@author
* https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/StringUtils.java
* contains digits, and is non-null@author
* https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/StringUtils.java
*
*
*
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module de.cuioss.java.tools {
requires static lombok;
requires java.desktop;
requires java.logging;
requires transitive java.desktop;
requires transitive java.logging;

exports de.cuioss.tools.base;
exports de.cuioss.tools.codec;
Expand Down

0 comments on commit 7eef9a2

Please sign in to comment.