Example usage for java.lang SecurityException getMessage

List of usage examples for java.lang SecurityException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.moneydance.modules.features.importlist.io.MacOSDirectoryChooser.java

@Override
void chooseBaseDirectory() {
    System.setProperty("apple.awt.fileDialogForDirectories", "true");
    final FileDialog fileDialog = new FileDialog((Frame) null, this.getLocalizable().getDirectoryChooserTitle(),
            FileDialog.LOAD);/*from w w  w.  j a v  a 2s  .  c  o m*/
    fileDialog.setModal(true);
    fileDialog.setFilenameFilter(DirectoryValidator.INSTANCE);

    try {
        fileDialog.setDirectory(FileUtils.getUserDirectory().getAbsolutePath());
    } catch (SecurityException e) {
        LOG.log(Level.WARNING, e.getMessage(), e);
    }

    if (this.getBaseDirectory() != null) {
        final File parentDirectory = this.getBaseDirectory().getParentFile();
        if (parentDirectory != null) {
            fileDialog.setDirectory(parentDirectory.getAbsolutePath());
        }
    }
    fileDialog.setVisible(true);
    System.setProperty("apple.awt.fileDialogForDirectories", "false");

    if (fileDialog.getFile() == null) {
        return;
    }

    this.getPrefs()
            .setBaseDirectory(new File(fileDialog.getDirectory(), fileDialog.getFile()).getAbsolutePath());

    LOG.info(String.format("Base directory is %s", this.getPrefs().getBaseDirectory()));
}

From source file:org.eclipse.xtend.type.impl.java.JavaTypeImpl.java

@Override
public boolean isAbstract() {
    try {//from ww w.  ja  va  2s .c o  m
        return clazz.getConstructor(new Class[0]) == null || Modifier.isAbstract(clazz.getModifiers());
    } catch (final SecurityException e) {
        log.error(e.getMessage(), e);
    } catch (final NoSuchMethodException e) {
        log.error(e.getMessage(), e);
    }
    return true;
}

From source file:org.mmadsen.sim.transmissionlab.util.SimOutputDirectory.java

private void createPerRunOutputDirectoryFilehandle() {
    StringBuffer sb = new StringBuffer();
    sb.append(this.model.getFileOutputDirectory());
    File dirParent = new File(sb.toString());
    this.perRunOutputDirectory = new File(dirParent, this.model.getUniqueRunIdentifier());

    try {/*from   w w w.ja  v  a 2s.c  om*/
        this.perRunOutputDirectory.mkdir();
    } catch (SecurityException ex) {
        System.out.println("FATAL EXCEPTION: " + ex.getMessage());
        System.exit(1);
    }
}

From source file:test.integ.be.e_contract.mycarenet.etee.UnsealerTest.java

@Test
public void testUnsealing() throws Exception {
    InputStream sealInputStream = SealTest.class.getResourceAsStream("/seal-fcorneli.der");
    assertNotNull(sealInputStream);//from  w ww. ja va  2s . co  m
    byte[] sealedData = IOUtils.toByteArray(sealInputStream);

    FileInputStream keyStoreInputStream = new FileInputStream(this.config.getEHealthPKCS12Path());
    byte[] keyStoreData = IOUtils.toByteArray(keyStoreInputStream);
    String keyStorePassword = this.config.getEHealthPKCS12Password();
    EHealthKeyStore eHealthKeyStore = new EHealthKeyStore(keyStoreData, keyStorePassword);

    Unsealer unsealer = new Unsealer(eHealthKeyStore.getEncryptionPrivateKey(),
            eHealthKeyStore.getEncryptionCertificate());

    try {
        unsealer.unseal(sealedData);
        fail();
    } catch (SecurityException e) {
        // expected
        LOG.debug(e.getMessage());
    }
}

From source file:org.psikeds.common.services.AbstractRESTService.java

protected Response buildResponse(final SecurityException sex) {
    return buildResponse(Status.FORBIDDEN, sex.getMessage());
}

From source file:org.jadira.scanner.classpath.types.JDefaultConstructor.java

