}else{
// check if author tag exists.
int index = -1;
String author = getAuthor(project);
for (int ii = 0; ii < tags.size(); ii++){
TagElement tag = (TagElement)tags.get(ii);
if(TagElement.TAG_AUTHOR.equals(tag.getTagName())){
String authorText = tag.fragments().size() > 0 ?
((TextElement)tag.fragments().get(0)).getText() : null;
// check if author tag is the same.
if(authorText != null && author.trim().equals(authorText.trim())){
index = -1;
break;
}
index = ii + 1;
}else if(tag.getTagName() != null){
if(index == -1){
index = ii;
}
}
}
// insert author tag if it doesn't exist.
if(index > -1){
TagElement authorTag = javadoc.getAST().newTagElement();
TextElement authorText = javadoc.getAST().newTextElement();
authorText.setText(author);
authorTag.setTagName(TagElement.TAG_AUTHOR);
@SuppressWarnings("unchecked")
List<ASTNode> fragments = authorTag.fragments();
fragments.add(authorText);
tags.add(index, authorTag);
}
// add the version tag if it doesn't exist.
boolean versionExists = false;
for (int ii = 0; ii < tags.size(); ii++){
TagElement tag = (TagElement)tags.get(ii);
if(TagElement.TAG_VERSION.equals(tag.getTagName())){
versionExists = true;
break;
}
}
if (!versionExists){