Skip to content

Commit

Permalink
Fix breaking changes between JSoup 1.14.2 to 1.15.3
Browse files Browse the repository at this point in the history
JSoup replaced org.jsoup.safety.Whitelist with org.jsoup.safety.Safelist. Purely a naming change, no difference of functionality.

This bumps the JSoup version (re: jagrosh#10) and handles the breaking changes. This is needed as the related MusicBot project has recently bumped the JSoup version to 1.15.3 (re: jagrosh/MusicBot@a7be2c4) causing runtime errors as it depends on JLyrics, which depends on a different JSoup version.
  • Loading branch information
TheConner committed Sep 8, 2022
1 parent 6e0d97d commit 8c2b920
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.2</version>
<version>1.15.3</version>
<type>jar</type>
</dependency>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/jagrosh/jlyrics/LyricsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Document.OutputSettings;
import org.jsoup.nodes.Element;
import org.jsoup.safety.Whitelist;
import org.jsoup.safety.Safelist;

/**
*
Expand All @@ -42,7 +42,7 @@ public class LyricsClient
private final Config config = ConfigFactory.load();
private final HashMap<String, Lyrics> cache = new HashMap<>();
private final OutputSettings noPrettyPrint = new OutputSettings().prettyPrint(false);
private final Whitelist newlineWhitelist = Whitelist.none().addTags("br", "p");
private final Safelist newlineSafelist = Safelist.none().addTags("br", "p");
private final Executor executor;
private final String defaultSource, userAgent;
private final int timeout;
Expand Down Expand Up @@ -178,6 +178,6 @@ public CompletableFuture<Lyrics> getLyrics(String search, String source)

private String cleanWithNewlines(Element element)
{
return Jsoup.clean(Jsoup.clean(element.html(), newlineWhitelist), "", Whitelist.none(), noPrettyPrint);
return Jsoup.clean(Jsoup.clean(element.html(), newlineSafelist), "", Safelist.none(), noPrettyPrint);
}
}

0 comments on commit 8c2b920

Please sign in to comment.