NO-JIRA Fix a "Dereference null return value" Coverity Scan warning

The value checked for null was not the one that was subsequently used.
This commit is contained in:
Jiri Danek 2019-02-14 15:50:03 +01:00 committed by Clebert Suconic
parent 8ff0cba3d6
commit b8df8dead3
2 changed files with 6 additions and 4 deletions

View File

@ -146,7 +146,7 @@ public class SpawnedVMSupport {
if (files == null) {
return getClassPath();
} else {
for (File f : libfolder.listFiles()) {
for (File f : files) {
if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip")) {
if (!empty) {
stringBuilder.append(File.pathSeparator);

View File

@ -65,9 +65,11 @@ public class WebTmpCleaner {
public static final void deleteFolder(final File file) {
if (file.isDirectory()) {
String[] files = file.list();
for (String path : files) {
File f = new File(file, path);
deleteFolder(f);
if (files != null) {
for (String path : files) {
File f = new File(file, path);
deleteFolder(f);
}
}
}
file.delete();