chiark / gitweb /
descend() prints information about the classes it walks to the debug log in a sensibl...
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 3 Jan 2011 15:18:45 +0000 (15:18 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Mon, 3 Jan 2011 15:18:45 +0000 (15:18 +0000)
src/net/chiark/yarrg/MarketUploader.java

index 49521d0..53b4349 100644 (file)
@@ -669,7 +669,6 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        private Accessible descendNodes(Accessible parent, int[] path) {
                for(int i=0;i<path.length;i++) {
                        if (null == (parent = descend(parent, path[i]))) return null;
-                       // if (dtxt!=null) dtxt.println(parent.getClass());
                }
                return parent;
        }
@@ -683,8 +682,15 @@ public class MarketUploader implements TopLevelWindowListener, GUIInitializedLis
        *       if the child is not found.
        */
        private Accessible descend(Accessible parent, int childNum) {
-               if (childNum >= parent.getAccessibleContext().getAccessibleChildrenCount()) return null;
-               return parent.getAccessibleContext().getAccessibleChild(childNum);
+               if (parent == null) return null;
+               int children = parent.getAccessibleContext().getAccessibleChildrenCount();
+               if (childNum >= children) {
+                   if (dtxt!=null) dtxt.println("DESCEND "+childNum+" > "+children+" NOT FOUND");
+                   return null;
+               }
+               Accessible child = parent.getAccessibleContext().getAccessibleChild(childNum);
+               if (dtxt!=null) dtxt.println("DESCEND "+childNum+" "+child.getClass().getName()+" OK");
+               return child;
        }
        
        public static void main(String[] args) {