mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
c7ffae7915
commit
b9417a4114
@ -377,7 +377,7 @@ public class Convert {
|
|||||||
* @param defaultValue 转换错误时的默认值
|
* @param defaultValue 转换错误时的默认值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Boolean toBool(final Object value, final Boolean defaultValue) {
|
public static Boolean toBoolean(final Object value, final Boolean defaultValue) {
|
||||||
return convertQuietly(Boolean.class, value, defaultValue);
|
return convertQuietly(Boolean.class, value, defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,8 +389,8 @@ public class Convert {
|
|||||||
* @param value 被转换的值
|
* @param value 被转换的值
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public static Boolean toBool(final Object value) {
|
public static Boolean toBoolean(final Object value) {
|
||||||
return toBool(value, null);
|
return toBoolean(value, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,17 +8,17 @@ public class ConvertToBooleanTest {
|
|||||||
@Test
|
@Test
|
||||||
public void intToBooleanTest() {
|
public void intToBooleanTest() {
|
||||||
final int a = 100;
|
final int a = 100;
|
||||||
final Boolean aBoolean = Convert.toBool(a);
|
final Boolean aBoolean = Convert.toBoolean(a);
|
||||||
Assert.assertTrue(aBoolean);
|
Assert.assertTrue(aBoolean);
|
||||||
|
|
||||||
final int b = 0;
|
final int b = 0;
|
||||||
final Boolean bBoolean = Convert.toBool(b);
|
final Boolean bBoolean = Convert.toBoolean(b);
|
||||||
Assert.assertFalse(bBoolean);
|
Assert.assertFalse(bBoolean);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void issueI65P8ATest() {
|
public void issueI65P8ATest() {
|
||||||
final Boolean bool = Convert.toBool("", Boolean.TRUE);
|
final Boolean bool = Convert.toBoolean("", Boolean.TRUE);
|
||||||
Assert.assertFalse(bool);
|
Assert.assertFalse(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,9 +108,9 @@ public final class DbUtil {
|
|||||||
*/
|
*/
|
||||||
public static void setShowSqlGlobal(final Setting setting) {
|
public static void setShowSqlGlobal(final Setting setting) {
|
||||||
// 初始化SQL显示
|
// 初始化SQL显示
|
||||||
final boolean isShowSql = Convert.toBool(setting.remove(SqlLog.KEY_SHOW_SQL), false);
|
final boolean isShowSql = Convert.toBoolean(setting.remove(SqlLog.KEY_SHOW_SQL), false);
|
||||||
final boolean isFormatSql = Convert.toBool(setting.remove(SqlLog.KEY_FORMAT_SQL), false);
|
final boolean isFormatSql = Convert.toBoolean(setting.remove(SqlLog.KEY_FORMAT_SQL), false);
|
||||||
final boolean isShowParams = Convert.toBool(setting.remove(SqlLog.KEY_SHOW_PARAMS), false);
|
final boolean isShowParams = Convert.toBoolean(setting.remove(SqlLog.KEY_SHOW_PARAMS), false);
|
||||||
String sqlLevelStr = setting.remove(SqlLog.KEY_SQL_LEVEL);
|
String sqlLevelStr = setting.remove(SqlLog.KEY_SQL_LEVEL);
|
||||||
if (null != sqlLevelStr) {
|
if (null != sqlLevelStr) {
|
||||||
sqlLevelStr = sqlLevelStr.toUpperCase();
|
sqlLevelStr = sqlLevelStr.toUpperCase();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user