lewismc commented on a change in pull request #18: SDAP-73
URL:
https://github.com/apache/incubator-sdap-mudrod/pull/18#discussion_r189141858
##########
File path: core/src/main/java/org/apache/sdap/mudrod/main/MudrodEngine.java
##########
@@ -173,34 +173,35 @@ private String decompressSVMWithSGDModel(String
archiveName) throws IOException
throw new IOException("Unable to locate " + archiveName + " as a
classpath resource.");
}
File tempDir = Files.createTempDirectory("mudrod").toFile();
- assert tempDir.setWritable(true);
+ boolean bWritable = tempDir.setWritable(true);
+ assert bWritable;
File archiveFile = new File(tempDir, archiveName);
FileUtils.copyURLToFile(scmArchive, archiveFile);
// Decompress archive
- int bufferSize = 512000;
- @SuppressWarnings("resource")
- ZipInputStream zipIn = new ZipInputStream(new
FileInputStream(archiveFile));
- ZipEntry entry;
- while ((entry = zipIn.getNextEntry()) != null) {
- File f = new File(tempDir, entry.getName());
- // If the entry is a directory, create the directory.
- if (entry.isDirectory() && !f.exists()) {
- boolean created = f.mkdirs();
- if (!created) {
- LOG.error("Unable to create directory '{}', during extraction of
archive contents.", f.getAbsolutePath());
- }
- } else if (!entry.isDirectory()) {
- boolean created = f.getParentFile().mkdirs();
- if (!created && !f.getParentFile().exists()) {
- LOG.error("Unable to create directory '{}', during extraction of
archive contents.", f.getParentFile().getAbsolutePath());
- }
- int count;
- byte data[] = new byte[bufferSize];
- FileOutputStream fos = new FileOutputStream(new File(tempDir,
entry.getName()), false);
- try (BufferedOutputStream dest = new BufferedOutputStream(fos,
bufferSize)) {
- while ((count = zipIn.read(data, 0, bufferSize)) != -1) {
- dest.write(data, 0, count);
+ int BUFFER_SIZE = 512000;
Review comment:
lowercase this variable... uppercase is not in compliance with Java code
conventions.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services