Hi, the java package name detection algorithm in hudson.plugins.check
style.util.JavaPackageDetetcor.detectPackageName()does not support all the
syntax options for package definitions.
- having a tab character after the word "package"
- having more than one white space character after the word "package"
- having leading white space before the word "package"
- having trailing white space or a "//" comment after the ';'
- not having the package name on the line same line as the word "package"
- having comments (either // style, or /* ... */) anywhere in the package
Whilst these constructs are unusual (and some of the are probably bad
practice), they should not break the checkstyle plugin.
A good start would be to read the whole file in, rather than using the
LineIterator class. You could then use a regular expression with the DOTALL
flag enabled, and use the '\s' contruct to match whitespace including line
terminators. This solves the white space issues and not having the package name
on the same line as the word "package".
To solve the comment issue, I suggest something like:
1. Read the whole file.
2. Strip out all comments.
3. Look for the package definition in the amended data.
|Field||Original Value||New Value|
|Status||Open [ 1 ]||In Progress [ 3 ]|
|Resolution||Fixed [ 1 ]|
|Status||In Progress [ 3 ]||Resolved [ 5 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Workflow||JNJira [ 131901 ]||JNJira + In-Review [ 201016 ]|