mirror of
https://github.com/alibaba/p3c.git
synced 2025-10-14 15:10:54 +00:00
Merge pull request #362 from wilsonjuxta/master
fix typo in example code
This commit is contained in:
@@ -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>
|
||||
@@ -134,9 +136,9 @@ 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>
|
||||
@@ -144,10 +146,11 @@ Positive example 1:
|
||||
<![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>
|
||||
|
Reference in New Issue
Block a user