Example usage for java.lang IllegalAccessError IllegalAccessError

List of usage examples for java.lang IllegalAccessError IllegalAccessError

Introduction

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

Prototype

public IllegalAccessError(String s) 

Source Link

Document

Constructs an IllegalAccessError with the specified detail message.

Usage

From source file:org.bndtools.rt.repository.marshall.CapReqJson.java

private static CapReqBuilder parseCapReq(JsonNode reqNode) throws IllegalArgumentException {
    String namespace = getRequiredField(reqNode, "ns").asText();
    CapReqBuilder builder = new CapReqBuilder(namespace);

    JsonNode dirsNode = reqNode.get("dirs");
    if (dirsNode != null) {
        if (dirsNode.isArray()) {
            for (JsonNode dirNode : dirsNode) {
                toDirective(builder, dirNode);
            }//from   w ww  . j av a  2s . c  om
        } else if (dirsNode.isObject()) {
            toDirective(builder, dirsNode);
        } else {
            throw new IllegalAccessError("Value of 'dirs' node is neither an Array or an Object.");
        }
    }

    JsonNode attrsNode = reqNode.get("attrs");
    if (attrsNode != null) {
        if (attrsNode.isArray()) {
            for (JsonNode attrNode : attrsNode) {
                toAttribute(builder, attrNode);
            }
        } else if (attrsNode.isObject()) {
            toAttribute(builder, attrsNode);
        } else {
            throw new IllegalAccessError("Value of 'attrs' node is neither an Array or an Object.");
        }
    }

    return builder;
}

From source file:sorcer.launcher.Sorcer.java

private ILauncher parseCommandLine(CommandLine cmd) throws ParseException, IOException {
    Mode mode = null;/*www  . j a v  a2s.  co m*/
    if (cmd.hasOption(MODE)) {
        String modeValue = cmd.getOptionValue(MODE);
        for (Mode m : Mode.values()) {
            if (m.paramValue.equalsIgnoreCase(modeValue))
                mode = m;
        }
        if (mode == null)
            throw new IllegalAccessError("Illegal mode " + modeValue);
    } else
        mode = Mode.preferDirect;

    Integer debugPort = null;
    if (cmd.hasOption(DEBUG)) {
        debugPort = Integer.parseInt(cmd.getOptionValue(DEBUG));
    }

    try {
        waitMode = cmd.hasOption(WAIT) ? WaitMode.valueOf(cmd.getOptionValue(WAIT)) : WaitMode.end;
    } catch (IllegalArgumentException x) {
        throw new IllegalArgumentException("Illegal wait option " + cmd.getOptionValue(WAIT) + ". Use one of "
                + Arrays.toString(WaitMode.values()), x);
    }

    ILauncher launcher = null;
    if (!mode.fork) {
        boolean envOk = SorcerLauncher.checkEnvironment();
        if (envOk && debugPort == null) {
            if (waitMode != WaitMode.end)
                System.err.println(
                        "WARN Starting SORCER with " + waitMode + " mode will result with early exit.");
            launcher = createSorcerLauncher();
        } else {
            if (debugPort != null)
                report(mode, "Cannot run in {} mode with debug", mode.paramValue);
            else
                report(mode, "Cannot run in {} mode; see above", mode.paramValue);
        }
    }

    if (launcher == null) {
        IForkingLauncher forkingLauncher = null;
        try {
            forkingLauncher = createForkingLauncher(debugPort, waitMode);
        } catch (IllegalStateException e) {
            if ((mode.fork && mode.force) || (!mode.fork))
                throw e;
        }
        launcher = forkingLauncher;
    }

    // called prefer-fork but didn't make it
    // fallback to direct
    if (launcher == null && mode.fork && !mode.force)
        launcher = createSorcerLauncher();

    if (launcher == null)
        throw new IllegalStateException("Could not start SORCER");

    String homePath = System.getProperty(SORCER_HOME);
    File home = null;
    if (homePath != null) {
        home = new File(homePath).getCanonicalFile();
        launcher.setHome(home);
    }

    File logDir = FileUtils.getFile(home, cmd.hasOption(LOGS) ? cmd.getOptionValue(LOGS) : "logs");

    launcher.setLogDir(logDir);

    @SuppressWarnings("unchecked")
    List<String> userConfigFiles = cmd.getArgList();
    launcher.setConfigs(userConfigFiles);

    if (cmd.hasOption(PROFILE))
        launcher.setProfile(cmd.getOptionValue(PROFILE));

    if (cmd.hasOption(RIO)) {
        String[] rioConfigs = StringUtils.tokenizerSplit(cmd.getOptionValue(RIO), File.pathSeparator);
        launcher.setRioConfigs(new ArrayList<String>(Arrays.asList(rioConfigs)));
    }

    return launcher;
}

