git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268568 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -454,7 +454,18 @@ public class TarEntry implements TarConstants { | |||||
| public void setSize(long size) { | public void setSize(long size) { | ||||
| this.size = size; | this.size = size; | ||||
| } | } | ||||
| /** | |||||
| * Indicate if this entry is a GNU long name block | |||||
| * | |||||
| * @return true if this is a long name extension provided by GNU tar | |||||
| */ | |||||
| public boolean isGNULongNameEntry() { | |||||
| return linkFlag == LF_GNUTYPE_LONGNAME && | |||||
| name.toString().equals(GNU_LONGLINK); | |||||
| } | |||||
| /** | /** | ||||
| * Return whether or not this entry represents a directory. | * Return whether or not this entry represents a directory. | ||||
| * | * | ||||
| @@ -286,6 +286,18 @@ public class TarInputStream extends FilterInputStream { | |||||
| this.entrySize = (int) this.currEntry.getSize(); | this.entrySize = (int) this.currEntry.getSize(); | ||||
| } | } | ||||
| if (this.currEntry != null && this.currEntry.isGNULongNameEntry()) { | |||||
| // read in the name | |||||
| StringBuffer longName = new StringBuffer(); | |||||
| byte[] buffer = new byte[256]; | |||||
| int length = 0; | |||||
| while ((length = read(buffer)) >= 0) { | |||||
| longName.append(new String(buffer, 0, length)); | |||||
| } | |||||
| getNextEntry(); | |||||
| this.currEntry.setName(longName.toString()); | |||||
| } | |||||
| return this.currEntry; | return this.currEntry; | ||||
| } | } | ||||