mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-18 18:51:26 +00:00
resolved sonarclouds mentioned issues
This commit is contained in:
@@ -10,6 +10,9 @@ import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class HttpHelper {
|
||||
|
||||
private HttpHelper(){
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
public static String readBody(HttpResponse<InputStream> response) throws IOException {
|
||||
try (var in = response.body(); var reader = new InputStreamReader(in, StandardCharsets.UTF_8)) {
|
||||
return CharStreams.toString(reader);
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.net.http.HttpResponse;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -126,9 +127,7 @@ public class ErrorController implements FxController {
|
||||
Clipboard.getSystemClipboard().setContent(clipboardContent);
|
||||
|
||||
copiedDetails.set(true);
|
||||
CompletableFuture.delayedExecutor(2, TimeUnit.SECONDS, Platform::runLater).execute(() -> {
|
||||
copiedDetails.set(false);
|
||||
});
|
||||
CompletableFuture.delayedExecutor(2, TimeUnit.SECONDS, Platform::runLater).execute(() -> copiedDetails.set(false));
|
||||
}
|
||||
|
||||
private void loadHttpResponse(HttpResponse<InputStream> response){
|
||||
@@ -137,15 +136,18 @@ public class ErrorController implements FxController {
|
||||
new InputStreamReader(response.body(),StandardCharsets.UTF_8),
|
||||
new TypeToken<Map<String,ErrorDiscussion>>(){}.getType());
|
||||
|
||||
if(!map.values().stream().filter(this::isPartialMatchFilter).findFirst().isEmpty()) {
|
||||
if(map.values().stream().anyMatch(this::isPartialMatchFilter)) {
|
||||
Comparator<ErrorDiscussion> comp = this::compareExactMatch;
|
||||
matchingErrorDiscussion = map.values().stream().sorted(comp
|
||||
Optional<ErrorDiscussion> value = map.values().stream().min(comp
|
||||
.thenComparing(this::compareSecondLevelMatch)
|
||||
.thenComparing(this::compareThirdLevelMatch)
|
||||
.thenComparing(this::compareIsAnswered)
|
||||
.thenComparing(this::compareUpvoteCount)
|
||||
).findFirst().get();
|
||||
lookUpSolutionVisibility.set(true);
|
||||
.thenComparing(this::compareUpvoteCount));
|
||||
|
||||
if(value.isPresent()){
|
||||
matchingErrorDiscussion = value.get();
|
||||
lookUpSolutionVisibility.set(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,5 @@ public class ErrorDiscussion {
|
||||
Answer answer;
|
||||
|
||||
static class Answer{
|
||||
private String url;
|
||||
private int upvoteCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user