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 304ada661 OOZIE-3693 [examples] Fix current SpotBugs discovered issues 
in Oozie's examples module (jmakai via dionusos)
304ada661 is described below

commit 304ada66147e23b5e026a1da0ce9906bef2d7bd2
Author: Denes Bodo <dionu...@apache.org>
AuthorDate: Thu Jan 12 17:42:55 2023 +0100

    OOZIE-3693 [examples] Fix current SpotBugs discovered issues in Oozie's 
examples module (jmakai via dionusos)
---
 examples/pom.xml                                   |  7 +++++
 examples/spotbugs-filter.xml                       | 31 ++++++++++++++++++++++
 .../apache/oozie/example/LocalOozieExample.java    |  1 +
 .../java/org/apache/oozie/example/Repeatable.java  |  3 ++-
 release-log.txt                                    |  1 +
 5 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/examples/pom.xml b/examples/pom.xml
index 6d9dada56..f243e27d9 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -157,6 +157,13 @@
     </dependencies>
     <build>
         <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.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
diff --git a/examples/spotbugs-filter.xml b/examples/spotbugs-filter.xml
new file mode 100644
index 000000000..fa35679b5
--- /dev/null
+++ b/examples/spotbugs-filter.xml
@@ -0,0 +1,31 @@
+<!--
+  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 LocalOozieExample -->
+    <Match>
+        <Class name="org.apache.oozie.example.LocalOozieExample"/>
+        <Bug pattern="WEAK_FILENAMEUTILS" />
+    </Match>
+    <!-- Since the full path is being provided for the properties file instead 
of assembling it, the `PATH_TRAVERSAL_IN`
+     found bug is false positive -->
+    <Match>
+        <Class name="org.apache.oozie.example.LocalOozieExample"/>
+        <Bug pattern="PATH_TRAVERSAL_IN" />
+    </Match>
+</FindBugsFilter>
\ No newline at end of file
diff --git 
a/examples/src/main/java/org/apache/oozie/example/LocalOozieExample.java 
b/examples/src/main/java/org/apache/oozie/example/LocalOozieExample.java
index 7cb8ed253..02535af57 100644
--- a/examples/src/main/java/org/apache/oozie/example/LocalOozieExample.java
+++ b/examples/src/main/java/org/apache/oozie/example/LocalOozieExample.java
@@ -18,6 +18,7 @@
 
 package org.apache.oozie.example;
 
+import org.apache.commons.io.FilenameUtils;
 import org.apache.oozie.client.WorkflowJob;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.client.WorkflowAction;
diff --git a/examples/src/main/java/org/apache/oozie/example/Repeatable.java 
b/examples/src/main/java/org/apache/oozie/example/Repeatable.java
index 198f3873f..bf9d9cb2c 100644
--- a/examples/src/main/java/org/apache/oozie/example/Repeatable.java
+++ b/examples/src/main/java/org/apache/oozie/example/Repeatable.java
@@ -19,6 +19,7 @@
 package org.apache.oozie.example;
 
 import java.util.Date;
+import java.util.Objects;
 import java.util.TimeZone;
 import java.util.Calendar;
 
@@ -172,7 +173,7 @@ public class Repeatable {
     }
 
     public void setBaseline(Date baseline) {
-        this.baseline = baseline;
+        this.baseline = Objects.requireNonNull(baseline, "Baseline date cannot 
be null");
     }
 
     public TimeZone getTimeZone() {
diff --git a/release-log.txt b/release-log.txt
index 2d84e0c8a..1764acace 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.3.0 release (trunk - unreleased)
 
+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)
 OOZIE-3688 Introduce retry mechanism when starting embedded servlet containers 
in unit tests (jmakai via dionusos)

Reply via email to