Example usage for java.lang IllegalAccessException IllegalAccessException

List of usage examples for java.lang IllegalAccessException IllegalAccessException

Introduction

In this page you can find the example usage for java.lang IllegalAccessException IllegalAccessException.

Prototype

public IllegalAccessException() 

Source Link

Document

Constructs an IllegalAccessException without a detail message.

Usage

From source file:org.apache.excalibur.mpool.VariableSizePool.java

public void shrink(final int byNum, final long key) throws IllegalAccessException {
    if (m_key < 0 || m_key != key) {
        throw new IllegalAccessException();
    }/*  ww  w . j a v a 2  s .  co m*/

    synchronized (m_buffer) {
        final int num = Math.min(byNum, m_buffer.size());

        for (int i = 0; i < num; i++) {
            try {
                m_factory.dispose(m_buffer.remove());
            } catch (Exception e) {
                // ignore exception
            }
        }
    }
}

From source file:org.apache.excalibur.mpool.VariableSizePool.java

public void grow(final int byNum, final long key) throws IllegalAccessException {
    if (m_key < 0 || m_key != key) {
        throw new IllegalAccessException();
    }//  w w  w  .  ja  v a2  s  . com

    synchronized (m_buffer) {
        for (int i = 0; i < byNum; i++) {
            try {
                m_buffer.add(newInstance());
            } catch (Exception e) {
                // ignore exception
            }
        }
    }
}

From source file:org.lnicholls.galleon.server.Server.java

public Server() throws Exception {
    if (mServer != null)
        throw new IllegalAccessException();

    mServer = this;

    //System.setSecurityManager(new CustomSecurityManager());

    mShortTermTasks = new ArrayList();
    mLongTermTasks = new ArrayList();
    mDataTasks = new ArrayList();

    try {//from  w  w  w.j a  v a2 s .co m
        System.out.println("Galleon " + Tools.getVersion() + " is starting...");

        ArrayList errors = new ArrayList();
        setup(errors);

        log = setupLog(Server.class.getName());

        for (int i = 0; i < errors.size(); i++)
            log.error(errors.get(i));

        createAppClassLoader();

        Thread.currentThread().setContextClassLoader(mAppClassLoader);

        mServerConfiguration = new ServerConfiguration();

        // Log the system properties
        printSystemProperties();
        printServerProperties();

        // Redirect standard out; some third-party libraries use this for
        // error logging
        // TODO
        // Tools.redirectStandardStreams();

        preLoadFonts();

    } catch (Exception ex) {
        Tools.logException(Server.class, ex);
    }
}

From source file:org.apache.cordova.X5CordovaBridge.java

private boolean verifySecret(String action, int bridgeSecret) throws IllegalAccessException {
    if (!jsMessageQueue.isBridgeEnabled()) {
        if (bridgeSecret == -1) {
            LOG.d(LOG_TAG, action + " call made before bridge was enabled.");
        } else {/*from  w ww.ja  v  a2 s  .  c  o m*/
            LOG.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
        }
        return false;
    }
    // Bridge secret wrong and bridge not due to it being from the previous page.
    if (expectedBridgeSecret < 0 || bridgeSecret != expectedBridgeSecret) {
        LOG.e(LOG_TAG,
                "Bridge access attempt with wrong secret token, possibly from malicious code. Disabling exec() bridge!");
        clearBridgeSecret();
        throw new IllegalAccessException();
    }
    return true;
}

From source file:org.apache.cordova.CordovaBridge.java

private boolean verifySecret(String action, int bridgeSecret) throws IllegalAccessException {
    if (!jsMessageQueue.isBridgeEnabled()) {
        if (bridgeSecret == -1) {
            Log.d(LOG_TAG, action + " call made before bridge was enabled.");
        } else {/*from   w ww .j av a 2s.  c o m*/
            Log.d(LOG_TAG, "Ignoring " + action + " from previous page load.");
        }
        return false;
    }
    // Bridge secret wrong and bridge not due to it being from the previous page.
    if (expectedBridgeSecret < 0 || bridgeSecret != expectedBridgeSecret) {
        Log.e(LOG_TAG,
                "Bridge access attempt with wrong secret token, possibly from malicious code. Disabling exec() bridge!");
        clearBridgeSecret();
        throw new IllegalAccessException();
    }
    return true;
}