From source file:com.baidu.cc.web.rpc.ConfigServerServiceImpl.java

/**
 * To authorize by user and project id./*from www .  j  a  v a  2 s  . c om*/
 * 
 * @param u
 *            {@link User} object
 * @param projectId
 *            project id
 */
protected void authorizeProject(User u, long projectId) {

    boolean authorization = accessSettingService.checkAuth(u.getId(), AccessSettingService.Auth_TYPE_PROJECT,
            projectId);
    if (!authorization) {
        String msg = "No access allowed for user '" + u.getName() + "' to projectId=" + projectId;
        if (LOGGER.isInfoEnabled()) {
            LOGGER.info(msg);
        }
        throw new IllegalAccessError(msg);
    }
}

From source file:org.apache.gora.dynamodb.store.DynamoDBNativeStore.java

@Override
/**/*from  w w  w . ja v  a2s  .c  om*/
 * Gets the object with the specific key
 * @throws IOException
 */
public T get(K key) {
    T object = null;
    try {
        Object rangeKey;
        rangeKey = getRangeKeyFromKey(key);
        Object hashKey = getHashFromKey(key);
        if (hashKey != null) {
            DynamoDBMapper mapper = new DynamoDBMapper(dynamoDBStoreHandler.getDynamoDbClient());
            if (rangeKey != null)
                object = mapper.load(persistentClass, hashKey, rangeKey);
            else
                object = mapper.load(persistentClass, hashKey);
        } else
            throw new GoraException("Error while retrieving keys from object: " + key.toString());
    } catch (IllegalArgumentException e) {
        LOG.error("Illegal argument detected", e.getMessage());
        throw new IllegalArgumentException(e);
    } catch (IllegalAccessException e) {
        LOG.error("Illegal access detected", e.getMessage());
        throw new IllegalAccessError(e.getMessage());
    } catch (InvocationTargetException e) {
        LOG.error(e.getMessage());
        throw new RuntimeException(e);
    } catch (GoraException ge) {
        LOG.error(ge.getMessage());
        LOG.error(ge.getStackTrace().toString());
    }
    return object;
}

From source file:org.fao.geonet.kernel.search.UnusedSearcher.java

/**
 * {@inheritDoc}/*www. j a v  a  2  s . c  om*/
 * @see org.fao.geonet.kernel.search.MetaSearcher#getAllUuids(int)
 */
@Override
public List<String> getAllUuids(int maxhits) throws Exception {
    throw new IllegalAccessError("Should not being called !");
}

From source file:eu.stratosphere.nephele.services.memorymanager.spi.DefaultMemoryManager.java

