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
32c4952d31
commit
e3c1852c4d
@ -473,8 +473,9 @@ public class Condition extends CloneSupport<Condition> {
|
|||||||
final String firstPart = strs.get(0).trim().toUpperCase();
|
final String firstPart = strs.get(0).trim().toUpperCase();
|
||||||
if (OPERATORS.contains(firstPart)) {
|
if (OPERATORS.contains(firstPart)) {
|
||||||
this.operator = firstPart;
|
this.operator = firstPart;
|
||||||
// 比较符号后跟大部分为数字,此处做转换
|
// 比较符号后跟大部分为数字,此处做转换(IN不做转换)
|
||||||
this.value = tryToNumber(strs.get(1));
|
final String valuePart = strs.get(1);
|
||||||
|
this.value = isOperatorIn() ? valuePart : tryToNumber(valuePart);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,6 +538,9 @@ public class Condition extends CloneSupport<Condition> {
|
|||||||
*/
|
*/
|
||||||
private static Object tryToNumber(String value){
|
private static Object tryToNumber(String value){
|
||||||
value = StrUtil.trim(value);
|
value = StrUtil.trim(value);
|
||||||
|
if(false == NumberUtil.isNumber(value)){
|
||||||
|
return value;
|
||||||
|
}
|
||||||
try{
|
try{
|
||||||
return NumberUtil.parseNumber(value);
|
return NumberUtil.parseNumber(value);
|
||||||
} catch (Exception ignore){
|
} catch (Exception ignore){
|
||||||
|
@ -60,4 +60,10 @@ public class ConditionTest {
|
|||||||
// issue I38LTM
|
// issue I38LTM
|
||||||
Assert.assertSame(Long.class, age.getValue().getClass());
|
Assert.assertSame(Long.class, age.getValue().getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void parseInTest(){
|
||||||
|
final Condition age = Condition.parse("age", "in 1,2,3");
|
||||||
|
Assert.assertEquals("age IN (?,?,?)", age.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,6 +110,8 @@ public class Ftp extends AbstractFtp {
|
|||||||
* @param user 用户名
|
* @param user 用户名
|
||||||
* @param password 密码
|
* @param password 密码
|
||||||
* @param charset 编码
|
* @param charset 编码
|
||||||
|
* @param serverLanguageCode 服务器语言
|
||||||
|
* @param systemKey 系统关键字
|
||||||
* @param mode 模式
|
* @param mode 模式
|
||||||
*/
|
*/
|
||||||
public Ftp(String host, int port, String user, String password, Charset charset, String serverLanguageCode, String systemKey, FtpMode mode) {
|
public Ftp(String host, int port, String user, String password, Charset charset, String serverLanguageCode, String systemKey, FtpMode mode) {
|
||||||
@ -626,8 +628,8 @@ public class Ftp extends AbstractFtp {
|
|||||||
* @param fileName 文件名
|
* @param fileName 文件名
|
||||||
* @param out 输出位置
|
* @param out 输出位置
|
||||||
* @param fileNameCharset 文件名编码
|
* @param fileNameCharset 文件名编码
|
||||||
* @since 5.5.7
|
|
||||||
* @throws IORuntimeException IO异常
|
* @throws IORuntimeException IO异常
|
||||||
|
* @since 5.5.7
|
||||||
*/
|
*/
|
||||||
public void download(String path, String fileName, OutputStream out, Charset fileNameCharset) throws IORuntimeException {
|
public void download(String path, String fileName, OutputStream out, Charset fileNameCharset) throws IORuntimeException {
|
||||||
String pwd = null;
|
String pwd = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user