Index: build/build.xml
===================================================================
--- build/build.xml	(revision 1116)
+++ build/build.xml	(working copy)
@@ -515,6 +515,7 @@
 
 	<!-- Initialization Target -->
 	<target name="all" depends="test, generate, javadoc, package, findbugs" description="Full build"/>
+	<target name="verify" depends="test, package, findbugs" description="verify build"/>
 
 	<!-- Initialization Target -->
 	<target name="init" description="Initialize some properties">
Index: module/com.noelios.restlet.test/src/com/noelios/restlet/test/CookiesTestCase.java
===================================================================
--- module/com.noelios.restlet.test/src/com/noelios/restlet/test/CookiesTestCase.java	(revision 1116)
+++ module/com.noelios.restlet.test/src/com/noelios/restlet/test/CookiesTestCase.java	(working copy)
@@ -142,7 +142,7 @@
 		Date date = DateUtils.parse(dateValue, DateUtils.FORMAT_RFC_1036);
 
 		// Rewrite the date
-		String newDateValue = DateUtils.format(date, DateUtils.FORMAT_RFC_1036[0]);
+		String newDateValue = DateUtils.format(date, DateUtils.FORMAT_RFC_1036.get(0));
 
 		// Compare initial and new headers
 		assertEquals(dateValue, newDateValue);
Index: module/com.noelios.restlet/src/com/noelios/restlet/http/HttpCall.java
===================================================================
--- module/com.noelios.restlet/src/com/noelios/restlet/http/HttpCall.java	(revision 1116)
+++ module/com.noelios.restlet/src/com/noelios/restlet/http/HttpCall.java	(working copy)
@@ -119,11 +119,11 @@
 	{
 		if (cookie)
 		{
-			return DateUtils.format(date, DateUtils.FORMAT_RFC_1036[0]);
+			return DateUtils.format(date, DateUtils.FORMAT_RFC_1036.get(0));
 		}
 		else
 		{
-			return DateUtils.format(date, DateUtils.FORMAT_RFC_1123[0]);
+			return DateUtils.format(date, DateUtils.FORMAT_RFC_1123.get(0));
 		}
 	}
 
Index: module/com.noelios.restlet/src/com/noelios/restlet/http/HttpClientConverter.java
===================================================================
--- module/com.noelios.restlet/src/com/noelios/restlet/http/HttpClientConverter.java	(revision 1116)
+++ module/com.noelios.restlet/src/com/noelios/restlet/http/HttpClientConverter.java	(working copy)
@@ -171,7 +171,7 @@
 		if (condition.getModifiedSince() != null)
 		{
 			String imsDate = DateUtils.format(condition.getModifiedSince(),
-					DateUtils.FORMAT_RFC_1123[0]);
+					DateUtils.FORMAT_RFC_1123.get(0));
 			requestHeaders.add(HttpConstants.HEADER_IF_MODIFIED_SINCE, imsDate);
 		}
 
@@ -191,7 +191,7 @@
 		if (condition.getUnmodifiedSince() != null)
 		{
 			String iusDate = DateUtils.format(condition.getUnmodifiedSince(),
-					DateUtils.FORMAT_RFC_1123[0]);
+					DateUtils.FORMAT_RFC_1123.get(0));
 			requestHeaders.add(HttpConstants.HEADER_IF_UNMODIFIED_SINCE, iusDate);
 		}
 
Index: module/com.noelios.restlet/src/com/noelios/restlet/http/HttpServerConverter.java
===================================================================
--- module/com.noelios.restlet/src/com/noelios/restlet/http/HttpServerConverter.java	(revision 1116)
+++ module/com.noelios.restlet/src/com/noelios/restlet/http/HttpServerConverter.java	(working copy)
@@ -135,7 +135,7 @@
 
 			// Add the date 
 			responseHeaders.add(HttpConstants.HEADER_DATE, DateUtils.format(new Date(),
-					DateUtils.FORMAT_RFC_1123[0]));
+					DateUtils.FORMAT_RFC_1123.get(0)));
 
 			// Add the cookie settings
 			List<CookieSetting> cookies = response.getCookieSettings();
Index: module/com.noelios.restlet/src/com/noelios/restlet/util/CookieUtils.java
===================================================================
--- module/com.noelios.restlet/src/com/noelios/restlet/util/CookieUtils.java	(revision 1116)
+++ module/com.noelios.restlet/src/com/noelios/restlet/util/CookieUtils.java	(working copy)
@@ -152,7 +152,7 @@
 					long expiresTime = currentTime + maxTime;
 					Date expires = new Date(expiresTime);
 					destination.append("; Expires=");
