4
4
import android .graphics .Color ;
5
5
import android .support .v7 .widget .RecyclerView ;
6
6
import android .text .TextUtils ;
7
+ import android .util .Log ;
7
8
import android .util .Pair ;
8
9
import android .view .LayoutInflater ;
9
10
import android .view .View ;
29
30
30
31
public class RecyclerAdapter extends RecyclerView .Adapter <RecyclerView .ViewHolder > {
31
32
33
+ private static final String TAG = "RecycleAdapter" ;
32
34
final private List <Pair <VulnerabilityTestResult , VulnerabilityDescriptor >> mResults ;
33
35
private Context mContext ;
34
36
@@ -40,7 +42,11 @@ public RecyclerAdapter(Context context, List<VulnerabilityTestResult> itemList)
40
42
Map <String , VulnerabilityDescriptor > vMap = VulnerabilityDescriptor .getParsedVulnMap (context );
41
43
42
44
for (VulnerabilityTestResult vtr : itemList ) {
43
- VulnerabilityDescriptor vd = vMap .get (vtr .getCVEorID ());
45
+ String cveOrId = vtr .getCVEorID ();
46
+ VulnerabilityDescriptor vd = vMap .get (cveOrId );
47
+ if (vd == null ){
48
+ Log .d (TAG , cveOrId + " has a null vulnerability descriptor" );
49
+ }
44
50
res .add (Pair .create (vtr , vd ));
45
51
}
46
52
@@ -49,7 +55,7 @@ public RecyclerAdapter(Context context, List<VulnerabilityTestResult> itemList)
49
55
public int compare (Pair <VulnerabilityTestResult , VulnerabilityDescriptor > lhs , Pair <VulnerabilityTestResult , VulnerabilityDescriptor > rhs ) {
50
56
VulnerabilityDescriptor lhDesc = lhs .second ;
51
57
VulnerabilityDescriptor rhDesc = rhs .second ;
52
- return lhDesc .getCVEDate ().before (rhDesc .getCVEDate ()) ? 0 : 1 ;
58
+ return lhDesc .getCVEDate ().before (rhDesc .getCVEDate ()) ? 1 : - 1 ;
53
59
}
54
60
});
55
61
}catch (Exception e ){
0 commit comments