Example usage for java.lang RuntimeException printStackTrace

List of usage examples for java.lang RuntimeException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:br.com.railsos.os.bean.AgendamentoBean.java

public void popular() {
    try {//from w ww  .ja v  a2 s  . com
        if (ordemServico != null) {
            FuncionarioDAO funcionarioDAO = new FuncionarioDAO();
            fs = funcionarioDAO.buscaPorTecnico(ordemServico.getId());
        } else {
            fs = new ArrayList<>();
        }
    } catch (RuntimeException erro) {
        Messages.addFlashGlobalError("Ocorreu um erro ao tentar filtrar o tcnico");
        erro.printStackTrace();
    }
}

From source file:com.chale22.ico01.fragments.FragmentExtras.java

private void actWallpapers() {
    String pkg = getResources().getString(R.string.pkg);
    Intent wallpapers = new Intent(Intent.ACTION_MAIN);
    wallpapers.setComponent(new ComponentName(pkg, pkg + ".wallpaper"));

    try {//from   w  ww  .j av a 2s . c o  m
        startActivity(wallpapers);
    } catch (RuntimeException wall) {
        wall.printStackTrace();
    }
}

From source file:br.com.railsos.os.bean.AgendamentoBean.java

public void excluir(ActionEvent evento) {
    try {/*  ww  w  .  j  a  v  a  2 s.  c o  m*/
        agendamento = (Agendamento) evento.getComponent().getAttributes().get("agendamentoSelecionado");

        AgendamentoDAO agendamentoDAO = new AgendamentoDAO();
        agendamentoDAO.excluir(agendamento);

        agendamentos = agendamentoDAO.listar();

        Messages.addGlobalInfo("Usurio removido com sucesso");
    } catch (RuntimeException erro) {
        Messages.addFlashGlobalError("Ocorreu um erro ao tentar remover o Usurio");
        erro.printStackTrace();
    }
}

From source file:com.chale22.ico01.fragments.FragmentExtras.java

private void actIcons() {
    String pkg = getResources().getString(R.string.pkg);
    Intent iconfrag = new Intent(Intent.ACTION_MAIN);
    iconfrag.setComponent(new ComponentName(pkg, pkg + ".IconActivity"));

    try {/*from   w  w  w.  j  a  v a  2s. c  o m*/
        startActivity(iconfrag);
    } catch (RuntimeException icons) {
        icons.printStackTrace();
    }
}

From source file:com.chale22.ico01.fragments.FragmentExtras.java

private void actRequest() {
    String pkg = getResources().getString(R.string.pkg);
    Intent iconrequest = new Intent(Intent.ACTION_MAIN);
    iconrequest.setComponent(new ComponentName(pkg, pkg + ".IconRequest"));

    try {//from  w ww.  jav a  2  s  . co m
        startActivity(iconrequest);
    } catch (RuntimeException icons) {
        icons.printStackTrace();
    }
}

From source file:br.com.railsos.os.bean.AgendamentoBean.java

public void novo() {
    try {/*from   ww  w . j a v  a 2s  .c o  m*/
        Date data = new Date();
        agendamento = new Agendamento();

        OrdemServicoDAO ordemServicoDAO = new OrdemServicoDAO();
        os = ordemServicoDAO.listar();
        FuncionarioDAO funcionarioDAO = new FuncionarioDAO();
        fs = funcionarioDAO.listar("nome");
        ClienteNewDAO clienteNewDAO = new ClienteNewDAO();
        cns = clienteNewDAO.listar();

        this.agendamento.setInicio(data);

        //fs = new ArrayList<Funcionario>();
    } catch (RuntimeException erro) {
        Messages.addFlashGlobalError("Ocorreu um erro ao gerar uma novo Usurio");
        erro.printStackTrace();
    }
}

From source file:com.igormaznitsa.jcp.expression.functions.AbstractFunctionTest.java

protected void assertFunctionException(final String expression) throws IOException {
    final PreprocessorContext context = new PreprocessorContext();
    try {//  w  w w.ja v a 2 s. c  o m
        Expression.evalExpression(expression, context);
        fail("Must throw RuntimeException [" + expression + ']');
    } catch (RuntimeException ex) {
        final PreprocessorException cause = PreprocessorException.extractPreprocessorException(ex);
        if (cause != null)
            return;
        ex.printStackTrace();
        fail("Expression must contain preprocessor exception as cause [" + expression
                + "] but it doesn't have [" + ex.getClass().getName() + ']');
    }
}

From source file:com.thebigbang.ftpclient.FTPOperation.java

/**
 * will force keep the device turned on for all the operation duration.
 * @param params//from  ww w.jav a2s.c om
 * @return 
 */
