Skip to content

Commit 23b7d93

Browse files
hyunw9Reamer
authored andcommitted
[ZEPPELIN-6267] Refactor JarHelper Class to Use a Logging Framework Instead of System.out.println()
### What is this PR for? Refactor JarHelper Class to Use a Logging Framework Instead of `System.out.println()` ### What type of PR is it? Refactoring ### Todos * [x] - Replace `println()` to `LOGGER.info()` ### What is the Jira issue? * [here](https://issues.apache.org/jira/browse/ZEPPELIN-6267) ### How should this be tested? * Strongly recommended: add automated unit tests for any new or changed behavior * Outline any manual steps to test the PR here. ### Screenshots (if appropriate) ### Questions: * Does the license files need to update? - no * Is there breaking changes for older versions? - no * Does this needs documentation? - no Closes #5009 from hyunw9/ZEPPELIN-6267. Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com> (cherry picked from commit d4072a6) Signed-off-by: Philipp Dallig <philipp.dallig@gmail.com>
1 parent 7be28f3 commit 23b7d93

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

flink/flink-scala-2.12/src/main/java/org/apache/zeppelin/flink/internal/JarHelper.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
import java.util.jar.JarInputStream;
3030
import java.util.jar.JarOutputStream;
3131

32+
import org.slf4j.Logger;
33+
import org.slf4j.LoggerFactory;
34+
3235
/**
3336
* This class is copied from flink project, the reason is that flink scala shell only supports
3437
* scala-2.11, we copied it here to support scala-2.12 as well.
@@ -38,6 +41,7 @@ public class JarHelper {
3841
// Constants
3942

4043
private static final int BUFFER_SIZE = 2156;
44+
private static final Logger LOGGER = LoggerFactory.getLogger(JarHelper.class);
4145

4246
// ========================================================================
4347
// Variables
@@ -110,7 +114,7 @@ public void unjar(InputStream in, File destDir) throws IOException {
110114
byte[] data = new byte[BUFFER_SIZE];
111115
File destFile = new File(destDir, entry.getName());
112116
if (mVerbose) {
113-
System.out.println("unjarring " + destFile + " from " + entry.getName());
117+
LOGGER.info("unjarring {} from {}", destFile, entry.getName());
114118
}
115119
FileOutputStream fos = new FileOutputStream(destFile);
116120
dest = new BufferedOutputStream(fos, BUFFER_SIZE);
@@ -143,7 +147,7 @@ public void setVerbose(boolean b) {
143147
*/
144148
private void jarDir(File dirOrFile2jar, JarOutputStream jos, String path) throws IOException {
145149
if (mVerbose) {
146-
System.out.println("checking " + dirOrFile2jar);
150+
LOGGER.info("checking {}", dirOrFile2jar);
147151
}
148152
if (dirOrFile2jar.isDirectory()) {
149153
String[] dirList = dirOrFile2jar.list();
@@ -162,7 +166,7 @@ private void jarDir(File dirOrFile2jar, JarOutputStream jos, String path) throws
162166
} else if (dirOrFile2jar.exists()) {
163167
if (dirOrFile2jar.getCanonicalPath().equals(mDestJarName)) {
164168
if (mVerbose) {
165-
System.out.println("skipping " + dirOrFile2jar.getPath());
169+
LOGGER.info("skipping {}", dirOrFile2jar.getPath());
166170
}
167171
return;
168172
}
@@ -178,7 +182,7 @@ private void jarDir(File dirOrFile2jar, JarOutputStream jos, String path) throws
178182
while ((mByteCount = fis.read(mBuffer)) != -1) {
179183
jos.write(mBuffer, 0, mByteCount);
180184
if (mVerbose) {
181-
System.out.println("wrote " + mByteCount + " bytes");
185+
LOGGER.info("wrote {} bytes", mByteCount);
182186
}
183187
}
184188
jos.flush();

0 commit comments

Comments
 (0)