NIFI-13157 Replaced deprecated getNextTarEntry() and getNextZipEntry() with getNextEntry().

This closes #8813

Signed-off-by: Joseph Witt <joewitt@apache.org>
This commit is contained in:
dan-s1 2024-05-10 17:01:20 +00:00 committed by Joseph Witt
parent 1c2469bf33
commit 7dfb4936a9
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
4 changed files with 6 additions and 6 deletions

View File

@ -238,7 +238,7 @@ public class TransferDebugOperationHandlerTest {
Map<String, String> fileNamesWithContents = new HashMap<>();
try (TarArchiveInputStream tarInputStream = new TarArchiveInputStream(new GzipCompressorInputStream(new ByteArrayInputStream(bundle)))) {
TarArchiveEntry currentEntry;
while ((currentEntry = tarInputStream.getNextTarEntry()) != null) {
while ((currentEntry = tarInputStream.getNextEntry()) != null) {
fileNamesWithContents.put(
currentEntry.getName(),
new BufferedReader(new InputStreamReader(tarInputStream)).lines().collect(joining(NEW_LINE)));

View File

@ -34,7 +34,7 @@ public class FlowFileUnpackagerV1 implements FlowFileUnpackager {
public Map<String, String> unpackageFlowFile(final InputStream in, final OutputStream out) throws IOException {
flowFilesRead++;
final TarArchiveInputStream tarIn = new TarArchiveInputStream(in);
final TarArchiveEntry attribEntry = tarIn.getNextTarEntry();
final TarArchiveEntry attribEntry = tarIn.getNextEntry();
if (attribEntry == null) {
return null;
}
@ -48,7 +48,7 @@ public class FlowFileUnpackagerV1 implements FlowFileUnpackager {
+ FlowFilePackagerV1.FILENAME_ATTRIBUTES);
}
final TarArchiveEntry contentEntry = tarIn.getNextTarEntry();
final TarArchiveEntry contentEntry = tarIn.getNextEntry();
if (contentEntry != null && contentEntry.getName().equals(FlowFilePackagerV1.FILENAME_CONTENT)) {
final byte[] buffer = new byte[512 << 10];//512KB

View File

@ -37,7 +37,7 @@ public class TarUnpackerSequenceFileWriter extends SequenceFileWriterImpl {
protected void processInputStream(final InputStream stream, final FlowFile tarArchivedFlowFile, final Writer writer) throws IOException {
try (final TarArchiveInputStream tarIn = new TarArchiveInputStream(new BufferedInputStream(stream))) {
TarArchiveEntry tarEntry;
while ((tarEntry = tarIn.getNextTarEntry()) != null) {
while ((tarEntry = tarIn.getNextEntry()) != null) {
if (tarEntry.isDirectory()) {
continue;
}

View File

@ -379,7 +379,7 @@ public class UnpackContent extends AbstractProcessor {
int fragmentCount = 0;
try (final TarArchiveInputStream tarIn = new TarArchiveInputStream(new BufferedInputStream(inputStream))) {
TarArchiveEntry tarEntry;
while ((tarEntry = tarIn.getNextTarEntry()) != null) {
while ((tarEntry = tarIn.getNextEntry()) != null) {
if (tarEntry.isDirectory() || !fileMatches(tarEntry)) {
continue;
}
@ -521,7 +521,7 @@ public class UnpackContent extends AbstractProcessor {
try (final ZipArchiveInputStream zipInputStream = new ZipArchiveInputStream(new BufferedInputStream(inputStream),
filenameEncoding.toString(), true, allowStoredEntriesWithDataDescriptor)) {
ZipArchiveEntry zipEntry;
while ((zipEntry = zipInputStream.getNextZipEntry()) != null) {
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
processEntry(zipInputStream, zipEntry.isDirectory(), zipEntry.getName(), EncryptionMethod.NONE);
}
}