@@ -164,6 +164,9 @@ def pin_version(old_configuration, version)
164164 if Utils ::VersionUtils . openjdk_jre? old_configuration
165165 rake_output_message "Pinning JRE #{ sub_component_id || component_id } version to #{ version } "
166166 pin_jre ( component_id , sub_component_id , version )
167+ elsif Utils ::VersionUtils . tomcat? old_configuration
168+ rake_output_message "Pinning Tomcat #{ sub_component_id || component_id } version to #{ version } "
169+ pin_tomcat ( component_id , sub_component_id , version )
167170 else
168171 rake_output_message "Pinning #{ sub_component_id || component_id } version to #{ version } "
169172 pin_component ( component_id , sub_component_id , version )
@@ -187,6 +190,17 @@ def pin_jre(component_id, sub_component_id, version)
187190 JavaBuildpack ::Util ::ConfigurationUtils . write ( component_id , configuration_to_update )
188191 end
189192
193+ def pin_tomcat ( component_id , sub_component_id , version )
194+ # update configuration file, pin version & version lines
195+ configuration_to_update = JavaBuildpack ::Util ::ConfigurationUtils . load ( component_id , false , true )
196+ update_configuration ( configuration_to_update , version , sub_component_id )
197+ configuration_to_update [ 'tomcat' ] [ 'version_lines' ] . each_with_index do |version_pattern , index |
198+ configuration_to_update [ 'tomcat' ] [ 'version_lines' ] [ index ] = version \
199+ if Utils ::VersionUtils . version_matches? ( version_pattern , [ version ] )
200+ end
201+ JavaBuildpack ::Util ::ConfigurationUtils . write ( component_id , configuration_to_update )
202+ end
203+
190204 def update_configuration ( config , version , sub_component )
191205 if sub_component . nil?
192206 config [ 'version' ] = version
0 commit comments