real-logic/simple-binary-encoding — pull request #163 by csoroiu (2014-06-12 22:16:22+00:00)
Title: [Java]: avoid unintended or evil buffer overrun and an eventual jvm crash

This commit contains a fix and unit tests that cover 98% of the code in DirectBuffer,
I changed getBytes(int,byte[],int,int) and putBytes(int,byte[],int,int) methods to also take into account the actual size of the byte[] buffer.
Also, accessing the byte[] buffer makes the method throw NPE in case the specified parameter is null, thus avoiding an illegal memory access which leads to jvm crash.
At this point, the behaviour of the methods getBytes(int,byte[],int,int) and putBytes(int,byte[],int,int) is similar to the other putBytes and getBytes methods.

Beside this, I made the byte order a DataPoint for the DirectBufferTest class in order to cover the non-native byte order branches inside the DirectBuffer methods.