diff --git a/build.gradle b/build.gradle index 4d5fded46..9edb7f350 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,7 @@ project.ext { supportVersion = "25.3.1" commonsioVersion = "2.5" commonslangVersion = "3.6" + commonstextVersion = "1.3" eventbusVersion = "2.4.0" flattr4jVersion = "2.14" glideVersion = "3.8.0" diff --git a/core/build.gradle b/core/build.gradle index 9967e99ff..af1ac7ad0 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -50,6 +50,7 @@ dependencies { implementation "com.android.support:support-v4:$supportVersion" implementation "com.android.support:appcompat-v7:$supportVersion" implementation "org.apache.commons:commons-lang3:$commonslangVersion" + implementation "org.apache.commons:commons-text:$commonstextVersion" implementation ("org.shredzone.flattr4j:flattr4j-core:$flattr4jVersion") { exclude group: "org.json", module: "json" } diff --git a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java index ea1b724d4..b512dce3f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java +++ b/core/src/main/java/de/danoeh/antennapod/core/syndication/namespace/atom/AtomText.java @@ -1,6 +1,6 @@ package de.danoeh.antennapod.core.syndication.namespace.atom; -import org.apache.commons.lang3.StringEscapeUtils; +import org.apache.commons.text.StringEscapeUtils; import de.danoeh.antennapod.core.syndication.namespace.Namespace; import de.danoeh.antennapod.core.syndication.namespace.SyndElement; diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java b/core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java index a93dd8ee3..d2e9d835e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java +++ b/core/src/main/java/de/danoeh/antennapod/core/util/FileNameGenerator.java @@ -3,7 +3,8 @@ package de.danoeh.antennapod.core.util; import android.text.TextUtils; import org.apache.commons.lang3.ArrayUtils; -import org.apache.commons.lang3.RandomStringUtils; +import org.apache.commons.text.RandomStringGenerator; + /** Generates valid filenames for a given string. */ public class FileNameGenerator { @@ -34,7 +35,11 @@ public class FileNameGenerator { } String filename = buf.toString().trim(); if(TextUtils.isEmpty(filename)) { - return RandomStringUtils.randomAlphanumeric(8); + return new RandomStringGenerator.Builder() + .withinRange('0', 'z') + .filteredBy(Character::isLetterOrDigit) + .build() + .generate(8); } return filename; }