Copilot commented on code in PR #709:
URL: https://github.com/apache/commons-compress/pull/709#discussion_r2372338640
##########
src/test/java/org/apache/commons/compress/archivers/tar/TarFileTest.java:
##########
@@ -40,15 +40,14 @@
import java.util.List;
import java.util.zip.GZIPInputStream;
-import org.apache.commons.compress.AbstractTest;
+import org.apache.commons.compress.archivers.AbstractArchiveFileTest;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
Review Comment:
The import has been changed from
`shaded.org.apache.commons.lang3.StringUtils` to
`org.apache.commons.lang3.StringUtils`. Ensure this change is intentional and
that the non-shaded version provides the same functionality expected by the
test code.
##########
src/main/java/org/apache/commons/compress/archivers/tar/TarFile.java:
##########
@@ -240,7 +238,11 @@ private TarFile(final Builder builder) throws IOException {
this.recordBuffer = ByteBuffer.allocate(this.recordSize);
this.blockSize = builder.getBlockSize();
this.lenient = builder.isLenient();
- forEach(entries::add);
+ // Read all entries eagerly
+ TarArchiveEntry entry;
+ while ((entry = getNextTarEntry()) != null) {
+ entries.add(entry);
+ }
Review Comment:
The implementation has changed from lazy loading using
`forEach(entries::add)` to eager loading with an explicit while loop. This
change should be documented or explained as it affects memory usage and
initialization performance for large archives.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]