use of com.helger.commons.collection.impl.ICommonsOrderedMap in project ph-css by phax.
the class MainReadAllCSSOnDisc method main.
@SuppressFBWarnings("DMI_HARDCODED_ABSOLUTE_FILENAME")
public static void main(final String[] args) {
int nFilesOK = 0;
int nFilesError = 0;
final ICommonsOrderedMap<File, ParseException> aErrors = new CommonsLinkedHashMap<>();
final Wrapper<File> aCurrentFile = new Wrapper<>();
final ICSSParseExceptionCallback aHdl = ex -> aErrors.put(aCurrentFile.get(), ex);
for (final File aFile : new FileSystemRecursiveIterator(new File("/")).withFilter(IFileFilter.filenameEndsWith(".css"))) {
if (false)
s_aLogger.info(aFile.getAbsolutePath());
aCurrentFile.set(aFile);
final CascadingStyleSheet aCSS = CSSReader.readFromFile(aFile, StandardCharsets.UTF_8, ECSSVersion.CSS30, aHdl);
if (aCSS == null) {
nFilesError++;
s_aLogger.warn(" " + aFile.getAbsolutePath() + " failed!");
} else
nFilesOK++;
}
s_aLogger.info("Done");
for (final Map.Entry<File, ParseException> aEntry : aErrors.entrySet()) s_aLogger.info(" " + aEntry.getKey().getAbsolutePath() + ":\n" + aEntry.getValue().getMessage() + "\n");
s_aLogger.info("OK: " + nFilesOK + "; Error: " + nFilesError);
}
Aggregations