本文整理匯總了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