- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Fri, 24 Jul 2009 13:47:48 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/util In directory hutz:/tmp/cvs-serv28782/org/w3c/unicorn/util Added Files: MergeProperties.java Log Message: Fixed errors where the velocity config file could not be found New template system for index.html : only one velocity template file and several language properties files --- NEW FILE: MergeProperties.java --- package org.w3c.unicorn.util; import java.io.File; import java.io.IOException; import java.util.Iterator; import java.util.Properties; import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * MergeProperties provides functionality to merge two separate Properties object * * @author Thomas GAMBET */ public class MergeProperties { public static final Log logger = LogFactory.getLog("org.w3c.unicorn.until"); public Properties getMergeProperties(File defaultPropFile, File sourcePropFile) { Properties defaultProps = new Properties(); Properties sourceProps = new Properties(); try { defaultProps.load(defaultPropFile.toURL().openStream()); sourceProps.load(sourcePropFile.toURL().openStream()); } catch (IOException e) { logger.error("Merge Properties Error : " + e.getMessage(), e); } Properties propMerge = new Properties(); Set<Object> keys = defaultProps.keySet(); Iterator<Object> itr = keys.iterator(); String key; while (itr.hasNext()) { key = itr.next().toString(); if (sourceProps.containsKey(key)) propMerge.put(key, sourceProps.get(key)); else propMerge.put(key, defaultProps.get(key)); } return propMerge; } }
Received on Friday, 24 July 2009 13:48:00 UTC