List of usage examples for java.lang IllegalAccessError IllegalAccessError
public IllegalAccessError(String s)
IllegalAccessError
with the specified detail message. From source file:hm.binkley.util.XPropsConverter.java
@SuppressWarnings("unchecked") private static <T, E extends Exception> Conversion<T, E> invokeValueOf(final Class<T> token) throws NoSuchMethodError { try {//from w w w. jav a2s . c om final Method method = token.getMethod("valueOf", String.class); return value -> { try { return (T) method.invoke(null, value); } catch (final IllegalAccessException e) { final IllegalAccessError x = new IllegalAccessError(e.getMessage()); x.setStackTrace(e.getStackTrace()); throw x; } catch (final InvocationTargetException e) { final Throwable root = getRootCause(e); final RuntimeException x = new RuntimeException(root); x.setStackTrace(root.getStackTrace()); throw x; } }; } catch (final NoSuchMethodException ignored) { return null; } }
From source file:com.jaliansystems.activeMQLite.impl.ObjectRepository.java
/** * Publish an object.// w w w. java2 s . c om * * @param o * the object * @param iface * the interface implemented by the object. * @return the object handle */ public ObjectHandle publish(Object o, Class<?> iface) { if (!iface.isInterface()) throw new IllegalAccessError("Only objects that implement interfaces can be exported"); if (!iface.isInstance(o)) throw new IllegalArgumentException("The object should implement the interface"); publishedInterfaces.put(iface, o); exportedInterfaces.add(iface); return createHandle(o, iface); }
From source file:org.onecmdb.core.utils.xml.XmlParser.java
private void loadBeans() { beans = new ArrayList<CiBean>(); for (String url : urls) { //log.info("Load provider url '" + url + "'"); if (this.beanConfig != null) { if (this.beanConfig.isImported(url)) { continue; }/*from w ww . j av a 2s . c om*/ this.beanConfig.importURL(url); } // Need to locate this url. InputStream input = null; URL u = null; if (url.startsWith("res:") || url.startsWith("classpath:")) { int index = url.indexOf(':'); String resName = url.substring(index + 1); u = this.getClass().getClassLoader().getResource(resName); if (u == null) { //log.error("Resource '" + resName + "' not found"); throw new IllegalArgumentException("No resource with name " + resName + " found"); } } else { try { u = new URL(url); } catch (MalformedURLException e) { //log.error("Url '" + url + "' malformed"); e.printStackTrace(); throw new IllegalArgumentException("Not a corect url:" + e.toString(), e); } } //log.debug("load url <" + u.getPath() + ">"); try { input = u.openStream(); } catch (IOException e) { e.printStackTrace(); //log.error("Can't open url '" + u.toExternalForm() + "'"); throw new IllegalArgumentException("Can't open inputStream for url " + url + " :" + e.toString(), e); } try { beans.addAll(parseInputStream(input)); } catch (DocumentException e) { //log.error("Parsing url '" + u.toExternalForm() + "'", e); //e.printStackTrace(); System.out.println("ERROR in URL " + url); throw new IllegalAccessError("Can't parse XML URL[" + url + "]:" + e.toString()); } finally { // Close it or ? if (input != null) { try { input.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } // Build bean map. beanMap = new HashMap<String, CiBean>(); for (CiBean bean : beans) { beanMap.put(bean.getAlias(), bean); } this.beansLoaded = true; }
From source file:com.baidu.cc.web.rpc.ConfigServerServiceImpl.java
/** * ??id?? ???? IllegalAccessError./*www . j av a 2 s .co m*/ * * @param user * ?? * @param password * ? * @param envId * ?id * @return Map<String,String> String tag */ @Override public Map<String, String> getLastestConfigItems(String user, String password, Long envId) { User u = authenticate(user, password); // should check authorization here by project authorizeEnv(u, envId); // ?envId?version id(version id) Version version = getLastestConfigVersion(envId); if (version == null) { throw new IllegalAccessError("No version under environemt id: " + envId); } Map<String, String> items = getConfigItems(version.getId()); // add tag items.put(TAG_KEY, version.getCheckSum()); return items; }
From source file:hm.binkley.util.XPropsConverter.java
@SuppressWarnings("unchecked") private static <T, E extends Exception> Conversion<T, E> invokeOf(final Class<T> token) throws NoSuchMethodError { try {/*from w ww . ja v a 2 s . c o m*/ final Method method = token.getMethod("of", String.class); return value -> { try { return (T) method.invoke(null, value); } catch (final IllegalAccessException e) { final IllegalAccessError x = new IllegalAccessError(e.getMessage()); x.setStackTrace(e.getStackTrace()); throw x; } catch (final InvocationTargetException e) { final Throwable root = getRootCause(e); final RuntimeException x = new RuntimeException(root); x.setStackTrace(root.getStackTrace()); throw x; } }; } catch (final NoSuchMethodException ignored) { return null; } }
From source file:org.osiam.client.oauth.AuthService.java
/** * provides the needed URI which is needed to reconnect the User to the OSIAM server to login. * A detailed example how to use this method, can be seen in our wiki in gitHub * @return the needed redirect Uri/*from w w w . j ava 2s. c o m*/ * @see <a href="https://github.com/osiam/connector4java/wiki/Login-and-getting-an-access-token#grant-authorization-code">https://github.com/osiam/connector4java/wiki/Login-and-getting-an-access-token#grant-authorization-code</a> */ public URI getRedirectLoginUri() { if (grantType != GrantType.AUTHORIZATION_CODE) {// NOSONAR - false-positive from clover; if-expression is correct throw new IllegalAccessError("You need to use the GrantType " + GrantType.AUTHORIZATION_CODE + " to be able to use this method."); } URI returnUri; try { returnUri = new URIBuilder().setPath(getFinalEndpoint()).addParameter("client_id", clientId) .addParameter("response_type", "code").addParameter("redirect_uri", clientRedirectUri) .addParameter("scope", scopes).build(); } catch (URISyntaxException e) { throw new ConnectionInitializationException("Unable to create redirect URI", e); } return returnUri; }
From source file:com.yahoo.bard.webservice.util.SimplifiedIntervalList.java
/** * Only internal calls to linked list mutators should be used to change the list. * * @param e Any element to be added/*from ww w . ja va 2 s .co m*/ * * @return nothing, a runtime exception is always thrown */ @Override public boolean add(Interval e) { throw new IllegalAccessError("Do not use add in Simplified Interval List"); }
From source file:hm.binkley.util.XPropsConverter.java
private static <T, E extends Exception> Conversion<T, E> invokeConstructor(final Class<T> token) throws NoSuchMethodError { try {//w w w . j av a 2 s .c o m final Constructor<T> ctor = token.getConstructor(String.class); return value -> { try { return ctor.newInstance(value); } catch (final IllegalAccessException e) { final IllegalAccessError x = new IllegalAccessError(e.getMessage()); x.setStackTrace(e.getStackTrace()); throw x; } catch (final InvocationTargetException e) { final Throwable root = getRootCause(e); final RuntimeException x = new RuntimeException(root); x.setStackTrace(root.getStackTrace()); throw x; } catch (final InstantiationException e) { final InstantiationError x = new InstantiationError(e.getMessage()); x.setStackTrace(e.getStackTrace()); throw x; } }; } catch (final NoSuchMethodException ignored) { return null; } }
From source file:org.sqsh.VariableManager.java
/** * Removes a variable./*from w ww . j ava 2 s .c o m*/ * @param name The name of the variable. * @return The variable that was removed or null if the variable * was not defined in the first place. */ @Override public String remove(Object name) { Variable var = variables.get(name); if (var == null && parent != null) { return parent.remove(name); } if (!var.isRemoveable()) { throw new IllegalAccessError( "Variable \"" + name + "\" is a " + "configuration variable and cannot be unset"); } variables.remove(name); return var.toString(); }
From source file:org.onecmdb.core.utils.xml.XmlParser.java
public List<CiBean> parseInputStream(InputStream input) throws DocumentException { SAXReader reader = new SAXReader(); Document document = reader.read(input); List<CiBean> beans = new ArrayList<CiBean>(); Element el = document.getRootElement(); if (el.getName().equals(ROOT_ELEMENT.getName())) { for (Element childEl : (List<Element>) el.elements()) { if (childEl.getName().equals(TEMPLATES_ELEMENT.getName())) { beans.addAll(parseBlueprints(childEl)); continue; }/*w ww. j av a 2s. c om*/ if (childEl.getName().equals(INSTANCES_ELEMENT.getName())) { beans.addAll(parseInstances(childEl)); continue; } throw new IllegalAccessError("Unkown element <" + childEl.getName() + "> must be " + TEMPLATES_ELEMENT + "|" + INSTANCES_ELEMENT); } } else { throw new IllegalAccessError( "Unkown root element <" + el.getName() + "> must be <" + ROOT_ELEMENT.getName() + ">"); } return (beans); }