This commit is contained in:
Looly
2021-03-12 22:30:52 +08:00
parent eb1ca9b679
commit d9ce2aff95
5 changed files with 26 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------
# 5.6.0 (2021-03-11) # 5.6.0 (2021-03-12)
### 新特性 ### 新特性
* 【poi 】 重要不再兼容POI-3.x增加兼容POI-5.xissue#I35J6B@Gitee * 【poi 】 重要不再兼容POI-3.x增加兼容POI-5.xissue#I35J6B@Gitee
@@ -21,6 +21,8 @@
* 【socket 】 修复Client创建失败资源未释放问题。 * 【socket 】 修复Client创建失败资源未释放问题。
* 【core 】 修复DataSizeUtil中EB单位错误问题issue#I39O7I@Gitee * 【core 】 修复DataSizeUtil中EB单位错误问题issue#I39O7I@Gitee
* 【core 】 修复BeanDesc.isMatchSetter的ignoreCase未使用问题issue#I3AXIJ@Gitee * 【core 】 修复BeanDesc.isMatchSetter的ignoreCase未使用问题issue#I3AXIJ@Gitee
* 【core 】 修复CRC16Checksum中issue#I3AXIJ@Gitee
* 【core 】 修复UrlQuery中对空key解析丢失问题issue#I3B3J6@Gitee
------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------

View File

@@ -47,7 +47,7 @@ public abstract class CRC16Checksum implements Checksum, Serializable {
public String getHexValue(boolean isPadding){ public String getHexValue(boolean isPadding){
String hex = HexUtil.toHex(getValue()); String hex = HexUtil.toHex(getValue());
if(isPadding){ if(isPadding){
hex = StrUtil.padAfter(hex, 4, '0'); hex = StrUtil.padPre(hex, 4, '0');
} }
return hex; return hex;

View File

@@ -222,7 +222,7 @@ public class UrlQuery {
sb.append("&"); sb.append("&");
} }
key = entry.getKey(); key = entry.getKey();
if (StrUtil.isNotEmpty(key)) { if (null != key) {
sb.append(URLUtil.encodeAll(StrUtil.str(key), charset)); sb.append(URLUtil.encodeAll(StrUtil.str(key), charset));
value = entry.getValue(); value = entry.getValue();
if (null != value) { if (null != value) {

View File

@@ -1,12 +1,14 @@
package cn.hutool.core.io.checksum; package cn.hutool.core.io.checksum;
import cn.hutool.core.io.checksum.crc16.CRC16XModem;
import cn.hutool.core.util.HexUtil; import cn.hutool.core.util.HexUtil;
import cn.hutool.core.util.StrUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
* CRC校验单元测试 * CRC校验单元测试
* *
* @author looly * @author looly
* *
*/ */
@@ -40,4 +42,14 @@ public class CrcTest {
String crc16 = HexUtil.toHex(crc.getValue()); String crc16 = HexUtil.toHex(crc.getValue());
Assert.assertEquals("18c", crc16); Assert.assertEquals("18c", crc16);
} }
@Test
public void paddingTest(){
// I3B3RV@Gitee
String text = "000123FFFFFF";
CRC16XModem crc16 = new CRC16XModem();
crc16.update(StrUtil.bytes(text));
String hexValue = crc16.getHexValue(true);
Assert.assertEquals("0e04", hexValue);
}
} }

View File

@@ -26,4 +26,12 @@ public class UrlQueryTest {
final String queryStr = urlBuilder.getQueryStr(); final String queryStr = urlBuilder.getQueryStr();
Assert.assertEquals("imageMogr2/auto-orient/thumbnail/500&pid=259848", queryStr); Assert.assertEquals("imageMogr2/auto-orient/thumbnail/500&pid=259848", queryStr);
} }
@Test
public void parseTest2(){
String requestUrl = "http://192.168.1.1:8080/pc?=d52i5837i4ed=o39-ap9e19s5--=72e54*ll0lodl-f338868d2";
UrlQuery q = new UrlQuery();
UrlQuery parse = q.parse(requestUrl, Charset.defaultCharset());
Assert.assertEquals("=d52i5837i4ed=o39-ap9e19s5--=72e54*ll0lodl-f338868d2", parse.toString());
}
} }