[caddx] Corrected try with resources on a test class (#9123)

Signed-off-by: Georgios Moutsos <georgios.moutsos@gmail.com>
This commit is contained in:
Georgios Moutsos 2020-11-25 09:05:25 +02:00 committed by GitHub
parent 55943502b5
commit af735031c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -41,8 +41,10 @@ public final class CaddxMessageReaderUtil {
* @return The raw bytes of a telegram
*/
public static byte[] readRawMessage(String messageName) {
try (InputStream is = CaddxMessageReaderUtil.class.getResourceAsStream(messageName + MESSAGE_EXT)) {
String hexString = new BufferedReader(new InputStreamReader(is)).lines().collect(Collectors.joining("\n"));
try (InputStream is = CaddxMessageReaderUtil.class.getResourceAsStream(messageName + MESSAGE_EXT);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr)) {
String hexString = br.lines().collect(Collectors.joining("\n"));
return HexUtils.hexToBytes(hexString, " ");
} catch (IOException e) {