添加TODO 代码规约扫描

pull/183/head
1332987 3 years ago
parent 1157caddfd
commit 7c394a46ac

@ -21,11 +21,11 @@ public class EscapeUtil
} }
// special HTML characters // special HTML characters
TEXT['\''] = "'".toCharArray(); // 单引号 TEXT['\''] = "'".toCharArray();
TEXT['"'] = """.toCharArray(); // 双引号 TEXT['"'] = """.toCharArray();
TEXT['&'] = "&".toCharArray(); // &符 TEXT['&'] = "&".toCharArray();
TEXT['<'] = "&#60;".toCharArray(); // 小于号 TEXT['<'] = "&#60;".toCharArray();
TEXT['>'] = "&#62;".toCharArray(); // 大于号 TEXT['>'] = "&#62;".toCharArray();
} }
/** /**

@ -121,7 +121,7 @@ public final class HtmlFilter {
vSelfClosingTags = new String[]{"img"}; vSelfClosingTags = new String[]{"img"};
vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"}; vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"};
vDisallowed = new String[]{}; vDisallowed = new String[]{};
vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp. vAllowedProtocols = new String[]{"http", "mailto", "https"};
vProtocolAtts = new String[]{"src", "href"}; vProtocolAtts = new String[]{"src", "href"};
vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"}; vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"};
vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"}; vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"};
@ -221,7 +221,7 @@ public final class HtmlFilter {
final Matcher m = P_COMMENTS.matcher(s); final Matcher m = P_COMMENTS.matcher(s);
final StringBuffer buf = new StringBuffer(); final StringBuffer buf = new StringBuffer();
if (m.find()) { if (m.find()) {
final String match = m.group(1); // (.*?) final String match = m.group(1);
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->")); m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
} }
m.appendTail(buf); m.appendTail(buf);
@ -329,12 +329,12 @@ public final class HtmlFilter {
final List<String> paramNames = new ArrayList<>(); final List<String> paramNames = new ArrayList<>();
final List<String> paramValues = new ArrayList<>(); final List<String> paramValues = new ArrayList<>();
while (m2.find()) { while (m2.find()) {
paramNames.add(m2.group(1)); // ([a-z0-9]+) paramNames.add(m2.group(1));
paramValues.add(m2.group(3)); // (.*?) paramValues.add(m2.group(3));
} }
while (m3.find()) { while (m3.find()) {
paramNames.add(m3.group(1)); // ([a-z0-9]+) paramNames.add(m3.group(1));
paramValues.add(m3.group(3)); // ([^\"\\s']+) paramValues.add(m3.group(3));
} }
String paramName, paramValue; String paramName, paramValue;
for (int ii = 0; ii < paramNames.size(); ii++) { for (int ii = 0; ii < paramNames.size(); ii++) {
@ -434,8 +434,8 @@ public final class HtmlFilter {
// validate entities throughout the string // validate entities throughout the string
Matcher m = P_VALID_ENTITIES.matcher(s); Matcher m = P_VALID_ENTITIES.matcher(s);
while (m.find()) { while (m.find()) {
final String one = m.group(1); // ([^&;]*) final String one = m.group(1);
final String two = m.group(2); // (?=(;|&|$)) final String two = m.group(2);
m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two)));
} }
m.appendTail(buf); m.appendTail(buf);
@ -448,10 +448,10 @@ public final class HtmlFilter {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
Matcher m = P_VALID_QUOTES.matcher(s); Matcher m = P_VALID_QUOTES.matcher(s);
while (m.find()) { while (m.find()) {
final String one = m.group(1); // (>|^) final String one = m.group(1);
final String two = m.group(2); // ([^<]+?) final String two = m.group(2);
final String three = m.group(3); // (<|$) final String three = m.group(3);
// 不替换双引号为&quot;防止json格式无效 regexReplace(P_QUOTE, "&quot;", two) /*不替换双引号为&quot;防止json格式无效 regexReplace(P_QUOTE, "&quot;", two)*/
m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three));
} }
m.appendTail(buf); m.appendTail(buf);

