Skip to content

Commit

Permalink
优化错误提示
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonwan committed Sep 22, 2020
1 parent 69ca773 commit 189ecae
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import org.apache.commons.lang3.StringUtils
import java.nio.charset.Charset
import java.util.Base64
import org.slf4j.LoggerFactory
import java.lang.IndexOutOfBoundsException

@AtomService(paramClass = InnerJobParam::class)
class JobScriptAtom : TaskAtom<InnerJobParam> {
Expand Down Expand Up @@ -81,7 +82,13 @@ class JobScriptAtom : TaskAtom<InnerJobParam> {
} else {
val ipList = param.targetIpList.trim().split(",", "", ";", "\n").filter(StringUtils::isNotBlank).toList()
logger.info("targetIpList:$ipList")
ipDTOList = ipList.map { IpDTO(it.split(":", "")[1].trim(), it.split(":", "")[0].trim().toLong()) }
try {
ipDTOList = ipList.map { IpDTO(it.split(":", "")[1].trim(), it.split(":", "")[0].trim().toLong()) }
} catch (e: IndexOutOfBoundsException) {
result.status = Status.failure
result.message = "IP输入格式不正确,请检查,正确格式:云区域ID:IP,例如0:192.168.1.1 (Please check IP format, right IP format:cloud area id:ip, ex:0:192.168.1.1)"
return
}
}
if (dynamicGroupIdListStr.isEmpty()) {
logger.info("dynamicGroupIdListStr is empty")
Expand Down

0 comments on commit 189ecae

Please sign in to comment.