mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix bug
This commit is contained in:
@@ -8,7 +8,8 @@
|
|||||||
### 🐣新特性
|
### 🐣新特性
|
||||||
### 🐞Bug修复
|
### 🐞Bug修复
|
||||||
* 【core 】 LineReadWatcher#onModify文件清空判断问题(issue#2013@Github)
|
* 【core 】 LineReadWatcher#onModify文件清空判断问题(issue#2013@Github)
|
||||||
* 【core 】 修复4位bytes转换float问题(issue#I4M0E4@Github)
|
* 【core 】 修复4位bytes转换float问题(issue#I4M0E4@Gitee)
|
||||||
|
* 【core 】 修复CharSequenceUtil.replace问题(issue#I4M16G@Gitee)
|
||||||
|
|
||||||
-------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------
|
||||||
# 5.7.17 (2021-12-09)
|
# 5.7.17 (2021-12-09)
|
||||||
|
@@ -3538,6 +3538,11 @@ public class CharSequenceUtil {
|
|||||||
|
|
||||||
final int strLength = str.length();
|
final int strLength = str.length();
|
||||||
final int searchStrLength = searchStr.length();
|
final int searchStrLength = searchStr.length();
|
||||||
|
if(strLength < searchStrLength){
|
||||||
|
// issue#I4M16G@Gitee
|
||||||
|
return str(str);
|
||||||
|
}
|
||||||
|
|
||||||
if (fromIndex > strLength) {
|
if (fromIndex > strLength) {
|
||||||
return str(str);
|
return str(str);
|
||||||
} else if (fromIndex < 0) {
|
} else if (fromIndex < 0) {
|
||||||
|
@@ -1499,20 +1499,26 @@ public class XmlUtil {
|
|||||||
*/
|
*/
|
||||||
private void examineNode(Node node, boolean attributesOnly) {
|
private void examineNode(Node node, boolean attributesOnly) {
|
||||||
final NamedNodeMap attributes = node.getAttributes();
|
final NamedNodeMap attributes = node.getAttributes();
|
||||||
final int length = attributes.getLength();
|
//noinspection ConstantConditions
|
||||||
for (int i = 0; i < length; i++) {
|
if (null != attributes) {
|
||||||
Node attribute = attributes.item(i);
|
final int length = attributes.getLength();
|
||||||
storeAttribute(attribute);
|
for (int i = 0; i < length; i++) {
|
||||||
|
Node attribute = attributes.item(i);
|
||||||
|
storeAttribute(attribute);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false == attributesOnly) {
|
if (false == attributesOnly) {
|
||||||
final NodeList childNodes = node.getChildNodes();
|
final NodeList childNodes = node.getChildNodes();
|
||||||
Node item;
|
//noinspection ConstantConditions
|
||||||
final int childLength = childNodes.getLength();
|
if(null != childNodes){
|
||||||
for (int i = 0; i < childLength; i++) {
|
Node item;
|
||||||
item = childNodes.item(i);
|
final int childLength = childNodes.getLength();
|
||||||
if (item.getNodeType() == Node.ELEMENT_NODE)
|
for (int i = 0; i < childLength; i++) {
|
||||||
examineNode(item, false);
|
item = childNodes.item(i);
|
||||||
|
if (item.getNodeType() == Node.ELEMENT_NODE)
|
||||||
|
examineNode(item, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,14 @@ public class CharSequenceUtilTest {
|
|||||||
Assert.assertEquals("SSMBeryAllen", actual);
|
Assert.assertEquals("SSMBeryAllen", actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void replaceTest2(){
|
||||||
|
// https://gitee.com/dromara/hutool/issues/I4M16G
|
||||||
|
String replace = "#{A}";
|
||||||
|
String result = CharSequenceUtil.replace(replace, "#{AAAAAAA}", "1");
|
||||||
|
Assert.assertEquals(replace, result);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void addPrefixIfNotTest(){
|
public void addPrefixIfNotTest(){
|
||||||
String str = "hutool";
|
String str = "hutool";
|
||||||
|
Reference in New Issue
Block a user