if (sourceName == null)
throw new NullPointerException();
if (context == null)
throw new NullPointerException();
InputStreamProvider provider = resolver.getProvider(sourceName);
Object cached = provider.getCachedResult();
if ((cached != null) && expectedType.isInstance(cached))
return (StyleSheetEntry)cached;
InputStream stream = provider.openInputStream();
try
{
// Store a resolver relative to the file we're about to parse. This will be used for imports.
// Store the inputStreamProvider on the context;
// this will be used to get the document's timestamp later on
XMLUtils.setResolver(context, resolver.getResolver(sourceName));
XMLUtils.setInputStreamProvider(context, provider);
// PARSE!
// create a SkinStyleSheetNode
// (contains a namespaceMap and a List of SkinSelectorPropertiesNodes
// and additional information like direction, locale, etc.)
// (selectorName + a css propertyList))
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
SkinCSSParser parser = new SkinCSSParser();
// Send over the ParseContext so that we can get the resolver from it in case we encounter
// an @import in the CSS file.
SkinCSSDocumentHandler documentHandler = new SkinCSSDocumentHandler(context);
parser.parseCSSDocument(reader, documentHandler);
List <SkinStyleSheetNode> skinSSNodeList = documentHandler.getSkinStyleSheetNodes();
reader.close();
// process the SkinStyleSheetNodes to create a StyleSheetEntry object
StyleSheetEntry styleSheetEntry =
_createStyleSheetEntry(context, sourceName, skinSSNodeList);
// Store the cached result (if successful)
// otherwise, if we don't do this, we will keep reparsing. Somehow
// this affects whether the file has been modified. STRANGE!
// if (value != null)
// provider.setCachedResult(value);
// return value;
provider.setCachedResult(styleSheetEntry);
return styleSheetEntry;
}
finally
{