Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mat-dev] fix for CollectionFillRatioQuery.java for null tables

I think the fix for CollectionFillRatioQuery to deal with HashMaps under 
construction isn't quite right.

Would this be better?

### Eclipse Workspace Patch 1.0
#P org.eclipse.mat.api
Index: 
src/org/eclipse/mat/inspections/collections/CollectionFillRatioQuery.java  

===================================================================
--- 
src/org/eclipse/mat/inspections/collections/CollectionFillRatioQuery.java 
(revision 150)
+++ 
src/org/eclipse/mat/inspections/collections/CollectionFillRatioQuery.java 
(working copy)
@@ -148,7 +148,7 @@
         int size = info.getSize(hashtableObject);
         IObjectArray table = info.getBackingArray(hashtableObject);
 
-        if (table.getLength() == 0 || table.getLength() == 0)
+        if (table == null || table.getLength() == 0)
             return 1; // 100% if the array has length 0 --> the good ones
 
         return (double) size / (double) table.getLength();


Andrew Johnson






Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU








Back to the top