@ VisibleForTesting static void pretendValidateResource ( String resourceName , ContentKind kind ) { int index = resourceName . lastIndexOf ( ' ' ) ; Preconditions . checkArgument ( index >= 0 , "Currently, we only validate resources with explicit extensions." ) ; String fileExtension = resourceName . substring ( index + 1 ) . toLowerCase ( ) ; switch ( kind ) { case JS : Preconditions . checkArgument ( fileExtension . equals ( "js" ) ) ; break ; case HTML : Preconditions . checkArgument ( SAFE_HTML_FILE_EXTENSIONS . contains ( fileExtension ) ) ; break ; case CSS : Preconditions . checkArgument ( fileExtension . equals ( "css" ) ) ; break ; default : throw new IllegalArgumentException ( "Don't know how to validate resources of kind " + kind ) ; } }
Very basic but strict validation that the resource s extension matches the content kind .