Python java.lang.IllegalArgumentException() Examples

The following are 11 code examples of java.lang.IllegalArgumentException(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module java.lang , or try the search function .
Example #1
Source File: ApplySig.py    From ApplySig with GNU Lesser General Public License v3.0 5 votes vote down vote up
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") 
Example #2
Source File: test_exception.py    From chaquopy with MIT License 5 votes vote down vote up
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 
Example #3
Source File: pkgutil.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #4
Source File: ssl.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #5
Source File: pkgutil.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #6
Source File: ssl.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #7
Source File: pkgutil.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #8
Source File: ssl.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #9
Source File: pkgutil.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #10
Source File: ssl.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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)) 
Example #11
Source File: signal.py    From medicare-demo with Apache License 2.0 4 votes vote down vote up
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