Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
Description
SkinStyleSheetParserUtils.trimQuotes trims mis-matched quotes, though mismatched quotes should not be allowed. Here is the code.
public static String trimQuotes(String in)
We can change it to be more strict, but log a warning if they had mismatched quotes so they will know and they can fix them.
public static String trimQuotesStrict(String in)
{
if ( in == null )
return in;
in = in.trim();
boolean startsWithDoubleQuote = in.startsWith( "\"" );
boolean startsWithSingleQuote = in.startsWith( "\'" );
boolean endsWithDoubleQuote = in.endsWith( "\"" );
boolean endsWithSingleQuote = in.endsWith( "\'" );
if (( startsWithDoubleQuote && endsWithSingleQuote ) ||
( startsWithSingleQuote && endsWithDoubleQuote ))
if ( startsWithDoubleQuote && endsWithDoubleQuote )
return in.substring( 1, in.length() - 1 );
if ( startsWithSingleQuote && endsWithSingleQuote )
return in.substring( 1, in.length() - 1 );
return in;
}