List of usage examples for java.lang IllegalAccessException getCause
public synchronized Throwable getCause()
From source file:org.ajax4jsf.renderkit.compiler.MethodCallElement.java
void handleIllegalAccessException(TemplateContext context, IllegalAccessException e) { String logMessage = (utils)//w w w .ja v a2s .c o m ? Messages.getMessage(Messages.getMessage(Messages.METHOD_CALL_ERROR_3, methodName, context.getComponent().getId())) : Messages.getMessage(Messages.getMessage(Messages.METHOD_CALL_ERROR_3a, methodName, context.getComponent().getId())); String excMessage = (utils) ? Messages.getMessage(Messages.getMessage(Messages.METHOD_CALL_ERROR_4, new Object[] { methodName, context.getComponent().getId(), e.getCause().getMessage() })) : Messages.getMessage(Messages.getMessage(Messages.METHOD_CALL_ERROR_4a, new Object[] { methodName, context.getComponent().getId(), e.getCause().getMessage() })); MethodCallElement._log.error(logMessage, e); throw new FacesException(excMessage, e); }
From source file:de.fiz.ddb.aas.utils.LDAPEngineUtilityOrganisation.java
public Set<OIDs> getAllSubOrgIds(boolean pLicensedOrgs, OIDs pOIDs, int pScopy, AasPrincipal pPerformer) throws ExecutionException { Set<OIDs> vSetOIDs = new HashSet<OIDs>(); NamingEnumeration<SearchResult> searchResults = null; try {//from ww w.j a v a 2 s . c om searchResults = getAllSubOrgs(pLicensedOrgs, pOIDs, pScopy, new String[] { Constants.ldap_ddbOrg_Id, Constants.ldap_ddbOrg_PID, "+" }, pPerformer); SearchResult sr; Attribute attr; while (searchResults.hasMore()) { sr = searchResults.next(); if ((attr = sr.getAttributes().get(Constants.ldap_ddb_EntryDN)) != null) { vSetOIDs.add(new OIDs(String.valueOf(attr.get()), (attr = sr.getAttributes().get(Constants.ldap_ddbOrg_PID)) != null ? String.valueOf(attr.get()) : null)); } else { throw new ExecutionException("entryDN = null : OIDs = " + pOIDs, null); } } } catch (IllegalAccessException ex) { LOG.log(Level.SEVERE, "Connection-Error", ex); throw new ExecutionException(ex.getMessage(), ex.getCause()); } catch (NamingException ne) { LOG.log(Level.SEVERE, "NamingException", ne); throw new ExecutionException(ne.getMessage(), ne.getCause()); } finally { if (searchResults != null) { try { searchResults.close(); searchResults = null; } catch (NamingException ex) { } } } return vSetOIDs; }
From source file:de.fiz.ddb.aas.utils.LDAPEngineUtilityOrganisation.java
public NamingEnumeration<SearchResult> getAllSubOrgs(boolean pLicensedOrgs, OIDs pOIDs, int pScopy, String[] attributeFilter, AasPrincipal pPerformer) throws ExecutionException { if (pPerformer == null) { throw new IllegalArgumentException("The contractor is unknown: Performer == null"); }// w w w . jav a 2 s .c o m if (attributeFilter == null) { attributeFilter = new String[] { "*", "+" }; } String orgRdn = pOIDs.getOrgRDN(); if (StringUtils.isEmpty(orgRdn)) { orgRdn = getOrgRdnForOrgId(pOIDs, pPerformer); } if (orgRdn == null) { throw new ExecutionException("OrgRDN = null", null); } InitialLdapContext ctx = null; try { ctx = LDAPConnector.getSingletonInstance().takeCtx(); StringBuilder vBaseDn = new StringBuilder(Constants.ldap_ddbOrg_Id).append("=") .append(orgRdn.replaceAll(",", "," + Constants.ldap_ddbOrg_Id + "=")).append(",") .append((!pLicensedOrgs ? LDAPConnector.getSingletonInstance().getInstitutionBaseDN() : LDAPConnector.getSingletonInstance().getLicensedInstitutionsBaseDN())); StringBuilder vFilter = new StringBuilder("(objectClass=").append(Constants.ldap_ddbOrg_ObjectClass) .append(")"); NamingEnumeration<SearchResult> searchResults = this.query(ctx, vBaseDn.toString(), vFilter.toString(), attributeFilter, pScopy); return searchResults; } catch (IllegalAccessException ex) { LOG.log(Level.SEVERE, "Connection-Error", ex); throw new ExecutionException(ex.getMessage(), ex.getCause()); } catch (NamingException ne) { LOG.log(Level.SEVERE, "NamingException", ne); throw new ExecutionException(ne.getMessage(), ne.getCause()); } finally { if (ctx != null) { try { LDAPConnector.getSingletonInstance().putCtx(ctx); } catch (Exception ex) { LOG.log(Level.SEVERE, "Exception", ex); } } } }
From source file:gov.nih.nci.caarray.web.action.ArrayDesignAction.java
/** * Handles reimporting an array design that was previously imported-not-parsed but now can be parsed. * * @return "list"/*from w ww . ja v a2 s . c o m*/ */ public String reimport() { if (getArrayDesign() == null || getArrayDesign().getId() == null) { ActionHelper.saveMessage(getText("arrayDesign.noDesignSelected")); return SUCCESS; } try { ServiceLocatorFactory.getFileManagementService().reimportAndParseArrayDesign(getArrayDesign().getId()); ActionHelper.saveMessage(getText("arrayDesign.importing")); } catch (final IllegalAccessException e) { ActionHelper.saveMessage(getText("arrayDesign.cannotReimport")); } catch (final InvalidDataFileException e) { ActionHelper.saveMessage(getText("arrayDesign.invalid")); for (final ValidationMessage vm : e.getFileValidationResult().getMessages()) { ActionHelper.saveMessage(vm.getMessage()); } } catch (final UnhandledException e) { ActionHelper.saveMessage(getText("arrayDesign.error.importingFile")); ActionHelper.saveMessage(e.getCause().getMessage()); } return SUCCESS; }
From source file:org.wisdom.wamp.WampController.java
private void handleRPCInvocation(WampClient client, String callId, ExportedService service, String method, List<JsonNode> args) { // Find method using reflection Method[] methods = service.service.getClass().getMethods(); Method callback = null;/*from w w w.j a v a2s. co m*/ for (Method m : methods) { if (m.getName().equals(method)) { callback = m; break; } } if (callback == null) { LOGGER.error("Invalid CALL message, cannot find method {} in class {}", method, service.service.getClass().getName()); sendOnWebSocket(new RPCError(callId, new UnsupportedOperationException( "Cannot find method " + method + " in " + service.service.getClass().getName()), errorPrefix).toJson(json), client); return; } // IMPORTANT: method name must be unique. // Callback found, wrap arguments. Object[] arguments = new Object[callback.getParameterTypes().length]; if (args.size() != arguments.length) { LOGGER.error("Invalid CALL message, the method {} exists in class {}, but the number of arguments does " + "not match the RPC request", method, service.service.getClass().getName()); sendOnWebSocket( new RPCError(callId, new UnsupportedOperationException("Argument mismatch, " + "expecting " + arguments.length + ", received " + args.size() + " values"), errorPrefix).toJson(json), client); return; } for (int i = 0; i < arguments.length; i++) { Class<?> type = callback.getParameterTypes()[i]; JsonNode node = args.get(i); Object value = json.fromJson(node, type); arguments[i] = value; } // Invoke and send Object result; try { if (!callback.isAccessible()) { callback.setAccessible(true); } result = callback.invoke(service.service, arguments); RPCResult message = new RPCResult(callId, result); sendOnWebSocket(message.toJson(json), client); } catch (IllegalAccessException e) { LOGGER.error("Invalid CALL message, the method {} from class {} is not accessible", method, service.service.getClass().getName(), e); sendOnWebSocket(new RPCError(callId, e, "cannot access method " + callback.getName() + " from " + service.service.getClass().getName(), errorPrefix).toJson(json), client); } catch (InvocationTargetException e) { //NOSONAR LOGGER.error("Invalid CALL message, the method {} from class {} has thrown an exception", method, service.service.getClass().getName(), e.getCause()); sendOnWebSocket( new RPCError(callId, e.getTargetException(), "error while invoking " + callback.getName() + " " + "from " + service.service.getClass().getName(), errorPrefix).toJson(json), client); } }
From source file:de.itsvs.cwtrpc.controller.RemoteServiceControllerServlet.java
protected String invokeAndEncodeResponse(HttpServletRequest servletRequest, HttpServletResponse response, Object service, RPCRequest rpcRequest) throws ServletException, IOException, SecurityException, SerializationException { String responsePayload;/*from w w w . j ava 2s . c o m*/ try { final Object invocationResult; invocationResult = rpcRequest.getMethod().invoke(service, rpcRequest.getParameters()); responsePayload = RPC.encodeResponseForSuccess(rpcRequest.getMethod(), invocationResult, rpcRequest.getSerializationPolicy(), rpcRequest.getFlags()); if (CwtRpcUtils.getRpcSessionInvalidationPolicy(servletRequest).isInvalidateAfterInvocation()) { invalidateSession(servletRequest); } } catch (IllegalAccessException e) { throw new SecurityException("Illegal access detected when invoking method " + rpcRequest.getMethod() + " on service " + service.getClass().getName() + " (as requested by client)", e); } catch (IllegalArgumentException e) { throw new SecurityException( "Illegal argument types detected when invoking method " + rpcRequest.getMethod() + " with arguments \"" + createTypeNameString(rpcRequest.getParameters()) + "\" on service " + service.getClass().getName() + " (as requested by client)", e); } catch (InvocationTargetException e) { responsePayload = processInvocationException(servletRequest, service, rpcRequest, e.getCause()); } return responsePayload; }
From source file:de.fiz.ddb.aas.auxiliaryoperations.ThreadOrganisationCreate.java
/** * /*from w ww.j a v a 2s . co m*/ * @return Organisation * @throws AASUnauthorizedException * @throws NamingException * @throws IOException * @throws CloneNotSupportedException * @throws IllegalAccessException * @throws Exception */ @PreAuthorize(privileges = { PrivilegeEnum.DEFAULT }, scope = Scope.ORGANIZATION) public Organisation call() throws AASUnauthorizedException, ExecutionException, NameAlreadyBoundException { Organisation vResult = this._orgObj; // -- Fr eine Prfung, ob bereits existent: // but only if that is not a copy in the export directory if (!this.isAddToLicensedOrgs() && organizationExists(this._orgObj.getOIDs().getOrgName())) { throw new NameAlreadyBoundException( "Error: A organization with ID: '" + this._orgObj.getOIDs().getOrgName() + "' already exists!"); } try { // -- Ist ein Parent bekannt, muss auch die komplette RDN aufgebaut // werden: if (!this.isAddToLicensedOrgs()) { if ((this._orgObj.getOrgRDN() == null) && (this._orgObj.getOrgParent() != null) && (!this._orgObj.getOrgParent().isEmpty())) { ThreadOIDsRDNComplement threadOIDsRDNComplement = new ThreadOIDsRDNComplement( new OIDs(this._orgObj.getOrgParent(), false), getPerformer()); this._orgParentOIDs = threadOIDsRDNComplement.call(); if (this._orgParentOIDs != null) { LOG.info("OrgParent = " + this._orgParentOIDs); this._orgObj.setOrgRDN(new StringBuilder(this._orgObj.getId()).append(",") .append(this._orgParentOIDs.getOrgRDN()).toString()); } else { throw new IllegalArgumentException("Error: A parent organization with ID: '" + this._orgObj.getOrgParent() + "' not found!"); } } else { this._orgObj.setOrgRDN(this._orgObj.getId()); } } // -- Ask about Geo coordinates but only if that is not a copy in the export directory or Licensed directory if (!this.isAddToLicensedOrgs() && !this.isIngestingOperation()) { boolean vQueryRequestForGeocoding = ((Math.abs(this._orgObj.getAddress().getLatitude()) <= 1e-6) || (Math.abs(this._orgObj.getAddress().getLongitude()) <= 1e-6)); if (vQueryRequestForGeocoding) { try { GeoRequest vGeoRequest = new GeoRequest(new GeoAdresse(this._orgObj.getAddress()), LDAPConnector.getSingletonInstance().getHttpProxy()); vGeoRequest.setAskForLocation(true); // -- should be set by Properties... change it! vGeoRequest.addAcceptLocationType(GeoLocationType.ROOFTOP, GeoLocationType.RANGE_INTERPOLATED, GeoLocationType.GEOMETRIC_CENTER, GeoLocationType.APPROXIMATE); _submit = LDAPConnector.getSingletonInstance().getExecutorServiceOne().submit(vGeoRequest); } catch (IllegalAccessException ex) { LOG.log(Level.SEVERE, "Error bei Adresse: " + this._orgObj.getAddress(), ex); } } } this.createOrg(); vResult = this._orgObj; // -- The performer gets automatically a member of this organization // X but only if that is not a copy in the export or licensed directory if ((!this.isAddToLicensedOrgs()) && (this._performer != null)) { //if ((this._performer != null)) { Map<OIDs, Set<PrivilegeEnum>> privileges = new HashMap<OIDs, Set<PrivilegeEnum>>(); privileges.put(this._orgObj.getOIDs(), new HashSet<PrivilegeEnum>()); privileges.get(this._orgObj.getOIDs()).add(PrivilegeEnum.ADMIN_ORG); ThreadUserOrgPrivilegsOperations threadUserOrgPrivilegsOperations = new ThreadUserOrgPrivilegsOperations( _performer.getUid(), privileges, Action.ADD, this._performer); threadUserOrgPrivilegsOperations.call(); } } catch (ExecutionException ex) { LOG.log(Level.WARNING, ex.getMessage(), ex.getCause()); throw ex; } catch (NameNotFoundException ex) { LOG.log(Level.SEVERE, ex.getMessage()); throw new ExecutionException(ex.getMessage(), ex); } catch (AssertionError ex) { LOG.log(Level.SEVERE, ex.getMessage()); throw new ExecutionException(ex.getMessage(), ex); } finally { if (this._ready != null) { this._ready.countDown(); } if ((_submit != null) && (!_submit.isDone()) && (!_submit.isCancelled())) { _submit.cancel(true); } } return vResult; }