From faa4973738db138f667b83fb9004f562dd09d6bb Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 8 Feb 2020 15:42:27 +0100 Subject: [PATCH] Remove jsonpath --- airsonic-main/pom.xml | 4 ---- .../org/airsonic/player/service/VersionService.java | 13 +++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/airsonic-main/pom.xml b/airsonic-main/pom.xml index 65428bc1..3c56be9e 100755 --- a/airsonic-main/pom.xml +++ b/airsonic-main/pom.xml @@ -520,10 +520,6 @@ com.fasterxml.jackson.core jackson-databind - - com.jayway.jsonpath - json-path - com.sun.mail javax.mail diff --git a/airsonic-main/src/main/java/org/airsonic/player/service/VersionService.java b/airsonic-main/src/main/java/org/airsonic/player/service/VersionService.java index d0cd489a..5d5996c0 100644 --- a/airsonic-main/src/main/java/org/airsonic/player/service/VersionService.java +++ b/airsonic-main/src/main/java/org/airsonic/player/service/VersionService.java @@ -19,7 +19,8 @@ */ package org.airsonic.player.service; -import com.jayway.jsonpath.JsonPath; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import org.airsonic.player.domain.Version; import org.airsonic.player.util.FileUtil; import org.apache.http.client.ResponseHandler; @@ -37,10 +38,7 @@ import org.springframework.stereotype.Service; import java.io.*; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.Optional; +import java.util.*; import java.util.function.Function; import java.util.function.Predicate; import java.util.regex.Matcher; @@ -243,7 +241,10 @@ public class VersionService { return; } - List unsortedTags = JsonPath.read(content, JSON_PATH); + ListunsortedTags = new LinkedList<>(); + for (JsonNode item: new ObjectMapper().readTree(content)) { + unsortedTags.add(item.path("tag_name").asText()); + } Function convertToVersion = s -> { Matcher match = VERSION_REGEX.matcher(s);