Replace deprecated org.apache.commons.lang3 methods with org.apache.commons.text methods
This commit is contained in:
parent
c82dce79eb
commit
8c628d98b9
|
@ -45,6 +45,7 @@ project.ext {
|
||||||
supportVersion = "25.3.1"
|
supportVersion = "25.3.1"
|
||||||
commonsioVersion = "2.5"
|
commonsioVersion = "2.5"
|
||||||
commonslangVersion = "3.6"
|
commonslangVersion = "3.6"
|
||||||
|
commonstextVersion = "1.3"
|
||||||
eventbusVersion = "2.4.0"
|
eventbusVersion = "2.4.0"
|
||||||
flattr4jVersion = "2.14"
|
flattr4jVersion = "2.14"
|
||||||
glideVersion = "3.8.0"
|
glideVersion = "3.8.0"
|
||||||
|
|
|
@ -50,6 +50,7 @@ dependencies {
|
||||||
implementation "com.android.support:support-v4:$supportVersion"
|
implementation "com.android.support:support-v4:$supportVersion"
|
||||||
implementation "com.android.support:appcompat-v7:$supportVersion"
|
implementation "com.android.support:appcompat-v7:$supportVersion"
|
||||||
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
|
implementation "org.apache.commons:commons-lang3:$commonslangVersion"
|
||||||
|
implementation "org.apache.commons:commons-text:$commonstextVersion"
|
||||||
implementation ("org.shredzone.flattr4j:flattr4j-core:$flattr4jVersion") {
|
implementation ("org.shredzone.flattr4j:flattr4j-core:$flattr4jVersion") {
|
||||||
exclude group: "org.json", module: "json"
|
exclude group: "org.json", module: "json"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package de.danoeh.antennapod.core.syndication.namespace.atom;
|
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.Namespace;
|
||||||
import de.danoeh.antennapod.core.syndication.namespace.SyndElement;
|
import de.danoeh.antennapod.core.syndication.namespace.SyndElement;
|
||||||
|
|
|
@ -3,7 +3,8 @@ package de.danoeh.antennapod.core.util;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
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. */
|
/** Generates valid filenames for a given string. */
|
||||||
public class FileNameGenerator {
|
public class FileNameGenerator {
|
||||||
|
@ -34,7 +35,11 @@ public class FileNameGenerator {
|
||||||
}
|
}
|
||||||
String filename = buf.toString().trim();
|
String filename = buf.toString().trim();
|
||||||
if(TextUtils.isEmpty(filename)) {
|
if(TextUtils.isEmpty(filename)) {
|
||||||
return RandomStringUtils.randomAlphanumeric(8);
|
return new RandomStringGenerator.Builder()
|
||||||
|
.withinRange('0', 'z')
|
||||||
|
.filteredBy(Character::isLetterOrDigit)
|
||||||
|
.build()
|
||||||
|
.generate(8);
|
||||||
}
|
}
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue