修复提示信息错误

This commit is contained in:
Looly 2022-08-30 21:53:45 +08:00
parent 7ddcc117fd
commit c5911c0501
4 changed files with 34 additions and 1 deletions

View File

@ -28,6 +28,7 @@
* 【core 】 修复zip被识别成jar和apk被识别成jar或zip的问题pr#2548@Github
* 【core 】 修复UrlBuilder.addPath 方法传入非有效路径字符串时会出现空指针异常的问题issue#I5O4ML@Gitee
* 【core 】 修复FilterIter当参数filter为空时存在问题issue#I5OG7U@Gitee
* 【poi 】 修复Excel读取提示信息错误issue#I5OSFC@Gitee
-------------------------------------------------------------------------------------------------------------

View File

@ -3,6 +3,8 @@ package cn.hutool.core.date;
import org.junit.Assert;
import org.junit.Test;
import java.util.Calendar;
public class ZodiacTest {
@Test
@ -10,6 +12,12 @@ public class ZodiacTest {
Assert.assertEquals("摩羯座", Zodiac.getZodiac(Month.JANUARY, 19));
Assert.assertEquals("水瓶座", Zodiac.getZodiac(Month.JANUARY, 20));
Assert.assertEquals("巨蟹座", Zodiac.getZodiac(6, 17));
final Calendar calendar = Calendar.getInstance();
calendar.set(2022, Calendar.JULY, 17);
Assert.assertEquals("巨蟹座", Zodiac.getZodiac(calendar.getTime()));
Assert.assertEquals("巨蟹座", Zodiac.getZodiac(calendar));
Assert.assertNull(Zodiac.getZodiac((Calendar) null));
}
@Test
@ -17,5 +25,12 @@ public class ZodiacTest {
Assert.assertEquals("", Zodiac.getChineseZodiac(1994));
Assert.assertEquals("", Zodiac.getChineseZodiac(2018));
Assert.assertEquals("", Zodiac.getChineseZodiac(2019));
final Calendar calendar = Calendar.getInstance();
calendar.set(2022, Calendar.JULY, 17);
Assert.assertEquals("", Zodiac.getChineseZodiac(calendar.getTime()));
Assert.assertEquals("", Zodiac.getChineseZodiac(calendar));
Assert.assertNull(Zodiac.getChineseZodiac(1899));
Assert.assertNull(Zodiac.getChineseZodiac((Calendar) null));
}
}

View File

@ -0,0 +1,15 @@
package cn.hutool.core.date;
import org.junit.Assert;
import org.junit.Test;
import java.time.ZoneId;
import java.util.TimeZone;
public class ZoneUtilTest {
@Test
public void toTest() {
Assert.assertEquals(ZoneId.systemDefault(), ZoneUtil.toZoneId(null));
Assert.assertEquals(TimeZone.getDefault(), ZoneUtil.toTimeZone(null));
}
}

View File

@ -44,7 +44,9 @@ public class MapSheetReader extends AbstractSheetReader<List<Map<String, Object>
if (headerRowIndex < firstRowNum) {
throw new IndexOutOfBoundsException(StrUtil.format("Header row index {} is lower than first row index {}.", headerRowIndex, firstRowNum));
} else if (headerRowIndex > lastRowNum) {
throw new IndexOutOfBoundsException(StrUtil.format("Header row index {} is greater than last row index {}.", headerRowIndex, firstRowNum));
throw new IndexOutOfBoundsException(StrUtil.format("Header row index {} is greater than last row index {}.", headerRowIndex, lastRowNum));
} else if (startRowIndex > lastRowNum) {
throw new IndexOutOfBoundsException(StrUtil.format("startRowIndex row index {} is greater than last row index {}.", startRowIndex, lastRowNum));
}
final int startRowIndex = Math.max(this.startRowIndex, firstRowNum);// 读取起始行包含
final int endRowIndex = Math.min(this.endRowIndex, lastRowNum);// 读取结束行包含