@ -908,7 +908,7 @@ public class ExcelUtil<T> {
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) { if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) {
val = cell.getNumericCellValue(); val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell)) { if (DateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换 val = DateUtil.getJavaDate((Double) val);
} else { } else {
if ((Double) val % 1 != 0) { if ((Double) val % 1 != 0) {
val = new BigDecimal(val.toString()); val = new BigDecimal(val.toString());

@ -145,9 +145,9 @@ public final class Base64 {
return null; return null;
} }
char[] base64Data = encoded.toCharArray(); char[] base64Data = encoded.toCharArray();
int len = removeWhiteSpace(base64Data);// 删除空格 int len = removeWhiteSpace(base64Data);
if (len % FOURBYTE != 0) { if (len % FOURBYTE != 0) {
return null;// sho应该能被四整除 return null;
} }
int numberQuadruple = (len / FOURBYTE); int numberQuadruple = (len / FOURBYTE);
if (numberQuadruple == 0) { if (numberQuadruple == 0) {
@ -164,7 +164,7 @@ public final class Base64 {
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))
|| !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) { || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) {
return null; return null;
} // if found "no data" just return null }
b1 = BASE_64_ALPHABET[d1]; b1 = BASE_64_ALPHABET[d1];
b2 = BASE_64_ALPHABET[d2]; b2 = BASE_64_ALPHABET[d2];
b3 = BASE_64_ALPHABET[d3]; b3 = BASE_64_ALPHABET[d3];
@ -174,16 +174,15 @@ public final class Base64 {
decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
} }
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) { if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
return null;// if found "no data" just return null return null;
} }
b1 = BASE_64_ALPHABET[d1]; b1 = BASE_64_ALPHABET[d1];
b2 = BASE_64_ALPHABET[d2]; b2 = BASE_64_ALPHABET[d2];
d3 = base64Data[dataIndex++]; d3 = base64Data[dataIndex++];
d4 = base64Data[dataIndex++]; d4 = base64Data[dataIndex++];
if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters if (!isData((d3)) || !isData((d4))) {
if (isPad(d3) && isPad(d4)) { if (isPad(d3) && isPad(d4)) {
if ((b2 & 0xf) != 0)// last 4 bits should be zero if ((b2 & 0xf) != 0) {
{
return null; return null;
} }
byte[] tmp = new byte[i * 3 + 1]; byte[] tmp = new byte[i * 3 + 1];
@ -192,8 +191,7 @@ public final class Base64 {
return tmp; return tmp;
} else if (!isPad(d3) && isPad(d4)) { } else if (!isPad(d3) && isPad(d4)) {
b3 = BASE_64_ALPHABET[d3]; b3 = BASE_64_ALPHABET[d3];
if ((b3 & 0x3) != 0)// last 2 bits should be zero if ((b3 & 0x3) != 0) {
{
return null; return null;
} }
byte[] tmp = new byte[i * 3 + 2]; byte[] tmp = new byte[i * 3 + 2];

@ -98,10 +98,10 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
byte[] randomBytes = new byte[16]; byte[] randomBytes = new byte[16];
ng.nextBytes(randomBytes); ng.nextBytes(randomBytes);
randomBytes[6] &= 0x0f; /* clear version */ randomBytes[6] &= 0x0f;
randomBytes[6] |= 0x40; /* set to version 4 */ randomBytes[6] |= 0x40;
randomBytes[8] &= 0x3f; /* clear variant */ randomBytes[8] &= 0x3f;
randomBytes[8] |= 0x80; /* set to IETF variant */ randomBytes[8] |= 0x80;
return new UUID(randomBytes); return new UUID(randomBytes);
} }
@ -124,10 +124,10 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
throw new InternalError("MD5 not supported"); throw new InternalError("MD5 not supported");
} }
byte[] md5Bytes = md.digest(name); byte[] md5Bytes = md.digest(name);
md5Bytes[6] &= 0x0f; /* clear version */ md5Bytes[6] &= 0x0f;
md5Bytes[6] |= 0x30; /* set to version 3 */ md5Bytes[6] |= 0x30;
md5Bytes[8] &= 0x3f; /* clear variant */ md5Bytes[8] &= 0x3f;
md5Bytes[8] |= 0x80; /* set to IETF variant */ md5Bytes[8] |= 0x80;
return new UUID(md5Bytes); return new UUID(md5Bytes);
} }
@ -245,8 +245,8 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
public long timestamp() throws UnsupportedOperationException public long timestamp() throws UnsupportedOperationException
{ {
checkTimeBase(); checkTimeBase();
return (mostSigBits & 0x0FFFL) << 48// return (mostSigBits & 0x0FFFL) << 48
| ((mostSigBits >> 16) & 0x0FFFFL) << 32// | ((mostSigBits >> 16) & 0x0FFFFL) << 32
| mostSigBits >>> 32; | mostSigBits >>> 32;
} }
@ -425,10 +425,10 @@ public final class UUID implements java.io.Serializable, Comparable<UUID>
{ {
// The ordering is intentionally set up so that the UUIDs // The ordering is intentionally set up so that the UUIDs
// can simply be numerically compared as two numbers // can simply be numerically compared as two numbers
return (this.mostSigBits < val.mostSigBits ? -1 : // return (this.mostSigBits < val.mostSigBits ? -1 :
(this.mostSigBits > val.mostSigBits ? 1 : // (this.mostSigBits > val.mostSigBits ? 1 :
(this.leastSigBits < val.leastSigBits ? -1 : // (this.leastSigBits < val.leastSigBits ? -1 :
(this.leastSigBits > val.leastSigBits ? 1 : // (this.leastSigBits > val.leastSigBits ? 1 :
0)))); 0))));
} }

