This is an automated email from the ASF dual-hosted git repository.
dionusos pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/oozie.git
The following commit(s) were added to refs/heads/master by this push:
new fde5c8a01 OOZIE-3692 [sharelib-spark] Fix current SpotBugs discovered
issues in Oozie's sharelib-spark module (jmakai via dionusos)
fde5c8a01 is described below
commit fde5c8a01741407ad0885d6df624d064cde73f72
Author: Denes Bodo <[email protected]>
AuthorDate: Fri Jan 13 09:47:21 2023 +0100
OOZIE-3692 [sharelib-spark] Fix current SpotBugs discovered issues in
Oozie's sharelib-spark module (jmakai via dionusos)
---
release-log.txt | 1 +
sharelib/spark/pom.xml | 7 ++++++
sharelib/spark/spotbugs-filter.xml | 25 ++++++++++++++++++++++
.../org/apache/oozie/action/hadoop/SparkMain.java | 9 ++++----
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/release-log.txt b/release-log.txt
index 1764acace..f0a4c026b 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 5.3.0 release (trunk - unreleased)
+OOZIE-3692 [sharelib-spark] Fix current SpotBugs discovered issues in Oozie's
sharelib-spark module (jmakai via dionusos)
OOZIE-3693 [examples] Fix current SpotBugs discovered issues in Oozie's
examples module (jmakai via dionusos)
OOZIE-3696 [sharelib-git] Fix current SpotBugs discovered issues in Oozie's
sharelib-git module (dionusos via jmakai)
OOZIE-3689 Remove usage of commons-httpclient due to EOL (jmakai via dionusos)
diff --git a/sharelib/spark/pom.xml b/sharelib/spark/pom.xml
index 3c62951a6..f49d414fc 100644
--- a/sharelib/spark/pom.xml
+++ b/sharelib/spark/pom.xml
@@ -386,6 +386,13 @@
</resource>
</resources>
<plugins>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <configuration>
+
<excludeFilterFile>${basedir}/spotbugs-filter.xml</excludeFilterFile>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
diff --git a/sharelib/spark/spotbugs-filter.xml
b/sharelib/spark/spotbugs-filter.xml
new file mode 100644
index 000000000..2abc3cee6
--- /dev/null
+++ b/sharelib/spark/spotbugs-filter.xml
@@ -0,0 +1,25 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<FindBugsFilter>
+ <!-- Since Java 7 update 40 or Java 8, the NULL byte injection in
filenames is fixed so `WEAK_FILENAMEUTILS`
+ can be filtered in SparkMain class -->
+ <Match>
+ <Class name="org.apache.oozie.action.hadoop.SparkMain"/>
+ <Bug pattern="WEAK_FILENAMEUTILS" />
+ </Match>
+</FindBugsFilter>
\ No newline at end of file
diff --git
a/sharelib/spark/src/main/java/org/apache/oozie/action/hadoop/SparkMain.java
b/sharelib/spark/src/main/java/org/apache/oozie/action/hadoop/SparkMain.java
index e76a58476..ac3d01d0d 100644
--- a/sharelib/spark/src/main/java/org/apache/oozie/action/hadoop/SparkMain.java
+++ b/sharelib/spark/src/main/java/org/apache/oozie/action/hadoop/SparkMain.java
@@ -30,6 +30,7 @@ import java.util.Objects;
import java.util.regex.Pattern;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
@@ -46,10 +47,10 @@ public class SparkMain extends LauncherMain {
Pattern.compile("Submitted application (application[0-9_]*)") };
@VisibleForTesting
static final Pattern SPARK_ASSEMBLY_JAR_PATTERN = Pattern
-
.compile("^spark-assembly((?:(-|_|(\\d+\\.))\\d+(?:\\.\\d+)*))*\\.jar$");
+ .compile("^spark-assembly(-|_|\\d|\\.)*\\.jar$");
@VisibleForTesting
static final Pattern SPARK_YARN_JAR_PATTERN = Pattern
-
.compile("^spark-yarn((?:(-|_|(\\d+\\.))\\d+(?:\\.\\d+)*))*\\.jar$");
+ .compile("^spark-yarn(-|_|\\d|\\.)*\\.jar$");
static final String HIVE_SITE_CONF = "hive-site.xml";
static final String SPARK_LOG4J_PROPS = "spark-log4j.properties";
@@ -131,7 +132,7 @@ public class SparkMain extends LauncherMain {
for(final Pattern fileNamePattern : PYSPARK_DEP_FILE_PATTERN) {
final File file = getMatchingPyFile(fileNamePattern);
- final File destination = new File(pythonLibDir, file.getName());
+ final File destination = new File(pythonLibDir,
FilenameUtils.getName(file.getName()));
FileUtils.copyFile(file, destination);
System.out.println("Copied " + file + " to " +
destination.getAbsolutePath());
}
@@ -171,7 +172,7 @@ public class SparkMain extends LauncherMain {
for (final String fileName : localFileNames){
if (fileNamePattern.matcher(fileName).find()){
- return new File(fileName);
+ return new File(FilenameUtils.getName(fileName));
}
}