IO-543-ReversedLinesFileReader-with-RandowFileAccess-API#39
IO-543-ReversedLinesFileReader-with-RandowFileAccess-API#39JeanPierrePortier wants to merge 2 commits intoapache:masterfrom Jean-Pierre-Portier:IO-543-ReversedLinesFileReader-with-RandowFileAccess-API
Conversation
garydgregory
left a comment
There was a problem hiding this comment.
@JeanPierrePortier
Thank you for your PR. May you please rebase on git master and address my comments?
| seek (totalByteLength); | ||
|
|
||
| } | ||
| /** |
There was a problem hiding this comment.
All new public and protected method should have complete Javadoc. Here the first sentence is missing as is the since tag.
| /** | ||
| * @return Returns the current offset in this file | ||
| */ | ||
| public long getFilePointer(){ |
There was a problem hiding this comment.
Formatting is missing a space.
| private byte[] leftOver; | ||
|
|
||
| private int currentLastBytePos; | ||
| private int mappedFilePointer; // store file pointer position according to currentLastBytePos but take |
There was a problem hiding this comment.
Just a Javadoc comment instead.
| line = new String(lineData, encoding); | ||
|
|
||
| currentLastBytePos = i - newLineMatchByteCount; | ||
| mappedFilePointer=i; |
| leftOver = null; | ||
| } | ||
| currentLastBytePos = -1; | ||
| mappedFilePointer=0; |
garydgregory
left a comment
There was a problem hiding this comment.
Hi @JeanPierrePortier
Ping?
|
Hi @garydgregory |
Added new JUnit tests (ReversedLinesFileReaderTestRandomAccess)
|
Hello @garydgregory , |
|
Hello @JeanPierrePortier |
Codecov Report
@@ Coverage Diff @@
## master #39 +/- ##
============================================
- Coverage 85.66% 85.65% -0.01%
+ Complexity 3102 3101 -1
============================================
Files 204 204
Lines 7368 7370 +2
Branches 905 904 -1
============================================
+ Hits 6312 6313 +1
Misses 810 810
- Partials 246 247 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
Yes just seen this (I just launched |
Just run |
|
Last CI run failed for windows env for files not related to this PR. |
garydgregory
left a comment
There was a problem hiding this comment.
Hi @JeanPierrePortier
Please rebase on master where the OS and Java version-specific build failure are fixed; please also address my comments in the PR comments. TY!
| * Returns the current offset in this file | ||
| * @return the current offset | ||
| * @throws IOException if an I/O error occurs. | ||
| */ |
There was a problem hiding this comment.
New public and protected APIs need an @since tag.
| * @return the current offset | ||
| * @throws IOException if an I/O error occurs. | ||
| */ | ||
| public long getFilePointer() throws IOException { |
There was a problem hiding this comment.
Why not call the new method position since (1) there are no pointers in Java and (2) it reflects the underlying operation?
| /** | ||
| * Sets the file-pointer offset, measured from the beginning of this file, at which the next read occurs. | ||
| * @param pos the offset value to be set | ||
| * @throws IOException if an I/O error occurs. |
| * @param pos the offset value to be set | ||
| * @throws IOException if an I/O error occurs. | ||
| */ | ||
| public void seek (long pos) throws IOException { |
There was a problem hiding this comment.
No space after the method name. Use final where you can.
| this.currentFilePart = new FilePart(block, blockLength, null); | ||
|
|
||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
Files should end in a blank line.
| @AfterEach | ||
| public void closeReader() { | ||
| try { | ||
| reversedLinesFileReader.close(); |
There was a problem hiding this comment.
Use IOUtils.closeQuietly() instead.
There was a problem hiding this comment.
Thank you for your feedbacks @garydgregory
I won't be able to take them before two weeks, but will do it ASAP.
pull request for ticket: https://issues.apache.org/jira/browse/IO-543