@SuppressLint("Wakelock")
@SuppressWarnings("deprecation")
@Override
protected Boolean doInBackground(FTPBundle... params) {
    Thread.currentThread().setName("FTPOperationWorker");
    for (final FTPBundle bundle : params) {

        FTPClient ftp = new FTPClient();
        PowerManager pw = (PowerManager) ctx.getSystemService(Context.POWER_SERVICE);
        WakeLock w = pw.newWakeLock(PowerManager.FULL_WAKE_LOCK, "FTP Client");
        try {
            // setup ftp connection:
            InetAddress addr = InetAddress.getByName(bundle.FTPServerHost);
            //set here the timeout.
            TimeoutThread timeout = new TimeoutThread(_timeOut, new FTPTimeout() {
                @Override
                public void Occurred(TimeoutException e) {
                    bundle.Exception = e;
                    bundle.OperationStatus = FTPOperationStatus.Failed;
                    publishProgress(bundle);
                }
            });
            timeout.start();
            ftp.connect(addr, bundle.FTPServerPort);
            int reply = ftp.getReplyCode();
            timeout.Stop();
            if (!FTPReply.isPositiveCompletion(reply)) {
                throw new IOException("connection refuse");
            }
            ftp.login(bundle.FTPCredentialUsername, bundle.FTPCredentialPassword);
            if (bundle.OperationType == FTPOperationType.Connect) {
                bundle.OperationStatus = FTPOperationStatus.Succed;
                publishProgress(bundle);
                continue;
            }
            ftp.setFileType(FTP.BINARY_FILE_TYPE);
            ftp.enterLocalPassiveMode();

            w.acquire();
            // then switch between enum of operation types.
            if (bundle.OperationType == FTPOperationType.RetrieveFilesFoldersList) {
                ftp.changeWorkingDirectory(bundle.RemoteWorkingDirectory);
                bundle.FilesOnCurrentPath = ftp.listFiles();
                bundle.FoldersOnCurrentPath = ftp.listDirectories();
                bundle.OperationStatus = FTPOperationStatus.Succed;
            } else if (bundle.OperationType == FTPOperationType.RetrieveFolderList) {
                ftp.changeWorkingDirectory(bundle.RemoteWorkingDirectory);
                bundle.FoldersOnCurrentPath = ftp.listDirectories();
                bundle.OperationStatus = FTPOperationStatus.Succed;
            } else if (bundle.OperationType == FTPOperationType.RetrieveFileList) {
                ftp.changeWorkingDirectory(bundle.RemoteWorkingDirectory);
                bundle.FilesOnCurrentPath = ftp.listFiles();
                bundle.OperationStatus = FTPOperationStatus.Succed;
            } else if (bundle.OperationType == FTPOperationType.GetData) {
                String finalFPFi = bundle.LocalFilePathName;
                // The remote filename to be downloaded.
                if (bundle.LocalWorkingDirectory != null && bundle.LocalWorkingDirectory != "") {
                    File f = new File(bundle.LocalWorkingDirectory);
                    f.mkdirs();

                    finalFPFi = bundle.LocalWorkingDirectory + finalFPFi;
                }
                FileOutputStream fos = new FileOutputStream(finalFPFi);

                // Download file from FTP server
                String finalFileN = bundle.RemoteFilePathName;
                if (bundle.RemoteWorkingDirectory != null && bundle.RemoteWorkingDirectory != "") {
                    finalFileN = bundle.RemoteWorkingDirectory + finalFileN;
                }
                boolean b = ftp.retrieveFile(finalFileN, fos);
                if (b)
                    bundle.OperationStatus = FTPOperationStatus.Succed;
                else
                    bundle.OperationStatus = FTPOperationStatus.Failed;
                fos.close();

            } else if (bundle.OperationType == FTPOperationType.SendData) {
                InputStream istr = new FileInputStream(bundle.LocalFilePathName);
                ftp.changeWorkingDirectory(bundle.RemoteWorkingDirectory);
                Boolean b = ftp.storeFile(bundle.RemoteFilePathName, istr);
                istr.close();
                if (b)
                    bundle.OperationStatus = FTPOperationStatus.Succed;
                else
                    bundle.OperationStatus = FTPOperationStatus.Failed;
            } else if (bundle.OperationType == FTPOperationType.DeleteData) {
                throw new IOException("DeleteData is Not yet implemented");
            }

            ftp.disconnect();
            // then finish/return.
            //publishProgress(bundle);
        } catch (IOException e) {
            e.printStackTrace();
            bundle.Exception = e;
            bundle.OperationStatus = FTPOperationStatus.Failed;
        }
        try {
            w.release();
        } catch (RuntimeException ex) {
            ex.printStackTrace();
        }
        publishProgress(bundle);
    }
    return true;
}

From source file:br.com.railsos.os.bean.AgendamentoBean.java

public void editar(ActionEvent evento) {
    try {/*  ww  w  . ja v a2 s .c o m*/
        agendamento = (Agendamento) evento.getComponent().getAttributes().get("agendamentoSelecionado");

        OrdemServicoDAO ordemServicoDAO = new OrdemServicoDAO();
        os = ordemServicoDAO.listar();
        FuncionarioDAO funcionarioDAO = new FuncionarioDAO();
        fs = funcionarioDAO.listar();
        ClienteNewDAO clienteNewDAO = new ClienteNewDAO();
        cns = clienteNewDAO.listar();

    } catch (RuntimeException erro) {
        Messages.addFlashGlobalError("Ocorreu um erro ao tentar selecionar um Agendamento");
        erro.printStackTrace();
    }
}

From source file:br.com.railsos.os.bean.AgendamentoBean.java

public void salvar() {
    try {/*from  ww  w .  j av a 2 s . c o m*/
        AgendamentoDAO agendamentoDAO = new AgendamentoDAO();
        agendamentoDAO.merge(agendamento);

        agendamento = new Agendamento();

        OrdemServicoDAO ordemServicoDAO = new OrdemServicoDAO();
        os = ordemServicoDAO.listar();
        FuncionarioDAO funcionarioDAO = new FuncionarioDAO();
        fs = funcionarioDAO.listar();
        ClienteNewDAO clienteNewDAO = new ClienteNewDAO();
        cns = clienteNewDAO.listar();

        agendamentos = agendamentoDAO.listar();

        Messages.addGlobalInfo("Agendado salvo com sucesso");
    } catch (RuntimeException erro) {
        Messages.addFlashGlobalError("Ocorreu um erro ao tentar salvar o agendamento");
        erro.printStackTrace();
    }
}