cpd: fix #1144 CPD encoding argument has no effect

Make sure the encoding is set before creating the renderer
This commit is contained in:
Peter Bruin 2013-10-28 15:47:59 +08:00
parent c9da879840
commit 33413371f6

View File

@ -23,12 +23,12 @@ public class CPDConfiguration extends AbstractConfiguration {
String languageString = findOptionalStringValue(args, "--language", "java");
language = new LanguageFactory().createLanguage(languageString);
String formatString = findOptionalStringValue(args, "--format", "text");
renderer = getRendererFromString(formatString);
final String systemDefaultEncoding = System.getProperty("file.encoding");
setEncoding( findOptionalStringValue(args, "--encoding", systemDefaultEncoding) );
String formatString = findOptionalStringValue(args, "--format", "text");
renderer = getRendererFromString(formatString);
minimumTileSize = Integer.parseInt(findRequiredStringValue(args, "--minimum-tokens"));
skipDuplicates = findBooleanSwitch(args, "--skip-duplicate-files");