Clover coverage report - Maven Clover report
Coverage timestamp: Thu Oct 11 2007 08:41:48 CEST
file stats: LOC: 70   Methods: 3
NCLOC: 37   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SafeHashtable.java 75% 83.3% 100% 84.2%
coverage coverage
 1    /*
 2    * Copyright (C) 2007 Eric MIGNOT - mignots.eric@free.fr
 3    *
 4    * This library is free software; you can redistribute it and/or
 5    * modify it under the terms of the GNU Lesser General Public
 6    * License as published by the Free Software Foundation; either
 7    * version 2.1 of the License, or (at your option) any later version.
 8    *
 9    * This library is distributed in the hope that it will be useful,
 10    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 12    * Lesser General Public License for more details.
 13    *
 14    * You should have received a copy of the GNU Lesser General Public
 15    * License along with this library; if not, write to the Free Software
 16    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18   
 19    package org.ericmignot.modeler.util.collection;
 20   
 21    import java.io.UnsupportedEncodingException;
 22    import java.net.URLDecoder;
 23    import java.util.*;
 24   
 25    /**
 26    * A Hashtable that provides an API with default value for the get Hashtable
 27    * native method
 28    */
 29    public class SafeHashtable extends Hashtable
 30    {
 31    /**
 32    * Return the value corresponding to the given key or the default value if not found
 33    * or null if the given key is null
 34    * @param p_Key
 35    * @param p_DefaultValue
 36    * @return
 37    */
 38  1388 public String get(String p_Key, String p_DefaultValue)
 39    {
 40  0 if (p_Key == null) return null;
 41  1388 Object l_ToReturn = get(p_Key);
 42  1388 if (l_ToReturn == null)
 43    {
 44  1343 return p_DefaultValue;
 45    }
 46    else
 47    {
 48  45 return (String) l_ToReturn;
 49    }
 50    }
 51   
 52  48 public Object put(Object key, Object value)
 53    {
 54  48 String valueToPut = (String ) value;
 55  48 try
 56    {
 57  48 valueToPut = URLDecoder.decode(valueToPut, "utf-8");
 58    }
 59    catch (UnsupportedEncodingException e)
 60    {
 61  0 e.printStackTrace();
 62    }
 63  48 return super.put(key, valueToPut);
 64    }
 65   
 66  6 public void init()
 67    {
 68  6 this.clear();
 69    }
 70    }