Skip to content

Commit

Permalink
fix sonar cloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SrdjanStevanetic committed Jan 25, 2025
1 parent 3ce7b22 commit 0493484
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ public Map<String, String> dereferenceMany(List<String> uris, String language) {
// we need to separate the individual jsons manually
Pattern pattern = Pattern.compile("\\{\\s*\"@context\":");//matches {<0 or more spaces>"@context":
Matcher matcher = pattern.matcher(jsonLdStr);
//List<Integer> startingPositions = findSubstringIndexes(jsonLdStr, "{ \"@context\":");
List<Integer> startingPositions = new ArrayList<>();
while (matcher.find()) {
startingPositions.add(matcher.start());
Expand Down Expand Up @@ -232,32 +231,6 @@ private String getUriPresentInIdPart(List<String> uris, String derefJson) {
return null;
}

/**
* This method need to be moved to utils.
*
* This method finds all indexes of a substring within a string, e.g. for the substring "abc"
* within a string "abcdefabc abc dejjabc", the output will be [0,6,10,18].
*
* @param input
* @param substring
* @return
*/
private List<Integer> findSubstringIndexes(String input, String substring) {
List<Integer> indexes = new ArrayList<>();
int substringLength = substring.length();
int index = input.indexOf(substring, 0);
if (index != -1) {
indexes.add(index);
while (index != -1) {
index = input.indexOf(substring, index + substringLength);
if (index != -1) {
indexes.add(index);
}
}
}
return indexes;
}

/**
* An XSLT converts dereference output to JSON-LD.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ protected Annotation updateAndReindex(PersistentAnnotation persistentAnnotation)
}

boolean isSemanticTagOrHighlightWithBodyAsUrl(Annotation annotation) {
return (MotivationTypes.TAGGING.equals(annotation.getMotivationType()) ||
MotivationTypes.HIGHLIGHTING.equals(annotation.getMotivationType()))
&& hasBodyUrl(annotation);
return (MotivationTypes.TAGGING.getOaType().equals(annotation.getMotivation()) ||
MotivationTypes.HIGHLIGHTING.getOaType().equals(annotation.getMotivation()))
&& hasBodyUrl(annotation);
}

boolean hasBodyUrl(Annotation annotation) {
Expand Down

0 comments on commit 0493484

Please sign in to comment.