From 3fbd22f037518a171aa14591e3921a568ad38b82 Mon Sep 17 00:00:00 2001 From: Valerij Fredriksen Date: Mon, 7 May 2018 22:08:17 +0200 Subject: Remove unncessary throws --- .../vespa/hosted/node/maintainer/CoreCollector.java | 10 +++++----- .../hosted/node/maintainer/CoreCollectorTest.java | 20 ++++++++++---------- .../hosted/node/maintainer/CoredumpHandlerTest.java | 6 +++--- .../vespa/hosted/node/maintainer/FileHelperTest.java | 2 +- .../commons/noderepo/IPAddressVerifierTest.java | 2 +- .../hardware/benchmarks/CPUBenchmarkTest.java | 2 +- .../spec/retrievers/CPURetrieverTest.java | 2 +- .../spec/retrievers/DiskRetrieverTest.java | 6 +++--- .../spec/retrievers/MemoryRetrieverTest.java | 2 +- .../spec/retrievers/NetRetrieverTest.java | 2 +- 10 files changed, 27 insertions(+), 27 deletions(-) (limited to 'node-maintainer/src') diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java index c82f4406015..fe09f23d282 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java @@ -58,7 +58,7 @@ public class CoreCollector { return Arrays.asList(result.getSecond().split("\n")); } - Path readBinPathFallback(Path coredumpPath) throws IOException, InterruptedException { + Path readBinPathFallback(Path coredumpPath) throws IOException { String command = GDB_PATH + " -n -batch -core " + coredumpPath + " | grep \'^Core was generated by\'"; String[] wrappedCommand = new String[] {"/bin/sh", "-c", command}; Pair result = processExecuter.exec(wrappedCommand); @@ -71,7 +71,7 @@ public class CoreCollector { return Paths.get(matcher.group("path").split(" ")[0]); } - Path readBinPath(Path coredumpPath) throws IOException, InterruptedException { + Path readBinPath(Path coredumpPath) throws IOException { String[] command = new String[] {"file", coredumpPath.toString()}; try { Pair result = processExecuter.exec(command); @@ -97,7 +97,7 @@ public class CoreCollector { return readBinPathFallback(coredumpPath); } - List readBacktrace(Path coredumpPath, Path binPath, boolean allThreads) throws IOException, InterruptedException { + List readBacktrace(Path coredumpPath, Path binPath, boolean allThreads) throws IOException { String threads = allThreads ? "thread apply all bt" : "bt"; String[] command = new String[]{GDB_PATH, "-n", "-ex", threads, "-batch", binPath.toString(), coredumpPath.toString()}; Pair result = processExecuter.exec(command); @@ -111,7 +111,7 @@ public class CoreCollector { Map data = new LinkedHashMap<>(); try { coredumpPath = compressCoredump(coredumpPath); - } catch (IOException | InterruptedException e) { + } catch (IOException e) { logger.log(Level.WARNING, "Failed compressing/decompressing core dump", e); } @@ -154,7 +154,7 @@ public class CoreCollector { * * @return Path to the decompressed core dump */ - private Path compressCoredump(Path coredumpPath) throws IOException, InterruptedException { + private Path compressCoredump(Path coredumpPath) throws IOException { if (! coredumpPath.toString().endsWith(".lz4")) { processExecuter.exec( new String[]{LZ4_PATH, coredumpPath.toString(), coredumpPath.toString() + ".lz4"}); diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java index 4b58c16bdc3..b32f6d076a7 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java @@ -53,18 +53,18 @@ public class CoreCollectorTest { @Rule public TemporaryFolder folder= new TemporaryFolder(); - private void mockExec(String[] cmd, String output) throws IOException, InterruptedException { + private void mockExec(String[] cmd, String output) throws IOException { mockExec(cmd, output, ""); } - private void mockExec(String[] cmd, String output, String error) throws IOException, InterruptedException { + private void mockExec(String[] cmd, String output, String error) throws IOException { when(processExecuter.exec(cmd)).thenReturn(new Pair<>(error.isEmpty() ? 0 : 1, output + error)); } static final String GDB_PATH = getDefaults().underVespaHome("bin64/gdb"); @Test - public void extractsBinaryPathTest() throws IOException, InterruptedException { + public void extractsBinaryPathTest() throws IOException { final String[] cmd = {"file", TEST_CORE_PATH.toString()}; mockExec(cmd, @@ -101,7 +101,7 @@ public class CoreCollectorTest { } @Test - public void extractsBinaryPathUsingGdbTest() throws IOException, InterruptedException { + public void extractsBinaryPathUsingGdbTest() throws IOException { final String[] cmd = new String[]{"/bin/sh", "-c", GDB_PATH + " -n -batch -core /tmp/core.1234 | grep '^Core was generated by'"}; @@ -119,7 +119,7 @@ public class CoreCollectorTest { } @Test - public void extractsBacktraceUsingGdb() throws IOException, InterruptedException { + public void extractsBacktraceUsingGdb() throws IOException { mockExec(new String[]{GDB_PATH, "-n", "-ex", "bt", "-batch", "/usr/bin/program", "/tmp/core.1234"}, String.join("\n", GDB_BACKTRACE)); assertEquals(GDB_BACKTRACE, coreCollector.readBacktrace(TEST_CORE_PATH, TEST_BIN_PATH, false)); @@ -136,7 +136,7 @@ public class CoreCollectorTest { } @Test - public void extractsBacktraceFromAllThreadsUsingGdb() throws IOException, InterruptedException { + public void extractsBacktraceFromAllThreadsUsingGdb() throws IOException { mockExec(new String[]{GDB_PATH, "-n", "-ex", "thread apply all bt", "-batch", "/usr/bin/program", "/tmp/core.1234"}, String.join("\n", GDB_BACKTRACE)); @@ -144,7 +144,7 @@ public class CoreCollectorTest { } @Test - public void collectsDataTest() throws IOException, InterruptedException { + public void collectsDataTest() throws IOException { mockExec(new String[]{"file", TEST_CORE_PATH.toString()}, "/tmp/core.1234: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from " + "'/usr/bin/program'"); @@ -166,7 +166,7 @@ public class CoreCollectorTest { } @Test - public void collectsPartialIfUnableToDetermineDumpingProgramTest() throws IOException, InterruptedException { + public void collectsPartialIfUnableToDetermineDumpingProgramTest() throws IOException { // We fail to get backtrace and RPM packages, but install state works, make sure it is returned mockExec(new String[]{"cat", INSTALL_STATE_PATH.toString()}, String.join("\n", INSTALL_STATE)); @@ -176,7 +176,7 @@ public class CoreCollectorTest { } @Test - public void collectsPartialIfBacktraceFailsTest() throws IOException, InterruptedException { + public void collectsPartialIfBacktraceFailsTest() throws IOException { mockExec(new String[]{"file", TEST_CORE_PATH.toString()}, "/tmp/core.1234: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from " + "'/usr/bin/program'"); @@ -189,7 +189,7 @@ public class CoreCollectorTest { } @Test - public void parseTotalMemoryTestTest() throws IOException { + public void parseTotalMemoryTestTest() { String memInfo = "MemTotal: 100000000 kB\nMemUsed: 1000000 kB\n"; assertEquals(100000000, coreCollector.parseTotalMemorySize(memInfo)); diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java index 2cc96567e20..4a5fddf984e 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoredumpHandlerTest.java @@ -141,7 +141,7 @@ public class CoredumpHandlerTest { } @Test - public void coredumpMetadataCollectAndWriteTest() throws IOException, InterruptedException { + public void coredumpMetadataCollectAndWriteTest() throws IOException { createCoredump("core.dump", Instant.now()); Path processingPath = coredumpHandler.enqueueCoredumps(); Path processingCoredumpPath = Files.list(processingPath).findFirst().orElseThrow(() -> @@ -157,7 +157,7 @@ public class CoredumpHandlerTest { } @Test - public void coredumpMetadataReadIfExistsTest() throws IOException, InterruptedException { + public void coredumpMetadataReadIfExistsTest() throws IOException { final String documentId = "UIDD-ABCD-EFGH"; Path metadataPath = createProcessedCoredump(documentId); @@ -167,7 +167,7 @@ public class CoredumpHandlerTest { } @Test - public void reportSuccessCoredumpTest() throws IOException, URISyntaxException, InterruptedException { + public void reportSuccessCoredumpTest() throws IOException, URISyntaxException { final String documentId = "UIDD-ABCD-EFGH"; Path coredumpPath = createProcessedCoredump(documentId); diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java index 4bbfe3e5b25..eefdcf4adad 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/FileHelperTest.java @@ -125,7 +125,7 @@ public class FileHelperTest { } @Test - public void testGetContentsOfNonExistingDirectory() throws IOException { + public void testGetContentsOfNonExistingDirectory() { Path fakePath = Paths.get("/some/made/up/dir/"); assertEquals(Collections.emptyList(), FileHelper.listContentsOfDirectory(fakePath)); } diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java index fc846e3eba6..5762975ec9b 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/commons/noderepo/IPAddressVerifierTest.java @@ -25,7 +25,7 @@ public class IPAddressVerifierTest { private String ipv6LookupFormat; @Before - public void setup() throws Exception { + public void setup() { ipv4LookupFormat = "8.4.2.10.in-addr.arpa"; ipv6LookupFormat = "4.3.2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.b.a.d.f.ip6.arpa"; } diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java index 04e9057b44e..70fab6eecb1 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/hardware/benchmarks/CPUBenchmarkTest.java @@ -68,7 +68,7 @@ public class CPUBenchmarkTest { } @Test - public void test_if_setCpuCyclesPerSec_reads_output_correctly() throws IOException { + public void test_if_setCpuCyclesPerSec_reads_output_correctly() { List parseResults = new ArrayList<>(); parseResults.add(new ParseResult("cycles", "2.066.201.729")); parseResults.add(new ParseResult("seconds", "0,957617512")); diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java index d878d6614f7..0cf6bb0907b 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/CPURetrieverTest.java @@ -33,7 +33,7 @@ public class CPURetrieverTest { } @Test - public void updateInfo_should_write_numOfCpuCores_to_hardware_info() throws Exception { + public void updateInfo_should_write_numOfCpuCores_to_hardware_info() { commandExecutor.addCommand("cat " + FILENAME); cpu.updateInfo(); double expectedAmountOfCores = 4; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java index 220d89f3be9..a72cca1c72a 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/DiskRetrieverTest.java @@ -44,14 +44,14 @@ public class DiskRetrieverTest { } @Test - public void updateDiskType__should_store_diskType_in_hardwareInfo() throws IOException { + public void updateDiskType__should_store_diskType_in_hardwareInfo() { commandExecutor.addCommand(CAT_RESOURCE_PATH + "DiskTypeFastDisk"); diskRetriever.updateDiskType(); assertEquals(DiskType.FAST, hardwareInfo.getDiskType()); } @Test - public void updateDiskSize__should_store_diskSize_in_hardwareInfo() throws IOException { + public void updateDiskSize__should_store_diskSize_in_hardwareInfo() { commandExecutor.addCommand(CAT_RESOURCE_PATH + "filesize"); diskRetriever.updateDiskSize(); double expectedSize = 1760.0; @@ -76,7 +76,7 @@ public class DiskRetrieverTest { } @Test - public void parseDiskType_with_invalid_outputstream_does_not_contain_searchword_should_throw_exception() throws Exception { + public void parseDiskType_with_invalid_outputstream_does_not_contain_searchword_should_throw_exception() { List mockOutput = commandExecutor.outputFromString("Name Rota"); try { diskRetriever.parseDiskType(mockOutput); diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java index 6b0b5f6d24a..1722abdc7b8 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/MemoryRetrieverTest.java @@ -32,7 +32,7 @@ public class MemoryRetrieverTest { } @Test - public void updateInfo_should_set_memory_available_in_hardwareInfo() throws IOException { + public void updateInfo_should_set_memory_available_in_hardwareInfo() { commandExecutor.addCommand("cat " + FILENAME); memory.updateInfo(); double expectedMemory = 4.042128; diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java index eb9f122b726..dad73a9bb90 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/verification/spec/retrievers/NetRetrieverTest.java @@ -62,7 +62,7 @@ public class NetRetrieverTest { } @Test - public void findInterfaceSpeed_valid_input() throws IOException { + public void findInterfaceSpeed_valid_input() { commandExecutor.addCommand("cat " + NET_FIND_INTERFACE); commandExecutor.addCommand("cat " + NET_CHECK_INTERFACE_SPEED); parseResults = net.findInterface(); -- cgit v1.2.3