Hi,

I was testing comparing some small input streams, looping through a list to see 
if a stream was already present and I got unexpected results. The bug can be 
recreated simply

@Test
void testCompare() throws Exception {
    byte[] b1 = new byte[]{'a','b','c'};
    byte[] b2 = new byte[]{'d','e','f'};
    InputStream is1 = new ByteArrayInputStream(b1);
    InputStream is2 = new ByteArrayInputStream(b2);
    for (int i=0; i<2; i++) {
        assertFalse(IOUtils.contentEquals(is1, is2));
    }
}
[cid:image001.png@01D6EFED.5E2B1E20]

Please ignore if I have misunderstood the meaning of "equals" with regards to 
InputStream.

Java\jdk1.8.0_241
Commons-io 2.5

Regards

[cid:image004.png@01D6EFF4.BB4FB4B0]



Andrew Singleton

Consultant

Programme Delivery

+44 (0)7729615505 email: andrew.single...@santander.co.uk

Santander House CMK, 201 Grafton Gate East, Milton Keynes, MK9 1AN



Emails aren't always secure, and they may be intercepted or changed after 
they've been sent. Santander doesn't accept liability if this happens. If you 
think someone may have interfered with this email, please get in touch with the 
sender another way. This message doesn't create or change any contract. 
Santander doesn't accept responsibility for damage caused by any viruses 
contained in this email or its attachments. Emails may be monitored. If you've 
received this email by mistake, please let the sender know at once that it's 
gone to the wrong person and then destroy it without copying, using, or telling 
anyone about its contents.

Santander UK plc. Registered Office: 2 Triton Square, Regent's Place, London, 
NW1 3AN, United Kingdom. Registered Number 2294747. Registered in England and 
Wales. https://www.santander.co.uk. Telephone 0800 389 7000. Calls may be 
recorded or monitored. Authorised by the Prudential Regulation Authority and 
regulated by the Financial Conduct Authority and the Prudential Regulation 
Authority. Our Financial Services Register number is 106054. You can check this 
on the Financial Services Register by visiting the FCA’s website 
https://www.fca.org.uk/register.  Santander and the flame logo are registered 
trademarks.


Ref:[PDB#1-4B]

Reply via email to