Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@ public class FileUtil {

static public String findFirstString(String string, File file) {
String str;
try {
BufferedReader in = new BufferedReader(new FileReader(file) );
try (BufferedReader in = new BufferedReader(new FileReader(file))) {
while ( (str = in.readLine() ) != null ) {
if(str.indexOf(string)>=0) {
break;
}
}
in.close();
}
}
catch (IOException e) {
throw new RuntimeException("trouble with searching in " + file,e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ public class ResourceUtil {
public static void createResources(Object test, String[] resources, File resourcesDir) {
try {
for (String resource : resources) {
InputStream inputStream = resolveResourceLocation(test.getClass(), resource);
File resourceFile = new File(resourcesDir, resource);
File parent = resourceFile.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
try (InputStream inputStream = resolveResourceLocation(test.getClass(), resource)) {
File resourceFile = new File(resourcesDir, resource);
File parent = resourceFile.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
Files.copy(inputStream, resourceFile.toPath());
}
Files.copy(inputStream, resourceFile.toPath());
}
} catch (IOException e) {
throw new RuntimeException(e);
Expand Down