Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The end condition of a for loop is precomputed. #245

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ private PomUtils() {
}

/**
* Adds module {@code artifactId} unless the module already presents in {@code fileReader}.
* Adds module {@code artifactId} unless the module is already present in {@code fileReader}.
*
* @param artifactId artifactId of module to add
* @param fileReader source POM XML
* @param fileWriter target XML
* @return {@code true} if modules section in POM is empty or does not exist or {@code artifactId} does not appear
* a module in {@code fileReader} XML.
* @return {@code true} if modules section in POM is empty or does not exist or {@code artifactId} is not
* a module in {@code fileReader} XML
* @throws IOException if I/O error
* @throws InvalidPackaging if packaging is not "pom" or not exist in POM
* @throws InvalidPackaging if packaging is not "pom" or does not exist in POM
* @throws ArchetypeTemplateProcessingException if "project" does not exist or "modules" element is duplicated
* @throws ParserConfigurationException if parser error
* @throws SAXException if parser error
* @throws TransformerException if an error writing to {@code fileWriter}
* @throws TransformerException error writing to {@code fileWriter}
*/
public static boolean addNewModule(String artifactId, Reader fileReader, Writer fileWriter)
throws ArchetypeTemplateProcessingException, InvalidPackaging, IOException, ParserConfigurationException,
Expand Down Expand Up @@ -140,7 +140,7 @@ public static boolean addNewModule(String artifactId, Reader fileReader, Writer
private static Node getModulesNode(Element project) {
Node modules = null;
NodeList nodes = project.getChildNodes();
for (int len = nodes.getLength(), i = 0; i < len; i++) {
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE && "modules".equals(node.getNodeName())) {
modules = node;
Expand Down