Clover coverage report - Converter - 1.0
Coverage timestamp: Thu Jan 1 1970 10:00:00 EST
file stats: LOC: 66   Methods: 3
NCLOC: 29   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
StringToURLConverter.java - 0% 0% 0%
coverage
 1   
 /*
 2   
  * Copyright (C) The Spice Group. All rights reserved.
 3   
  *
 4   
  * This software is published under the terms of the Spice
 5   
  * Software License version 1.1, a copy of which has been included
 6   
  * with this distribution in the LICENSE.txt file.
 7   
  */
 8   
 package org.codehaus.spice.converter.lib;
 9   
 
 10   
 import java.net.MalformedURLException;
 11   
 import java.net.URL;
 12   
 import org.codehaus.spice.converter.AbstractConverter;
 13   
 import org.codehaus.spice.converter.ConverterException;
 14   
 
 15   
 /**
 16   
  * String to URL converter
 17   
  *
 18   
  * @author Peter Donald
 19   
  * @version $Revision: 1.1 $ $Date: 2003/12/02 08:37:56 $
 20   
  */
 21   
 public class StringToURLConverter
 22   
     extends AbstractConverter
 23   
 {
 24   
     /**
 25   
      * Construct the converter.
 26   
      */
 27  0
     public StringToURLConverter()
 28   
     {
 29  0
         this( null );
 30   
     }
 31   
 
 32   
     /**
 33   
      * Construct the converter with a default value.
 34   
      * If the default value is non-null, it will be returned if unable
 35   
      * to convert object to correct type.
 36   
      *
 37   
      * @param defaultValue the default value
 38   
      */
 39  0
     public StringToURLConverter( final URL defaultValue )
 40   
     {
 41  0
         super( String.class, URL.class, defaultValue );
 42   
     }
 43   
 
 44   
     /**
 45   
      * Converts a String to a URL.
 46   
      *
 47   
      * @param object the original object to convert
 48   
      * @param context the context in which to convert object (unused)
 49   
      * @return the converted object
 50   
      * @throws ConverterException if error converting object
 51   
      */
 52  0
     public Object convert( final Object object, final Object context )
 53   
         throws ConverterException
 54   
     {
 55  0
         try
 56   
         {
 57  0
             return new URL( (String)object );
 58   
         }
 59   
         catch( final MalformedURLException mue )
 60   
         {
 61  0
             return noConvert( object, mue );
 62   
         }
 63   
     }
 64   
 }
 65   
 
 66