[
https://issues.apache.org/jira/browse/COMPRESS-404?focusedWorklogId=434466&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-434466
]
ASF GitHub Bot logged work on COMPRESS-404:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/May/20 16:00
Start Date: 18/May/20 16:00
Worklog Time Spent: 10m
Work Description: theobisproject commented on a change in pull request
#97:
URL: https://github.com/apache/commons-compress/pull/97#discussion_r426733165
##########
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:
I don't think this will ever work without ignoring the exception here.
Have a look at TarArchiveEntryTest#testTarFileWithFSRoot. On Windows the
entries are directly added from the C:\ drive. They don't have to exist that
the test passes with the old File API. But the NIO API tries to read the file
size from disk. When it is not present it will throw an NoSuchFileException.
Also throwing a runtime exception here is in my opinion a really bad idea.
This is totally unexpected for the user since he only notices it at runtime.
With a checked exception he would directly notice it after upgrading. But since
changing the API is no option I think we are only left with swallowing the
error.
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 434466)
Time Spent: 2h 40m (was: 2.5h)
> Add Path equivalents to TarArchiveEntry, with methods using File delegating
> to equivalents
> ------------------------------------------------------------------------------------------
>
> Key: COMPRESS-404
> URL: https://issues.apache.org/jira/browse/COMPRESS-404
> Project: Commons Compress
> Issue Type: Sub-task
> Reporter: Simon Spero
> Priority: Minor
> Time Spent: 2h 40m
> Remaining Estimate: 0h
>
> (This is a reasonable place to start, as Paths give better access to
> tar-relevant metadata on unix system).
> Symlink info is easier to obtain
> Unix based Paths allow access to useful attributes under "unix:*"
> - numeric uid and gid
> - string owner and group names
> - mtime,ctime,atime
> - numeric mode
> - numeric dev and inode
> - numeric rdev
> - Linux, Solaris and Windows allow access to extended attributes
> (MacOS X xattrs aren't supported as of jdk 9)
--
This message was sent by Atlassian Jira
(v8.3.4#803005)