LibScout
LibScout copied to clipboard
NPE when loading profiles, fails when sorting by version name
I get this NPE when working with profiles I generated myself from the attached file.
$ libscout --opmode match --android-sdk /home/fdroid/android-sdk/platforms/android-29/android.jar --libscout-conf /home/fdroid/code/reddr/LibScout/config/LibScout.toml --log-dir /data/ttt-apks/libraries/run-match.sh-1598623728-logs --profiles-dir ./profiles --json-dir /data/ttt-apks/random-google-play//json /data/ttt-apks/random-google-play/
Exception in thread "main" java.lang.NullPointerException
at de.infsec.tpl.profile.LibProfile$LibProfileComparator.compare(LibProfile.java:68)
at de.infsec.tpl.profile.LibProfile$LibProfileComparator.compare(LibProfile.java:65)
at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.base/java.util.TimSort.sort(TimSort.java:234)
at java.base/java.util.Arrays.sort(Arrays.java:1515)
at java.base/java.util.ArrayList.sort(ArrayList.java:1750)
at de.infsec.tpl.profile.Profile.loadLibraryProfiles(Profile.java:87)
at de.infsec.tpl.TplCLI.main(TplCLI.java:122)
Here is my proposed fix for --opmode match:
--- a/src/de/infsec/tpl/profile/Profile.java
+++ b/src/de/infsec/tpl/profile/Profile.java
@@ -81,6 +81,10 @@ public abstract class Profile implements Serializable {
// de-serialize library profiles
for (File f : Utils.collectFiles(profilesDir, new String[]{LibraryProfiler.FILE_EXT_LIB_PROFILE})) {
LibProfile lp = (LibProfile) Utils.disk2Object(f);
+ if (lp == null || lp.description == null) {
+ System.err.println("ERROR: " + f + " produces a null profile!");
+ continue;
+ }
profiles.add(lp);
}
I'm not sure whether this is caused by the .aar or the .jar, here are the training files:
- https://pyze.bintray.com/pyze-android/com/pyze/PyzeLibrary/2.5.0/PyzeLibrary-2.5.0.aar
- https://pyze.bintray.com/pyze-android/com/pyze/PyzeLibrary/2.5.0/PyzeLibrary-2.5.0.jar
- PyzeLibrary-2.5.0_library-xml.zip