-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-9743][Client] Use correct zip/jar path separator #6263
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
Conversation
| @Test | ||
| public void testExtractContainedLibraries() { | ||
| String s = "testExtractContainedLibraries"; | ||
| Path workDir = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use junit TemporaryFolder instead
| Path workDir = null; | ||
| Path fakeJar = null; | ||
| try { | ||
| workDir = Files.createTempDirectory(PackagedProgram.class.getSimpleName() + "_"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
derive from TemporaryFolder
| } | ||
| PackagedProgram.extractContainedLibraries(fakeJar.toUri().toURL()); | ||
| } | ||
| catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to catch them, just let them bubble up
| System.err.println(e.getMessage()); | ||
| e.printStackTrace(); | ||
| Assert.fail("Test is erroneous: " + e.getMessage()); | ||
| } finally { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this block will be unnecessary with the usage of TemporaryFolder
| zos.putNextEntry(entry); | ||
| zos.write(s.getBytes()); | ||
| zos.closeEntry(); | ||
| } catch (IOException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, just let hte exception bubble up.
| workDir = Files.createTempDirectory(PackagedProgram.class.getSimpleName() + "_"); | ||
| fakeJar = Paths.get(workDir.toAbsolutePath().toString(), "test.jar"); | ||
| FileOutputStream fos = new FileOutputStream(fakeJar.toFile()); | ||
| try (ZipOutputStream zos = new ZipOutputStream(fos)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline FileOutputStream creation, i.e. new ZipOutputStream(new FileOutputStream(...))
PackagedProgramTest#testExtractContainedLibraries to check PackagedProgram#extractContainedLibraries
zentol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, will try it out locally.
| public class PackagedProgramTest { | ||
|
|
||
| @Rule | ||
| public TemporaryFolder temporaryFolder = new TemporaryFolder(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be final
|
If it work I'll fix the issue I found and merge it afterwards. |
|
ok, thank you for review |
|
yes, |
What is the purpose of the change
This PR resolves libraries extraction issue from jars
Brief change log
Verifying this change
test.jar
|- lib
|--|- internalTest.jar
and then calls for
PackagedProgram#extractContainedLibrariesto check if it extracts internalTest.jar correctlyDoes this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation