Skip to content

Commit 812feb9

Browse files
committed
Suppress warnings for streams deliberately left unclosed
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1441247 13f79535-47bb-0310-9956-ffa450edef68
1 parent 88c45dc commit 812feb9

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/test/java/org/apache/commons/io/IOUtilsWriteTestCase.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public void testWrite_byteArrayToOutputStream_nullStream() throws Exception {
9393
//-----------------------------------------------------------------------
9494
public void testWrite_byteArrayToWriter() throws Exception {
9595
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
96+
@SuppressWarnings("resource") // deliberately not closed
9697
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
9798
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
9899

@@ -106,6 +107,7 @@ public void testWrite_byteArrayToWriter() throws Exception {
106107

107108
public void testWrite_byteArrayToWriter_nullData() throws Exception {
108109
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
110+
@SuppressWarnings("resource") // deliberately not closed
109111
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
110112
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
111113

@@ -126,6 +128,7 @@ public void testWrite_byteArrayToWriter_nullWriter() throws Exception {
126128
//-----------------------------------------------------------------------
127129
public void testWrite_byteArrayToWriter_Encoding() throws Exception {
128130
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
131+
@SuppressWarnings("resource") // deliberately not closed
129132
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
130133
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
131134

@@ -140,6 +143,7 @@ public void testWrite_byteArrayToWriter_Encoding() throws Exception {
140143

141144
public void testWrite_byteArrayToWriter_Encoding_nullData() throws Exception {
142145
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
146+
@SuppressWarnings("resource") // deliberately not closed
143147
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
144148
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
145149

@@ -159,6 +163,7 @@ public void testWrite_byteArrayToWriter_Encoding_nullWriter() throws Exception {
159163

160164
public void testWrite_byteArrayToWriter_Encoding_nullEncoding() throws Exception {
161165
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
166+
@SuppressWarnings("resource") // deliberately not closed
162167
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
163168
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
164169

@@ -257,6 +262,7 @@ public void testWrite_charSequenceToWriter() throws Exception {
257262
final CharSequence csq = new StringBuilder(new String(inData, "US-ASCII"));
258263

259264
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
265+
@SuppressWarnings("resource") // deliberately not closed
260266
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
261267
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
262268

@@ -270,6 +276,7 @@ public void testWrite_charSequenceToWriter() throws Exception {
270276

271277
public void testWrite_charSequenceToWriter_Encoding_nullData() throws Exception {
272278
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
279+
@SuppressWarnings("resource") // deliberately not closed
273280
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
274281
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
275282

@@ -375,6 +382,7 @@ public void testWrite_stringToWriter() throws Exception {
375382
final String str = new String(inData, "US-ASCII");
376383

377384
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
385+
@SuppressWarnings("resource") // deliberately not closed
378386
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
379387
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
380388

@@ -388,6 +396,7 @@ public void testWrite_stringToWriter() throws Exception {
388396

389397
public void testWrite_stringToWriter_Encoding_nullData() throws Exception {
390398
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
399+
@SuppressWarnings("resource") // deliberately not closed
391400
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
392401
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
393402

@@ -494,6 +503,7 @@ public void testWrite_charArrayToWriter() throws Exception {
494503
final String str = new String(inData, "US-ASCII");
495504

496505
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
506+
@SuppressWarnings("resource") // deliberately not closed
497507
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
498508
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
499509

@@ -507,6 +517,7 @@ public void testWrite_charArrayToWriter() throws Exception {
507517

508518
public void testWrite_charArrayToWriter_Encoding_nullData() throws Exception {
509519
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
520+
@SuppressWarnings("resource") // deliberately not closed
510521
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
511522
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
512523

@@ -660,6 +671,7 @@ public void testWriteLines_Writer() throws Exception {
660671
final List<Object> list = Arrays.asList(data);
661672

662673
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
674+
@SuppressWarnings("resource") // deliberately not closed
663675
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
664676
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
665677

@@ -675,6 +687,7 @@ public void testWriteLines_Writer() throws Exception {
675687

676688
public void testWriteLines_Writer_nullData() throws Exception {
677689
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
690+
@SuppressWarnings("resource") // deliberately not closed
678691
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
679692
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
680693

@@ -690,6 +703,7 @@ public void testWriteLines_Writer_nullSeparator() throws Exception {
690703
final List<Object> list = Arrays.asList(data);
691704

692705
final ByteArrayOutputStream baout = new ByteArrayOutputStream();
706+
@SuppressWarnings("resource") // deliberately not closed
693707
final YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
694708
final Writer writer = new OutputStreamWriter(baout, "US-ASCII");
695709

0 commit comments

Comments
 (0)