From source file:egovframework.rte.fdl.string.EgovObjectUtil.java

/**
 * ? ?  ?? ?? ? . ) Class <?>/*from   ww  w.  j  av a2  s .c  o  m*/
 * clazz = EgovObjectUtil.loadClass(this.mapClass);
 * Constructor <?> constructor =
 * clazz.getConstructor(new Class
 * []{DataSource.class, String.class}); Object []
 * params = new Object []{getDataSource(),
 * getUsersByUsernameQuery()};
 * this.usersByUsernameMapping =
 * (EgovUsersByUsernameMapping)
 * constructor.newInstance(params);
 * @param className
 * @return
 * @throws ClassNotFoundException
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws Exception
 */
public static Object instantiate(String className, String[] types, Object[] values)
        throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception {
    Class<?> clazz;
    Class<?>[] classParams = new Class[values.length];
    Object[] objectParams = new Object[values.length];

    try {
        clazz = loadClass(className);

        for (int i = 0; i < values.length; i++) {
            classParams[i] = loadClass(types[i]);
            objectParams[i] = values[i];
        }

        Constructor<?> constructor = clazz.getConstructor(classParams);
        return constructor.newInstance(values);

    } catch (ClassNotFoundException e) {
        if (log.isErrorEnabled())
            log.error(className + " : Class is can not instantialized.");
        throw new ClassNotFoundException();
    } catch (InstantiationException e) {
        if (log.isErrorEnabled())
            log.error(className + " : Class is can not instantialized.");
        throw new InstantiationException();
    } catch (IllegalAccessException e) {
        if (log.isErrorEnabled())
            log.error(className + " : Class is not accessed.");
        throw new IllegalAccessException();
    } catch (Exception e) {
        if (log.isErrorEnabled())
            log.error(className + " : Class is not accessed.");
        throw new Exception(e);
    }
}

From source file:org.apache.excalibur.mpool.VariableSizePool.java

public int size(final long key) throws IllegalAccessException {
    if (m_key < 0 || m_key != key) {
        throw new IllegalAccessException();
    }/* w  w w.  j av a 2s.c  om*/

    synchronized (m_buffer) {
        return m_buffer.size();
    }
}

From source file:org.jtransfo.JTransfoImplTest.java

@Test
public void testConvertIllegalAccessException() throws Exception {
    when(reflectionHelper.newInstance(SimpleClassDomain.class)).thenThrow(new IllegalAccessException());
    exception.expect(JTransfoException.class);
    exception.expectMessage("Cannot create instance for domain class org.jtransfo.object.SimpleClassDomain.");
    jTransfo.convert(new SimpleClassNameTo());
}

From source file:org.callistasoftware.netcare.api.rest.UserApi.java

@RequestMapping(value = "/create", method = RequestMethod.POST, produces = "application/json", consumes = "application/json")
@ResponseBody/*from   ww  w  .java  2  s  .com*/
public ServiceResult<Patient> createNewPatient(@RequestBody final Patient patient, HttpServletRequest request)
        throws IllegalAccessException {
    this.logAccess("create", "patient", request, patient, " ");

    final UserBaseView user = this.getUser();
    if (user.isCareActor()) {
        return this.patientService.createPatient(patient);
    } else {
        throw new IllegalAccessException();
    }
}

From source file:org.jtransfo.JTransfoImplTest.java

@Test
public void testConvertToIllegalAccessException() throws Exception {
    when(reflectionHelper.newInstance(SimpleClassDomain.class)).thenThrow(new IllegalAccessException());
    exception.expect(JTransfoException.class);
    exception.expectMessage("Cannot create instance for domain class org.jtransfo.object.SimpleClassDomain.");
    jTransfo.convertTo(new SimpleClassNameTo(), SimpleClassDomain.class);
}