Changeset 11320 in josm
- Timestamp:
- 2016-11-26T23:45:05+01:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r11319 r11320 1366 1366 * 1367 1367 * @param stream input stream 1368 * @return byte array of data in input stream 1368 * @return byte array of data in input stream or null if stream is null 1369 1369 * @throws IOException if any I/O error occurs 1370 1370 */ 1371 1371 public static byte[] readBytesFromStream(InputStream stream) throws IOException { 1372 if (stream == null) { 1373 return null; 1374 } 1372 1375 try { 1373 1376 ByteArrayOutputStream bout = new ByteArrayOutputStream(stream.available()); -
trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java
r11241 r11320 3 3 4 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 5 6 7 import java.io.IOException; 6 8 import java.util.Arrays; 7 9 import java.util.Collections; … … 162 164 assertEquals("<ul></ul>", Utils.joinAsHtmlUnorderedList(Collections.emptyList())); 163 165 } 166 167 /** 168 * Tests if readBytesFromStream handles null streams (might happen when there is no data on error stream) 169 * @throws IOException 170 * 171 */ 172 @Test 173 public void testNullStreamForReadBytesFromStream() throws IOException { 174 assertNull("Null on null stream", Utils.readBytesFromStream(null)); 175 } 176 164 177 }
Note:
See TracChangeset
for help on using the changeset viewer.