mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -263,7 +263,7 @@ public class CsvBaseReader implements Serializable {
|
||||
rowHandler.accept(csvParser.next());
|
||||
}
|
||||
} finally {
|
||||
IoUtil.close(csvParser);
|
||||
IoUtil.closeQuietly(csvParser);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -147,7 +147,7 @@ public class WorkbookUtil {
|
||||
} catch (final Exception e) {
|
||||
throw new POIException(e);
|
||||
} finally {
|
||||
IoUtil.close(in);
|
||||
IoUtil.closeQuietly(in);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -142,6 +142,6 @@ public class OfdWriter implements Serializable, Closeable {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
IoUtil.close(this.doc);
|
||||
IoUtil.closeQuietly(this.doc);
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user