List of usage examples for java.lang SecurityException getMessage
public String getMessage()
From source file:org.seedstack.seed.transaction.internal.TransactionPluginTest.java
@Test public void isTransactionalTest() { try {/* w w w .jav a2s .c om*/ Assertions .assertThat(pluginUnderTest .isTransactional(this.getClass().getDeclaredMethod("testTransactional", null))) .isTrue(); } catch (SecurityException e) { Fail.fail(e.getMessage()); } catch (NoSuchMethodException e) { Fail.fail(e.getMessage()); } }
From source file:com.impetus.kundera.query.QueryResolver.java
/** * Gets the query implementation.//from www . jav a2 s. c o m * * @param jpaQuery * the jpa query * @param persistenceDelegator * the persistence delegator * @param persistenceUnits * the persistence units * @return the query implementation */ public Query getQueryImplementation(String jpaQuery, PersistenceDelegator persistenceDelegator) { kunderaQuery = new KunderaQuery(); ApplicationMetadata appMetadata = KunderaMetadata.INSTANCE.getApplicationMetadata(); String mappedQuery = appMetadata.getQuery(jpaQuery); boolean isNative = appMetadata.isNative(jpaQuery); String pu = null; EntityMetadata m = null; // In case of named native query if (!isNative) { KunderaQueryParser parser = new KunderaQueryParser(kunderaQuery, mappedQuery != null ? mappedQuery : jpaQuery); parser.parse(); kunderaQuery.postParsingInit(); pu = kunderaQuery.getPersistenceUnit(); m = kunderaQuery.getEntityMetadata(); } else { Class mappedClass = appMetadata.getMappedClass(jpaQuery); pu = appMetadata.getMappedPersistenceUnit(mappedClass).get(0); m = KunderaMetadataManager.getEntityMetadata(mappedClass); } PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(pu); Query query = null; try { query = getQuery(jpaQuery, persistenceDelegator, m); } catch (SecurityException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } catch (IllegalArgumentException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } catch (ClassNotFoundException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } catch (NoSuchMethodException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } catch (InstantiationException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } catch (IllegalAccessException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } catch (InvocationTargetException e) { log.error(e.getMessage()); throw new QueryHandlerException(e); } return query; }
From source file:com.btmatthews.tools.xjc.addon.commons_lang3.XjcCommonsLang3Plugin.java
@Override public int parseArgument(final Options opt, final String[] args, final int i) throws BadCommandLineException { // eg. -Xcommons-lang3 ToStringStyle=SIMPLE_STYLE final String arg = args[i].trim(); if (arg.startsWith(TOSTRING_STYLE_PARAM)) { toStringStyle = arg.substring(TOSTRING_STYLE_PARAM.length()); try {/* w ww .j a v a 2 s . co m*/ ToStringStyle.class.getField(toStringStyle); return 1; } catch (final SecurityException e) { throw new BadCommandLineException(e.getMessage()); } catch (final NoSuchFieldException ignore) { } try { customToStringStyle = Class.forName(toStringStyle); } catch (final ClassNotFoundException e) { throw new BadCommandLineException(e.getMessage()); } return 1; } return 0; }
From source file:com.marianhello.bgloc.AbstractLocationProvider.java
/** * Handle security exception/*from w w w. j a v a 2s. c o m*/ * @param exception */ public void handleSecurityException(SecurityException exception) { JSONObject error = JSONErrorFactory.getJSONError(PERMISSION_DENIED_ERROR_CODE, exception.getMessage()); locationService.handleError(error); }
From source file:com.symbian.driver.remoting.cmdline.ResultsCmdLine.java
/** * Implements additional constraints on switches. * //from w w w . j a va 2s . c om * @param aCommandLine * {@inheritDoc} */ public void checkAdditionalConstraints(final CommandLine aCommandLine) { if (aCommandLine.hasOption("j")) { if (Integer.parseInt(aCommandLine.getOptionValue("j")) < 1) { LOGGER.severe("Job ID must be a positive number"); } } if (aCommandLine.hasOption("c")) { File resultsPath = new File(aCommandLine.getOptionValue("c")); if (!resultsPath.exists()) { try { resultsPath.mkdirs(); } catch (SecurityException se) { LOGGER.severe( "Can not create " + resultsPath + ". Please check permissions." + se.getMessage()); } } else if (!resultsPath.isDirectory() || !resultsPath.canWrite()) { LOGGER.severe("Results path " + resultsPath + " is not a valid directory."); } } }
From source file:org.sc.probro.BrokerData.java
public String writeHTMLLink() { try {/*ww w.j a v a2s . c o m*/ Field idField = getClass().getField("id"); String href = String.valueOf(idField.get(this)); String text = toString(); return String.format("<a href=\"%s\">%s</a>", href, text); } catch (SecurityException e) { throw new UnsupportedOperationException(e.getMessage()); } catch (NoSuchFieldException e) { throw new UnsupportedOperationException(e.getMessage()); } catch (IllegalAccessException e) { throw new UnsupportedOperationException(e.getMessage()); } }
From source file:org.onexus.data.manager.internal.ws.DsServlet.java
public void response(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { HttpSession session = req.getSession(); if (session != null && LoginContext.get(session.getId()) != null) { LoginContext ctx = LoginContext.get(session.getId()); LoginContext.set(ctx, null); } else {//from w w w .j a v a2 s .c o m LoginContext.set(LoginContext.ANONYMOUS_CONTEXT, null); } ORI dataResource = requestToORI(req); if (dataResource != null) { try { IDataStreams streams = dataManager.load(dataResource); // Minimum Response header information (size and MIME type) long size = dataManager.size(dataResource); resp.setContentLength((int) size); resp.setContentType(getServletContext().getMimeType(dataResource.getPath())); OutputStream out = resp.getOutputStream(); for (InputStream in : streams) { IOUtils.copy(in, out); in.close(); } out.close(); } catch (SecurityException e) { resp.sendError(HttpServletResponse.SC_FORBIDDEN, e.getMessage()); } catch (Exception e) { resp.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage()); } } else { resp.sendError(HttpServletResponse.SC_NOT_FOUND); } }
From source file:test.unit.be.e_contract.dssp.client.DigitalSignatureServiceClientTest.java
@Test public void testUnverifiedSignResponse() throws Exception { // setup/*from w w w . j av a2 s . co m*/ DigitalSignatureServiceSession session = this.client.uploadDocument("text/plain", SignatureType.XADES_X_L, "hello world".getBytes()); LOG.debug("has token key: " + (null != session.getKey())); CallbackTestHandler.tokenKey = session.getKey(); // operate try { this.client.downloadSignedDocument(session); fail(); } catch (SecurityException e) { // expected LOG.debug("expected exception: " + e.getMessage()); } }
From source file:com.alfresco.orm.CreateHelper.java
public void save(final AlfrescoContent alfrescoContent) throws ORMException { AlfrescoType alfrescoContentType = alfrescoContent.getClass().getAnnotation(AlfrescoType.class); AlfrescoQName alfrescoQName = alfrescoContent.getClass().getAnnotation(AlfrescoQName.class); try {//from w ww .j ava 2s . c o m NodeRef nodeRef = createContent(alfrescoContentType, alfrescoQName, alfrescoContent); if (null != nodeRef) { AlfrescoContent alfrescoVO = (AlfrescoContent) alfrescoContent; alfrescoVO.setNodeUUID(nodeRef.getId()); Map<QName, Serializable> properties = ORMUtil.getAlfrescoProperty(alfrescoContent); ORMUtil.saveProperties(alfrescoContent, properties, serviceRegistry.getNodeService(), restrictedPropertiesForUpdate); ORMUtil.executeCustomeMethodForProperty(alfrescoContent, beanFactory); ORMUtil.executeAssociation(alfrescoContent, beanFactory, serviceRegistry); } } catch (SecurityException e) { throw new ORMException(e.getMessage(), e); } catch (NoSuchMethodException e) { throw new ORMException(e.getMessage(), e); } catch (IllegalArgumentException e) { throw new ORMException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new ORMException(e.getMessage(), e); } catch (InvocationTargetException e) { throw new ORMException(e.getMessage(), e); } catch (InstantiationException e) { throw new ORMException(e.getMessage(), e); } }
From source file:eu.eidas.auth.engine.core.impl.AbstractSigner.java
public Signature computeSignature(KeyStore keystore, String target) throws SAMLEngineException { Signature signature = null;/*from ww w . j a v a 2s.c om*/ try { LOG.debug("Begin signature with openSaml"); signature = (Signature) Configuration.getBuilderFactory().getBuilder(Signature.DEFAULT_ELEMENT_NAME) .buildObject(Signature.DEFAULT_ELEMENT_NAME); Credential credential = getSigningCredential(keystore, target); signature.setSigningCredential(credential); signature.setSignatureAlgorithm(getSignatureAlgorithmForSign()); final SecurityConfiguration secConfiguration = SAMLEngineUtils.getEidasGlobalSecurityConfiguration(); final NamedKeyInfoGeneratorManager keyInfoManager = secConfiguration.getKeyInfoGeneratorManager(); final KeyInfoGeneratorManager keyInfoGenManager = keyInfoManager.getDefaultManager(); final KeyInfoGeneratorFactory keyInfoGenFac = keyInfoGenManager.getFactory(credential); final KeyInfoGenerator keyInfoGenerator = keyInfoGenFac.newInstance(); KeyInfo keyInfo = keyInfoGenerator.generate(credential); signature.setKeyInfo(keyInfo); signature.setCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS); } catch (org.opensaml.xml.security.SecurityException e) { LOG.warn("ERROR : Security exception.", e.getMessage()); LOG.debug("ERROR : Security exception.", e); throw new SAMLEngineException(e); } return signature; }