Merge pull request #2654 from ydinath/ReplaceDeprecatedLang3Methods

Replace deprecated org.apache.commons.lang3 methods
This commit is contained in:
Martin Fietz 2018-04-22 09:23:51 +02:00 committed by GitHub
commit c9a2bbc2c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 3 deletions

View File

@ -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"

View File

@ -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"
}

View File

@ -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;

View File

@ -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;
}