2002/css-validator/org/w3c/css/index IndexGenerator.java,1.1,1.2

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

Modified Files:
	IndexGenerator.java 
Log Message:
The method getClass().getResources("") is not working the same way on each machine.
So I added a test case to see if the template is find with this method and if not, the missing path is added manually.

Index: IndexGenerator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/index/IndexGenerator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- IndexGenerator.java	30 Jul 2007 12:10:55 -0000	1.1
+++ IndexGenerator.java	20 Aug 2007 14:48:43 -0000	1.2
@@ -36,6 +36,7 @@
 	// (NB: the same context is used for each index page, changing every thing
 	// inside)
 	public static VelocityContext vc = new VelocityContext();
+	private static String template_name = "validator.vm";
 
 	/**
 	 * @param args
@@ -77,7 +78,9 @@
 				path = new URI(path).getPath();
 			Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, path);
 			Velocity.init();
-			Template tpl = Velocity.getTemplate("validator.vm", "UTF-8");
+			if (!new File(path + template_name).exists())
+				template_name = "org/w3c/css/css/" + template_name;
+			Template tpl = Velocity.getTemplate(template_name, "UTF-8");
 			int count = 0;
 
 			// For each language, we set the context are create the template
@@ -89,7 +92,6 @@
 				// and if they have been created after the last template modification
 				if ((tmpFile.lastModified() < tpl.getLastModified()) || !tmpFile.exists()) {
 					ApplContext ac = new ApplContext(name);
-					vc.put("link", "validator." + name);
 					vc.put("lang", name);
 
 					if (ac.getLang().equals(default_lang)) {

Received on Monday, 20 August 2007 14:48:50 UTC