Example usage for java.lang IllegalAccessError IllegalAccessError

List of usage examples for java.lang IllegalAccessError IllegalAccessError

Introduction

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

Prototype

public IllegalAccessError(String s) 

Source Link

Document

Constructs an IllegalAccessError with the specified detail message.

Usage

From source file:org.onecmdb.core.utils.xpath.commands.DeleteCommand.java

protected void setupTX() {
    // Setup the tx.
    ISession session = getCurrentSession();
    if (session == null) {
        throw new IllegalAccessError("Not logged in.");
    }//w ww.  j  av a2 s.  com
    ICcb ccb = (ICcb) session.getService(ICcb.class);

    // The TX is stored in the session.
    this.tx = ccb.getTx(session);
    getDataContext().put("tx", this.tx);

}

From source file:com.bobomee.android.gank.io.base.adapter.SwipeRefreshDelegate.java

public void setEnabled(boolean enable) {
    if (swipeRefreshLayout == null) {
        throw new IllegalAccessError("The SwipeRefreshLayout has not been initialized.");
    }//from   ww w .  ja v  a2  s . c  om
    swipeRefreshLayout.setEnabled(enable);
}

From source file:cats.twitter.webapp.controller.module.ApiController.java

@Transactional
@RequestMapping(value = "/api-chain", method = RequestMethod.GET)
public void apiChain(@RequestHeader("token") String token, HttpServletResponse response) {
    Optional<Request> req = reqRepository.findOneByToken(token);
    if (!req.isPresent()) {
        throw new IllegalAccessError("Please verify your token!");
    }//from   w w  w . j  av a2 s .c om
    String result = null;
    if (req.get().isChained() && req.get().getPreviousRequest() != null) {
        result = req.get().getPreviousRequest().getResult(Result.TypeRes.FILE).getResult();
        try {

            File downloadFile = new File(result);
            FileInputStream inputStream = new FileInputStream(downloadFile);

            // set content attributes for the response
            response.setContentType("text/plain");
            response.setContentLength((int) downloadFile.length());

            // get output stream of the response
            OutputStream outStream = response.getOutputStream();

            byte[] buffer = new byte[BUFFER_SIZE];
            int bytesRead = -1;

            // write bytes read from the input stream into the output stream
            while ((bytesRead = inputStream.read(buffer)) != -1) {
                outStream.write(buffer, 0, bytesRead);
            }

            inputStream.close();
            outStream.close();
        } catch (Exception e) {
            Result res = new Result();
            res.setDate(new Date());
            res.setResult(e.getMessage());
            res.setType(Result.TypeRes.ERROR);
            req.get().addResult(res);
            e.printStackTrace();
        }
    }
}

From source file:com.orange.retrytest.OkHttpStack.java

private static ProtocolVersion parseProtocol(Protocol p) {
    switch (p) {/*from   ww w  .  ja v a  2  s  . c o  m*/
    case HTTP_1_0:
        return new ProtocolVersion("HTTP", 1, 0);
    case HTTP_1_1:
        return new ProtocolVersion("HTTP", 1, 1);
    case SPDY_3:
        return new ProtocolVersion("SPDY", 3, 1);
    case HTTP_2:
        return new ProtocolVersion("HTTP", 2, 0);
    }
    throw new IllegalAccessError("Unknown protocol: " + p);
}

From source file:uk.ac.gda.client.hrpd.typedpvscannables.EpicsPVScannable.java

/**
 * @see gda.device.Scannable#asynchronousMoveTo(java.lang.Object)
 *///  ww w  . j a va2s .c  o m
@Override
public void asynchronousMoveTo(Object position) throws DeviceException {
    if (isReadOnly()) {
        throw new IllegalAccessError("This object is read only.");
    }
}

From source file:com.ponysdk.ui.server.basic.PObject.java

public void sendToNative(final JSONObject data) {

    if (nativeBindingFunction == null)
        throw new IllegalAccessError("Object not bind to a native function");

    final Update update = new Update(getID());
    update.put(Dictionnary.PROPERTY.NATIVE, data);
    Txn.get().getTxnContext().save(update);
}

From source file:com.alta189.cyborg.Cyborg.java

public Cyborg() {
    if (instance != null) {
        throw new IllegalAccessError("There is already an instance of Cyborg!");
    }//w  w  w.  j a v a 2s  .c o m
    pluginManager = new CommonPluginManager(this);
    pluginManager.registerPluginLoader(CommonPluginLoader.class);
    eventManager = new SimpleEventManager();
    commandManager = new CommonCommandManager();

    // Register Internal Listeners
    bot.getListenerManager().addListener(new PircBotXListener());
    eventManager.registerEvents(new CommandListener(), this);
    eventManager.registerEvents(new InternalListener(), this);

    // Setup Bot \\
    bot.setVerbose(StartupArguments.getInstance().isVerbose());
    bot.setName(Settings.getNick());
    bot.setLogin(Settings.getIdent());
    setMessageDelay(Settings.getMessageDelay());

    // Register Default Commands \\
    commandManager.registerCommands(new Named() {
        @Override
        public String getName() {
            return Cyborg.class.getCanonicalName();
        }
    }, TerminalCommands.class, new EmptyConstructorInjector());

    instance = this;
}

From source file:org.onecmdb.core.utils.xpath.commands.DeleteCommand.java

protected void processTX() {
    ISession session = getCurrentSession();
    if (session == null) {
        throw new IllegalAccessError("Not logged in.");
    }//from w ww.  ja va2s  .co m
    ICcb ccb = (ICcb) session.getService(ICcb.class);

    // Commit the tx.   
    if (this.tx == null) {
        throw new IllegalArgumentException("No tx setup!");
    }
    ITicket ticket = ccb.submitTx(tx);
    IRfcResult result = ccb.waitForTx(ticket);
    if (result.isRejected()) {
        throw new IllegalAccessError("Rejected:" + result.getRejectCause());
    }

}

From source file:org.apache.ibatis.cache.TransactionalCacheManager.java

/**
 * ?//from   w w w .j  a v a  2  s .c o  m
 * @param ?
 * @return   ??
 * @throws CloneNotSupportedException
 */
@SuppressWarnings("unchecked")
public static <T> T cloneObject(T obj) throws CloneNotSupportedException {
    if (obj == null) {
        return null;
    }
    if (obj instanceof Cloneable) {//implement Cloneable?clone
        Class<? extends Object> clazz = obj.getClass();
        Method m;
        try {
            m = clazz.getMethod("clone", (Class[]) null);
        } catch (NoSuchMethodException ex) {
            throw new NoSuchMethodError(ex.getMessage());
        }
        try {
            Object result = m.invoke(obj, (Object[]) null);
            return (T) result;
        } catch (InvocationTargetException ex) {
            Throwable cause = ex.getCause();
            if (cause instanceof CloneNotSupportedException) {
                throw ((CloneNotSupportedException) cause);
            }
            throw new Error("Unexpected exception", cause);
        } catch (IllegalAccessException ex) {
            throw new IllegalAccessError(ex.getMessage());
        }
    }
    if (obj instanceof Serializable)//??????
        return (T) SerializationUtils.clone((Serializable) obj);
    throw new SerializationException();
}

From source file:de.juwimm.cms.Main.java

public static Main getInstance() {
    if (instance == null) {
        throw new IllegalAccessError("Main window is not initialized");
    }/* ww  w. j a v a2  s. co  m*/
    return instance;
}