Skip to content
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

fix typo in example code #362

Merged
merged 1 commit into from
Nov 6, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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