fix(): 代码规范更改

boot3.0
dongzeliang 2025-01-16 10:10:53 +08:00
parent 97cfbe27ca
commit 1e65257478
17 changed files with 174 additions and 132 deletions

View File

@ -21,134 +21,134 @@ public @interface Excel {
/**
* excel
*/
public int sort () default Integer.MAX_VALUE;
int sort() default Integer.MAX_VALUE;
/**
* Excel.
*/
public String name () default "";
String name() default "";
/**
* , : yyyy-MM-dd
*/
public String dateFormat () default "";
String dateFormat() default "";
/**
* (: 0=,1=,2=)
*/
public String readConverterExp () default "";
String readConverterExp() default "";
/**
*
*/
public String separator () default ",";
String separator() default ",";
/**
* BigDecimal :-1(BigDecimal)
*/
public int scale () default -1;
int scale () default -1;
/**
* BigDecimal :BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
int roundingMode () default BigDecimal.ROUND_HALF_EVEN;
/**
* excel
*/
public double height () default 14;
double height () default 14;
/**
* excel
*/
public double width () default 16;
double width () default 16;
/**
* ,% 90 90%
*/
public String suffix () default "";
String suffix () default "";
/**
* ,
*/
public String defaultValue () default "";
String defaultValue () default "";
/**
*
*/
public String prompt () default "";
String prompt () default "";
/**
* .
*/
public String[] combo () default {};
String[] combo () default {};
/**
* ,:list)
*/
public boolean needMerge () default false;
boolean needMerge () default false;
/**
* ,:,.
*/
public boolean isExport () default true;
boolean isExport () default true;
/**
* ,,
*/
public String targetAttr () default "";
String targetAttr () default "";
/**
* ,
*/
public boolean isStatistics () default false;
boolean isStatistics () default false;
/**
* 0 1
* 0 1
*/
public ColumnType cellType () default ColumnType.STRING;
ColumnType cellType () default ColumnType.STRING;
/**
*
*/
public IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
IndexedColors headerBackgroundColor () default IndexedColors.GREY_50_PERCENT;
/**
*
*/
public IndexedColors headerColor () default IndexedColors.WHITE;
IndexedColors headerColor () default IndexedColors.WHITE;
/**
*
*/
public IndexedColors backgroundColor () default IndexedColors.WHITE;
IndexedColors backgroundColor () default IndexedColors.WHITE;
/**
*
*/
public IndexedColors color () default IndexedColors.BLACK;
IndexedColors color () default IndexedColors.BLACK;
/**
*
*/
public HorizontalAlignment align () default HorizontalAlignment.CENTER;
HorizontalAlignment align () default HorizontalAlignment.CENTER;
/**
*
*/
public Class<?> handler () default ExcelHandlerAdapter.class;
Class<?> handler () default ExcelHandlerAdapter.class;
/**
*
*/
public String[] args () default {};
String[] args () default {};
/**
* 012
*/
Type type () default Type.ALL;
public enum Type {
enum Type {
ALL(0), EXPORT(1), IMPORT(2);
private final int value;
@ -156,12 +156,12 @@ public @interface Excel {
this.value = value;
}
public int value () {
int value () {
return this.value;
}
}
public enum ColumnType {
enum ColumnType {
NUMERIC(0), STRING(1), IMAGE(2);
private final int value;
@ -169,7 +169,7 @@ public @interface Excel {
this.value = value;
}
public int value () {
int value () {
return this.value;
}
}

View File

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

View File

@ -119,7 +119,8 @@ public final class HTMLFilter {
vSelfClosingTags = new String[]{"img"};
vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"};
vDisallowed = new String[]{};
vAllowedProtocols = new String[]{"http", "mailto", "https"}; // no ftp.
// no ftp.
vAllowedProtocols = new String[]{"http", "mailto", "https"};
vProtocolAtts = new String[]{"src", "href"};
vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"};
vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"};
@ -206,7 +207,7 @@ public final class HTMLFilter {
s = escapeComments(s);
s = balanceHTML(s);
s = balanceHtml(s);
s = checkTags(s);
@ -227,9 +228,10 @@ public final class HTMLFilter {
private String escapeComments (final String s) {
final Matcher m = P_COMMENTS.matcher(s);
final StringBuffer buf = new StringBuffer();
final StringBuilder buf = new StringBuilder();
if (m.find()) {
final String match = m.group(1); // (.*?)
// (.*?)
final String match = m.group(1);
m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->"));
}
m.appendTail(buf);
@ -237,7 +239,7 @@ public final class HTMLFilter {
return buf.toString();
}
private String balanceHTML (String s) {
private String balanceHtml(String s) {
if (alwaysMakeTags) {
//
// try and form html
@ -466,9 +468,12 @@ public final class HTMLFilter {
StringBuffer buf = new StringBuffer();
Matcher m = P_VALID_QUOTES.matcher(s);
while (m.find()) {
final String one = m.group(1); // (>|^)
final String two = m.group(2); // ([^<]+?)
final String three = m.group(3); // (<|$)
// (>|^)
final String one = m.group(1);
// ([^<]+?)
final String two = m.group(2);
// (<|$)
final String three = m.group(3);
// 不替换双引号为&quot;防止json格式无效 regexReplace(P_QUOTE, "&quot;", two)
m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three));
}

View File

@ -266,7 +266,7 @@ public class IpUtils {
String[] s1 = ipWildCard.split("\\.");
String[] s2 = ip.split("\\.");
boolean isMatchedSeg = true;
for (int i = 0 ; i < s1.length && !s1[i].equals("*") ; i++) {
for (int i = 0; i < s1.length && !"*".equals(s1[i]) ; i++) {
if (!s1[i].equals(s2[i])) {
isMatchedSeg = false;
break;

View File

@ -869,7 +869,8 @@ public class ExcelUtil<T> {
*/
public void setXSSFValidationWithHidden (Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
String hideSheetName = "combo_" + firstCol + "_" + endCol;
Sheet hideSheet = wb.createSheet(hideSheetName); // 用于存储 下拉菜单数据
// 用于存储 下拉菜单数据
Sheet hideSheet = wb.createSheet(hideSheetName);
for (int i = 0 ; i < textlist.length ; i++) {
hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]);
}
@ -1112,7 +1113,8 @@ public class ExcelUtil<T> {
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) {
val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell)) {
val = DateUtil.getJavaDate((Double) val); // POI Excel 日期格式转换
// POI Excel 日期格式转换
val = DateUtil.getJavaDate((Double) val);
} else {
if ((Double) val % 1 != 0) {
val = new BigDecimal(val.toString());

View File

@ -82,9 +82,7 @@ public final class Base64 {
int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets;
char encodedData[] = null;
encodedData = new char[numberQuartet * 4];
char[] encodedData = new char[numberQuartet * 4];
byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
@ -152,7 +150,8 @@ public final class Base64 {
int len = removeWhiteSpace(base64Data);
if (len % FOURBYTE != 0) {
return null;// should be divisible by four
// should be divisible by four
return null;
}
int numberQuadruple = (len / FOURBYTE);
@ -161,7 +160,7 @@ public final class Base64 {
return new byte[0];
}
byte decodedData[] = null;
byte[] decodedData = null;
byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
@ -188,7 +187,8 @@ public final class Base64 {
}
if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) {
return null;// if found "no data" just return null
// 如果发现 “没有数据” 只是返回null
return null;
}
b1 = base64Alphabet[d1];
@ -196,9 +196,11 @@ public final class Base64 {
d3 = 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 ((b2 & 0xf) != 0)// last 4 bits should be zero
// 最后4位应为零
if ((b2 & 0xf) != 0)
{
return null;
}
@ -208,7 +210,8 @@ public final class Base64 {
return tmp;
} else if (!isPad(d3) && isPad(d4)) {
b3 = base64Alphabet[d3];
if ((b3 & 0x3) != 0)// last 2 bits should be zero
// 最后2位应为零
if ((b3 & 0x3) != 0)
{
return null;
}
@ -220,7 +223,8 @@ public final class Base64 {
} else {
return null;
}
} else { // No PAD e.g 3cQl
} else {
// 无衬垫 e.g 3cQl
b3 = base64Alphabet[d3];
b4 = base64Alphabet[d4];
decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
@ -232,18 +236,18 @@ public final class Base64 {
}
/**
* remove WhiteSpace from MIME containing encoded Base64 data.
* Base64MIME
*
* @param data the byte array of base64 data (with WS)
* @param data base64 (WS)
*
* @return the new length
* @return
*/
private static int removeWhiteSpace (char[] data) {
if (data == null) {
return 0;
}
// count characters that's not whitespace
// 计数不是空格的字符
int newSize = 0;
int len = data.length;
for (int i = 0 ; i < len ; i++) {

View File

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

View File

@ -95,8 +95,9 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
private Mono<Void> filterWithoutRequestBody(ServerWebExchange exchange, GatewayFilterChain chain, AccessLog accessLog) {
// 包装 Response用于记录 Response Body
ServerHttpResponseDecorator decoratedResponse = recordResponseLog(exchange, accessLog);
// 打印日志
return chain.filter(exchange.mutate().response(decoratedResponse).build())
.then(Mono.fromRunnable(() -> writeAccessLog(accessLog))); // 打印日志
.then(Mono.fromRunnable(() -> writeAccessLog(accessLog)));
}
/**
@ -119,7 +120,8 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
headers.putAll(exchange.getRequest().getHeaders());
// the new content type will be computed by bodyInserter
// and then set in the request decorator
headers.remove(HttpHeaders.CONTENT_LENGTH); // 移除
// 移除
headers.remove(HttpHeaders.CONTENT_LENGTH);
CachedBodyOutputMessage outputMessage = new CachedBodyOutputMessage(exchange, headers);
// 通过 BodyInserter 将 Request Body 写入到 CachedBodyOutputMessage 中
return bodyInserter.insert(outputMessage, new BodyInserterContext()).then(Mono.defer(() -> {

View File

@ -54,9 +54,12 @@ public class JobGroupController {
// package result
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal", list_count); // 总记录数
maps.put("recordsFiltered", list_count); // 过滤后的总记录数
maps.put("data", list); // 分页列表
// 总记录数
maps.put("recordsTotal", list_count);
// 过滤后的总记录数
maps.put("recordsFiltered", list_count);
// 分页列表
maps.put("data", list);
return maps;
}

View File

@ -44,8 +44,9 @@ public class JobAlarmer implements ApplicationContextAware, InitializingBean {
public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) {
boolean result = false;
if (jobAlarmList!=null && jobAlarmList.size()>0) {
result = true; // success means all-success
if (jobAlarmList!=null && !jobAlarmList.isEmpty()) {
// success means all-success
result = true;
for (JobAlarm alarm: jobAlarmList) {
boolean resultItem = false;
try {

View File

@ -210,8 +210,10 @@ public final class CronExpression implements Serializable, Cloneable {
protected static final int MONTH = 4;
protected static final int DAY_OF_WEEK = 5;
protected static final int YEAR = 6;
protected static final int ALL_SPEC_INT = 99; // '*'
protected static final int NO_SPEC_INT = 98; // '?'
// '*'
protected static final int ALL_SPEC_INT = 99;
// '?'
protected static final int NO_SPEC_INT = 98;
protected static final Integer ALL_SPEC = ALL_SPEC_INT;
protected static final Integer NO_SPEC = NO_SPEC_INT;
@ -437,7 +439,7 @@ public final class CronExpression implements Serializable, Cloneable {
//
////////////////////////////////////////////////////////////////////////////
protected void buildExpression(String expression) throws ParseException {
private void buildExpression(String expression) throws ParseException {
expressionParsed = true;
try {
@ -487,7 +489,7 @@ public final class CronExpression implements Serializable, Cloneable {
StringTokenizer vTok = new StringTokenizer(expr, ",");
while (vTok.hasMoreTokens()) {
String v = vTok.nextToken();
storeExpressionVals(0, v, exprOn);
storeExpressionVals(v, exprOn);
}
exprOn++;
@ -499,7 +501,7 @@ public final class CronExpression implements Serializable, Cloneable {
}
if (exprOn <= YEAR) {
storeExpressionVals(0, "*", YEAR);
storeExpressionVals("*", YEAR);
}
TreeSet<Integer> dow = getSet(DAY_OF_WEEK);
@ -523,16 +525,16 @@ public final class CronExpression implements Serializable, Cloneable {
}
}
protected int storeExpressionVals(int pos, String s, int type)
private void storeExpressionVals(String s, int type)
throws ParseException {
int incr = 0;
int i = skipWhiteSpace(pos, s);
int i = skipWhiteSpace(0, s);
if (i >= s.length()) {
return i;
return;
}
char c = s.charAt(i);
if ((c >= 'A') && (c <= 'Z') && (!s.equals("L")) && (!s.equals("LW")) && (!s.matches("^L-[0-9]*[W]?"))) {
if ((c >= 'A') && (c <= 'Z') && (!"L".equals(s)) && (!"LW".equals(s)) && (!s.matches("^L-[0-9]*W?"))) {
String sub = s.substring(i, i + 3);
int sval = -1;
int eval = -1;
@ -596,7 +598,7 @@ public final class CronExpression implements Serializable, Cloneable {
incr = 1;
}
addToSet(sval, eval, incr, type);
return (i + 3);
return;
}
if (c == '?') {
@ -621,13 +623,13 @@ public final class CronExpression implements Serializable, Cloneable {
}
addToSet(NO_SPEC_INT, -1, 0, type);
return i;
return;
}
if (c == '*' || c == '/') {
if (c == '*' && (i + 1) >= s.length()) {
addToSet(ALL_SPEC_INT, -1, incr, type);
return i + 1;
return;
} else if (c == '/'
&& ((i + 1) >= s.length() || s.charAt(i + 1) == ' ' || s
.charAt(i + 1) == '\t')) {
@ -636,7 +638,8 @@ public final class CronExpression implements Serializable, Cloneable {
i++;
}
c = s.charAt(i);
if (c == '/') { // is an increment specified?
// 是否指定了增量?
if (c == '/') {
i++;
if (i >= s.length()) {
throw new ParseException("Unexpected end of string.", i);
@ -654,7 +657,6 @@ public final class CronExpression implements Serializable, Cloneable {
}
addToSet(ALL_SPEC_INT, -1, incr, type);
return i;
} else if (c == 'L') {
i++;
if (type == DAY_OF_MONTH) {
@ -669,7 +671,7 @@ public final class CronExpression implements Serializable, Cloneable {
ValueSet vs = getValue(0, s, i+1);
lastdayOffset = vs.value;
if(lastdayOffset > 30) {
throw new ParseException("Offset from last day must be <= 30", i + 1);
throw new ParseException("与最后一天的偏移量必须 <= 30", i + 1);
}
i = vs.pos;
}
@ -681,7 +683,6 @@ public final class CronExpression implements Serializable, Cloneable {
}
}
}
return i;
} else if (c >= '0' && c <= '9') {
int val = Integer.parseInt(String.valueOf(c));
i++;
@ -695,13 +696,11 @@ public final class CronExpression implements Serializable, Cloneable {
i = vs.pos;
}
i = checkNext(i, s, val, type);
return i;
}
} else {
throw new ParseException("Unexpected character: " + c, i);
}
return i;
}
private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {
@ -1017,14 +1016,15 @@ public final class CronExpression implements Serializable, Cloneable {
if (val == ALL_SPEC_INT && incr <= 0) {
incr = 1;
set.add(ALL_SPEC); // put in a marker, but also fill values
// put in a marker, but also fill values
set.add(ALL_SPEC);
}
if (type == SECOND || type == MINUTE) {
if (stopAt == -1) {
stopAt = 59;
}
if (startAt == -1 || startAt == ALL_SPEC_INT) {
if (startAt == ALL_SPEC_INT) {
startAt = 0;
}
} else if (type == HOUR) {
@ -1188,7 +1188,8 @@ public final class CronExpression implements Serializable, Cloneable {
while (!gotOne) {
//if (endTime != null && cl.getTime().after(endTime)) return null;
if(cl.get(Calendar.YEAR) > 2999) { // prevent endless loop...
// prevent endless loop...
if(cl.get(Calendar.YEAR) > 2999) {
return null;
}
@ -1262,7 +1263,8 @@ public final class CronExpression implements Serializable, Cloneable {
// get day...................................................
boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
// get day by day of month rule
if (dayOfMSpec && !dayOfWSpec) {
st = daysOfMonth.tailSet(day);
if (lastdayOfMonth) {
if(!nearestWeekday) {
@ -1273,7 +1275,8 @@ public final class CronExpression implements Serializable, Cloneable {
mon++;
if(mon > 12) {
mon = 1;
tmon = 3333; // ensure test of mon != tmon further below fails
// 确保mon的测试!= 下面进一步的tmon失败
tmon = 3333;
cl.add(Calendar.YEAR, 1);
}
day = 1;
@ -1375,12 +1378,14 @@ public final class CronExpression implements Serializable, Cloneable {
// are 1-based
continue;
}
} else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
if (lastdayOfWeek) { // are we looking for the last XXX day of
// the month?
int dow = daysOfWeek.first(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
// get day by day of week rule
} else if (dayOfWSpec && !dayOfMSpec) {
// are we looking for the last XXX day of
if (lastdayOfWeek) {
// the month? // desired
int dow = daysOfWeek.first();
// d-o-w // current d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK);
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow;
@ -1390,8 +1395,8 @@ public final class CronExpression implements Serializable, Cloneable {
}
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day + daysToAdd > lDay) { // did we already miss the
// did we already miss the
if (day + daysToAdd > lDay) {
// last one?
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
@ -1422,8 +1427,8 @@ public final class CronExpression implements Serializable, Cloneable {
} else if (nthdayOfWeek != 0) {
// are we looking for the Nth XXX day in the month?
int dow = daysOfWeek.first(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
// d-o-w // current d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK);
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow;
@ -1464,8 +1469,10 @@ public final class CronExpression implements Serializable, Cloneable {
continue;
}
} else {
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int dow = daysOfWeek.first(); // desired
// current d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK);
// desired
int dow = daysOfWeek.first();
// d-o-w
st = daysOfWeek.tailSet(cDow);
if (st != null && st.size() > 0) {
@ -1481,8 +1488,8 @@ public final class CronExpression implements Serializable, Cloneable {
}
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day + daysToAdd > lDay) { // will we pass the end of
// will we pass the end of
if (day + daysToAdd > lDay) {
// the month?
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
@ -1491,7 +1498,8 @@ public final class CronExpression implements Serializable, Cloneable {
cl.set(Calendar.MONTH, mon);
// no '- 1' here because we are promoting the month
continue;
} else if (daysToAdd > 0) { // are we swithing days?
// are we swithing days?
} else if (daysToAdd > 0) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
@ -1553,7 +1561,8 @@ public final class CronExpression implements Serializable, Cloneable {
t = year;
year = st.first();
} else {
return null; // ran out of years...
// ran out of years...
return null;
}
if (year != t) {

View File

@ -29,10 +29,12 @@ public class ExecutorRouteLFU extends ExecutorRouter {
}
// lfu item init
HashMap<String, Integer> lfuItemMap = jobLfuMap.get(jobId); // Key排序可以用TreeMap+构造入参CompareValue排序暂时只能通过ArrayList
// Key排序可以用TreeMap+构造入参CompareValue排序暂时只能通过ArrayList
HashMap<String, Integer> lfuItemMap = jobLfuMap.get(jobId);
if (lfuItemMap == null) {
lfuItemMap = new HashMap<String, Integer>();
jobLfuMap.putIfAbsent(jobId, lfuItemMap); // 避免重复覆盖
lfuItemMap = new HashMap<>();
// 避免重复覆盖
jobLfuMap.putIfAbsent(jobId, lfuItemMap);
}
// put new

View File

@ -158,7 +158,8 @@ public class JobCompleteHelper {
return new ReturnT<String>(ReturnT.FAIL_CODE, "log item not found.");
}
if (log.getHandleCode() > 0) {
return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback."); // avoid repeat callback, trigger child job etc
// avoid repeat callback, trigger child job etc
return new ReturnT<String>(ReturnT.FAIL_CODE, "log repeate callback.");
}
// handle msg

View File

@ -14,8 +14,8 @@ import org.slf4j.LoggerFactory;
*/
public class FtlUtil {
private static Logger logger = LoggerFactory.getLogger(FtlUtil.class);
private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance();
//BeansWrapper.getDefaultInstance();
private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build();
public static TemplateHashModel generateStaticModel(String packageName) {
try {

View File

@ -9,8 +9,8 @@ import java.util.concurrent.ConcurrentMap;
* @author xuxueli 2018-01-22 21:37:34
*/
public class LocalCacheUtil {
private static ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>(); // 类型建议用抽象父类,兼容性更好;
// 类型建议用抽象父类,兼容性更好;
private static final ConcurrentMap<String, LocalCacheData> cacheRepository = new ConcurrentHashMap<String, LocalCacheData>();
private static class LocalCacheData{
private String key;
private Object val;

View File

@ -36,7 +36,8 @@ public class LoginService {
private XxlJobUser parseToken(String tokenHex){
XxlJobUser xxlJobUser = null;
if (tokenHex != null) {
String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray()); // username_password(md5)
// username_password(md5)
String tokenJson = new String(new BigInteger(tokenHex, 16).toByteArray());
xxlJobUser = JacksonUtil.readValue(tokenJson, XxlJobUser.class);
}
return xxlJobUser;

View File

@ -102,7 +102,8 @@ public class EmbedServer {
}
}
});
thread.setDaemon(true); // daemon, service jvm, user thread leave >>> daemon leave >>> jvm leave
// 守护进程服务jvm用户线程离开 >>> 守护进程离开 >>> jvm离开
thread.setDaemon(true);
thread.start();
}