Repository: deepjavalibrary/djl
Pull request #1880 (2022-08-09 01:13:57)

[ci] Workaround JDK 18 spotbugs issue.
Change-Id: I4c15161fdfb91fc164af05137ef69fbc2acadd62

## Description ##

Brief description of what this PR is about

- If this change is a backward incompatible change, why must this change be made?
- Interesting edge cases to note here


codecov-commenter: # [Codecov](https://codecov.io/gh/deepjavalibrary/djl/pull/1880?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) Report
> Merging [#1880](https://codecov.io/gh/deepjavalibrary/djl/pull/1880?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) (d044d81) into [master](https://codecov.io/gh/deepjavalibrary/djl/commit/bb5073f7ffc33f1883621fc1783dbb01e70b418f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) (bb5073f) will **decrease** coverage by `2.09%`.
> The diff coverage is `66.45%`.

> :exclamation: Current head d044d81 differs from pull request most recent head 5ef86e9. Consider uploading reports for the commit 5ef86e9 to get more accurate results

```diff
@@             Coverage Diff              @@
##             master    #1880      +/-   ##
============================================
- Coverage     72.08%   69.99%   -2.10%     
- Complexity     5126     5585     +459     
============================================
  Files           473      530      +57     
  Lines         21970    24624    +2654     
  Branches       2351     2679     +328     
============================================
+ Hits          15838    17236    +1398     
- Misses         4925     6073    +1148     
- Partials       1207     1315     +108     
```


| [Impacted Files](https://codecov.io/gh/deepjavalibrary/djl/pull/1880?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) | Coverage Δ | |
|---|---|---|
| [api/src/main/java/ai/djl/modality/cv/Image.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L0ltYWdlLmphdmE=) | `69.23% <ø> (-4.11%)` | :arrow_down: |
| [...rc/main/java/ai/djl/modality/cv/MultiBoxPrior.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L011bHRpQm94UHJpb3IuamF2YQ==) | `76.00% <ø> (ø)` | |
| [...rc/main/java/ai/djl/modality/cv/output/Joints.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9Kb2ludHMuamF2YQ==) | `71.42% <ø> (ø)` | |
| [.../main/java/ai/djl/modality/cv/output/Landmark.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9MYW5kbWFyay5qYXZh) | `100.00% <ø> (ø)` | |
| [...main/java/ai/djl/modality/cv/output/Rectangle.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L291dHB1dC9SZWN0YW5nbGUuamF2YQ==) | `72.41% <0.00%> (ø)` | |
| [...i/djl/modality/cv/translator/BigGANTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvQmlnR0FOVHJhbnNsYXRvci5qYXZh) | `21.42% <0.00%> (-5.24%)` | :arrow_down: |
| [...odality/cv/translator/BigGANTranslatorFactory.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvQmlnR0FOVHJhbnNsYXRvckZhY3RvcnkuamF2YQ==) | `33.33% <0.00%> (+8.33%)` | :arrow_up: |
| [...nslator/InstanceSegmentationTranslatorFactory.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvSW5zdGFuY2VTZWdtZW50YXRpb25UcmFuc2xhdG9yRmFjdG9yeS5qYXZh) | `14.28% <0.00%> (-3.90%)` | :arrow_down: |
| [.../cv/translator/SemanticSegmentationTranslator.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvU2VtYW50aWNTZWdtZW50YXRpb25UcmFuc2xhdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [.../cv/translator/StyleTransferTranslatorFactory.java](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary#diff-YXBpL3NyYy9tYWluL2phdmEvYWkvZGpsL21vZGFsaXR5L2N2L3RyYW5zbGF0b3IvU3R5bGVUcmFuc2ZlclRyYW5zbGF0b3JGYWN0b3J5LmphdmE=) | `40.00% <ø> (ø)` | |
| ... and [428 more](https://codecov.io/gh/deepjavalibrary/djl/pull/1880/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary) | |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepjavalibrary)


Patch:
diff --git a/tools/gradle/check.gradle b/tools/gradle/check.gradle
index 08e0d945a..f4b457512 100644
--- a/tools/gradle/check.gradle
+++ b/tools/gradle/check.gradle
@@ -1,19 +1,21 @@
-apply plugin: "com.github.spotbugs"
-spotbugs {
-    excludeFilter = file("${rootProject.projectDir}/tools/conf/findbugs-exclude.xml")
-    ignoreFailures = false
-    spotbugsTest.enabled = true
-}
-spotbugsMain {
-    reports {
-        xml.enabled false
-        html.enabled true
+if (JavaVersion.current() < JavaVersion.VERSION_18) {
+    apply plugin: "com.github.spotbugs"
+    spotbugs {
+        excludeFilter = file("${rootProject.projectDir}/tools/conf/findbugs-exclude.xml")
+        ignoreFailures = false
+        spotbugsTest.enabled = true
     }
-}
-spotbugsTest {
-    reports {
-        xml.enabled false
-        html.enabled true
+    spotbugsMain {
+        reports {
+            xml.enabled false
+            html.enabled true
+        }
+    }
+    spotbugsTest {
+        reports {
+            xml.enabled false
+            html.enabled true
+        }
     }
 }
 


Test patch:
diff --git a/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java b/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java
index 4bef642d2..3259f22b7 100644
--- a/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java
+++ b/extensions/hadoop/src/test/java/ai/djl/hadoop/hdfs/HdfsRepositoryTest.java
@@ -126,7 +126,8 @@ public class HdfsRepositoryTest {
 
     private void setFilePermission(Configuration config) {
         try {
-            Process process = Runtime.getRuntime().exec("/bin/sh -c umask");
+            String[] cmd = {"/bin/sh", "-c", "umask"};
+            Process process = Runtime.getRuntime().exec(cmd);
             int rc = process.waitFor();
             if (rc != 0) {
                 return;