// Beautify
StringBuffer sb = new StringBuffer();
Jalopy jalopy = new Jalopy();
jalopy.setFileFormat(FileFormat.UNIX);
jalopy.setInput(tempFile);
jalopy.setOutput(sb);
File jalopyXmlFile = new File("tools/jalopy.xml");
if (!jalopyXmlFile.exists()) {
jalopyXmlFile = new File("../tools/jalopy.xml");
}
if (!jalopyXmlFile.exists()) {
jalopyXmlFile = new File("misc/jalopy.xml");
}
if (!jalopyXmlFile.exists()) {
jalopyXmlFile = new File("../misc/jalopy.xml");
}
if (!jalopyXmlFile.exists()) {
jalopyXmlFile = new File("../../misc/jalopy.xml");
}
try {
Jalopy.setConvention(jalopyXmlFile);
}
catch (FileNotFoundException fnfe) {
}
if (jalopySettings == null) {
jalopySettings = new HashMap<String, Object>();
}
Environment env = Environment.getInstance();
// Author
author = GetterUtil.getString(
(String)jalopySettings.get("author"), author);
env.set("author", author);
// File name
env.set("fileName", file.getName());
Convention convention = Convention.getInstance();
String classMask = "/**\n * @author $author$\n*/";
convention.put(
ConventionKeys.COMMENT_JAVADOC_TEMPLATE_CLASS,
env.interpolate(classMask));
convention.put(
ConventionKeys.COMMENT_JAVADOC_TEMPLATE_INTERFACE,
env.interpolate(classMask));
jalopy.format();
String newContent = sb.toString();
// Remove double blank lines after the package or last import