nonTranslated = new HashSet<>();
+ for (String k : props.stringPropertyNames()) {
String val1 = props.getProperty(k);
String val2 = props2.getProperty(k);
- if (val2 != null && val1.equals(val2)) {
+ if (val1.equals(val2)) {
nonTranslated.add(k);
}
}
count[i] = count[i] + (props.size() - missing.size() - nonTranslated.size());
- StringBuffer statusRows = new StringBuffer();
- if (missing.size() != 0) {
- statusRows.append("" + missingKeysLabel + " | "
- + missing.size() + " |
");
+ StringBuilder statusRows = new StringBuilder();
+ if (!missing.isEmpty()) {
+ statusRows
+ .append("")
+ .append(missingKeysLabel)
+ .append(" | ")
+ .append(missing.size())
+ .append(" |
");
} else {
statusRows.append(" | |
");
}
- if (additional.size() != 0) {
- statusRows.append("" + additionalKeysLabel + " | "
- + additional.size() + " |
");
+ if (!additional.isEmpty()) {
+ statusRows
+ .append("")
+ .append(additionalKeysLabel)
+ .append(" | ")
+ .append(additional.size())
+ .append(" |
");
} else {
statusRows.append(" | |
");
}
- if (nonTranslated.size() != 0) {
- statusRows.append("" + nontranslatedKeysLabel + " | "
- + nonTranslated.size() + " |
");
+ if (!nonTranslated.isEmpty()) {
+ statusRows
+ .append("")
+ .append(nontranslatedKeysLabel)
+ .append(" | ")
+ .append(nonTranslated.size())
+ .append(" |
");
}
tableCell(wrapInTable(okLabel, statusRows.toString()), true);
- } finally {
- IOUtil.close(in2);
}
} else {
tableCell(missingFileLabel);
- count[i] = count[i] + 0;
+ count[i] += 0;
}
i = i + 1;
}
}
} catch (IOException ex) {
getLog().error(ex);
- } finally {
- IOUtil.close(in);
}
sink.tableRow_();
}
@@ -403,9 +391,9 @@ public void renderBody() {
sink.tableRow_();
endTable();
- sink.paragraph();
- text(bundle.getString("report.l10n.legend"));
- sink.paragraph_();
+
+ paragraph(bundle.getString("report.l10n.legend"));
+
sink.list();
sink.listItem();
text(bundle.getString("report.l10n.list1"));
@@ -423,19 +411,15 @@ public void renderBody() {
endSection();
if (locales != null) {
- Iterator itx = locales.iterator();
sink.list();
- while (itx.hasNext()) {
- String x = (String) itx.next();
+ for (String x : locales) {
sink.listItem();
link("#" + x, x + " - " + localeDisplayNames.get(x));
sink.listItem_();
}
sink.list_();
- itx = locales.iterator();
- while (itx.hasNext()) {
- String x = (String) itx.next();
+ for (String x : locales) {
startSection(x + " - " + localeDisplayNames.get(x));
sink.anchor(x);
sink.anchor_();
@@ -447,48 +431,43 @@ public void renderBody() {
bundle.getString("report.l10n.tableheader3"),
bundle.getString("report.l10n.tableheader4")
});
- Iterator usedIter = usedFiles.iterator();
- while (usedIter.hasNext()) {
+
+ for (Wrapper wr : usedFiles) {
sink.tableRow();
- Wrapper wr = (Wrapper) usedIter.next();
tableCell(wr.getPath());
- Properties defs = (Properties) wr.getProperties().get(Wrapper.DEFAULT_LOCALE);
- Properties locals = (Properties) wr.getProperties().get(x);
+ Properties defs = wr.getProperties().get(Wrapper.DEFAULT_LOCALE);
+ Properties locals = wr.getProperties().get(x);
if (locals == null) {
locals = new Properties();
}
- Set missing = new TreeSet(defs.keySet());
- missing.removeAll(locals.keySet());
+ Set missing = new TreeSet<>(defs.stringPropertyNames());
+ missing.removeAll(locals.stringPropertyNames());
String cell = "";
- Iterator ms = missing.iterator();
- while (ms.hasNext()) {
- cell = cell + "" + ms.next() + " |
";
+ for (String s : missing) {
+ cell = cell + "" + s + " |
";
}
tableCell(wrapInTable(okLabel, cell), true);
- Set additional = new TreeSet(locals.keySet());
- additional.removeAll(defs.keySet());
- Iterator ex = additional.iterator();
+ Set additional = new TreeSet<>(locals.stringPropertyNames());
+ additional.removeAll(defs.stringPropertyNames());
cell = "";
- while (ex.hasNext()) {
- cell = cell + "" + ex.next() + " |
";
+ for (String ex : additional) {
+ cell = cell + "" + ex + " |
";
}
tableCell(wrapInTable(okLabel, cell), true);
- Set nonTranslated = new TreeSet();
- Iterator itnt = defs.keySet().iterator();
- while (itnt.hasNext()) {
- String k = (String) itnt.next();
+ Set nonTranslated = new TreeSet<>();
+ for (String k : defs.stringPropertyNames()) {
String val1 = defs.getProperty(k);
String val2 = locals.getProperty(k);
- if (val2 != null && val1.equals(val2)) {
+ if (val1.equals(val2)) {
nonTranslated.add(k);
}
}
- Iterator nt = nonTranslated.iterator();
+
cell = "";
- while (nt.hasNext()) {
- String n = (String) nt.next();
+ for (String n : nonTranslated) {
cell = cell + "" + n + " | \"" + defs.getProperty(n) + "\" |
";
}
+
tableCell(wrapInTable(okLabel, cell), true);
sink.tableRow_();
@@ -521,7 +500,7 @@ private Locale createLocale(String localeCode) {
}
private String wrapInTable(String okLabel, String cell) {
- if (cell.length() == 0) {
+ if (cell.isEmpty()) {
cell = okLabel;
} else {
cell = "";
@@ -530,15 +509,15 @@ private String wrapInTable(String okLabel, String cell) {
}
}
- private static class Wrapper {
+ static class Wrapper {
- private String path;
+ private final String path;
- private File file;
+ private final File file;
- private MavenProject proj;
+ private final MavenProject proj;
- private Map properties;
+ private final Map properties;
static final String DEFAULT_LOCALE = "Default";
@@ -546,7 +525,7 @@ public Wrapper(String p, File f, MavenProject prj) {
path = p;
file = f;
proj = prj;
- properties = new HashMap();
+ properties = new HashMap<>();
}
public File getFile() {
@@ -561,16 +540,14 @@ public MavenProject getProject() {
return proj;
}
- public Map getProperties() {
+ public Map getProperties() {
return properties;
}
}
- private static class WrapperComparator implements Comparator {
+ private static class WrapperComparator implements Comparator {
- public int compare(Object o1, Object o2) {
- Wrapper wr1 = (Wrapper) o1;
- Wrapper wr2 = (Wrapper) o2;
+ public int compare(Wrapper wr1, Wrapper wr2) {
int comp1 = wr1.getProject().getBasedir().compareTo(wr2.getProject().getBasedir());
if (comp1 != 0) {
return comp1;