+ " longer than " + TarConstants.NAMELEN
+ "characters.", getLocation());
}
}
TarEntry te = new TarEntry(vPath);
te.setModTime(r.getLastModified());
// preserve permissions
if (r instanceof ArchiveResource) {
ArchiveResource ar = (ArchiveResource) r;
te.setMode(ar.getMode());
if (r instanceof TarResource) {
TarResource tr = (TarResource) r;
te.setUserName(tr.getUserName());
te.setUserId(tr.getUid());
te.setGroupName(tr.getGroup());
te.setGroupId(tr.getGid());
}
}
if (!r.isDirectory()) {
if (r.size() > TarConstants.MAXSIZE) {
throw new BuildException(
"Resource: " + r + " larger than "
+ TarConstants.MAXSIZE + " bytes.");
}
te.setSize(r.getSize());
// override permissions if set explicitly
if (tarFileSet != null && tarFileSet.hasFileModeBeenSet()) {
te.setMode(tarFileSet.getMode());
}
} else if (tarFileSet != null && tarFileSet.hasDirModeBeenSet()) {
// override permissions if set explicitly
te.setMode(tarFileSet.getDirMode(this.getProject()));
}
if (tarFileSet != null) {
// only override permissions if set explicitly
if (tarFileSet.hasUserNameBeenSet()) {
te.setUserName(tarFileSet.getUserName());
}
if (tarFileSet.hasGroupBeenSet()) {
te.setGroupName(tarFileSet.getGroup());
}
if (tarFileSet.hasUserIdBeenSet()) {
te.setUserId(tarFileSet.getUid());
}
if (tarFileSet.hasGroupIdBeenSet()) {
te.setGroupId(tarFileSet.getGid());
}
}
InputStream in = null;
try {