-
-
Notifications
You must be signed in to change notification settings - Fork 107
findbugs: fix issues in BuildData #44
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
Conversation
properly get displayname of node (jenkinsci#38)
Use FastDateFormat from apache which is thread safe Avoid possible NPE in Node detection Avoid possible NPE in result (previous logic already avoided it but findbugs still claimed it to be a problem) Node detection is same for pipeline and freestyle so move it to initData method
| public class BuildData { | ||
| // ISO 8601 date format | ||
| public transient static final DateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); | ||
| public transient static final FastDateFormat DATE_FORMATTER = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure.. the addition of milliseconds can be a breaking change if somebody is parsing the date with a strict parser. I'd suggest extracting the format to configuration if you need the milis part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will leave the format as is for now. Making this configurable could be done with the refactoring of configuration
| public class BuildData { | ||
| // ISO 8601 date format | ||
| public transient static final DateFormat DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); | ||
| public transient static final FastDateFormat DATE_FORMATTER = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we'r at it can you restrict it's visibility? The formatter has been made private in #40
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep changes in this PR to the findbugs issues. providing a method to access the formatter should be done in a separate PR.
we will make this configurable later
Use FastDateFormat from apache which is thread safe
Avoid possible NPE in Node detection
Avoid possible NPE in result (previous logic already avoided it but findbugs still claimed it to be a problem)
Node detection is same for pipeline and freestyle so move it to initData method