Skip to content

Commit

Permalink
Merge pull request #362 from wilsonjuxta/master
Browse files Browse the repository at this point in the history
fix typo in example code
  • Loading branch information
xuantan authored Nov 6, 2018
2 parents 1cdd7e0 + 15e43a7 commit 08a207f
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions p3c-pmd/src/main/resources/rulesets/java/ali-concurrent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ Positive example 3:
<example>
<![CDATA[
public class TimerTaskThread extends Thread {
public TimerTaskThread(){
super.setName("TimerTaskThread"); …
public TimerTaskThread() {
super.setName("TimerTaskThread");
// do something
}
}
]]>
</example>
Expand All @@ -134,20 +136,21 @@ Positive example 3:
<![CDATA[
Positive example 1:
private static final String FORMAT = "yyyy-MM-dd HH:mm:ss";
public String getFormat(Date date){
public String getFormat(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat(FORMAT);
return sdf.format(date);
return dateFormat.format(date);
}
]]>
</example>
<example>
<![CDATA[
Positive example 2:
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public void getFormat(){
synchronized (sdf){
sdf.format(new Date());
….;
public void getFormat() {
synchronized(SIMPLE_DATE_FORMAT) {
SIMPLE_DATE_FORMAT.format(new Date());
// do something
}
}
]]>
</example>
Expand Down

0 comments on commit 08a207f

Please sign in to comment.