|
From: Jean-Pierre P. <jp....@ti...> - 2004-05-08 21:05:50
|
Hi all, I returned recently from JBoss to Tomcat alone. I had a problem at = starting application as the setWebAppRootSystemProperty method throwed = an exception. First, I had to change the message generated by the exception to show = both the two strings compared. So I was able to see what was wrong. The problem:=20 When setting in Tomcat a relative location for a context, the path = generated by Tomcat starts from tomcat_folder/bin, having something like = "[Tomcat_path]/bin/../dummy". On other hand getRealPath() will render = something like "[Tomcat_path]/dummy". The paths are equivalent but the = strings don't match. The changes: - The exception from setWebAppRootSystemProperty writes both the = compared values - setWebAppRootSystemProperty calls now pathEquals method instead of = equals - In utils.StringUtils, pathEquals and cleanPath methods I wrote were = added - In TestSuiteStringUtils, a test method for cleanPath was added. cleanPath normalizes a path by suppressing all unneeded parts handling = "." and "..". Just it replaces the Windows "\" by unix slashes. It"s not = a problem to add code to restore original sign, but for comparizon, it's = unnecessary. Clearly the method change is more expensive as the original, but has a = better behaviour and finally is called once on start of the application, = so the change is worth as it allows all types of configuration in = Tomcat. Jean-Pierre Pawlak |