diff --git a/src/main/java/emissary/config/ExtractResource.java b/src/main/java/emissary/config/ExtractResource.java index 144088341a..a9bccb6ba8 100644 --- a/src/main/java/emissary/config/ExtractResource.java +++ b/src/main/java/emissary/config/ExtractResource.java @@ -43,8 +43,8 @@ public String getResource(final String theResource) throws IOException { } logger.debug("Reading " + resource); final String result; - try (final InputStream is = ConfigUtil.getConfigStream(resource); - final ByteArrayOutputStream baos = new ByteArrayOutputStream()) { + try (InputStream is = ConfigUtil.getConfigStream(resource); + ByteArrayOutputStream baos = new ByteArrayOutputStream()) { final byte[] buf = new byte[4096]; int thisReadOp = 0; while ((thisReadOp = is.read(buf)) > -1) { @@ -63,7 +63,7 @@ public void writeResource(final String theResource) throws IOException { final String rezdata = getResource(resource); final String outputPath = this.outputDirectory + "/" + resource.replaceAll("/", "."); logger.debug("Writing " + outputPath); - try (final BufferedOutputStream os = new BufferedOutputStream(Files.newOutputStream(Paths.get(outputPath)))) { + try (BufferedOutputStream os = new BufferedOutputStream(Files.newOutputStream(Paths.get(outputPath)))) { os.write(rezdata.getBytes()); } } diff --git a/src/main/java/emissary/core/BaseDataObject.java b/src/main/java/emissary/core/BaseDataObject.java index e390e27f89..ce755643c1 100755 --- a/src/main/java/emissary/core/BaseDataObject.java +++ b/src/main/java/emissary/core/BaseDataObject.java @@ -470,7 +470,7 @@ public long getChannelSize() throws IOException { case BYTE_ARRAY_ONLY: return ArrayUtils.getLength(theData); case CHANNEL_ONLY: - try (final SeekableByteChannel sbc = this.seekableByteChannelFactory.create()) { + try (SeekableByteChannel sbc = this.seekableByteChannelFactory.create()) { return sbc.size(); } case NO_DATA: diff --git a/src/main/java/emissary/core/channels/InputStreamChannelFactory.java b/src/main/java/emissary/core/channels/InputStreamChannelFactory.java index 1a5f36266a..acb0abb2b2 100644 --- a/src/main/java/emissary/core/channels/InputStreamChannelFactory.java +++ b/src/main/java/emissary/core/channels/InputStreamChannelFactory.java @@ -87,7 +87,7 @@ protected final int readImpl(final ByteBuffer byteBuffer) throws IOException { @Override protected long sizeImpl() throws IOException { if (size < 0) { - try (final InputStream is = inputStreamFactory.create()) { + try (InputStream is = inputStreamFactory.create()) { size = SeekableByteChannelHelper.available(is); } } diff --git a/src/main/java/emissary/core/channels/SeekableByteChannelHelper.java b/src/main/java/emissary/core/channels/SeekableByteChannelHelper.java index 21a1ce94bc..c35aceb58f 100644 --- a/src/main/java/emissary/core/channels/SeekableByteChannelHelper.java +++ b/src/main/java/emissary/core/channels/SeekableByteChannelHelper.java @@ -85,7 +85,7 @@ public static SeekableByteChannelFactory inputStream(final long size, final Inpu * @return a byte array of the data from the BDO sized up to maxSize (so could truncate data) */ public static byte[] getByteArrayFromBdo(final IBaseDataObject ibdo, final int maxSize) { - try (final SeekableByteChannel sbc = ibdo.getChannelFactory().create()) { + try (SeekableByteChannel sbc = ibdo.getChannelFactory().create()) { final long truncatedBy = sbc.size() - maxSize; if (truncatedBy > 0 && logger.isWarnEnabled()) { logger.warn("Returned data for [{}] will be truncated by {} bytes due to size constraints of byte arrays", ibdo.shortName(), @@ -108,7 +108,7 @@ public static byte[] getByteArrayFromBdo(final IBaseDataObject ibdo, final int m * @throws IOException if we couldn't read all the data */ public static byte[] getByteArrayFromChannel(final SeekableByteChannelFactory sbcf, final int maxSize) throws IOException { - try (final SeekableByteChannel sbc = sbcf.create()) { + try (SeekableByteChannel sbc = sbcf.create()) { final int byteArraySize = (int) Math.min(sbc.size(), maxSize); final ByteBuffer buff = ByteBuffer.allocate(byteArraySize); diff --git a/src/main/java/emissary/jni/JNI.java b/src/main/java/emissary/jni/JNI.java index 30b1602bf6..37862a0c6a 100755 --- a/src/main/java/emissary/jni/JNI.java +++ b/src/main/java/emissary/jni/JNI.java @@ -326,8 +326,8 @@ public boolean retrieveFile(final String filename, final String[] errmsg) { } // Save the contents into the disk file - try (final FileOutputStream fos = new FileOutputStream(fullPathName); - final BufferedOutputStream bos = new BufferedOutputStream(fos)) { + try (FileOutputStream fos = new FileOutputStream(fullPathName); + BufferedOutputStream bos = new BufferedOutputStream(fos)) { bos.write(libContents, 0, libContents.length); } catch (IOException ioe) { errmsg[0] = "Cannot write retrieved JNI library to " + fullPathName + ": " + ioe; diff --git a/src/main/java/emissary/jni/JniRepositoryPlace.java b/src/main/java/emissary/jni/JniRepositoryPlace.java index b60629d540..c774c1395e 100755 --- a/src/main/java/emissary/jni/JniRepositoryPlace.java +++ b/src/main/java/emissary/jni/JniRepositoryPlace.java @@ -95,8 +95,8 @@ private void configurePlace() { return null; } - try (final InputStream theFile = Files.newInputStream(nativeLib.toPath()); - final DataInputStream theStream = new DataInputStream(theFile)) { + try (InputStream theFile = Files.newInputStream(nativeLib.toPath()); + DataInputStream theStream = new DataInputStream(theFile)) { final byte[] theContent = new byte[theStream.available()]; theStream.readFully(theContent); return theContent; diff --git a/src/main/java/emissary/kff/ChecksumCalculator.java b/src/main/java/emissary/kff/ChecksumCalculator.java index 43c4bcd0de..a94c0dd020 100755 --- a/src/main/java/emissary/kff/ChecksumCalculator.java +++ b/src/main/java/emissary/kff/ChecksumCalculator.java @@ -179,7 +179,7 @@ public ChecksumResults digest(final SeekableByteChannelFactory sbcf) { final byte[] b = new byte[1024]; for (final MessageDigest d : digest) { - try (final InputStream is = Channels.newInputStream(sbcf.create())) { + try (InputStream is = Channels.newInputStream(sbcf.create())) { d.reset(); int bytesRead; @@ -194,7 +194,7 @@ public ChecksumResults digest(final SeekableByteChannelFactory sbcf) { } if (crc != null) { - try (final InputStream is = Channels.newInputStream(sbcf.create())) { + try (InputStream is = Channels.newInputStream(sbcf.create())) { crc.reset(); int bytesRead; diff --git a/src/main/java/emissary/kff/KffChain.java b/src/main/java/emissary/kff/KffChain.java index 9700139a8c..7e9df1db4a 100755 --- a/src/main/java/emissary/kff/KffChain.java +++ b/src/main/java/emissary/kff/KffChain.java @@ -154,7 +154,7 @@ public KffResult check(final String itemName, final SeekableByteChannelFactory s final ChecksumResults sums = computeSums(sbcf); KffResult answer = null; long sbcSize = 0; - try (final SeekableByteChannel sbc = sbcf.create()) { + try (SeekableByteChannel sbc = sbcf.create()) { sbcSize = sbc.size(); } if (sbcSize < kffMinDataSize || list.isEmpty()) { diff --git a/src/main/java/emissary/kff/KffDataObjectHandler.java b/src/main/java/emissary/kff/KffDataObjectHandler.java index b4ba35fad0..15be77c7c6 100755 --- a/src/main/java/emissary/kff/KffDataObjectHandler.java +++ b/src/main/java/emissary/kff/KffDataObjectHandler.java @@ -139,7 +139,7 @@ public Map hashData(final SeekableByteChannelFactory sbcf, final KffResult kffCheck = null; if (sbcf != null) { - try (final SeekableByteChannel sbc = sbcf.create()) { + try (SeekableByteChannel sbc = sbcf.create()) { if (sbc.size() > 0) { kffCheck = kff.check(name, sbcf); } diff --git a/src/main/java/emissary/kff/Ssdeep.java b/src/main/java/emissary/kff/Ssdeep.java index ceaa6597db..a66b766cc2 100644 --- a/src/main/java/emissary/kff/Ssdeep.java +++ b/src/main/java/emissary/kff/Ssdeep.java @@ -128,7 +128,7 @@ public SsContext(@Nullable final byte[] data) { public SsContext(final SeekableByteChannelFactory sbcf) { long expectedInputLength = 0; - try (final SeekableByteChannel sbc = sbcf.create()) { + try (SeekableByteChannel sbc = sbcf.create()) { expectedInputLength = sbc.size(); } catch (final IOException ioe) { // Ignore @@ -283,7 +283,7 @@ public SpamSumSignature generateHash(final SeekableByteChannelFactory sbcf) { beginHashing(); final RollingState rollState = new RollingState(); - try (final InputStream is = Channels.newInputStream(sbcf.create())) { + try (InputStream is = Channels.newInputStream(sbcf.create())) { final byte[] b = new byte[1024]; int bytesRead; @@ -438,7 +438,7 @@ public String fuzzyHash(final SeekableByteChannelFactory sbcf) { * @throws IOException If there is some I/O problem accessing the file. */ public String fuzzyHashFile(final File file) throws IOException { - try (final RandomAccessFile stream = new RandomAccessFile(file, "r")) { + try (RandomAccessFile stream = new RandomAccessFile(file, "r")) { final SsContext ctx = new SsContext(file); while (true) { stream.seek(0); @@ -706,7 +706,7 @@ public int compare(@Nullable final SpamSumSignature signature1, @Nullable final public static void main(final String[] args) throws Exception { final Ssdeep ss = new Ssdeep(); for (final String f : args) { - try (final InputStream is = Files.newInputStream(Paths.get(f))) { + try (InputStream is = Files.newInputStream(Paths.get(f))) { final byte[] buffer = IOUtils.toByteArray(is); // output format matches the original ssdeep program System.out.println(ss.fuzzyHash(buffer) + ",\"" + f + "\""); diff --git a/src/main/java/emissary/server/EmissaryServer.java b/src/main/java/emissary/server/EmissaryServer.java index b4a0bb45e4..a7c45a01cf 100644 --- a/src/main/java/emissary/server/EmissaryServer.java +++ b/src/main/java/emissary/server/EmissaryServer.java @@ -770,7 +770,7 @@ private static SslContextFactory.Server getSslContextFactory() throws IOExceptio sslContextFactory.setKeyStorePassword(keystorePass); KeyStore trustStoreInstance; - try (final InputStream is = Files.newInputStream(Paths.get(trustStore))) { + try (InputStream is = Files.newInputStream(Paths.get(trustStore))) { trustStoreInstance = KeyStore.getInstance("JKS"); trustStoreInstance.load(is, trustStorePass.toCharArray()); } catch (KeyStoreException | CertificateException | NoSuchAlgorithmException e) { diff --git a/src/main/java/emissary/util/PkiUtil.java b/src/main/java/emissary/util/PkiUtil.java index 2772b5161c..32a2dd03dd 100644 --- a/src/main/java/emissary/util/PkiUtil.java +++ b/src/main/java/emissary/util/PkiUtil.java @@ -51,7 +51,7 @@ public static KeyStore buildStore(@Nullable final String path, final char[] pazz if (isPemCertificate(pemData)) { loadKeyStore(keyStore, pemData); } else { - try (final InputStream is = Files.newInputStream(Paths.get(path))) { + try (InputStream is = Files.newInputStream(Paths.get(path))) { keyStore.load(is, pazz); } } diff --git a/src/main/java/emissary/util/shell/Executrix.java b/src/main/java/emissary/util/shell/Executrix.java index a51f600fd8..6bfabfa5ee 100755 --- a/src/main/java/emissary/util/shell/Executrix.java +++ b/src/main/java/emissary/util/shell/Executrix.java @@ -262,8 +262,8 @@ public static boolean writeDataToFile(@Nullable final byte[] theContent, final S */ public static void writeFile(final byte[] theContent, final int pos, final int len, final String filename, final boolean append) throws IOException { - try (final FileOutputStream theOutput = new FileOutputStream(filename, append); - final BufferedOutputStream theStream = new BufferedOutputStream(theOutput)) { + try (FileOutputStream theOutput = new FileOutputStream(filename, append); + BufferedOutputStream theStream = new BufferedOutputStream(theOutput)) { theStream.write(theContent, pos, len); } } diff --git a/src/main/java/emissary/util/xml/AbstractJDOMUtil.java b/src/main/java/emissary/util/xml/AbstractJDOMUtil.java index 20fda8cefb..94f87d6a6f 100755 --- a/src/main/java/emissary/util/xml/AbstractJDOMUtil.java +++ b/src/main/java/emissary/util/xml/AbstractJDOMUtil.java @@ -121,7 +121,7 @@ protected static Document createDocument(final InputSource is, @Nullable final X @Nullable public static String toString(final Document jdom) { final XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); - try (final ByteArrayOutputStream os = new ByteArrayOutputStream()) { + try (ByteArrayOutputStream os = new ByteArrayOutputStream()) { outputter.output(jdom, os); return os.toString(); } catch (IOException iox) { diff --git a/src/test/java/emissary/config/ServiceConfigGuideTest.java b/src/test/java/emissary/config/ServiceConfigGuideTest.java index 2814ac106c..a53da83535 100755 --- a/src/test/java/emissary/config/ServiceConfigGuideTest.java +++ b/src/test/java/emissary/config/ServiceConfigGuideTest.java @@ -427,7 +427,7 @@ void testConstructors() throws IOException { // Write the config bytes out to a temp file final File scfile = File.createTempFile("temp", ".cfg"); scfile.deleteOnExit(); - try (final OutputStream os = Files.newOutputStream(scfile.toPath())) { + try (OutputStream os = Files.newOutputStream(scfile.toPath())) { os.write(cdata.getBytes()); } diff --git a/src/test/java/emissary/core/BaseDataObjectTest.java b/src/test/java/emissary/core/BaseDataObjectTest.java index 14664415d8..12df2bb119 100755 --- a/src/test/java/emissary/core/BaseDataObjectTest.java +++ b/src/test/java/emissary/core/BaseDataObjectTest.java @@ -169,7 +169,7 @@ void testExceptionWhenGettingChannelFactory() throws IOException { // Hook into the SBCF this.b.setChannelFactory(sbcf); // Hook into an SBC - try (final SeekableByteChannel sbc = Mockito.spy(this.b.getChannelFactory().create())) { + try (SeekableByteChannel sbc = Mockito.spy(this.b.getChannelFactory().create())) { // Always return this spied SBC Mockito.when(sbcf.create()).thenReturn(sbc); // Kick an exception when calling size() @@ -185,7 +185,7 @@ void testExceptionWhenGettingChannelSize() throws IOException { final SeekableByteChannelFactory sbcf = Mockito.spy(SeekableByteChannelHelper.memory("Test data".getBytes())); this.b.setChannelFactory(sbcf); // Hook into an SBC - try (final SeekableByteChannel sbc = Mockito.spy(this.b.getChannelFactory().create())) { + try (SeekableByteChannel sbc = Mockito.spy(this.b.getChannelFactory().create())) { // Always return this spied SBC Mockito.when(sbcf.create()).thenReturn(sbc); // Kick an exception when asking for the size @@ -1316,8 +1316,8 @@ void testNewInputStream() throws IOException { ibdo.setData(bytes1); - try (final InputStream bytesInputStream = ibdo.newInputStream(); - final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();) { + try (InputStream bytesInputStream = ibdo.newInputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();) { IOUtils.copy(bytesInputStream, byteArrayOutputStream); assertArrayEquals(bytes1, byteArrayOutputStream.toByteArray()); @@ -1328,8 +1328,8 @@ void testNewInputStream() throws IOException { ibdo.setChannelFactory(sbcf); - try (final InputStream sbcfInputStream = ibdo.newInputStream(); - final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { + try (InputStream sbcfInputStream = ibdo.newInputStream(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { IOUtils.copy(sbcfInputStream, byteArrayOutputStream); assertArrayEquals(bytes2, byteArrayOutputStream.toByteArray()); diff --git a/src/test/java/emissary/core/channels/ChannelTestHelper.java b/src/test/java/emissary/core/channels/ChannelTestHelper.java index aad3b81814..1427cabf3e 100644 --- a/src/test/java/emissary/core/channels/ChannelTestHelper.java +++ b/src/test/java/emissary/core/channels/ChannelTestHelper.java @@ -15,7 +15,7 @@ public class ChannelTestHelper { public static void checkByteArrayAgainstSbc(final byte[] bytesToVerify, final SeekableByteChannelFactory sbcf) throws IOException { - try (final SeekableByteChannel sbc = sbcf.create()) { + try (SeekableByteChannel sbc = sbcf.create()) { int startIndex; int length; for (startIndex = 0; startIndex < bytesToVerify.length; startIndex++) { diff --git a/src/test/java/emissary/core/channels/ImmutableChannelFactoryTest.java b/src/test/java/emissary/core/channels/ImmutableChannelFactoryTest.java index bfb52619aa..2ffe0fb5b4 100644 --- a/src/test/java/emissary/core/channels/ImmutableChannelFactoryTest.java +++ b/src/test/java/emissary/core/channels/ImmutableChannelFactoryTest.java @@ -28,7 +28,7 @@ public SeekableByteChannel create() { }; final SeekableByteChannelFactory sbcf = ImmutableChannelFactory.create(simbcf); final ByteBuffer buff = ByteBuffer.wrap(TEST_STRING.concat(TEST_STRING).getBytes()); - try (final SeekableByteChannel sbc = sbcf.create()) { + try (SeekableByteChannel sbc = sbcf.create()) { assertThrows(NonWritableChannelException.class, () -> sbc.write(buff), "Writes aren't allowed to immutable channels"); } } diff --git a/src/test/java/emissary/core/channels/InputStreamChannelFactoryTest.java b/src/test/java/emissary/core/channels/InputStreamChannelFactoryTest.java index 8a06aab3e3..dc0d9066fe 100644 --- a/src/test/java/emissary/core/channels/InputStreamChannelFactoryTest.java +++ b/src/test/java/emissary/core/channels/InputStreamChannelFactoryTest.java @@ -88,7 +88,7 @@ void testRead() throws IOException { @Test void testSize() throws IOException { // Normal path - try (final SeekableByteChannel sbc = InputStreamChannelFactory.create(testBytes.length, new TestInputStreamFactory(testBytes)).create()) { + try (SeekableByteChannel sbc = InputStreamChannelFactory.create(testBytes.length, new TestInputStreamFactory(testBytes)).create()) { ByteBuffer buff = ByteBuffer.allocate(32); assertEquals(testBytes.length, sbc.size()); assertEquals(testBytes.length, sbc.read(buff)); @@ -99,7 +99,7 @@ void testSize() throws IOException { @Test void testCanWorkOutSize() throws IOException { // Make the factory work it out - try (final SeekableByteChannel sbc = InputStreamChannelFactory.create(-1, new TestInputStreamFactory(testBytes)).create()) { + try (SeekableByteChannel sbc = InputStreamChannelFactory.create(-1, new TestInputStreamFactory(testBytes)).create()) { ByteBuffer buff = ByteBuffer.allocate(32); assertEquals(testBytes.length, sbc.size()); assertEquals(testBytes.length, sbc.read(buff)); @@ -111,7 +111,7 @@ void testCanWorkOutSize() throws IOException { void testReadWithIncorrectSize() throws IOException { // You can set the size incorrectly, but this is still 'valid' final int sbcLength = testBytes.length + 8; - try (final SeekableByteChannel sbc = InputStreamChannelFactory.create(sbcLength, new TestInputStreamFactory(testBytes)).create()) { + try (SeekableByteChannel sbc = InputStreamChannelFactory.create(sbcLength, new TestInputStreamFactory(testBytes)).create()) { ByteBuffer buff = ByteBuffer.allocate(32); assertEquals(sbcLength, sbc.size()); assertEquals(testBytes.length, sbc.read(buff)); @@ -122,7 +122,7 @@ void testReadWithIncorrectSize() throws IOException { @Test void testReadWithZeroSize() throws IOException { // Zero length channel - will always be EOS, not reading anything into the buffer - try (final SeekableByteChannel sbc = InputStreamChannelFactory.create(0, new TestInputStreamFactory(testBytes)).create()) { + try (SeekableByteChannel sbc = InputStreamChannelFactory.create(0, new TestInputStreamFactory(testBytes)).create()) { ByteBuffer buff = ByteBuffer.allocate(1); assertEquals(0, sbc.size()); assertEquals(-1, sbc.read(buff)); @@ -134,7 +134,7 @@ void testReadWithZeroSize() throws IOException { void testStartReadBeyondActualData() throws IOException { // Set an SBC that is larger than the data we have, ensure an IOException occurs when reading final int sbcLength = testBytes.length + 8; - try (final SeekableByteChannel sbc = InputStreamChannelFactory.create(sbcLength, new TestInputStreamFactory(testBytes)).create()) { + try (SeekableByteChannel sbc = InputStreamChannelFactory.create(sbcLength, new TestInputStreamFactory(testBytes)).create()) { ByteBuffer buff = ByteBuffer.allocate(32); assertEquals(sbcLength, sbc.size()); // Set position beyond length @@ -148,7 +148,7 @@ void testStartReadBeyondActualData() throws IOException { void testReadWithLargerThanDefinedSize() throws IOException { final int sbcLength = testBytes.length / 2; // Set an SBC that is smaller than the amount of data we have, ensure that we can't read more than the defined size - try (final SeekableByteChannel sbc = InputStreamChannelFactory.create(sbcLength, new TestInputStreamFactory(testBytes)).create()) { + try (SeekableByteChannel sbc = InputStreamChannelFactory.create(sbcLength, new TestInputStreamFactory(testBytes)).create()) { ByteBuffer buff = ByteBuffer.allocate(32); assertEquals(sbcLength, sbc.size()); sbc.read(buff); diff --git a/src/test/java/emissary/output/roller/journal/JournaledChannelPoolTest.java b/src/test/java/emissary/output/roller/journal/JournaledChannelPoolTest.java index 98bfb4e053..2d80ffb8ee 100644 --- a/src/test/java/emissary/output/roller/journal/JournaledChannelPoolTest.java +++ b/src/test/java/emissary/output/roller/journal/JournaledChannelPoolTest.java @@ -69,7 +69,7 @@ void testGetJournalEntries() throws IOException, InterruptedException { } final ArrayList result = new ArrayList<>(); for (final Path journalPath : JournalReader.getJournalPaths(this.directory)) { - try (final JournalReader jr = new JournalReader(journalPath)) { + try (JournalReader jr = new JournalReader(journalPath)) { Journal j = jr.getJournal(); result.addAll(j.getEntries()); } diff --git a/src/test/java/emissary/server/mvc/internal/DeregisterPlaceActionTest.java b/src/test/java/emissary/server/mvc/internal/DeregisterPlaceActionTest.java index 5289ce435c..5b92989d77 100644 --- a/src/test/java/emissary/server/mvc/internal/DeregisterPlaceActionTest.java +++ b/src/test/java/emissary/server/mvc/internal/DeregisterPlaceActionTest.java @@ -63,7 +63,7 @@ void badParams(String badParam) { formParams.replace(ADD_KEY, Collections.singletonList(badParam)); // test - try (final Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -80,7 +80,7 @@ void cleanParams(String paramsToSanitize) { formParams.replace(ADD_KEY, Collections.singletonList(paramsToSanitize)); // test - try (final Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -95,7 +95,7 @@ void badDirectoryParam() { formParams.replace(TARGET_DIRECTORY, Collections.singletonList("CantFindThis")); // test - try (final Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -107,7 +107,7 @@ void badDirectoryParam() { @Test void removeSingleDirectory() { // test - try (final Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); @@ -121,7 +121,7 @@ void removeWithInvalidSecondKey() { // setup formParams.replace(ADD_KEY, Arrays.asList(ADD_KEY_DIR, "ThisOneWontHit")); // test - try (final Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); @@ -136,7 +136,7 @@ void removeWithMissingSecondKey() { // setup formParams.replace(ADD_KEY, Arrays.asList(ADD_KEY_DIR, ADD_KEY_DIR + "MissingMe")); // test - try (final Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(DEREGISTER_PLACE_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); diff --git a/src/test/java/emissary/server/mvc/internal/FailDirectoryActionTest.java b/src/test/java/emissary/server/mvc/internal/FailDirectoryActionTest.java index c8711ef42e..5a8e6e4579 100644 --- a/src/test/java/emissary/server/mvc/internal/FailDirectoryActionTest.java +++ b/src/test/java/emissary/server/mvc/internal/FailDirectoryActionTest.java @@ -69,7 +69,7 @@ void badParams(String badParam) { formParams.replace(ADD_KEY, Collections.singletonList(badParam)); // test - try (final Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -86,7 +86,7 @@ void cleanParams(String paramsToSanitize) { formParams.replace(ADD_KEY, Collections.singletonList(paramsToSanitize)); // test - try (final Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -98,7 +98,7 @@ void cleanParams(String paramsToSanitize) { @Test void failDirectoryNonPropagating() { // test - try (final Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); @@ -120,7 +120,7 @@ void failDirectoryPropagating() { formParams.put(ADD_PROPAGATION_FLAG, Collections.singletonList("true")); // test - try (final Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); @@ -137,7 +137,7 @@ void badDirectoryPlaceLookup() { formParams.replace(TARGET_DIRECTORY, Collections.singletonList("WontFindThis")); // test - try (final Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(FAIL_DIRECTORY_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); diff --git a/src/test/java/emissary/server/mvc/internal/HeartbeatActionTest.java b/src/test/java/emissary/server/mvc/internal/HeartbeatActionTest.java index 5d74ee6869..ee68eda620 100644 --- a/src/test/java/emissary/server/mvc/internal/HeartbeatActionTest.java +++ b/src/test/java/emissary/server/mvc/internal/HeartbeatActionTest.java @@ -62,7 +62,7 @@ void badParams(String badValue) { formParams.put(HeartbeatAdapter.TO_PLACE_NAME, Collections.singletonList(badValue)); // test - try (final Response response = target(HEARTBEAT_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(HEARTBEAT_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -74,7 +74,7 @@ void badParams(String badValue) { @Test void heartbeat() { // test - try (final Response response = target(HEARTBEAT_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(HEARTBEAT_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); @@ -91,7 +91,7 @@ void directoryNotRunning() { Namespace.bind(TO_PLACE, dp); // test - try (final Response response = target(HEARTBEAT_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(HEARTBEAT_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status); diff --git a/src/test/java/emissary/server/mvc/internal/WorkBundleCompletedActionTest.java b/src/test/java/emissary/server/mvc/internal/WorkBundleCompletedActionTest.java index 93f33ba4cc..195886dbd0 100644 --- a/src/test/java/emissary/server/mvc/internal/WorkBundleCompletedActionTest.java +++ b/src/test/java/emissary/server/mvc/internal/WorkBundleCompletedActionTest.java @@ -63,7 +63,7 @@ void emptyParams(String badValue) { formParams.replace(WORK_BUNDLE_STATUS, Collections.singletonList(badValue)); // test - try (final Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -78,7 +78,7 @@ void badWorkSpaceKey() { formParams.replace(SPACE_NAME, Collections.singletonList("ThisShouldCauseAnException")); // test - try (final Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -93,7 +93,7 @@ void missingWorkSpaceKey() { formParams.replace(SPACE_NAME, Collections.singletonList(WORKSPACE_NAME + "ThisWillMiss")); // test - try (final Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -110,7 +110,7 @@ void badPickupClientKey() { formParams.replace(CLIENT_NAME, Collections.singletonList("ThisIsBad")); // test - try (final Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -122,7 +122,7 @@ void badPickupClientKey() { @Test void itemNotPresentInPending() { // test - try (final Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(500, status); @@ -141,7 +141,7 @@ void successfulSubmission() throws Exception { Namespace.bind(WORKSPACE_BIND_KEY, spyWs); // test - try (final Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { + try (Response response = target(WORK_BUNDLE_COMPLETED_ACTION).request().post(Entity.form(formParams))) { // verify final int status = response.getStatus(); assertEquals(200, status);