Strange phenomenon of Java's ability to export or download attachments

has made a function to allow users to download files uploaded in the project system,

downloading is not a problem, but the background will occasionally exception because of files with different suffixes, but it does not affect the download.

in the current test, there is no problem with exporting xlsx,txt, and all other types of files will report exceptions such as actively disconnecting a connection, but it does not affect the download.

I am puzzled.

the core code is as follows

public static void downloadFile(String fileFullName) throws IOException {
        HttpServletResponse response = getResponse();
        File f = new File(fileFullName);
        if (!f.exists()) {
            response.sendError(404, "File not found!");
            return;
        }
        BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
        byte[] buf = new byte[1024];
        int len = 0;

        response.reset(); 
 
        response.setContentType("application/x-msdownload");
        response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(f.getName(), "utf-8"));
        
        OutputStream out = response.getOutputStream();
        while ((len = br.read(buf)) > 0)
            out.write(buf, 0, len);
        br.close();
        out.close();
    }
Mar.10,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf1f48-31da1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf1f48-31da1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?