Skip to content

Commit

Permalink
releng: fix more Sonarcloud code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin committed Oct 5, 2023
1 parent 66b193b commit 525df0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,9 @@ private Optional<NodeMetadata> getNodeMetadata(@NotNull String nodePath, @NotNul

private static boolean isRelevantNodeType(DocViewNode2 node, String type) {
boolean isNodeRelevant = node.getPrimaryType().equals(Optional.of(type));
if (!isNodeRelevant) {
// if node type == nt:unstructured, evaluate sling:resourceType instead
if (node.getPrimaryType().equals(Optional.of(JcrConstants.NT_UNSTRUCTURED))) {
isNodeRelevant = node.getPropertyValue(NAME_SLING_RESOURCETYPE).equals(Optional.of(type));
}
// if node type == nt:unstructured, evaluate sling:resourceType instead
if (!isNodeRelevant && (node.getPrimaryType().equals(Optional.of(JcrConstants.NT_UNSTRUCTURED)))) {
isNodeRelevant = node.getPropertyValue(NAME_SLING_RESOURCETYPE).equals(Optional.of(type));
}
return isNodeRelevant;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Validator createValidator(@NotNull ValidationContext context, @NotNull Va

static @NotNull Map<Pattern, String> parseNodePathPatternsAndTypes(String option) {
return Pattern.compile(",").splitAsStream(option)
.map((entry) -> {
.map(entry -> {
int startType = entry.lastIndexOf('[');
if (startType == -1) {
throw new IllegalArgumentException("Each entry must end with a type enclosed by \"[\" and \"]\", but found entry " + entry);
Expand Down

0 comments on commit 525df0a

Please sign in to comment.