public Method getActualMethod() throws ClasspathAccessException {

    try {//from   ww w  . j  a  va 2 s  . c  om
        return getEnclosingType().getActualClass().getMethod(getName());
    } catch (SecurityException e) {
        throw new ClasspathAccessException("Problem obtaining method: " + e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        throw new ClasspathAccessException("Problem finding method: " + e.getMessage(), e);
    }
}

From source file:org.kuali.kra.lookup.keyvalue.KeyValueFinderServiceImpl.java

/**
 * @see org.kuali.kra.lookup.keyvalue.KeyValueFinderService#getKeyValuesFor(java.lang.Class)
 *//*from   w w  w  .  j  a  va 2 s.c  o  m*/
public List<KeyLabelPair> getKeyValues(Class keyValClass, String codePropName, String valPropName) {
    Collection keyVals = businessObjectService.findAll(keyValClass);
    List<KeyLabelPair> keyValueList = new ArrayList<KeyLabelPair>(keyVals.size());
    keyValueList.add(new KeyLabelPair("", "select"));
    for (Iterator iterator = keyVals.iterator(); iterator.hasNext();) {
        Object keyValObj = iterator.next();
        Method getCodeMeth;
        try {
            getCodeMeth = keyValObj.getClass().getMethod("get" + StringUtils.capitalize(codePropName), null);
            Method getValMeth = keyValObj.getClass().getMethod("get" + StringUtils.capitalize(valPropName),
                    null);
            Object code = getCodeMeth.invoke(keyValObj, null);
            Object value = getValMeth.invoke(keyValObj, null);
            if (code != null && value != null) {
                keyValueList.add(new KeyLabelPair(code.toString(), value.toString()));
            }
        } catch (SecurityException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (NoSuchMethodException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (IllegalArgumentException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (IllegalAccessException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (InvocationTargetException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        }
    }
    return keyValueList;
}

From source file:org.kuali.kra.lookup.keyvalue.KeyValueFinderServiceImpl.java

/**
 * /* w ww .  j ava2s .c  om*/
 * @see org.kuali.kra.lookup.keyvalue.KeyValueFinderService#getKeyValues(java.lang.Class, java.lang.String, java.lang.String, java.util.Map)
 */
public List<KeyLabelPair> getKeyValues(Class keyValClass, String codePropName, String valPropName,
        Map queryMap) {

    Collection keyVals = businessObjectService.findMatching(keyValClass, queryMap);
    List<KeyLabelPair> keyValueList = new ArrayList<KeyLabelPair>(keyVals.size());
    keyValueList.add(new KeyLabelPair("", "select:"));
    for (Iterator iterator = keyVals.iterator(); iterator.hasNext();) {
        Object keyValObj = iterator.next();
        Method getCodeMeth;
        try {
            getCodeMeth = keyValObj.getClass().getMethod("get" + StringUtils.capitalize(codePropName), null);
            Method getValMeth = keyValObj.getClass().getMethod("get" + StringUtils.capitalize(valPropName),
                    null);
            String code = (String) getCodeMeth.invoke(keyValObj, null);
            String value = (String) getValMeth.invoke(keyValObj, null);
            keyValueList.add(new KeyLabelPair(code, value));
        } catch (SecurityException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (NoSuchMethodException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (IllegalArgumentException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (IllegalAccessException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        } catch (InvocationTargetException e) {
            LOG.debug(e.getMessage(), e);
            LOG.error(e.getMessage());
        }
    }
    return keyValueList;
}

From source file:org.jadira.scanner.classpath.types.JMethod.java

@Override
public Method getActualMethod() throws ClasspathAccessException {

    List<JParameter> params = getParameters();
    Class<?>[] paramClasses = new Class<?>[params.size()];
    for (int i = 0; i < params.size(); i++) {
        paramClasses[i] = params.get(i).getType().getActualClass();
    }/*from   w  ww.  ja va  2 s . c om*/

    try {
        return getEnclosingType().getActualClass().getDeclaredMethod(getName(), paramClasses);
    } catch (SecurityException e) {
        throw new ClasspathAccessException("Could not access class: " + e.getMessage(), e);
    } catch (NoSuchMethodException e) {
        throw new ClasspathAccessException("Could not find method: " + e.getMessage(), e);
    }
}

From source file:ddf.security.command.EncryptCommandTest.java

private void setPlainTextValueField(EncryptCommand encryptCommand, String value) {
    final String plainTextValueField = "plainTextValue";
    final Class<? extends EncryptCommand> clazz = encryptCommand.getClass();

    try {/*from ww  w.j a  v  a 2 s .c  o m*/
        final Field field = clazz.getDeclaredField(plainTextValueField);
        field.setAccessible(true);
        field.set(encryptCommand, value);
    } catch (SecurityException e) {
        LOGGER.debug("Security exception setting field value", e);
        fail(e.getMessage());
    } catch (NoSuchFieldException e) {
        LOGGER.debug("No such field exception setting field value", e);
        fail(e.getMessage());
    } catch (IllegalArgumentException e) {
        LOGGER.debug("Illegal argument exception setting field value", e);
        fail(e.getMessage());
    } catch (IllegalAccessException e) {
        LOGGER.debug("Illegal exception exception setting field value", e);
        fail(e.getMessage());
    }

}