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
Created attachment 13761 [details] patch fixing this problem Added patch
*** Bug 32577 has been marked as a duplicate of this bug. ***
This is fixed in the CVS. The fix is modified from the patch here, since your patch doesn't handle the case: <listener-class>package.MyClass$${inner.class}</listener-class>
*** Bug 34843 has been marked as a duplicate of this bug. ***