diff --git a/src/main/java/com/google/devtools/build/lib/util/BUILD b/src/main/java/com/google/devtools/build/lib/util/BUILD index c5fa44a4ff8d99..6d578c32225495 100644 --- a/src/main/java/com/google/devtools/build/lib/util/BUILD +++ b/src/main/java/com/google/devtools/build/lib/util/BUILD @@ -103,7 +103,6 @@ java_library( deps = [ "//src/main/java/com/google/devtools/build/lib/actions:localhost_capacity", "//src/main/java/com/google/devtools/common/options", - "//third_party:apache_commons_lang", "//third_party:guava", "//third_party:jsr305", ], diff --git a/src/main/java/com/google/devtools/build/lib/util/ResourceConverter.java b/src/main/java/com/google/devtools/build/lib/util/ResourceConverter.java index 67434bae14fcaf..5f666b893f300e 100644 --- a/src/main/java/com/google/devtools/build/lib/util/ResourceConverter.java +++ b/src/main/java/com/google/devtools/build/lib/util/ResourceConverter.java @@ -15,6 +15,7 @@ package com.google.devtools.build.lib.util; import com.google.common.collect.ImmutableMap; +import com.google.common.primitives.Ints; import com.google.devtools.build.lib.actions.LocalHostCapacity; import com.google.devtools.common.options.Converters; import com.google.devtools.common.options.OptionsParsingException; @@ -24,7 +25,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.annotation.Nullable; -import org.apache.commons.lang.math.NumberUtils; /** * Converter for options that configure Bazel's resource usage. @@ -112,7 +112,7 @@ public ResourceConverter( @Override public final Integer convert(String input) throws OptionsParsingException { int value; - if (NumberUtils.isNumber(input)) { + if (Ints.tryParse(input) != null) { value = super.convert(input); return checkAndLimit(value); } diff --git a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java index 8980fac3bba0fb..f645356907e38e 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java @@ -20,6 +20,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -91,7 +92,6 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.LockSupport; import javax.annotation.Nullable; -import org.apache.commons.lang.time.StopWatch; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -565,8 +565,7 @@ public void testConcurrency() throws Exception { public void concurrencyBenchmark() throws Exception { long time = 0; for (int iteration = 0; iteration < 3; iteration++) { - StopWatch watch = new StopWatch(); - watch.start(); + Stopwatch watch = Stopwatch.createStarted(); BuildEvent startEvent = new GenericBuildEvent( @@ -600,7 +599,7 @@ public void concurrencyBenchmark() throws Exception { pool.awaitTermination(1, TimeUnit.DAYS); watch.stop(); - time += watch.getTime(); + time += watch.elapsed().toMillis(); BuildEventId lateId = testId("late event"); streamer.buildEvent(new BuildCompleteEvent(new BuildResult(0), ImmutableList.of(lateId))); diff --git a/src/test/java/com/google/devtools/build/lib/util/ResourceConverterTest.java b/src/test/java/com/google/devtools/build/lib/util/ResourceConverterTest.java index 251d3b86a746ad..fa1d8e7f686363 100644 --- a/src/test/java/com/google/devtools/build/lib/util/ResourceConverterTest.java +++ b/src/test/java/com/google/devtools/build/lib/util/ResourceConverterTest.java @@ -98,7 +98,7 @@ public void convertFloat_throwsException() { resourceConverter = new ResourceConverter(() -> null); OptionsParsingException thrown = assertThrows(OptionsParsingException.class, () -> resourceConverter.convert(".5")); - assertThat(thrown).hasMessageThat().contains("not an int"); + assertThat(thrown).hasMessageThat().contains("This flag takes an integer"); } @Test