Example usage for java.lang IllegalAccessException IllegalAccessException

List of usage examples for java.lang IllegalAccessException IllegalAccessException

Introduction

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

Prototype

public IllegalAccessException(String s) 

Source Link

Document

Constructs an IllegalAccessException with a detail message.

Usage

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    System.out.println("caught inside procedure");
    throw new IllegalAccessException("demo");
}

From source file:Main.java

public static void processInstantiationExceptions(Throwable e, Class clazz) throws IllegalAccessException {
    throw new IllegalAccessException(e.getMessage() + " class name:" + ((clazz != null) ? clazz.getName() : "")
            + " maybe you use this class as inner "
            + "class, so we cant instantiate that outer from that, or maybe private modifier exist");

}

From source file:Main.java

public static Document loadFromFile(File file)
        throws IllegalAccessException, ParserConfigurationException, SAXException, IOException {
    if (!file.exists()) {
        throw new IllegalAccessException("File is not exists: " + file.getAbsolutePath());
    }/*from www .j a v a2 s. c o  m*/

    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    return db.parse(file);
}

From source file:org.dcm4che3.tool.probetc.ProbeTC.java

public static void main(String[] args) throws ParseException, IOException, InterruptedException,
        IncompatibleConnectionException, GeneralSecurityException, IllegalAccessException {
    CommandLine cl = null;//from  ww  w  .j  av  a 2  s.  co  m

    cl = parseComandLine(args);
    ProbeTC instance = new ProbeTC();
    Device device = null;
    if (cl.hasOption("b")) {
        device = new Device(cl.getOptionValue("b").toLowerCase());
    } else {
        LOG.error("Missing broadcast AETitle");
        throw new IllegalAccessException("missing broadcast AETitle");
    }
    Connection conn = new Connection();
    device.addConnection(conn);
    ApplicationEntity ae = new ApplicationEntity(cl.getOptionValue("b").toUpperCase());
    if (cl.hasOption("d")) {
        instance.setDestinationAET(cl.getOptionValue("d"));
    }
    if (cl.hasOption("s")) {
        instance.setSourceAET(cl.getOptionValue("s"));

    }
    device.addApplicationEntity(ae);
    ae.addConnection(conn);

    instance.destination = new Connection();

    configureConnect(instance.destination, instance.rq, cl, ae);
    CLIUtils.configure(conn, cl);
    // instance.sourceAE = new
    // ApplicationEntity(cl.getOptionValue("s").split(":")[0]);

    // here load the TCs

    if (cl.hasOption("ldap")) {
        try {
            InputStream is = null;
            Properties p = new Properties();
            if (!cl.getOptionValue("ldap").isEmpty()) {
                is = new FileInputStream(new File(cl.getOptionValue("ldap")));
            } else {
                LOG.error("Missing ldap properties file");
                throw new IllegalAccessException("missing ldap properties file");
            }
            p.load(is);
            DicomConfiguration conf = new LdapDicomConfiguration(p);
            LOG.info("Started Loading LDAP configuration");
            ArrayList<TransferCapability> tcs = null;
            if (cl.hasOption("s")) {
                ApplicationEntity sourceAE = conf.findApplicationEntity(instance.sourceAET);
                tcs = (ArrayList<TransferCapability>) sourceAE.getTransferCapabilities();
            } else {
                tcs = loadTCFile();
            }
            ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae, device, instance, tcs);
            // print accepted ones
            ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
            for (PresentationContext pc : pcs)
                if (pc.isAccepted())
                    acceptedPCs.add(pc);

            LOG.info("Probed the source ae and found the following accepted presentation contexts");
            for (PresentationContext pc : acceptedPCs) {
                LOG.info("PC[" + pc.getPCID() + "]\tAbstractSyntax:" + pc.getAbstractSyntax() + "\n with "
                        + " the following Transfer-Syntax:[" + pc.getTransferSyntax() + "]");

            }
            LOG.info("finished probing TCs");
            if (instance.destinationAET != null) {
                LOG.info("Adding Accepted TCs to configuration backend");
                ApplicationEntity destinationAE = conf.findApplicationEntity(instance.destinationAET);

                Device toStore = destinationAE.getDevice();
                TransferCapability[] TCs = mergeTCs(acceptedPCs);
                for (TransferCapability tc : TCs)
                    toStore.getApplicationEntity(instance.destinationAET).addTransferCapability(tc);

                conf.merge(toStore);
                logAddedTCs(TCs, destinationAE);
                conf.close();
            }
            System.exit(1);
        } catch (ConfigurationException e) {
            LOG.error("Configuration backend error - {}", e);
        }
    } else if (cl.hasOption("prefs")) {
        // prefs
        try {
            DicomConfiguration conf = new PreferencesDicomConfiguration();
            LOG.info("Started Loading LDAP configuration");
            ArrayList<TransferCapability> tcs = null;
            if (cl.hasOption("s")) {
                ApplicationEntity sourceAE = conf.findApplicationEntity(instance.sourceAET);
                tcs = (ArrayList<TransferCapability>) sourceAE.getTransferCapabilities();
            } else {
                tcs = loadTCFile();
            }
            ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae, device, instance, tcs);
            // print accepted ones
            ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
            for (PresentationContext pc : pcs)
                if (pc.isAccepted())
                    acceptedPCs.add(pc);

            LOG.info("Probed the source ae and found the following accepted presentation contexts");
            for (PresentationContext pc : acceptedPCs) {
                LOG.info("PC[" + pc.getPCID() + "]\tAbstractSyntax:" + pc.getAbstractSyntax() + "\n with "
                        + " the following Transfer-Syntax:[" + pc.getTransferSyntax() + "]");

            }
            LOG.info("finished probing TCs");
            if (instance.destinationAET != null) {
                LOG.info("Adding Accepted TCs to configuration backend");
                ApplicationEntity destinationAE = conf.findApplicationEntity(instance.destinationAET);

                Device toStore = destinationAE.getDevice();
                TransferCapability[] TCs = mergeTCs(acceptedPCs);
                for (TransferCapability tc : TCs)
                    toStore.getApplicationEntity(instance.destinationAET).addTransferCapability(tc);

                conf.merge(toStore);
                logAddedTCs(TCs, destinationAE);
                conf.close();
            }
            System.exit(1);
        } catch (ConfigurationException e) {
            LOG.error("Configuration backend error - {}", e);
        }
    } else {

        LOG.info("Started Loading TCS from file no configuration set or get");
        ArrayList<TransferCapability> tcs = null;
        tcs = loadTCFile();
        LOG.info("added the following presentation contexts: " + tcs.get(0).getSopClass());
        ArrayList<PresentationContext> pcs = addChunkedPCsandSend(ae, device, instance, tcs);
        // print accepted ones
        ArrayList<PresentationContext> acceptedPCs = new ArrayList<PresentationContext>();
        for (PresentationContext pc : pcs)
            if (pc.isAccepted())
                acceptedPCs.add(pc);

        LOG.info("Probed the source ae and found the following accepted presentation contexts");
        for (PresentationContext pc : acceptedPCs) {
            LOG.info("PC[" + pc.getPCID() + "]\tAbstractSyntax:" + pc.getAbstractSyntax() + "\n with "
                    + " the following Transfer-Syntax:[" + pc.getTransferSyntax() + "]");

        }
        LOG.info("finished probing TCs");

        System.exit(1);

    }

}

