Discussion:
[IO] Provenance of copied code in InfiniteCircularInputStream
Gary Gregory
2018-11-19 15:59:08 UTC
Permalink
Hi All and Pascal S.,

Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read() [1], we
have:

@Override
public int read() {
position = (position + 1) % repeatedContent.length;
return repeatedContent[position] & 0xff; // copied from
//
java.io.ByteArrayInputStream.read()
}

Where does the code originate? Oracle JRE? OpenJDK? Where? Such a comment
needs to show better provenance since I am pretty sure we are NOT allowed
to copy code from Oracle.

The code was added with the commit

https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473

With this authorship:

[image: @piotrturski] <https://github.com/piotrturski>[image:
@PascalSchumacher] <https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski> authored
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher>
committed on Dec 1, 2015

Gary

[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
Pascal Schumacher
2018-11-19 16:57:05 UTC
Permalink
Hi everybody,

the code is from a pull request which I merged:

https://github.com/apache/commons-io/pull/8

I did not author the code.

The comment seems incorrect because I do not think there is a field
"repeatedContent" in java.io.ByteArrayInputStream. The current OpenJDK
implementation looks pretty different:

http://hg.openjdk.java.net/jdk/jdk/file/49e0f711bb2b/src/java.base/share/classes/java/io/ByteArrayInputStream.java#l146

-Pascal
Post by Gary Gregory
Hi All and Pascal S.,
Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read() [1],
    public int read() {
        position = (position + 1) % repeatedContent.length;
        return repeatedContent[position] & 0xff; // copied from
 // java.io.ByteArrayInputStream.read()
    }
Where does the code originate? Oracle JRE? OpenJDK? Where? Such a
comment needs to show better provenance since I am pretty sure we are
NOT allowed to copy code from Oracle.
The code was added with the commit
https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473
@piotrturski <https://github.com/piotrturski>@PascalSchumacher
<https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski> authored
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher> committed
on Dec 1, 2015
Gary
[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
Mark Thomas
2018-11-19 17:15:17 UTC
Permalink
I'd image the comment is referring to the use of "... & 0xFF" but it
seems to be a fairly pointless comment as that is just the standard way
to switch from signed byte to 'unsigned' int values.

I can't see what else it could possibly be referring to.

I don't see any IP issue here.

I'd suggest simply removing the comment but with a fairly verbose commit
message to help anyone looking into this in the future.

Mark
Post by Pascal Schumacher
Hi everybody,
https://github.com/apache/commons-io/pull/8
I did not author the code.
The comment seems incorrect because I do not think there is a field
"repeatedContent" in java.io.ByteArrayInputStream. The current OpenJDK
http://hg.openjdk.java.net/jdk/jdk/file/49e0f711bb2b/src/java.base/share/classes/java/io/ByteArrayInputStream.java#l146
-Pascal
Post by Gary Gregory
Hi All and Pascal S.,
Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read() [1],
    public int read() {
        position = (position + 1) % repeatedContent.length;
        return repeatedContent[position] & 0xff; // copied from
 // java.io.ByteArrayInputStream.read()
    }
Where does the code originate? Oracle JRE? OpenJDK? Where? Such a
comment needs to show better provenance since I am pretty sure we are
NOT allowed to copy code from Oracle.
The code was added with the commit
https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473
@piotrturski <https://github.com/piotrturski>@PascalSchumacher
<https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski> authored
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher> committed
on Dec 1, 2015
Gary
[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org
Gary Gregory
2018-11-19 21:36:45 UTC
Permalink
Hi All:

I agree that the 0xff usage does not need to be documented, and while I do
see it used in ByteArrayInputStream#read() in Oracle Java 6, I really do
not think we need to refer to it.

I am +1 to removing the comment. Who will do the honors?

Gary
Post by Mark Thomas
I'd image the comment is referring to the use of "... & 0xFF" but it
seems to be a fairly pointless comment as that is just the standard way
to switch from signed byte to 'unsigned' int values.
I can't see what else it could possibly be referring to.
I don't see any IP issue here.
I'd suggest simply removing the comment but with a fairly verbose commit
message to help anyone looking into this in the future.
Mark
Post by Pascal Schumacher
Hi everybody,
https://github.com/apache/commons-io/pull/8
I did not author the code.
The comment seems incorrect because I do not think there is a field
"repeatedContent" in java.io.ByteArrayInputStream. The current OpenJDK
http://hg.openjdk.java.net/jdk/jdk/file/49e0f711bb2b/src/java.base/share/classes/java/io/ByteArrayInputStream.java#l146
Post by Pascal Schumacher
-Pascal
Post by Gary Gregory
Hi All and Pascal S.,
Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read() [1],
@Override
public int read() {
position = (position + 1) % repeatedContent.length;
return repeatedContent[position] & 0xff; // copied from
// java.io.ByteArrayInputStream.read()
}
Where does the code originate? Oracle JRE? OpenJDK? Where? Such a
comment needs to show better provenance since I am pretty sure we are
NOT allowed to copy code from Oracle.
The code was added with the commit
https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473
Post by Pascal Schumacher
Post by Gary Gregory
@piotrturski <https://github.com/piotrturski>@PascalSchumacher
<https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski
authored
Post by Gary Gregory
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher
committed
Post by Gary Gregory
on Dec 1, 2015
Gary
[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
---------------------------------------------------------------------
Sharon Corbett
2018-11-20 15:30:51 UTC
Permalink
Thanks for the quick investigation and response.

It's appreciated!

Regards,
Sharon
Post by Gary Gregory
I agree that the 0xff usage does not need to be documented, and while I do
see it used in ByteArrayInputStream#read() in Oracle Java 6, I really do
not think we need to refer to it.
I am +1 to removing the comment. Who will do the honors?
Gary
Post by Mark Thomas
I'd image the comment is referring to the use of "... & 0xFF" but it
seems to be a fairly pointless comment as that is just the standard way
to switch from signed byte to 'unsigned' int values.
I can't see what else it could possibly be referring to.
I don't see any IP issue here.
I'd suggest simply removing the comment but with a fairly verbose commit
message to help anyone looking into this in the future.
Mark
Post by Pascal Schumacher
Hi everybody,
https://github.com/apache/commons-io/pull/8
I did not author the code.
The comment seems incorrect because I do not think there is a field
"repeatedContent" in java.io.ByteArrayInputStream. The current OpenJDK
http://hg.openjdk.java.net/jdk/jdk/file/49e0f711bb2b/src/java.base/share/classes/java/io/ByteArrayInputStream.java#l146
Post by Pascal Schumacher
-Pascal
Post by Gary Gregory
Hi All and Pascal S.,
Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read() [1],
@Override
public int read() {
position = (position + 1) % repeatedContent.length;
return repeatedContent[position] & 0xff; // copied from
// java.io.ByteArrayInputStream.read()
}
Where does the code originate? Oracle JRE? OpenJDK? Where? Such a
comment needs to show better provenance since I am pretty sure we are
NOT allowed to copy code from Oracle.
The code was added with the commit
https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473
Post by Pascal Schumacher
Post by Gary Gregory
@piotrturski <https://github.com/piotrturski>@PascalSchumacher
<https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski
authored
Post by Gary Gregory
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher
committed
Post by Gary Gregory
on Dec 1, 2015
Gary
[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
---------------------------------------------------------------------
Gary Gregory
2018-11-20 23:30:11 UTC
Permalink
On Tue, Nov 20, 2018 at 8:31 AM Sharon Corbett <
Post by Sharon Corbett
Thanks for the quick investigation and response.
It's appreciated!
You're welcome Sharon.

I removed the comment in commit b487c9e8bc8410c7c0ca94f9494bcff90613946a

Gary
Post by Sharon Corbett
Regards,
Sharon
Post by Gary Gregory
I agree that the 0xff usage does not need to be documented, and while I
do see it used in ByteArrayInputStream#read() in Oracle Java 6, I really do
not think we need to refer to it.
I am +1 to removing the comment. Who will do the honors?
Gary
Post by Mark Thomas
I'd image the comment is referring to the use of "... & 0xFF" but it
seems to be a fairly pointless comment as that is just the standard way
to switch from signed byte to 'unsigned' int values.
I can't see what else it could possibly be referring to.
I don't see any IP issue here.
I'd suggest simply removing the comment but with a fairly verbose commit
message to help anyone looking into this in the future.
Mark
Post by Pascal Schumacher
Hi everybody,
https://github.com/apache/commons-io/pull/8
I did not author the code.
The comment seems incorrect because I do not think there is a field
"repeatedContent" in java.io.ByteArrayInputStream. The current OpenJDK
http://hg.openjdk.java.net/jdk/jdk/file/49e0f711bb2b/src/java.base/share/classes/java/io/ByteArrayInputStream.java#l146
Post by Pascal Schumacher
-Pascal
Post by Gary Gregory
Hi All and Pascal S.,
Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read()
[1],
Post by Pascal Schumacher
Post by Gary Gregory
@Override
public int read() {
position = (position + 1) % repeatedContent.length;
return repeatedContent[position] & 0xff; // copied from
// java.io.ByteArrayInputStream.read()
}
Where does the code originate? Oracle JRE? OpenJDK? Where? Such a
comment needs to show better provenance since I am pretty sure we are
NOT allowed to copy code from Oracle.
The code was added with the commit
https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473
Post by Pascal Schumacher
Post by Gary Gregory
@piotrturski <https://github.com/piotrturski>@PascalSchumacher
<https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski
authored
Post by Gary Gregory
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher
committed
Post by Gary Gregory
on Dec 1, 2015
Gary
[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
---------------------------------------------------------------------
Mark Struberg
2018-11-21 21:42:12 UTC
Permalink
+1. This is so trivial that it doesn't pass the threshold of originality.

LieGrue,
strub
Post by Mark Thomas
I'd image the comment is referring to the use of "... & 0xFF" but it
seems to be a fairly pointless comment as that is just the standard way
to switch from signed byte to 'unsigned' int values.
I can't see what else it could possibly be referring to.
I don't see any IP issue here.
I'd suggest simply removing the comment but with a fairly verbose commit
message to help anyone looking into this in the future.
Mark
Post by Pascal Schumacher
Hi everybody,
https://github.com/apache/commons-io/pull/8
I did not author the code.
The comment seems incorrect because I do not think there is a field
"repeatedContent" in java.io.ByteArrayInputStream. The current OpenJDK
http://hg.openjdk.java.net/jdk/jdk/file/49e0f711bb2b/src/java.base/share/classes/java/io/ByteArrayInputStream.java#l146
-Pascal
Post by Gary Gregory
Hi All and Pascal S.,
Sharon (Eclipse) has pointed out to me that
in org.apache.commons.io.input.InfiniteCircularInputStream.read() [1],
@Override
public int read() {
position = (position + 1) % repeatedContent.length;
return repeatedContent[position] & 0xff; // copied from
// java.io.ByteArrayInputStream.read()
}
Where does the code originate? Oracle JRE? OpenJDK? Where? Such a
comment needs to show better provenance since I am pretty sure we are
NOT allowed to copy code from Oracle.
The code was added with the commit
https://github.com/apache/commons-io/commit/699d6f0eca65837501d7ab7a92ae2c614f8e6cbf#diff-5cdd5f292c77ae5feee8f3f101ded473
@piotrturski <https://github.com/piotrturski>@PascalSchumacher
<https://github.com/PascalSchumacher>
piotrturski
<https://github.com/apache/commons-io/commits?author=piotrturski> authored
and PascalSchumacher
<https://github.com/apache/commons-io/commits?author=PascalSchumacher> committed
on Dec 1, 2015
Gary
[1]
https://github.com/apache/commons-io/blob/3ad22fe3d689781a76a92908d0bbc119b2c68892/src/main/java/org/apache/commons/io/input/InfiniteCircularInputStream.java#L48-L49
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@commons.apache.org
For additional commands, e-mail: dev-***@commons.apache.org

Loading...