@ -13,11 +13,17 @@ public interface ValidateCodeService
{ {
/** /**
* *
* @return AjaxResult
* @throws IOException /
* @throws CaptchaException /
*/ */
public AjaxResult createCaptcha() throws IOException, CaptchaException; public AjaxResult createCaptcha() throws IOException, CaptchaException;
/** /**
* *
* @param key
* @param value
* @throws CaptchaException /
*/ */
public void checkCaptcha(String key, String value) throws CaptchaException; public void checkCaptcha(String key, String value) throws CaptchaException;
} }

@ -56,42 +56,46 @@ public interface ISysJobService
public int deleteJob(SysJob job) throws SchedulerException; public int deleteJob(SysJob job) throws SchedulerException;
/** /**
*
* *
* *
* @param jobIds ID * @param jobIds ID
* @return * @return
* @throws SchedulerException /
*/ */
public void deleteJobByIds(Long[] jobIds) throws SchedulerException; public void deleteJobByIds(Long[] jobIds) throws SchedulerException;
/** /**
* *
*
* @param job * @param job
* @return * @return
* @throws SchedulerException /
*/ */
public int changeStatus(SysJob job) throws SchedulerException; public int changeStatus(SysJob job) throws SchedulerException;
/** /**
* *
*
* @param job * @param job
* @return * @return
* @throws SchedulerException /
*/ */
public void run(SysJob job) throws SchedulerException; public void run(SysJob job) throws SchedulerException;
/** /**
* *
*
* @param job * @param job
* @return * @return
* @throws SchedulerException /
* @throws TaskException /
*/ */
public int insertJob(SysJob job) throws SchedulerException, TaskException; public int insertJob(SysJob job) throws SchedulerException, TaskException;
/** /**
* *
*
* @param job * @param job
* @return * @return
* @throws SchedulerException /
* @throws TaskException /
*/ */
public int updateJob(SysJob job) throws SchedulerException, TaskException; public int updateJob(SysJob job) throws SchedulerException, TaskException;

Loading…
Cancel
Save