On 1 March 2014 11:51, Benedikt Ritter <brit...@apache.org> wrote:
> 2014-03-01 12:46 GMT+01:00 sebb <seb...@gmail.com>:
>
>> On 1 March 2014 02:09, Gary Gregory <garydgreg...@gmail.com> wrote:
>> > On Fri, Feb 28, 2014 at 2:29 PM, <s...@apache.org> wrote:
>> >
>> >> Author: sebb
>> >> Date: Fri Feb 28 19:29:12 2014
>> >> New Revision: 1573038
>> >>
>> >> URL: http://svn.apache.org/r1573038
>> >> Log:
>> >> Arrays#copyOfRange is Java 1.6+; replace with basic local implementation
>> >>
>> >> Ugh. Why not up to 1.6? 21st century and all.
>>
>> Same response as always.
>>
>> Not everyone can update their Java version easily (or at all), so why
>> exclude some end users unnecessarily when there is a trivial solution
>> that benefits all end-users?
>>
>> Yes, there will come a time when it is necessary to drop 1.5 support,
>> but that needs to be done on the basis of a code requirement.
>>
>
> I'd argue that having to back port stuff from JDK 1.6 to make it work is a
> code requirement.

This is TEST code.

Of course even test code is code, but I believe code should be created
for the benefit of as many users as possible, not restricted to those
on particular versions of Java.

UNLESS there is a clear benefit to end-users to do so.

> Benedikt
>
>
>>
>> > Gary
>> >
>> >
>> >
>> >>
>> >> Modified:
>> >>
>> >>
>> commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
>> >>
>> >> Modified:
>> >>
>> commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
>> >> URL:
>> >>
>> http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java?rev=1573038&r1=1573037&r2=1573038&view=diff
>> >>
>> >>
>> ==============================================================================
>> >> ---
>> >>
>> commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
>> >> (original)
>> >> +++
>> >>
>> commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java
>> >> Fri Feb 28 19:29:12 2014
>> >> @@ -57,7 +57,7 @@ public class PythonTruncatedBzip2Test {
>> >>          DATA = out.toByteArray();
>> >>
>> >>          // Drop the eos_magic field (6 bytes) and CRC (4 bytes).
>> >> -        TRUNCATED_DATA = Arrays.copyOfRange(DATA, 0, DATA.length - 10);
>> >> +        TRUNCATED_DATA = copyOfRange(DATA, 0, DATA.length - 10);
>> >>      }
>> >>
>> >>      @Before
>> >> @@ -91,7 +91,7 @@ public class PythonTruncatedBzip2Test {
>> >>          ByteBuffer buffer = ByteBuffer.allocate(length);
>> >>          bz2Channel.read(buffer);
>> >>
>> >> -        assertArrayEquals(Arrays.copyOfRange(TEXT.getBytes(), 0,
>> length),
>> >> +        assertArrayEquals(copyOfRange(TEXT.getBytes(), 0, length),
>> >>                  buffer.array());
>> >>
>> >>          // subsequent read should throw
>> >> @@ -110,4 +110,13 @@ public class PythonTruncatedBzip2Test {
>> >>
>> >>          return Channels.newChannel(bZin);
>> >>      }
>> >> +
>> >> +    // Helper method since Arrays#copyOfRange is Java 1.6+
>> >> +    // Does not check parameters, so may fail if they are incompatible
>> >> +    private static byte[] copyOfRange(byte[] original, int from, int
>> to) {
>> >> +        int length = to - from;
>> >> +        byte buff[] = new byte[length];
>> >> +        System.arraycopy(original, from, buff, 0, length);
>> >> +        return buff;
>> >> +    }
>> >>  }
>> >>
>> >>
>> >>
>> >
>> >
>> > --
>> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> > Spring Batch in Action <http://www.manning.com/templier/>
>> > Blog: http://garygregory.wordpress.com
>> > Home: http://garygregory.com/
>> > Tweet! http://twitter.com/GaryGregory
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to