Skip to content

Commit

Permalink
WFLY-11215: Removes usage of Apache Commons Lang3 deprecated function…
Browse files Browse the repository at this point in the history
…ality
  • Loading branch information
emmartins committed Oct 19, 2018
1 parent 6ffc076 commit 370f1d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
6 changes: 0 additions & 6 deletions batch-processing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@

<!-- Now we declare any tools needed -->

<!-- We use commons lang to generate random Strings -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>

<!-- Annotation processor to generate the JPA metamodel classes for
typesafe criteria queries -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Logger;
Expand All @@ -41,8 +42,6 @@
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

import org.apache.commons.lang3.RandomStringUtils;

//The @Model stereotype is a convenience mechanism to make this a request-scoped bean that has an
//EL name
//Read more about the @Model stereotype in this FAQ:
Expand All @@ -69,9 +68,18 @@ public void generate() throws IOException {
try (BufferedWriter bos = new BufferedWriter(new FileWriter(tempFile, false))) {
log.info("Starting to generate " + numRecords + " records in file " + tempFile);
String previousName = null;
final Random random = new Random();
for (int x = 0; x < numRecords; x++) {
String name = RandomStringUtils.randomAlphabetic(10);
String phone = RandomStringUtils.randomNumeric(9);
// generate random name
String name = random.ints('a','z'+1)
.limit(10)
.collect(StringBuilder::new, (sb, i) -> sb.append((char) i), StringBuilder::append)
.toString();
// generate random phone number
String phone = random.ints('0','9'+1)
.limit(9)
.collect(StringBuilder::new, (sb, i) -> sb.append((char) i), StringBuilder::append)
.toString();
// Generate a duplicate name;
if (generateWithError && x == (numRecords / 2)) {
name = previousName;
Expand Down
6 changes: 0 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
<version.com.fasterxml.jackson>2.9.5</version.com.fasterxml.jackson>
<version.com.h2database>1.4.193</version.com.h2database>
<version.com.sun.istack>3.0.5</version.com.sun.istack>
<version.commons-lang3>3.6</version.commons-lang3>
<version.org.bouncycastle>1.60</version.org.bouncycastle>
<version.org.javassist>3.23.1-GA</version.org.javassist>
<version.org.jboss.ws.cxf>5.2.4.Final</version.org.jboss.ws.cxf>
Expand Down Expand Up @@ -118,11 +117,6 @@
<type>pom</type>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${version.commons-lang3}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand Down

0 comments on commit 370f1d5

Please sign in to comment.