-					appendValue(DateUtils.format(expires, DateUtils.FORMAT_RFC_1036[0]),
+					appendValue(DateUtils.format(expires, DateUtils.FORMAT_RFC_1036.get(0)),
 							version, destination);
 				}
 				else
Index: module/com.noelios.restlet/src/com/noelios/restlet/util/SecurityUtils.java
===================================================================
--- module/com.noelios.restlet/src/com/noelios/restlet/util/SecurityUtils.java	(revision 1116)
+++ module/com.noelios.restlet/src/com/noelios/restlet/util/SecurityUtils.java	(working copy)
@@ -98,7 +98,7 @@
 				if (date == null)
 				{
 					// Add a fresh Date header
-					date = DateUtils.format(new Date(), DateUtils.FORMAT_RFC_1123[0]);
+					date = DateUtils.format(new Date(), DateUtils.FORMAT_RFC_1123.get(0));
 					httpHeaders.add(HttpConstants.HEADER_DATE, date);
 				}
 			}
Index: module/org.restlet/src/org/restlet/data/ChallengeScheme.java
===================================================================
--- module/org.restlet/src/org/restlet/data/ChallengeScheme.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/ChallengeScheme.java	(working copy)
@@ -91,12 +91,21 @@
 	 * @param object The object to compare to.
 	 * @return True if both metadata are equal.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof ChallengeScheme)
 				&& ((ChallengeScheme) object).getName().equalsIgnoreCase(getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().toLowerCase().hashCode();
+	}
 
+
 	/**
 	 * Returns the challenge scheme associated to a scheme name. If an existing constant exists then it is 
 	 * returned, otherwise a new instance is created.
Index: module/org.restlet/src/org/restlet/data/CharacterSet.java
===================================================================
--- module/org.restlet/src/org/restlet/data/CharacterSet.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/CharacterSet.java	(working copy)
@@ -84,12 +84,21 @@
 	 * @param object The object to compare to.
 	 * @return True if the character set is equal to a given one.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof CharacterSet)
 				&& getName().equalsIgnoreCase(((CharacterSet) object).getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().toLowerCase().hashCode();
+	}
 
+
 	/**
 	 * Returns the character set associated to a name. If an existing constant exists then it is 
 	 * returned, otherwise a new instance is created.
Index: module/org.restlet/src/org/restlet/data/Conditions.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Conditions.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Conditions.java	(working copy)
@@ -22,6 +22,7 @@
 
 package org.restlet.data;
 
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -48,10 +49,7 @@
 	 */
 	public Conditions()
 	{
-		this.modifiedSince = null;
-		this.unmodifiedSince = null;
-		this.match = null;
-		this.noneMatch = null;
+
 	}
 
 	/**
Index: module/org.restlet/src/org/restlet/data/Encoding.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Encoding.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Encoding.java	(working copy)
@@ -73,12 +73,21 @@
 	 * @param object The object to compare to.
 	 * @return True if the encoding is equal to a given one.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Encoding)
 				&& getName().equalsIgnoreCase(((Encoding) object).getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().toLowerCase().hashCode();
+	}
 
+
 	/**
 	 * Returns the encoding associated to a name. If an existing constant exists then it is 
 	 * returned, otherwise a new instance is created.
Index: module/org.restlet/src/org/restlet/data/Language.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Language.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Language.java	(working copy)
@@ -107,12 +107,21 @@
 	 * @param object The object to compare to.
 	 * @return True if the language is equal to a given one.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Language)
 				&& getName().equalsIgnoreCase(((Language) object).getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().toLowerCase().hashCode();
+	}
 
+
 	/**
 	 * Returns the language associated to a name. If an existing constant exists then it is 
 	 * returned, otherwise a new instance is created.
Index: module/org.restlet/src/org/restlet/data/MediaType.java
===================================================================
--- module/org.restlet/src/org/restlet/data/MediaType.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/MediaType.java	(working copy)
@@ -343,11 +343,19 @@
 	 * @param object The object to compare to.
 	 * @return True if both media types are equal.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof MediaType)
 				&& ((MediaType) object).getName().equals(getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().hashCode();
+	}
 
 	/**
 	 * Returns the media type associated to a name. If an existing constant exists then it is 
Index: module/org.restlet/src/org/restlet/data/Metadata.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Metadata.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Metadata.java	(working copy)
@@ -75,12 +75,20 @@
 	 * @param object The object to compare to.
 	 * @return True if both metadata are equal.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Metadata)
 				&& ((Metadata) object).getName().equals(getName());
 	}
 
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().hashCode();
+	}
+
 	/**
 	 * Returns the description.
 	 * @return The description.
Index: module/org.restlet/src/org/restlet/data/Method.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Method.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Method.java	(working copy)
@@ -157,11 +157,19 @@
 	 * @param object The object to compare to.
 	 * @return True if both metadata are equal.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Method)
 				&& ((Method) object).getName().equals(getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().hashCode();
+	}
 
 	/**
 	 * Returns the method associated to a given method name. If an existing constant exists then it is returned,
Index: module/org.restlet/src/org/restlet/data/Parameter.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Parameter.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Parameter.java	(working copy)
@@ -79,35 +79,51 @@
     * @return True if the parameters are identical (name and value).
     */
    public boolean equals(Object object)
