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:fg.sonar.plugins.secaudit.rules.checks.xpath.XPathMatchers.java

private XPathMatchers() {
    throw new IllegalAccessError("Cannot instantiate this utility class.");
}

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

public static List<Requirement> parseRequirements(JsonFactory jf, InputStream stream) throws IOException {
    List<Requirement> result;

    String collect = IO.collect(stream);
    JsonNode rootNode = new ObjectMapper(jf).readTree(collect);
    if (rootNode.isArray()) {
        result = new LinkedList<Requirement>();
        for (JsonNode reqNode : rootNode) {
            result.add(parseCapReq(reqNode).buildSyntheticRequirement());
        }//w w w.  j a va  2 s . co  m
    } else if (rootNode.isObject()) {
        result = Collections.singletonList(parseCapReq(rootNode).buildRequirement());
    } else {
        throw new IllegalAccessError("JSON data is neither an Array nor an Object");
    }

    return result;
}

From source file:com.phattn.vnexpressnews.io.OkHttpStack.java

private static ProtocolVersion parseProtocol(final Protocol p) {
    switch (p) {//from w ww  .j ava 2s  .com
    case HTTP_1_0:
        return new ProtocolVersion("HTTP", 1, 0);
    case HTTP_1_1:
        return new ProtocolVersion("HTTP", 1, 1);
    case SPDY_3:
        return new ProtocolVersion("SPDY", 3, 1);
    case HTTP_2:
        return new ProtocolVersion("HTTP", 2, 0);
    }

    throw new IllegalAccessError("Unknown protocol");
}

From source file:org.globus.workspace.groupauthz.GroupAuthz.java

public void setdef16(String nope) {
    throw new IllegalAccessError("Only support for 15 groups right now");
}

From source file:com.aix.city.comm.OkHttpStack.java

private static ProtocolVersion parseProtocol(final Protocol p) {
    switch (p) {//from   ww w.j a v  a  2 s. c  o m
    case HTTP_1_0:
        return new ProtocolVersion("HTTP", 1, 0);
    case HTTP_1_1:
        return new ProtocolVersion("HTTP", 1, 1);
    case SPDY_3:
        return new ProtocolVersion("SPDY", 3, 1);
    case HTTP_2:
        return new ProtocolVersion("HTTP", 2, 0);
    }

    throw new IllegalAccessError("Unkwown protocol");
}

From source file:gldapo.filter.FilterBuilder.java

public Object invokeMethod(String name, Object[] args) {
    if (log.isDebugEnabled())
        log.debug("[" + hashCode() + "Invoked " + name + " (" + DefaultGroovyMethods.inspect(args) + ")");
    if ("and".equals(name)) {
        if (args.length == 1 && args[0] instanceof Closure) {
            Closure c = (Closure) args[0];
            push("and");
            call(c);/*from   www . j  a v  a  2  s . c o  m*/
            return add(FilterUtil.and(pop("and")));
        } else {
            throw new IllegalArgumentException("FilterBuilder 'and' call is invalid!");
        }
    } else if ("or".equals(name)) {
        if (args.length == 1 && args[0] instanceof Closure) {
            Closure c = (Closure) args[0];
            push("and");
            call(c);
            return add(FilterUtil.or(pop("and")));
        } else {
            throw new IllegalArgumentException("FilterBuilder 'or' call is invalid!");
        }
    } else if ("eq".equals(name)) {
        if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {
            return add(FilterUtil.eq((String) args[0], (String) args[1]));
        } else {
            throw new IllegalArgumentException(
                    "FilterBuilder 'eq' call must have two arguments of type String");
        }
    } else if ("like".equals(name)) {
        if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {
            return add(FilterUtil.like((String) args[0], (String) args[1]));
        } else {
            throw new IllegalArgumentException(
                    "FilterBuilder 'like' call must have two arguments of type String");
        }
    } else if ("gte".equals(name)) {
        if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {
            return add(FilterUtil.gte((String) args[0], (String) args[1]));
        } else {
            throw new IllegalArgumentException(
                    "FilterBuilder 'gte' call must have two arguments of type String");
        }
    } else if ("lte".equals(name)) {
        if (args.length == 2 && args[0] instanceof String && args[1] instanceof String) {
            return add(FilterUtil.lte((String) args[0], (String) args[1]));
        } else {
            throw new IllegalArgumentException(
                    "FilterBuilder 'lte' call must have two arguments of type String");
        }
    } else if ("not".equals(name)) {
        if (args.length == 1 && args[0] instanceof Closure) {
            push("not");
            call((Closure) args[0]);
            return add(FilterUtil.not(FilterUtil.and(pop("not"))));
        } else if (args.length == 1 && args[0] instanceof Integer) {
            int idx = (Integer) args[0];
            stack.peek().set(idx, FilterUtil.not(stack.peek().get(idx)));
            return idx;
        } else {
            throw new IllegalArgumentException("FilterBuilder 'not' call is invalid!");
        }
    } else
        throw new IllegalAccessError("FilterBuilder invalid call: " + name);
}

