Skip to content
Permalink
Browse files

[JENKINS-49176/JENKINS-49185] - Do not cache the SimpleDateFormat for…

…mat (JEP-200 & concurrency)
  • Loading branch information
oleg-nenashev committed Jan 26, 2018
1 parent 60842ea commit cf4f17f53d5b07f6db593fbc361acf3f20c6068a
@@ -80,8 +80,6 @@

private static final short RECURSION_DEPTH = 50;

private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);

private String specificRevision; //revision id to crete the diff

private String specificBuild; // create the diff with the revision of an specific build
@@ -322,7 +320,8 @@ public LastChanges getLastChanges() {
@Override
public int compare(CommitInfo c1, CommitInfo c2) {
try {
return DATE_FORMAT.parse(c1.getCommitDate()).compareTo(DATE_FORMAT.parse(c2.getCommitDate()));
DateFormat format = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);
return format.parse(c1.getCommitDate()).compareTo(format.parse(c2.getCommitDate()));
} catch (ParseException e) {
LOG.severe(String.format("Could not parse commit dates %s and %s ", c1.getCommitDate(), c2.getCommitDate()));
return 0;
@@ -19,7 +19,6 @@
private String committerName;
private String committerEmail;
private String commitDate;
private DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);

@Whitelisted
public String getCommitterName() {
@@ -66,6 +65,7 @@ public String getCommitMessage() {


public String format(Date date, TimeZone tz) {
DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT);
dateFormat.setTimeZone(tz);
return dateFormat.format(date);
}

0 comments on commit cf4f17f

Please sign in to comment.
You can’t perform that action at this time.