bodewig commented on a change in pull request #97:
URL: https://github.com/apache/commons-compress/pull/97#discussion_r429555828
##########
File path:
src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveEntry.java
##########
@@ -368,10 +397,74 @@ public TarArchiveEntry(final File file) {
* @param fileName the name to be used for the entry.
*/
public TarArchiveEntry(final File file, final String fileName) {
+ final String normalizedName = normalizeFileName(fileName, false);
+ this.file = file.toPath();
+
+ try {
+ readFileMode(this.file, normalizedName);
+ } catch (IOException e) {
+ // Ignore for backwards compatibility
Review comment:
Ignoring exceptions here - and documenting that we do - seems to be the
best approach.
Another alternative would be to not change this constructor's code to use
the new methods at all. If we want to invoke the new methods then I'd suggest
to set `modTime` and `size` "the old way" before invoking the new methods so
we keep the old behaviour if things go wrong in NIO land.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]