Coverage report

  %line %branch
org.apache.jetspeed.security.impl.BaseHierarchyResolver
0% 
0% 

 1  
 /* 
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
 *
 9  
 *     http://www.apache.org/licenses/LICENSE-2.0
 10  
 *
 11  
 * Unless required by applicable law or agreed to in writing, software
 12  
 * distributed under the License is distributed on an "AS IS" BASIS,
 13  
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
 * See the License for the specific language governing permissions and
 15  
 * limitations under the License.
 16  
 */
 17  
 package org.apache.jetspeed.security.impl;
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.List;
 21  
 import java.util.prefs.BackingStoreException;
 22  
 import java.util.prefs.Preferences;
 23  
 
 24  
 import org.apache.commons.logging.Log;
 25  
 import org.apache.commons.logging.LogFactory;
 26  
 import org.apache.jetspeed.util.ArgUtil;
 27  
 
 28  
 /**
 29  
  * <p>
 30  
  * Base implementation for the hierarchy resolver.
 31  
  * <p>
 32  
  * 
 33  
  * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
 34  
  */
 35  0
 public class BaseHierarchyResolver
 36  
 {
 37  
     /** The logger. */
 38  0
     private static final Log log = LogFactory.getLog(BaseHierarchyResolver.class);
 39  
     
 40  
     /**
 41  
      * @see org.apache.jetspeed.security.HierarchyResolver#resolveChildren(java.util.prefs.Preferences)
 42  
      */
 43  
     public String[] resolveChildren(Preferences prefs)
 44  
     {
 45  0
         ArgUtil.notNull(new Object[] { prefs }, class="keyword">new String[] { "preferences" }, "resolveChildren(java.util.prefs.Preferences)");
 46  
 
 47  0
         List children = new ArrayList();
 48  0
         processPreferences(prefs, children);
 49  0
         return (String[]) children.toArray(new String[0]);
 50  
     }
 51  
     
 52  
     /**
 53  
      * <p>
 54  
      * Recursively processes the preferences.
 55  
      * </p>
 56  
      * 
 57  
      * @param prefs The preferences.
 58  
      * @param list The list to add the preferences to.
 59  
      */
 60  
     protected void processPreferences(Preferences prefs, List list)
 61  
     {
 62  0
         if (!list.contains(prefs.absolutePath()))
 63  
         {
 64  0
             list.add(prefs.absolutePath());
 65  
         }
 66  
         try
 67  
         {
 68  0
             String[] names = prefs.childrenNames();
 69  0
             for (int i = 0; i < names.length; i++)
 70  
             {
 71  0
                 processPreferences(prefs.node(names[i]), list);
 72  
             }
 73  
         }
 74  0
         catch (BackingStoreException bse)
 75  
         {
 76  0
             log.warn("can't find children of " + prefs.absolutePath(), bse);
 77  0
         }
 78  0
     }
 79  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.