From source file:com.lixplor.fastutil.utils.runtime.PermissionUtil.java

private PermissionUtil() throws IllegalAccessException {
    throw new IllegalAccessException("Instantiation is not allowed! Use static methods only!");
}

From source file:tech.sirwellington.alchemy.generator.BooleanGenerators.java

BooleanGenerators() throws IllegalAccessException {
    throw new IllegalAccessException("cannot instantiate this class");
}

From source file:com.netflix.dynomitemanager.sidecore.utils.RetryableCallable.java

public RetryableCallable(int retrys, long waitTime) {
    if (retrys <= -1)
        throw new RuntimeException(new IllegalAccessException("Retrys should be >= 0"));
    if (waitTime <= -1)
        throw new RuntimeException(new IllegalAccessException("waitTime should be >= 0"));
    set(retrys, waitTime);/*from www.  j  av a  2  s. com*/
}

From source file:tech.sirwellington.alchemy.generator.BinaryGenerators.java

BinaryGenerators() throws IllegalAccessException {
    throw new IllegalAccessException("cannot instantiate this class");
}

From source file:org.mycontroller.standalone.scripts.McScriptEngineUtils.java

public static File getScriptFile(String scriptFileName) throws IllegalAccessException, IOException {
    File scriptFile = FileUtils.getFile(AppProperties.getInstance().getScriptsLocation() + scriptFileName);
    String scriptCanonicalPath = scriptFile.getCanonicalPath();
    String scriptLocation = FileUtils.getFile(AppProperties.getInstance().getScriptsLocation())
            .getCanonicalPath();//from w  w  w.ja v a  2 s .  c  om
    //Check is file available and has access to read
    if (!scriptFile.exists() || !scriptFile.canRead()) {
        throw new IllegalAccessException("Unable to access this file '" + scriptCanonicalPath + "'!");
    }
    //Check file location inside scripts location
    if (!scriptCanonicalPath.startsWith(scriptLocation)) {
        throw new IllegalAccessException(
                "Selected file is not under script location! '" + scriptCanonicalPath + "'!");
    }
    return scriptFile;
}

From source file:com.bstek.dorado.view.resolver.SkinFileResolver.java

@Override
protected Resource[] getResourcesByFileName(DoradoContext context, String resourcePrefix, String fileName,
        String resourceSuffix) throws Exception {
    if (!PathUtils.isSafePath(fileName)) {
        throw new IllegalAccessException("Request [" + context.getRequest().getRequestURI() + "] forbidden.");
    }/*from  w  w  w . ja v a  2s  .  c o m*/

    String originFileName = fileName, skin, subPath;
    int i = originFileName.indexOf(SKIN_URI_PREFIX);
    if (i >= 0) {
        subPath = originFileName.substring(i + SKIN_URI_PREFIX.length());
        i = subPath.indexOf(PathUtils.PATH_DELIM);
        if (i > 0) {
            skin = subPath.substring(0, i);
            subPath = subPath.substring(i + 1);

            Resource[] resources;
            String customSkinPath = WebConfigure.getString("view.skin." + skin);
            if (StringUtils.isNotEmpty(customSkinPath)) {
                resources = super.getResourcesByFileName(context, customSkinPath, subPath, resourceSuffix);
            } else {
                resources = super.getResourcesByFileName(context, resourcePrefix, originFileName,
                        resourceSuffix);
            }
            if (!skin.equals(DEFAULT_SKIN) && !resources[0].exists()) {
                subPath = PathUtils.concatPath(SKIN_URI_PREFIX, DEFAULT_SKIN, subPath);
                resources = super.getResourcesByFileName(context, resourcePrefix, subPath, resourceSuffix);
            }
            return resources;
        }
    }
    return EMPTY_RESOURCES;
}