Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPS-85506 Use ZipFile instead of FileSystem #63191

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@

package com.liferay.portal.target.platform.indexer.internal;

import com.liferay.portal.kernel.util.StreamUtil;
import com.liferay.portal.target.platform.indexer.Indexer;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;

import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
Expand Down Expand Up @@ -129,13 +128,12 @@ private String _getRepositoryName(File lpkgFile) {
private boolean _readCachedIndex(OutputStream outputStream)
throws IOException {

try (FileSystem fileSystem = FileSystems.newFileSystem(
_lpkgFile.toPath(), null)) {

Path indexPath = fileSystem.getPath("index.xml");
try (ZipFile zipFile = new ZipFile(_lpkgFile)) {
ZipEntry indexEntry = zipFile.getEntry("index.xml");

if (Files.exists(indexPath)) {
Files.copy(indexPath, outputStream);
if (indexEntry != null) {
StreamUtil.transfer(
zipFile.getInputStream(indexEntry), outputStream, false);

return true;
}
Expand Down