-   {
-      boolean result = object instanceof Parameter;
+	{
+		boolean result = false;
+		if (object instanceof Parameter && object != null) //avoid findbugs correctness warning
+		{
+			final Parameter that = (Parameter) object;
+			final String thisName = this.getName();
+			final String thatName = that.getName();
+			if(!(thisName == thatName)) { // compare names taking care of nulls
+				result = (thisName != null && thisName.equals(thatName));				
+			}
+			//compare values if names are equal
+			if (result)
+			{
+				final String thisValue = this.getValue();
+				final String thatValue = that.getValue();
+				if (!(thisValue == thatValue)) // consider equality with nulls
+				{ 
+					result = (thisValue != null && thisValue.equals(thatValue));
+				}
+			}
 
-      if(result)
-      {
-      	Parameter param = (Parameter)object;
-      	
-	      if(getName() == null)
-	      {
-	         result = (param.getName() == null);
-	      }
-	      else
-	      {
-	         result = getName().equals(param.getName());
-	      }
-	
-	      if(getValue() == null)
-	      {
-	         result &= (param.getValue() == null);
-	      }
-	      else
-	      {
-	         result &= getValue().equals(param.getValue());
-	      }
-      }
-      
-      return result;
-   }
+		}
 
+		return result;
+	}
+
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		int nameHashCode = 0;
+		int valueHashCode = 0;
+
+		if (getName() != null)
+		{
+			nameHashCode = getName().hashCode();
+		}
+		if (getValue() != null)
+		{
+			valueHashCode = getValue().hashCode();
+		}
+		// todo could we exceed INTEGER.MAX_VALUE?
+		return nameHashCode + valueHashCode;
+	}
+
    /**
     * Returns the name of this parameter.
     * @return The name of this parameter.
Index: module/org.restlet/src/org/restlet/data/Protocol.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Protocol.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Protocol.java	(working copy)
@@ -134,12 +134,21 @@
 	 * @param object The object to compare to.
 	 * @return True if the protocol is equal to a given one.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Protocol)
 				&& getName().equalsIgnoreCase(((Protocol) object).getName());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().toLowerCase().hashCode();
+	}
 
+
 	/**
 	 * Creates the protocol associated to a URI scheme name. If an existing constant exists then it is returned,
 	 * otherwise a new instance is created.
Index: module/org.restlet/src/org/restlet/data/ReferenceList.java
===================================================================
--- module/org.restlet/src/org/restlet/data/ReferenceList.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/ReferenceList.java	(working copy)
@@ -27,6 +27,7 @@
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.logging.Logger;
 
 import org.restlet.resource.Representation;
 import org.restlet.resource.StringRepresentation;
@@ -38,6 +39,10 @@
  */
 public class ReferenceList extends WrapperList<Reference>
 {
+	/** Obtain a suitable logger. */
+	private static Logger logger = Logger
+			.getLogger(ReferenceList.class.getCanonicalName());
+
 	/** The list reference. */
 	private Reference listRef;
 
@@ -74,24 +79,45 @@
 	 */
 	public ReferenceList(Representation uriList) throws IOException
 	{
-		BufferedReader br = new BufferedReader(new InputStreamReader(uriList.getStream()));
-		String line = br.readLine();
+		BufferedReader br = null;
+		try
+		{
+			br = new BufferedReader(new InputStreamReader(uriList.getStream()));
 
-		// Check if the list reference is specified as the first comment
-		if (line.startsWith("#"))
-		{
-			setListRef(new Reference(line.substring(1).trim()));
-			line = br.readLine();
+			String line = br.readLine();
+
+			// Check if the list reference is specified as the first comment
+			if (line.startsWith("#"))
+			{
+				setListRef(new Reference(line.substring(1).trim()));
+				line = br.readLine();
+			}
+
+			while (line != null)
+			{
+				if (!line.startsWith("#"))
+				{
+					add(new Reference(line.trim()));
+				}
+
+				line = br.readLine();
+			}
 		}
-
-		while (line != null)
+		finally
 		{
-			if (!line.startsWith("#"))
+			if (br != null)
 			{
-				add(new Reference(line.trim()));
+				try
+				{
+					br.close();
+				}
+				catch (IOException e)
+				{
+					logger.warning("IOException encountered while closing an open BufferedReader"
+									+ e.getMessage());
+				}
 			}
 
-			line = br.readLine();
 		}
 	}
 
Index: module/org.restlet/src/org/restlet/data/Request.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Request.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Request.java	(working copy)
@@ -284,7 +284,7 @@
 		}
 		else if ((baseRef != null) && !baseRef.isParent(getResourceRef()))
 		{
-			new IllegalArgumentException(
+			throw new IllegalArgumentException(
 					"You must specify a base reference that is a parent of the resource reference");
 		}
 
Index: module/org.restlet/src/org/restlet/data/Status.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Status.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Status.java	(working copy)
@@ -930,10 +930,18 @@
 	 * @param object The object to compare to.
 	 * @return True if the status is equal to a given one.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Status) && (this.code == ((Status) object).getCode());
 	}