From source file:eu.crisis_economics.configuration.ObjectReferenceExpression.java

@Override
final void setObject(Object definition, int arrayIndex) {
    throw new IllegalAccessError("ObjectReferenceExpression: references cannot be assigned to.");
}

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

/**
 * To authorize by user and env id./*from  w  ww . j  a va  2 s .  c  o  m*/
 * 
 * @param u
 *            {@link User} object
 * @param envId
 *            environment id
 */
protected void authorizeEnv(User u, long envId) {

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

From source file:org.osiam.client.oauth.AuthService.java

/**
 * Provide an {@link AccessToken} for the given parameters of this service.
 *
 * @return a valid AccessToken/*  w  w  w .  ja  v a2  s. c o m*/
 * @throws ConnectionInitializationException
 *                               If the Service is unable to connect to the configured OAuth2 service.
 * @throws UnauthorizedException If the configured credentials for this service are not permitted
 *                               to retrieve an {@link AccessToken}
 */
public AccessToken retrieveAccessToken() {
    if (grantType == GrantType.AUTHORIZATION_CODE) {// NOSONAR - false-positive from clover; if-expression is correct
        throw new IllegalAccessError("For the grant type " + GrantType.AUTHORIZATION_CODE
                + " you need to retrieve a authentication code first.");
    }
    HttpResponse response = performRequest();
    int status = response.getStatusLine().getStatusCode();

    if (status != SC_OK) { // NOSONAR - false-positive from clover; if-expression is correct
        String errorMessage;
        String defaultMessage;
        switch (status) {
        case SC_BAD_REQUEST:
            defaultMessage = "Unable to create Connection. Please make sure that you have the correct grants.";
            errorMessage = getErrorMessage(response, defaultMessage);
            throw new ConnectionInitializationException(errorMessage);
        case SC_UNAUTHORIZED:
            defaultMessage = "You are not authorized to directly retrieve a access token.";
            errorMessage = getErrorMessage(response, defaultMessage);
            throw new UnauthorizedException(errorMessage);
        case SC_NOT_FOUND:
            defaultMessage = "Unable to find the given OSIAM service (" + getFinalEndpoint() + ")";
            errorMessage = getErrorMessage(response, defaultMessage);
            throw new ConnectionInitializationException(errorMessage);
        default:
            defaultMessage = String.format("Unable to setup connection (HTTP Status Code: %d)", status);
            errorMessage = getErrorMessage(response, defaultMessage);
            throw new ConnectionInitializationException(errorMessage);
        }
    }

    return getAccessToken(response);
}

From source file:org.sakaiproject.hybrid.tool.SiteVisitToolPlacementServlet.java

/**
 * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
 *      javax.servlet.http.HttpServletResponse)
 *//*w w w. j a  v a 2  s .  co  m*/
@Override
@SuppressWarnings({ "PMD.CyclomaticComplexity", "PMD.ExcessiveMethodLength", "PMD.NPathComplexity" })
protected void doGet(final HttpServletRequest req, final HttpServletResponse resp)
        throws ServletException, IOException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("doGet(HttpServletRequest " + req + ", HttpServletResponse " + resp + ")");
    }
    // ensure siteId getParameter
    final String siteId = req.getParameter(SITE_ID);
    if (siteId == null || "".equals(siteId)) {
        if (!resp.isCommitted()) {
            resp.sendError(HttpServletResponse.SC_BAD_REQUEST);
            return;
        } else {
            throw new IllegalAccessError("HttpServletResponse.SC_BAD_REQUEST");
        }
    }
    // should we record a site visit event?
    @SuppressWarnings("PMD.DataflowAnomalyAnalysis")
    final boolean writeEvent = Boolean.parseBoolean(req.getParameter("writeEvent"));
    // current user
    @SuppressWarnings("PMD.DataflowAnomalyAnalysis")
    final String principal = sessionManager.getCurrentSession().getUserEid();
    // 1) get the Site object for siteId
    // 2) ensure user has access to Site via SiteService.getSiteVisit()
    @SuppressWarnings("PMD.DataflowAnomalyAnalysis")
    Site site = null;
    try {
        site = siteService.getSiteVisit(siteId);
    } catch (IdUnusedException e) {
        LOG.debug("Site not found: " + siteId, e);
        sendError(resp, HttpServletResponse.SC_NOT_FOUND, "HttpServletResponse.SC_NOT_FOUND: " + siteId);
        return;
    } catch (PermissionException e) {
        LOG.warn("Permission denied: " + principal + " could not access site " + siteId);
        sendError(resp, HttpServletResponse.SC_FORBIDDEN, "HttpServletResponse.SC_FORBIDDEN");
        return;
    }
    if (site != null) { // normal program flow
        final JSONObject json = new JSONObject();
        json.element("principal", sessionManager.getCurrentSession().getUserEid());
        final JSONObject siteJson = new JSONObject();
        siteJson.element("title", site.getTitle());
        siteJson.element("id", site.getId());
        siteJson.element("icon", site.getIconUrlFull());
        siteJson.element("skin", site.getSkin());
        siteJson.element("type", site.getType());
        // get the list of site pages
        final List<SitePage> pages = site.getOrderedPages();
        int number = 0;
        if (pages != null && canAccessAtLeastOneTool(site, pages)) {
            final JSONArray pagesArray = new JSONArray();
            for (SitePage page : pages) { // for each page
                if (!canAccessAtLeastOneTool(site, page)) {
                    continue;
                }
                final JSONObject pageJson = new JSONObject();
                pageJson.element("id", page.getId());
                pageJson.element("name", page.getTitle());
                pageJson.element("layout", page.getLayout());
                pageJson.element("number", ++number);
                pageJson.element("popup", page.isPopUp());
                // get list of tools for the page
                final List<ToolConfiguration> tools = page.getTools();
                if (tools != null && !tools.isEmpty()) {
                    pageJson.element("iconclass", "icon-" + tools.get(0).getToolId().replaceAll("[.]", "-"));
                    final JSONArray toolsArray = new JSONArray();
                    for (ToolConfiguration toolConfig : tools) {
                        // for each toolConfig
                        if (toolHelper.allowTool(site, toolConfig)) {
                            final JSONObject toolJson = new JSONObject();
                            toolJson.element("url", toolConfig.getId());
                            final Tool tool = toolConfig.getTool();
                            if (tool != null && tool.getId() != null) {
                                toolJson.element("title", tool.getTitle());
                                toolJson.element("layouthint", toolConfig.getLayoutHints());
                            } else {
                                toolJson.element("title", page.getTitle());
                            }
                            toolsArray.add(toolJson);
                        }
                    }
                    pageJson.element("tools", toolsArray);
                }
                pagesArray.add(pageJson);
            }
            siteJson.element("pages", pagesArray);
        }
        // get roles for site
        final JSONArray rolesArray = new JSONArray();
        try {
            final AuthzGroup group = authzGroupService.getAuthzGroup("/site/" + siteId);
            final Set<Role> roles = group.getRoles();
            for (Role role : roles) {
                final JSONObject roleJson = new JSONObject();
                roleJson.element("id", role.getId());
                roleJson.element("description", role.getDescription());
                rolesArray.add(roleJson);
            }
        } catch (GroupNotDefinedException e) {
            LOG.warn("No AuthzGroup found for site: " + siteId);
        }
        siteJson.element("roles", rolesArray);

        // write siteJson to containing json
        json.element("site", siteJson);
        // dump json to response writer
        resp.setContentType("application/json");
        resp.setCharacterEncoding("UTF-8");
        resp.setStatus(HttpServletResponse.SC_OK);
        json.write(resp.getWriter());
        // post events if requested
        if (writeEvent) {
            final Event presenceBegin = eventTrackingService.newEvent("pres.begin",
                    "/presence/" + siteId + "-presence", true);
            eventTrackingService.post(presenceBegin);
            final Event siteVisit = eventTrackingService.newEvent("site.visit", "/site/" + siteId, true);
            eventTrackingService.post(siteVisit);
        }
    } else {
        sendError(resp, HttpServletResponse.SC_NOT_FOUND, "HttpServletResponse.SC_NOT_FOUND: " + siteId);
        return;
    }
}