Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 6.1.1 CE GA2, 6.1.20 EE GA2
-
Fix Version/s: 6.1.X EE, 6.2.0 CE M4
-
Component/s: API, API > Utils
-
Labels:
-
Branch Version/s:6.1.x
-
Backported to Branch:Committed
-
Story Points:2
-
Similar Issues:
Description
The Javadoc formatter is throwing a NullPointerException when run with the init option.
Steps:
1. ant compile compile-test
2. ant format-javadoc -Dlimit=ResourceLocalServiceImpl -Dinit=true
Results in:
...
[java] java.lang.NullPointerException
[java] at com.liferay.portal.tools.JavadocFormatter._wrapText(JavadocFormatter.java:1563)
[java] at com.liferay.portal.tools.JavadocFormatter._getJavaClassComment(JavadocFormatter.java:883)
[java] at com.liferay.portal.tools.JavadocFormatter._updateJavaFromDocument(JavadocFormatter.java:1467)
[java] at com.liferay.portal.tools.JavadocFormatter._format(JavadocFormatter.java:695)
[java] at com.liferay.portal.tools.JavadocFormatter.<init>(JavadocFormatter.java:162)
[java] at com.liferay.portal.tools.JavadocFormatter.main(JavadocFormatter.java:70)

Corrected faulty logic that was attempting wrapping text comments, even if a comment String was null.
All comments should be should be wrapped to 80 columns if they are non-null, regardless of whether init is flagged.
Tests run...
Test1:
1. ant compile compile-test
2. ant format-javadoc -Dlimit=ResourceLocalServiceImpl
Results:
Javadoc comments were initialized.
For example,
/**
*
*/
public void addModelResources(...)
Note, the update mode was unaffected continuing to work appropriately.