+	
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getCode();
+	}
 
 	/**
 	 * Returns the name of the status followed by its HTTP code.
Index: module/org.restlet/src/org/restlet/data/Tag.java
===================================================================
--- module/org.restlet/src/org/restlet/data/Tag.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/data/Tag.java	(working copy)
@@ -155,9 +155,17 @@
 	 * @param object The object to compare to.
 	 * @return True if both tags are equal.
 	 */
+	@Override
 	public boolean equals(Object object)
 	{
 		return (object instanceof Tag) && getName().equals(((Tag) object).getName());
 	}
 
+	/** @{inheritDoc} */
+	@Override
+	public int hashCode()
+	{
+		return getName().hashCode();
+	}
+
 }
Index: module/org.restlet/src/org/restlet/Extractor.java
===================================================================
--- module/org.restlet/src/org/restlet/Extractor.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/Extractor.java	(working copy)
@@ -296,7 +296,7 @@
 	/**
 	 * Internal class holding extraction information.
 	 */
-	protected class ExtractInfo
+	protected static class ExtractInfo
 	{
 		/**
 		 * Holds the attribute name.
Index: module/org.restlet/src/org/restlet/util/DateUtils.java
===================================================================
--- module/org.restlet/src/org/restlet/util/DateUtils.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/util/DateUtils.java	(working copy)
@@ -24,7 +24,10 @@
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
+import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
 
@@ -35,26 +38,38 @@
 public class DateUtils
 {
    /** Preferred HTTP date format (RFC 1123). */
-   public static final String[] FORMAT_RFC_1123 = {"EEE, dd MMM yyyy HH:mm:ss zzz"};
+   public static final List<String> FORMAT_RFC_1123 = unmodifiableList("EEE, dd MMM yyyy HH:mm:ss zzz");
 
    /** Obsoleted HTTP date format (RFC 1036). */
-   public static final String[] FORMAT_RFC_1036 = {"EEEE, dd-MMM-yy HH:mm:ss zzz"};
+   public static final List<String> FORMAT_RFC_1036 = unmodifiableList("EEEE, dd-MMM-yy HH:mm:ss zzz");
 
    /** Obsoleted HTTP date format (ANSI C asctime() format). */
-   public static final String[] FORMAT_ASC_TIME = {"EEE MMM dd HH:mm:ss yyyy"};
+   public static final List<String> FORMAT_ASC_TIME = unmodifiableList("EEE MMM dd HH:mm:ss yyyy");
    
    /** W3C date format (RFC 3339). */
-   public static final String[] FORMAT_RFC_3339 = {"yyyy-MM-dd'T'HH:mm:ssz", "yyyy-MM-dd'T'HH:mmz", 
-   	"yyyy-MM-dd", "yyyy-MM", "yyyy"};
+   public static final List<String> FORMAT_RFC_3339 = unmodifiableList("yyyy-MM-dd'T'HH:mm:ssz", "yyyy-MM-dd'T'HH:mmz", 
+      	"yyyy-MM-dd", "yyyy-MM", "yyyy");
 
    /** Common date format (RFC 822). */
-   public static final String[] FORMAT_RFC_822 = {"EEE, dd MMM yy HH:mm:ss z", "EEE, dd MMM yy HH:mm z",
-   	"dd MMM yy HH:mm:ss z", "dd MMM yy HH:mm z"};
+   public static final List<String> FORMAT_RFC_822 = unmodifiableList("EEE, dd MMM yy HH:mm:ss z", "EEE, dd MMM yy HH:mm z",
+   	"dd MMM yy HH:mm:ss z", "dd MMM yy HH:mm z");
    
    /** Remember the often used GMT time zone. */
    private static final TimeZone TIMEZONE_GMT = TimeZone.getTimeZone("GMT");
 
    /**
+    * Helper method to help initialize this class by providing unmodifiable lists based on arrays.
+    * 
+    * @param <T> Any valid java object
+    * @param array to be convereted into an unmodifiable list
+    * @return unmodifiable list based on the provided array
+    */
+   private static <T> List<T> unmodifiableList(T... array)
+	{
+		return Collections.unmodifiableList(Arrays.asList(array));
+	}
+   
+   /**
     * Compares two date with a precision of one second.
     * @param baseDate The base date
     * @param afterDate The date supposed to be after.
@@ -140,6 +155,45 @@
     * @param formats The date formats to use sorted by completeness.
     * @return The parsed date.
     */
+   public static Date parse(String date, List<String> formats)
+   {
+   	Date result = null;
+   	
+      if(date == null) 
+      {
+         throw new IllegalArgumentException("Date is null");
+      }
+      else
+      {
+      	String format = null;
+      	final int formatsSize = formats.size();
+      	for(int i = 0; (result == null) && (i < formatsSize); i++)
+      	{
+      		format = formats.get(i);
+	         SimpleDateFormat parser = new SimpleDateFormat(format, Locale.US);
+	         parser.setTimeZone(TIMEZONE_GMT);
+	         
+	         try
+	         {
+	            result = parser.parse(date);
+	         }
+	         catch(ParseException e)
+	         {
+	         	// Ignore error as the next format may work better
+	         }
+      	}
+      }
+      
+      return result;
+   }
+   
+   /**
+    * Parses a formatted date into a Date object.
+    * @param date The date to parse.
+    * @param formats The date formats to use sorted by completeness.
+    * @return The parsed date.
+    * @deprecated use instead {@link #parse(String, List)} to be removed in release 22
+    */
    public static Date parse(String date, String[] formats)
    {
    	Date result = null;
@@ -171,4 +225,11 @@
       return result;
    }
    
+   /**
+	 * Private constructor to ensure that the class acts as a true utility class i.e. it isn't instatiable and extensible.
+	 */
+	private DateUtils()
+	{
+
+	}
 }
