DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=32719>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=32719 Summary: IntrospectionUtils feature causes $ charters to be stripped out of web.xml files Product: Tomcat 5 Version: 5.5.4 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Unknown AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] class: org.apache.tomcat.util.IntrospectionUtils method: replaceProperties(String, Hashtable, PropertySource[]) CVS: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/IntrospectionUtils.java A possibily unintentional feature of IntrospectionUtils.replaceProperties causes the $ character to the stripped from web.xml files when they are loaded. This was discovered when the name of an inner class was specified as a parameter: <init-param> <param-name>source.factory</param-name> <param-value>com.ssl.javaservlets.tihinterface.PcoRegionsSqlDataSource$Factory</param-value> </init-param> However when the servlet retrieved this parameter, the $ character had been removed yeilding the result: "com.ssl.javaservlets.tihinterface.PcoRegionsSqlDataSourceFactory" rather than: "com.ssl.javaservlets.tihinterface.PcoRegionsSqlDataSource$Factory" This seemed related to the processing of replacement properties defined in the style ${property.name}. However if the is no property "property.name" then the raw text "${property.name}" passes through untouched, likewise if a $ is placed a the end of a string. Upon inspecting the IntrospectionUtils.replaceProperties method, I noticed that this behaviour was due to the following code starting @ line 475: } else if (value.charAt(pos + 1) != '{') { sb.append(value.charAt(pos + 1)); prev = pos + 2; // XXX } else { Therefore after consuming a $ and the lookahead says that a non { character follows, only the non { character is placed on the buffer and the $ which has just been consumed is dropped. This can be fixed by simply adding the $ to the buffer, thus: } else if (value.charAt(pos + 1) != '{') { sb.append('$'); sb.append(value.charAt(pos + 1)); prev = pos + 2; } else { I looking back over the CVS history this faulty logic is almost 3 years old, yet I could not find an entry in the bug database for it. I've been using Tomcat for over 3 years now myself and find it strange to of only stubled over this bug after all this time, I guess I've never used a string with the $ character before :P -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]