mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
fix code
This commit is contained in:
parent
68ad664fec
commit
dd1f89b555
@ -107,7 +107,7 @@ public final class CsvRow implements List<String> {
|
||||
* @since 5.3.6
|
||||
*/
|
||||
public <T> T toBean(Class<T> clazz){
|
||||
return BeanUtil.mapToBean(getFieldMap(), clazz, true);
|
||||
return BeanUtil.toBeanIgnoreError(getFieldMap(), clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5,10 +5,11 @@ import org.junit.Test;
|
||||
|
||||
public class XMLTest {
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Test
|
||||
public void toXmlTest(){
|
||||
final JSONObject put = JSONUtil.createObj().put("aaa", "你好").put("键2", "test");
|
||||
final JSONObject put = JSONUtil.createObj()
|
||||
.set("aaa", "你好")
|
||||
.set("键2", "test");
|
||||
final String s = JSONUtil.toXmlStr(put);
|
||||
Assert.assertEquals("<aaa>你好</aaa><键2>test</键2>", s);
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ public class ExcelUtil {
|
||||
*/
|
||||
public static ExcelReader getReader(InputStream bookStream, int sheetIndex) {
|
||||
try {
|
||||
return new ExcelReader(bookStream, sheetIndex, true);
|
||||
return new ExcelReader(bookStream, sheetIndex);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||
}
|
||||
@ -303,10 +303,12 @@ public class ExcelUtil {
|
||||
* @param closeAfterRead 读取结束是否关闭流
|
||||
* @return {@link ExcelReader}
|
||||
* @since 4.0.3
|
||||
* @deprecated 使用完毕无论是否closeAfterRead,poi会关闭流,此参数无意义。
|
||||
*/
|
||||
@Deprecated
|
||||
public static ExcelReader getReader(InputStream bookStream, int sheetIndex, boolean closeAfterRead) {
|
||||
try {
|
||||
return new ExcelReader(bookStream, sheetIndex, closeAfterRead);
|
||||
return new ExcelReader(bookStream, sheetIndex);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||
}
|
||||
@ -322,7 +324,7 @@ public class ExcelUtil {
|
||||
*/
|
||||
public static ExcelReader getReader(InputStream bookStream, String sheetName) {
|
||||
try {
|
||||
return new ExcelReader(bookStream, sheetName, true);
|
||||
return new ExcelReader(bookStream, sheetName);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||
}
|
||||
@ -335,10 +337,12 @@ public class ExcelUtil {
|
||||
* @param sheetName sheet名,第一个默认是sheet1
|
||||
* @param closeAfterRead 读取结束是否关闭流
|
||||
* @return {@link ExcelReader}
|
||||
* @deprecated 使用完毕无论是否closeAfterRead,poi会关闭流,此参数无意义。
|
||||
*/
|
||||
@Deprecated
|
||||
public static ExcelReader getReader(InputStream bookStream, String sheetName, boolean closeAfterRead) {
|
||||
try {
|
||||
return new ExcelReader(bookStream, sheetName, closeAfterRead);
|
||||
return new ExcelReader(bookStream, sheetName);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user