Skip to content

Commit

Permalink
[JENKINS-26839] - Avoid the usage of static SimpleDateFormat instance
Browse files Browse the repository at this point in the history
I also changed the date parsing method visibility to implement several tests

Signed-off-by: Oleg Nenashev <o.v.nenashev@gmail.com>
  • Loading branch information
oleg-nenashev committed Feb 7, 2015
1 parent 1393356 commit 7dc6a97
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/com/tek42/perforce/parse/ChangelistBuilder.java
Expand Up @@ -55,9 +55,7 @@ public class ChangelistBuilder implements Builder<Changelist> {
//Maximum amount of files to be recorded to a changelist
private int maxFiles;
private final @CheckForNull Depot depot;
private static final SimpleDateFormat dateParser = new
SimpleDateFormat("yyyy/MM/dd HH:mm:ss ZZZZZ", Locale.ENGLISH);


public ChangelistBuilder(int maxFiles) {
this(maxFiles, null);
}
Expand Down Expand Up @@ -281,8 +279,10 @@ public void save(Changelist obj, Writer out) throws PerforceException {
* not be parsed according to the format specified in {@code dateParser}.
* @since 1.3.30 (JENKINS-24401)
*/
private static java.util.Date parseDateWithTimezone(String newDate) throws PerforceException {
try {
/*package*/ static java.util.Date parseDateWithTimezone(String newDate) throws PerforceException {
final SimpleDateFormat dateParser = new
SimpleDateFormat("yyyy/MM/dd HH:mm:ss ZZZZZ", Locale.ENGLISH);
try {
return dateParser.parse(newDate);
} catch(ParseException e) {
throw new PerforceException("Cannot parse changelist timestamp : " + newDate, e);
Expand Down

0 comments on commit 7dc6a97

Please sign in to comment.