Index: module/org.restlet/src/org/restlet/util/Factory.java
===================================================================
--- module/org.restlet/src/org/restlet/util/Factory.java	(revision 1116)
+++ module/org.restlet/src/org/restlet/util/Factory.java	(working copy)
@@ -92,6 +92,7 @@
 
 	/**
 	 * Returns the factory of the Restlet implementation.
+	 * 
 	 * @return The factory of the Restlet implementation.
 	 */
 	public static Factory getInstance()
@@ -123,29 +124,40 @@
 
 			if (configURL != null)
 			{
+				BufferedReader reader = null;
 				try
 				{
-					BufferedReader reader = new BufferedReader(new InputStreamReader(configURL
-							.openStream(), "utf-8"));
+					reader = new BufferedReader(new InputStreamReader(configURL.openStream(),
+							"utf-8"));
 					String providerName = reader.readLine();
 					factoryClassName = providerName.substring(0, providerName.indexOf('#'))
 							.trim();
 				}
 				catch (Exception e)
 				{
-					// Exception during resolution
+					logger
+							.log(
+									Level.SEVERE,
+									"Unable to register the Restlet API implementation. Please check that the JAR file is in your classpath.");
 				}
-			}
+				finally
+				{
+					if (reader != null)
+					{
+						try
+						{
+							reader.close();
+						}
+						catch (IOException e)
+						{
+							logger
+									.warning("IOException encountered while closing an open BufferedReader"
+											+ e.getMessage());
+						}
+					}
 
-			if (factoryClassName == null)
-			{
-				logger
-						.log(
-								Level.SEVERE,
-								"Unable to register the Restlet API implementation. Please check that the JAR file is in your classpath.");
-			}
-			else
-			{
+				}
+
 				// Instantiate the factory
 				try
 				{
@@ -160,11 +172,13 @@
 							"Unable to register the Restlet API implementation");
 				}
 			}
+
 		}
 
 		return result;
 	}
 
+
 	/**
 	 * Sets the factory of the Restlet implementation.
 	 * @param factory The factory to register.
