This commit is contained in:
Looly
2023-03-27 02:02:10 +08:00
parent 16f7549c7d
commit 4fca8310e7
96 changed files with 307 additions and 315 deletions

View File

@@ -263,7 +263,7 @@ public class CsvBaseReader implements Serializable {
rowHandler.accept(csvParser.next());
}
} finally {
IoUtil.close(csvParser);
IoUtil.closeQuietly(csvParser);
}
}

View File

@@ -143,6 +143,6 @@ public class CsvReader extends CsvBaseReader implements Iterable<CsvRow>, Closea
@Override
public void close() {
IoUtil.close(this.reader);
IoUtil.closeQuietly(this.reader);
}
}

View File

@@ -344,7 +344,7 @@ public final class CsvWriter implements Closeable, Flushable, Serializable {
@Override
public void close() {
IoUtil.close(this.writer);
IoUtil.closeQuietly(this.writer);
}
@Override

View File

@@ -505,7 +505,7 @@ public class ExcelBase<T extends ExcelBase<T>> implements Closeable {
*/
@Override
public void close() {
IoUtil.close(this.workbook);
IoUtil.closeQuietly(this.workbook);
this.sheet = null;
this.workbook = null;
this.isClosed = true;

View File

@@ -1321,7 +1321,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
IoUtil.close(out);
IoUtil.closeQuietly(out);
}
}
return this;

View File

@@ -147,7 +147,7 @@ public class WorkbookUtil {
} catch (final Exception e) {
throw new POIException(e);
} finally {
IoUtil.close(in);
IoUtil.closeQuietly(in);
}
}

View File

@@ -148,7 +148,7 @@ public class Excel03SaxReader implements HSSFListener, ExcelSaxReader<Excel03Sax
} catch (final IOException e) {
throw new POIException(e);
} finally {
IoUtil.close(fs);
IoUtil.closeQuietly(fs);
}
return this;
}

View File

@@ -174,7 +174,7 @@ public class Excel07SaxReader implements ExcelSaxReader<Excel07SaxReader> {
} catch (final Exception e) {
throw new POIException(e);
} finally {
IoUtil.close(sheetInputStream);
IoUtil.closeQuietly(sheetInputStream);
}
return this;
}

View File

@@ -69,7 +69,7 @@ public class SheetRidReader extends DefaultHandler {
} catch (final IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(workbookData);
IoUtil.closeQuietly(workbookData);
}
return this;
}

View File

@@ -142,6 +142,6 @@ public class OfdWriter implements Serializable, Closeable {
@Override
public void close() {
IoUtil.close(this.doc);
IoUtil.closeQuietly(this.doc);
}
}

View File

@@ -208,7 +208,7 @@ public class Word07Writer implements Closeable {
} catch (final IOException e) {
throw new IORuntimeException(e);
} finally {
IoUtil.close(in);
IoUtil.closeQuietly(in);
}
return this;
@@ -267,7 +267,7 @@ public class Word07Writer implements Closeable {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
IoUtil.close(out);
IoUtil.closeQuietly(out);
}
}
return this;
@@ -289,7 +289,7 @@ public class Word07Writer implements Closeable {
* 关闭Word文档但是不写出
*/
protected void closeWithoutFlush() {
IoUtil.close(this.doc);
IoUtil.closeQuietly(this.doc);
this.isClosed = true;
}
}

View File

@@ -16,7 +16,7 @@ public class CsvParserTest {
final CsvRow row = parser.nextRow();
//noinspection ConstantConditions
Assert.assertEquals("b\"bba\"", row.getRawList().get(1));
IoUtil.close(parser);
IoUtil.closeQuietly(parser);
}
@Test
@@ -26,7 +26,7 @@ public class CsvParserTest {
final CsvRow row = parser.nextRow();
//noinspection ConstantConditions
Assert.assertEquals("\"bba\"bbb", row.getRawList().get(1));
IoUtil.close(parser);
IoUtil.closeQuietly(parser);
}
@Test
@@ -36,7 +36,7 @@ public class CsvParserTest {
final CsvRow row = parser.nextRow();
//noinspection ConstantConditions
Assert.assertEquals("bba", row.getRawList().get(1));
IoUtil.close(parser);
IoUtil.closeQuietly(parser);
}
@Test
@@ -46,7 +46,7 @@ public class CsvParserTest {
final CsvRow row = parser.nextRow();
//noinspection ConstantConditions
Assert.assertEquals("", row.getRawList().get(1));
IoUtil.close(parser);
IoUtil.closeQuietly(parser);
}
@Test

View File

@@ -16,7 +16,7 @@ public class ExcelFileUtilTest {
Assert.assertTrue(ExcelFileUtil.isXls(in));
Assert.assertFalse(ExcelFileUtil.isXlsx(in));
} finally {
IoUtil.close(in);
IoUtil.closeQuietly(in);
}
}
@@ -27,7 +27,7 @@ public class ExcelFileUtilTest {
Assert.assertFalse(ExcelFileUtil.isXls(in));
Assert.assertTrue(ExcelFileUtil.isXlsx(in));
} finally {
IoUtil.close(in);
IoUtil.closeQuietly(in);
}
}
}