mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -110,7 +110,7 @@ public class SevenZArchiver implements Archiver {
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
}
|
||||
IoUtil.close(this.sevenZOutputFile);
|
||||
IoUtil.closeQuietly(this.sevenZOutputFile);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -145,7 +145,7 @@ public class StreamArchiver implements Archiver {
|
||||
} catch (final Exception ignore) {
|
||||
//ignore
|
||||
}
|
||||
IoUtil.close(this.out);
|
||||
IoUtil.closeQuietly(this.out);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -158,6 +158,6 @@ public class SevenZExtractor implements Extractor, RandomAccess {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.sevenZFile);
|
||||
IoUtil.closeQuietly(this.sevenZFile);
|
||||
}
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ public class StreamExtractor implements Extractor {
|
||||
}
|
||||
} catch (final ArchiveException e) {
|
||||
// issue#2384,如果报错可能持有文件句柄,导致无法删除文件
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(in);
|
||||
throw new CompressException(e);
|
||||
}
|
||||
}
|
||||
@@ -168,6 +168,6 @@ public class StreamExtractor implements Extractor {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.in);
|
||||
IoUtil.closeQuietly(this.in);
|
||||
}
|
||||
}
|
||||
|
@@ -294,7 +294,7 @@ public class Mail implements Builder<MimeMessage> {
|
||||
in = FileUtil.getInputStream(imageFile);
|
||||
return addImage(cid, in, FileTypeMap.getDefaultFileTypeMap().getContentType(imageFile));
|
||||
} finally {
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -411,7 +411,7 @@ public class MailUtil {
|
||||
for (final Entry<String, InputStream> entry : imageMap.entrySet()) {
|
||||
mail.addImage(entry.getKey(), entry.getValue());
|
||||
// 关闭流
|
||||
IoUtil.close(entry.getValue());
|
||||
IoUtil.closeQuietly(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -566,7 +566,7 @@ public class JakartaServletUtil {
|
||||
} catch (final IOException e) {
|
||||
throw new UtilException(e);
|
||||
} finally {
|
||||
IoUtil.close(writer);
|
||||
IoUtil.closeQuietly(writer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ public class JakartaServletUtil {
|
||||
in = FileUtil.getInputStream(file);
|
||||
write(response, in, contentType, fileName);
|
||||
} finally {
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,8 +658,8 @@ public class JakartaServletUtil {
|
||||
} catch (final IOException e) {
|
||||
throw new UtilException(e);
|
||||
} finally {
|
||||
IoUtil.close(out);
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(out);
|
||||
IoUtil.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -565,7 +565,7 @@ public class ServletUtil {
|
||||
} catch (final IOException e) {
|
||||
throw new UtilException(e);
|
||||
} finally {
|
||||
IoUtil.close(writer);
|
||||
IoUtil.closeQuietly(writer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ public class ServletUtil {
|
||||
in = FileUtil.getInputStream(file);
|
||||
write(response, in, contentType, fileName);
|
||||
} finally {
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -657,8 +657,8 @@ public class ServletUtil {
|
||||
} catch (final IOException e) {
|
||||
throw new UtilException(e);
|
||||
} finally {
|
||||
IoUtil.close(out);
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(out);
|
||||
IoUtil.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -477,7 +477,7 @@ public class JschUtil {
|
||||
} catch (final JSchException e) {
|
||||
throw new JschRuntimeException(e);
|
||||
} finally {
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(in);
|
||||
close(channel);
|
||||
}
|
||||
}
|
||||
@@ -511,8 +511,8 @@ public class JschUtil {
|
||||
} catch (final IOException e) {
|
||||
throw new IORuntimeException(e);
|
||||
} finally {
|
||||
IoUtil.close(out);
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(out);
|
||||
IoUtil.closeQuietly(in);
|
||||
close(shell);
|
||||
}
|
||||
}
|
||||
|
@@ -255,7 +255,7 @@ public class SshjSftp extends AbstractFtp {
|
||||
} catch (final Exception e) {
|
||||
throw new FtpException(e);
|
||||
} finally {
|
||||
IoUtil.close(session);
|
||||
IoUtil.closeQuietly(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ public interface Template {
|
||||
out = FileUtil.getOutputStream(file);
|
||||
this.render(bindingMap, out);
|
||||
} finally {
|
||||
IoUtil.close(out);
|
||||
IoUtil.closeQuietly(out);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -115,7 +115,7 @@ public class JAXBUtil {
|
||||
} catch (final Exception e) {
|
||||
throw new RuntimeException("convertToJava2 错误:" + e.getMessage(), e);
|
||||
} finally {
|
||||
IoUtil.close(reader);
|
||||
IoUtil.closeQuietly(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ public class FtpTest {
|
||||
ftp.cd("/file/aaa");
|
||||
Console.log(ftp.pwd());
|
||||
|
||||
IoUtil.close(ftp);
|
||||
IoUtil.closeQuietly(ftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -30,7 +30,7 @@ public class FtpTest {
|
||||
final boolean upload = ftp.uploadFile("/temp", FileUtil.file("d:/test/test.zip"));
|
||||
Console.log(upload);
|
||||
|
||||
IoUtil.close(ftp);
|
||||
IoUtil.closeQuietly(ftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -54,7 +54,7 @@ public class FtpTest {
|
||||
|
||||
Console.log("打印pwd: " + ftp.pwd());
|
||||
|
||||
IoUtil.close(ftp);
|
||||
IoUtil.closeQuietly(ftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,7 +63,7 @@ public class FtpTest {
|
||||
final Ftp ftp = new Ftp("looly.centos");
|
||||
ftp.recursiveDownloadFolder("/",FileUtil.file("d:/test/download"));
|
||||
|
||||
IoUtil.close(ftp);
|
||||
IoUtil.closeQuietly(ftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -75,7 +75,7 @@ public class FtpTest {
|
||||
Console.log(ftp.pwd());
|
||||
ftp.recursiveDownloadFolder("/",FileUtil.file("d:/test/download"));
|
||||
|
||||
IoUtil.close(ftp);
|
||||
IoUtil.closeQuietly(ftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -90,7 +90,7 @@ public class FtpTest {
|
||||
FileUtil.file("d:/test/download/" + name));
|
||||
}
|
||||
|
||||
IoUtil.close(ftp);
|
||||
IoUtil.closeQuietly(ftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@@ -71,7 +71,7 @@ public class JschUtilTest {
|
||||
|
||||
Console.log("打印pwd: " + sftp.pwd());
|
||||
|
||||
IoUtil.close(sftp);
|
||||
IoUtil.closeQuietly(sftp);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user