potential NPE in PackageInternalsFinder (#1998)

pull/2004/head
XenoAmess 3 years ago committed by GitHub
parent 4be365e2ba
commit 109abe1ba3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -95,14 +95,16 @@ public class PackageInternalsFinder {
List<JavaFileObject> result = new ArrayList<JavaFileObject>();
File[] childFiles = directory.listFiles();
for (File childFile : childFiles) {
if (childFile.isFile()) {
// We only want the .class files.
if (childFile.getName().endsWith(CLASS_FILE_EXTENSION)) {
String binaryName = packageName + "." + childFile.getName();
binaryName = binaryName.replaceAll(CLASS_FILE_EXTENSION + "$", "");
result.add(new CustomJavaFileObject(binaryName, childFile.toURI()));
if (childFiles != null) {
for (File childFile : childFiles) {
if (childFile.isFile()) {
// We only want the .class files.
if (childFile.getName().endsWith(CLASS_FILE_EXTENSION)) {
String binaryName = packageName + "." + childFile.getName();
binaryName = binaryName.replaceAll(CLASS_FILE_EXTENSION + "$", "");
result.add(new CustomJavaFileObject(binaryName, childFile.toURI()));
}
}
}
}

Loading…
Cancel
Save