You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <ga...@gmail.com> on 2014/03/01 03:09:04 UTC

Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

On Fri, Feb 28, 2014 at 2:29 PM, <se...@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.

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: garydgregory@gmail.com | ggregory@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

Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by Stefan Bodewig <bo...@apache.org>.
On 2014-03-02, sebb wrote:

> On 1 March 2014 19:53, Matt Benson <gu...@gmail.com> wrote:
>> I've said it before: doocracy. If someone wants to take on the work to
>> provide 1.5 support, they've widened the audience of the component, which
>> should be seen as a win if it didn't cause anyone else a problem.

> Which is what I just did; I fixed the test code so it still compiled
> with Java 1.5.

Thanks you for that, BTW.

> I do wish people would stop taking that as an opportunitty to suggest
> a completely unnecessary move to a later version of Java.

FWIW I agree with you on this.  We've tentatively agreed to move to
Java7 with Compress 2.x and I personally don't see any real benefit of
moving to Java6 at this point.

Stefan

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


Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by sebb <se...@gmail.com>.
On 1 March 2014 19:53, Matt Benson <gu...@gmail.com> wrote:
> I've said it before: doocracy. If someone wants to take on the work to
> provide 1.5 support, they've widened the audience of the component, which
> should be seen as a win if it didn't cause anyone else a problem.

Which is what I just did; I fixed the test code so it still compiled
with Java 1.5.

I do wish people would stop taking that as an opportunitty to suggest
a completely unnecessary move to a later version of Java.

> Maybe we
> should have a [compatibility] component to capture these backports in a
> reusable way! ;-)

It's not a backport; that would require a lot more work.

The point is that most Commons components are intended for wide re-use.
Unnecessarily restricting the field of use is plain wrong in my opiniong.

> Matt
> On Mar 1, 2014 11:34 AM, "Benedikt Ritter" <br...@apache.org> wrote:
>
>> If it's only test code, I'm hesitant to move to Java 6. Are there
>> improvements for production code as well?
>>
>> Benedikt
>>
>>
>> 2014-03-01 17:54 GMT+01:00 Gary Gregory <ga...@gmail.com>:
>>
>> > On Sat, Mar 1, 2014 at 11:47 AM, Emmanuel Bourg <eb...@apache.org>
>> wrote:
>> >
>> > > +1 to stop bothering with Java 5 for all our components.
>> > >
>> >
>> > +1 :)
>> > Gary
>> >
>> >
>> > >
>> > > Emmanuel Bourg
>> > >
>> > >
>> > > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> > > For additional commands, e-mail: dev-help@commons.apache.org
>> > >
>> > >
>> >
>> >
>> > --
>> > E-Mail: garydgregory@gmail.com | ggregory@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
>> >
>>
>>
>>
>> --
>> http://people.apache.org/~britter/
>> http://www.systemoutprintln.de/
>> http://twitter.com/BenediktRitter
>> http://github.com/britter
>>

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


Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by Matt Benson <gu...@gmail.com>.
I've said it before: doocracy. If someone wants to take on the work to
provide 1.5 support, they've widened the audience of the component, which
should be seen as a win if it didn't cause anyone else a problem. Maybe we
should have a [compatibility] component to capture these backports in a
reusable way! ;-)

Matt
On Mar 1, 2014 11:34 AM, "Benedikt Ritter" <br...@apache.org> wrote:

> If it's only test code, I'm hesitant to move to Java 6. Are there
> improvements for production code as well?
>
> Benedikt
>
>
> 2014-03-01 17:54 GMT+01:00 Gary Gregory <ga...@gmail.com>:
>
> > On Sat, Mar 1, 2014 at 11:47 AM, Emmanuel Bourg <eb...@apache.org>
> wrote:
> >
> > > +1 to stop bothering with Java 5 for all our components.
> > >
> >
> > +1 :)
> > Gary
> >
> >
> > >
> > > Emmanuel Bourg
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > > For additional commands, e-mail: dev-help@commons.apache.org
> > >
> > >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com | ggregory@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
> >
>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter
>

Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by Benedikt Ritter <br...@apache.org>.
If it's only test code, I'm hesitant to move to Java 6. Are there
improvements for production code as well?

Benedikt


2014-03-01 17:54 GMT+01:00 Gary Gregory <ga...@gmail.com>:

> On Sat, Mar 1, 2014 at 11:47 AM, Emmanuel Bourg <eb...@apache.org> wrote:
>
> > +1 to stop bothering with Java 5 for all our components.
> >
>
> +1 :)
> Gary
>
>
> >
> > Emmanuel Bourg
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@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
>



-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by Gary Gregory <ga...@gmail.com>.
On Sat, Mar 1, 2014 at 11:47 AM, Emmanuel Bourg <eb...@apache.org> wrote:

> +1 to stop bothering with Java 5 for all our components.
>

+1 :)
Gary


>
> Emmanuel Bourg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@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

Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by Emmanuel Bourg <eb...@apache.org>.
+1 to stop bothering with Java 5 for all our components.

Emmanuel Bourg


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


Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by sebb <se...@gmail.com>.
On 1 March 2014 11:51, Benedikt Ritter <br...@apache.org> wrote:
> 2014-03-01 12:46 GMT+01:00 sebb <se...@gmail.com>:
>
>> On 1 March 2014 02:09, Gary Gregory <ga...@gmail.com> wrote:
>> > On Fri, Feb 28, 2014 at 2:29 PM, <se...@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: garydgregory@gmail.com | ggregory@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-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@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-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by Benedikt Ritter <br...@apache.org>.
2014-03-01 12:46 GMT+01:00 sebb <se...@gmail.com>:

> On 1 March 2014 02:09, Gary Gregory <ga...@gmail.com> wrote:
> > On Fri, Feb 28, 2014 at 2:29 PM, <se...@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.

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: garydgregory@gmail.com | ggregory@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-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java

Posted by sebb <se...@gmail.com>.
On 1 March 2014 02:09, Gary Gregory <ga...@gmail.com> wrote:
> On Fri, Feb 28, 2014 at 2:29 PM, <se...@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.

> 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: garydgregory@gmail.com | ggregory@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-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org