From 755bd7fd6b74d520a3fced16a35b3725f31d63e8 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Mon, 27 Mar 2023 09:30:22 -0400 Subject: [PATCH] Use try with resources in integhration test --- src/it/MRESOURCES-99/verify.groovy | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/it/MRESOURCES-99/verify.groovy b/src/it/MRESOURCES-99/verify.groovy index c1944a4..b0b2e7d 100644 --- a/src/it/MRESOURCES-99/verify.groovy +++ b/src/it/MRESOURCES-99/verify.groovy @@ -23,8 +23,6 @@ import java.util.List; import java.util.Collections; import java.util.Arrays; -import org.codehaus.plexus.util.*; - boolean result = true; File target = new File( basedir, "target" ); @@ -43,23 +41,14 @@ if ( !someResource.exists() || someResource.isDirectory() ) Properties props = new Properties(); -FileInputStream fis = null; -try -{ - fis = new FileInputStream( someResource ); +try (FileInputStream fis = new FileInputStream( someResource )) { props.load( fis ); - fis.close(); - fis = null; } catch ( IOException ex ) { System.err.println( "Failure during reading the properties " + someResource.getAbsolutePath() ); return false; } -finally -{ - IOUtil.close( fis ); -} def keysWhichHaveToExist = [ "timestamp",