Gradle 2.4 war task corrupts images

Hi

We have just migrated to Gradle 2.4 noticed that the war task is corrupting all of our image files if it has a code to replace token without specifying any file filters.

E.g. below is the war task that is corrupting images

war{
    rootSpec.exclude "*.jar" 
	manifest {
        attributes("Java-Version": org.gradle.api.JavaVersion.current(), "Built-By": System.properties['user.name'],"Built-on":new Date(),"Version":version)
    }	
	   		
	//These tokens are used to replace in file process.xml under PLF/Metadata
	project.buildEnvProps.APPLICATION_VERSION=rootProject.version
	project.buildEnvProps.APPLICATION_REVDATE=new Date().toString()
	
	//Replace all the tokens while moving file to build directory
	filter(ReplaceTokens, tokens: project.buildEnvProps)
}

Same war task works fine (all the images are displaying properly) with everything same as above except for the below line.
//Replace all the tokens while moving file to build directory
filesMatching( ‘**/*.xml’ ) {
filter(ReplaceTokens, tokens: project.buildEnvProps)
}

Image Inside war if war task has no file filter for token replace:

Image inside war if war task has file filter for token replace:

This is due to the ReplaceTokens filter which indiscriminately mucks with your files. Essentially, you’ll want to avoid using filters in conjunction with binary files. Limiting its application to file extensions that will contain the tokens, as demonstrated in your second example is the best solution.