@Override
public void allocatePages(AbstractInvokable owner, List<MemorySegment> target, int numPages)
        throws MemoryAllocationException {
    // sanity check
    if (owner == null) {
        throw new IllegalAccessError("The memory owner must not be null.");
    }//from  ww  w  .  j a v  a 2s  .  co m

    // reserve array space, if applicable
    if (target instanceof ArrayList) {
        ((ArrayList<MemorySegment>) target).ensureCapacity(numPages);
    }

    // -------------------- BEGIN CRITICAL SECTION -------------------
    synchronized (this.lock) {
        if (this.isShutDown) {
            throw new IllegalStateException("Memory manager has been shut down.");
        }

        if (numPages > this.freeSegments.size()) {
            throw new MemoryAllocationException("Could not allocate " + numPages + " pages. Only "
                    + this.freeSegments.size() + " pages are remaining.");
        }

        Set<DefaultMemorySegment> segmentsForOwner = this.allocatedSegments.get(owner);
        if (segmentsForOwner == null) {
            segmentsForOwner = new HashSet<DefaultMemorySegment>(4 * numPages / 3 + 1);
            this.allocatedSegments.put(owner, segmentsForOwner);
        }

        for (int i = numPages; i > 0; i--) {
            byte[] buffer = this.freeSegments.poll();
            final DefaultMemorySegment segment = new DefaultMemorySegment(owner, buffer);
            target.add(segment);
            segmentsForOwner.add(segment);
        }
    }
    // -------------------- END CRITICAL SECTION -------------------
}

From source file:com.baidu.cc.web.rpc.ConfigServerServiceImpl.java

/**
 * ???? ???? IllegalAccessError./*from www.j av a  2  s.  c  o  m*/
 * 
 * @param user
 *            ??
 * @param password
 *            ?
 * @param version
 *            ?
 * @return Map<String,String> String.tag
 */
@Override
public Map<String, String> getConfigItems(String user, String password, Long version) {
    User u = authenticate(user, password);

    Version v = versionService.findById(version);
    if (v == null) {
        throw new IllegalAccessError("No version id '" + version + "'  found.");
    }

    authorizeProject(u, v.getProjectId());

    Map<String, String> items = getConfigItems(version);
    // add tag
    items.put(TAG_KEY, v.getCheckSum());

    return items;
}

From source file:de.hh.changeRing.user.User.java

@XmlElement
public String getPassword() {
    throw new IllegalAccessError("password not readable, UserId:" + id);
}

From source file:org.vietspider.net.client.impl.AnonymousHttpClient.java

@Override
protected ClientConnectionManager createClientConnectionManager() {
    SchemeRegistry registry = new SchemeRegistry();
    registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

    ClientConnectionManager connManager = null;
    HttpParams params = getParams();/*from   ww w.  j  av  a 2s  . c  o  m*/

    ClientConnectionManagerFactory factory = null;

    // Try first getting the factory directly as an object.
    factory = (ClientConnectionManagerFactory) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY);
    if (factory == null) { // then try getting its class name.
        String className = (String) params.getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
        if (className != null) {
            try {
                Class<?> clazz = Class.forName(className);
                factory = (ClientConnectionManagerFactory) clazz.newInstance();
            } catch (ClassNotFoundException ex) {
                throw new IllegalStateException("Invalid class name: " + className);
            } catch (IllegalAccessException ex) {
                throw new IllegalAccessError(ex.getMessage());
            } catch (InstantiationException ex) {
                throw new InstantiationError(ex.getMessage());
            }
        }
    }

    if (factory != null) {
        connManager = factory.newInstance(params, registry);
    } else {
        connManager = new SingleClientConnManager(getParams(), registry);
    }

    return connManager;
}

From source file:org.apache.gora.dynamodb.store.DynamoDBNativeStore.java

/**
 * Returns a new persistent object//from ww w  . ja v a  2 s.c  o  m
 *
 * @return
 */
@Override
public T newPersistent() {
    T obj = null;
    try {
        obj = persistentClass.newInstance();
    } catch (InstantiationException e) {
        LOG.error("Error instantiating " + persistentClass.getCanonicalName());
        throw new InstantiationError(e.getMessage());
    } catch (IllegalAccessException e) {
        LOG.error("Error instantiating " + persistentClass.getCanonicalName());
        throw new IllegalAccessError(e.getMessage());
    }
    return obj;
}