Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundle.name
Bundle-SymbolicName: org.eclipse.embedcdt.debug.gdbjtag.core;singleton:=true
Bundle-Version: 5.2.2.qualifier
Bundle-Version: 5.2.3.qualifier
Bundle-Activator: org.eclipse.embedcdt.internal.debug.gdbjtag.core.Activator
Require-Bundle: org.eclipse.embedcdt.core;bundle-version="6.7.0",
org.eclipse.embedcdt.debug.core;bundle-version="2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,35 +435,34 @@ public static Leaf getTree(IPath path) throws CoreException {
out.println("Decompressing zipped SVD file \"" + path.toOSString() + "\"...");

// This is the signature of ZIP files.
ZipInputStream zipInput;
zipInput = new ZipInputStream(new FileInputStream(file));
// Get the zipped file list entry
ZipEntry zipEntry = zipInput.getNextEntry();
while (zipEntry != null) {
if (!zipEntry.isDirectory()) {
String fileName = zipEntry.getName();

File outFile = PacksStorage.getCachedFileObject(fileName);
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs();
try (ZipInputStream zipInput = new ZipInputStream(new FileInputStream(file))) {
// Get the zipped file list entry
ZipEntry zipEntry = zipInput.getNextEntry();
while (zipEntry != null) {
if (!zipEntry.isDirectory()) {
String fileName = zipEntry.getName();

File outFile = PacksStorage.getCachedFileObject(fileName);
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs();
}
out.println("Writing \"" + outFile + "\"...");

OutputStream output = new FileOutputStream(outFile);

byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = zipInput.read(buf)) > 0) {
output.write(buf, 0, bytesRead);
}
output.close();
actualPath = new Path(outFile.getAbsolutePath());
break;
}
out.println("Writing \"" + outFile + "\"...");

OutputStream output = new FileOutputStream(outFile);

byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = zipInput.read(buf)) > 0) {
output.write(buf, 0, bytesRead);
}
output.close();
actualPath = new Path(outFile.getAbsolutePath());
break;
zipEntry = zipInput.getNextEntry();
}
zipEntry = zipInput.getNextEntry();
zipInput.closeEntry();
}
zipInput.closeEntry();
zipInput.close();

file = actualPath.toFile();
reader = new FileReader(file);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundle.name
Bundle-SymbolicName: org.eclipse.embedcdt.packs.core;singleton:=true
Bundle-Version: 3.1.3.qualifier
Bundle-Version: 3.1.4.qualifier
Bundle-Activator: org.eclipse.embedcdt.internal.packs.core.Activator
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,73 +333,72 @@ private boolean unzip(File archiveFile, IPath destRelativePath) throws IOExcepti
boolean result = true;

// Get the zip file content.
ZipInputStream zipInput;
zipInput = new ZipInputStream(new FileInputStream(archiveFile));
// Get the zipped file list entry
ZipEntry zipEntry = zipInput.getNextEntry();
try (ZipInputStream zipInput = new ZipInputStream(new FileInputStream(archiveFile))) {
// Get the zipped file list entry
ZipEntry zipEntry = zipInput.getNextEntry();

int countFiles = 0;
int countBytes = 0;
while (zipEntry != null && (result == true)) {
int countFiles = 0;
int countBytes = 0;
while (zipEntry != null && (result == true)) {

// Skip the folder definitions, we automatically create them.
if (!zipEntry.isDirectory()) {
// Skip the folder definitions, we automatically create them.
if (!zipEntry.isDirectory()) {

String fileName = zipEntry.getName();
String fileName = zipEntry.getName();

IPath path = destRelativePath.append(fileName);
File outFile = PacksStorage.getFileObject(path.toString());
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs();
}
fOut.println("Writing \"" + outFile + "\"...");

OutputStream output = new FileOutputStream(outFile);

byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = zipInput.read(buf)) > 0) {
IPath path = destRelativePath.append(fileName);
File outFile = PacksStorage.getFileObject(path.toString());
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs();
}
fOut.println("Writing \"" + outFile + "\"...");

OutputStream output = new FileOutputStream(outFile);

byte[] buf = new byte[1024];
int bytesRead;
while ((bytesRead = zipInput.read(buf)) > 0) {
try {
output.write(buf, 0, bytesRead);
} catch (IOException e) {
String msg = e.getMessage() + ", file: " + outFile.getName();
fOut.println("Error: " + msg);
DataUtils.reportError(msg);

result = false;
break;
}
countBytes += bytesRead;
}
try {
output.write(buf, 0, bytesRead);
output.close();
} catch (IOException e) {
String msg = e.getMessage() + ", file: " + outFile.getName();
fOut.println("Error: " + msg);
DataUtils.reportError(msg);

result = false;
break;
}
countBytes += bytesRead;
}
try {
output.close();
} catch (IOException e) {
String msg = e.getMessage() + ", file: " + outFile.getName();
fOut.println("Error: " + msg);
DataUtils.reportError(msg);

result = false;
}

outFile.setReadOnly();
++countFiles;
outFile.setReadOnly();
++countFiles;

}
}

zipEntry = zipInput.getNextEntry();
}
zipEntry = zipInput.getNextEntry();
}

fMonitor.worked(1);
fMonitor.worked(1);

zipInput.closeEntry();
zipInput.close();
if (countBytes > 0) {
fOut.println(countFiles + " files written, " + StringUtils.convertSizeToString(countBytes) + ".");
} else {
fOut.println("No files written.");
result = false;
zipInput.closeEntry();
if (countBytes > 0) {
fOut.println(countFiles + " files written, " + StringUtils.convertSizeToString(countBytes) + ".");
} else {
fOut.println("No files written.");
result = false;
}
return result;
}
return result;
}

}