Пишет, что FileInputStream не закрывается :
public class Solution {
public static void main(
String[] args) throws
DownloadException,
IOException {
/*
FileInputStream
file1 ;
*/
while (true) {
try (
BufferedReader reader =
new BufferedReader(
new InputStreamReader(
System.in));
FileInputStream
file1 =
new FileInputStream(
reader.readLine())) {
int size =
file1.available();
System.out.println(
"size = "+size);
if (size < 1000) {
reader.close();
file1.close();
throw new
DownloadException();
}
file1.close();
}
}
}
public static class
DownloadException
extends Exception {
public
DownloadException () {
System.out.println(
"DownloadException");
}
}
}
package com.javarush.task.task18.task1810;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.Exception;
/* DownloadException */
public class Solution {
public static void main(
String[] args) throws
DownloadException,
IOException {
while (true) {
try (
BufferedReader reader =
new BufferedReader(
new InputStreamReader(
System.in));
FileInputStream
file1 =
new FileInputStream(
reader.readLine())) {
int size =
file1.available();
System.out.println(
"size = "+size);
if (size < 1000) {
//reader.close();
file1.close();
throw new
DownloadException();
}
file1.close();
}
}
}
public static class
DownloadException
extends Exception {
public
DownloadException () {
System.out.println(
"DownloadException");
}
}
}