W3C home > Mailing lists > Public > www-validator-cvs@w3.org > February 2009

2002/css-validator/org/w3c/css/properties PropertiesLoader.java,1.3,1.4

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 11 Feb 2009 22:42:23 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1LXNmh-00024C-72@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/properties
In directory hutz:/tmp/cvs-serv7818

Modified Files:
	PropertiesLoader.java 
Log Message:
generics

Index: PropertiesLoader.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/properties/PropertiesLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- PropertiesLoader.java	13 Sep 2007 10:10:47 -0000	1.3
+++ PropertiesLoader.java	11 Feb 2009 22:42:18 -0000	1.4
@@ -45,18 +45,19 @@
      * This hashtable contains for each css profile, an Utf8Properties
      * containing all its properties
      */
-    private static Hashtable allProps;
+    private static Hashtable<String, Utf8Properties> allProps;
 
     private static Utf8Properties loadProfile(String profile,
-	    String profilePath) throws IOException {
-
+					      String profilePath) 
+	throws IOException 
+    {
 	Utf8Properties result = new Utf8Properties();
 	InputStream f = null;
 
 	URL url = null;
 
 	// the url of the properties file of the selected profile
-	if(profilePath != null) {
+	if (profilePath != null) {
 	    url = PropertiesLoader.class.getResource(profilePath);
 	}
 
@@ -67,7 +68,7 @@
 	// we add the profile to the profiles Hashtable
 	allProps.put(new String(profile), result);
 
-	if(Util.onDebug) {
+	if (Util.onDebug) {
 	    System.out.println(profile + " profile loaded");
 	}
 	return result;
@@ -75,26 +76,26 @@
 
     /**
      *
-     * @param profile the profile needed
-     * @return an Utf8Properties containing all the properties for the specified profile
+     * @param  profile the profile needed
+     * @return an Utf8Properties containing all the properties 
+     *         for the specified profile
      */
     public static Utf8Properties getProfile(String profile) {
 	Utf8Properties result = (Utf8Properties) allProps.get(profile);
 	// the profile has not been loaded yet
-	if(result == null) {
+	if (result == null) {
 	    result = new Utf8Properties();
 
 	    String profilePath = (String) profiles.get(profile);
 
-	    if(profilePath != null && !profilePath.equals("")) {
+	    if (profilePath != null && !profilePath.equals("")) {
 		try {
 		    return loadProfile(profile, profilePath);
-		}
-		catch(IOException e) {
+		} catch(IOException e) {
 		    if(Util.onDebug) {
 			System.out.println(PropertiesLoader.class +
-				": Error while loading " + profile +
-				" profile");
+					   ": Error while loading " + profile +
+					   " profile");
 		    }
 		    e.printStackTrace();
 		}
@@ -102,8 +103,7 @@
 	    // if the wanted profile is unknown, or there has been an error
 	    // while loading it, we return the default profile
 	    return DEFAULT_PROFILE;
-	}
-	else {
+	} else {
 	    return result;
 	}
     }
@@ -118,14 +118,14 @@
     	//initializations
     	Iterator it = profiles.keySet().iterator();
     	
-    	ArrayList res = new ArrayList();
+    	ArrayList<String> res = new ArrayList<String>();
     	String profil;
     	
     	while (it.hasNext()) {
-    		// we filtered only the profiles that we're interessted in
-    		profil = it.next().toString();
-    		if (profil.startsWith("css"))
-	    		res.add(profil);
+	    // we filtered only the profiles that we're interessted in
+	    profil = it.next().toString();
+	    if (profil.startsWith("css"))
+		res.add(profil);
     	}
     	// we sort them
     	Collections.sort(res);
@@ -138,7 +138,7 @@
 	mediaProperties = new Utf8Properties();
 	profiles = new Utf8Properties();
 
-	allProps = new Hashtable();
+	allProps = new Hashtable<String, Utf8Properties>();
 
 	InputStream f = null;
 
@@ -149,13 +149,14 @@
 	    config.load(f);
 
 	    // the media associated to each property
-	    url = PropertiesLoader.class.getResource(config.getProperty("media"));
+	    url = PropertiesLoader.class.getResource(
+						   config.getProperty("media"));
 	    f = url.openStream();
 	    mediaProperties.load(f);
 
 	    // profiles
 	    url = PropertiesLoader.class.getResource(
-		    config.getProperty("profilesProperties"));
+				      config.getProperty("profilesProperties"));
 
 	    f = url.openStream();
 	    profiles.load(f);
@@ -167,12 +168,11 @@
 
 	    if(Util.onDebug) {
 		System.out.println("Default profile (" + defaultProfile +
-			") loaded");
+				   ") loaded");
 	    }
-
 	} catch (Exception e) {
 	    System.err.println(PropertiesLoader.class +
-		    ": Error while loading default config");
+			       ": Error while loading default config");
 	    e.printStackTrace();
 	} finally {
 	    try {
Received on Wednesday, 11 February 2009 22:42:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:08 GMT