本文整理汇总了Python中java.lang.IllegalArgumentException方法的典型用法代码示例。如果您正苦于以下问题:Python lang.IllegalArgumentException方法的具体用法?Python lang.IllegalArgumentException怎么用?Python lang.IllegalArgumentException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang
的用法示例。
在下文中一共展示了lang.IllegalArgumentException方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_catch
# 需要导入模块: from java import lang [as 别名]
# 或者: from java.lang import IllegalArgumentException [as 别名]
def test_catch(self):
from java.lang import Integer
from java.lang import RuntimeException, IllegalArgumentException, NumberFormatException
with self.assertRaises(NumberFormatException): # Actual class
Integer.parseInt("hello")
with self.assertRaises(IllegalArgumentException): # Parent class
Integer.parseInt("hello")
with self.assertRaises(RuntimeException): # Grandparent class
Integer.parseInt("hello")
from java.lang import System
from java.io import IOException
try:
System.getProperty("")
except IOException: # Unrelated class
self.fail()
except NumberFormatException: # Child class
self.fail()
except IllegalArgumentException: # Actual class
pass
示例2: ask_sig
# 需要导入模块: from java import lang [as 别名]
# 或者: from java.lang import IllegalArgumentException [as 别名]
def ask_sig():
try:
filepath = askFile("Choose Sig file:", "ApplySig").toString()
print('Load File:' + filepath)
return open(filepath, 'rb')
except IllegalArgumentException as error:
Msg.warn(self, error.toString())
except ghidra.util.exception.CancelledException:
print("User Cancelled")
示例3: read_jython_code
# 需要导入模块: from java import lang [as 别名]
# 或者: from java.lang import IllegalArgumentException [as 别名]
def read_jython_code(fullname, stream, filename):
try:
data = _imp.readCode(filename, stream, False)
return BytecodeLoader.makeCode(fullname + "$py", data, filename)
except IllegalArgumentException:
return None
示例4: load_cert_chain
# 需要导入模块: from java import lang [as 别名]
# 或者: from java.lang import IllegalArgumentException [as 别名]
def load_cert_chain(self, certfile, keyfile=None, password=None):
try:
self._key_managers = _get_openssl_key_manager(certfile, keyfile, password, _key_store=self._key_store)
except IllegalArgumentException as err:
raise SSLError(SSL_ERROR_SSL, "PEM lib ({})".format(err))
示例5: _init_signals
# 需要导入模块: from java import lang [as 别名]
# 或者: from java.lang import IllegalArgumentException [as 别名]
def _init_signals():
# install signals by checking for standard names
# using IllegalArgumentException to diagnose
possible_signals = """
SIGABRT
SIGALRM
SIGBUS
SIGCHLD
SIGCONT
SIGFPE
SIGHUP
SIGILL
SIGINFO
SIGINT
SIGIOT
SIGKILL
SIGPIPE
SIGPOLL
SIGPROF
SIGQUIT
SIGSEGV
SIGSTOP
SIGSYS
SIGTERM
SIGTRAP
SIGTSTP
SIGTTIN
SIGTTOU
SIGURG
SIGUSR1
SIGUSR2
SIGVTALRM
SIGWINCH
SIGXCPU
SIGXFSZ
""".split()
_module = __import__(__name__)
signals = {}
signals_by_name = {}
for signal_name in possible_signals:
try:
java_signal = sun.misc.Signal(signal_name[3:])
except IllegalArgumentException:
continue
signal_number = java_signal.getNumber()
signals[signal_number] = java_signal
signals_by_name[signal_name] = java_signal
setattr(_module, signal_name, signal_number) # install as a module constant
return signals