Example usage for java.lang Exception getStackTrace

List of usage examples for java.lang Exception getStackTrace

Introduction

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

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

Provides programmatic access to the stack trace information printed by #printStackTrace() .

Usage

From source file:com.sisrni.managedbean.ProgramaMovilidadMB.java

private void cargarProgramaMovilidad() {
    try {/*  w w  w  . j  ava  2s  .  com*/
        actualizar = false;
        programaMovilidad = new ProgramaMovilidad();
        listadoProgramaMovilidad = programaMovilidadService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.predic8.membrane.core.CoreActivator.java

public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;

    pluginLogger = CoreActivator.getDefault().getLog();

    //String path = new File(FileLocator.resolve(CoreActivator.getDefault().getBundle().getEntry("/")).getPath()).getAbsolutePath();

    final MembraneCommandLine cl = new MembraneCommandLine();
    cl.parse(fixArguments(Platform.getCommandLineArgs()));

    if (cl.hasMonitorBeans()) {
        log.info("loading monitor beans from command line argument: " + cl.getMonitorBeans());
        Router.init(FileUtil.prefixMembraneHomeIfNeeded(new File(cl.getMonitorBeans())).getAbsolutePath(),
                this.getClass().getClassLoader());
    } else {//from  w w  w . j  a  va 2  s  .c  o m
        try {
            if (ClassloaderUtil.fileExists(getMonitorBeansFileName())) {
                info("Eclipse framework found config file: " + getMonitorBeansFileName());
                readBeanConfigWhenStartedAsProduct();
            } else {
                readBeanConfigWhenStartedInEclipse();
            }
        } catch (Exception e1) {
            error("Unable to read bean configuration file: " + e1.getMessage());
            error("Unable to read bean configuration file: " + e1.getStackTrace());
            e1.printStackTrace();
        }
    }

    Executors.newSingleThreadExecutor().execute(new Runnable() {
        public void run() {
            try {
                Router.getInstance().getConfigurationManager().loadConfiguration(getConfigurationFileName(cl));
            } catch (Exception e) {
                log.warn("no configuration loaded", e);
                // we ignore this exception because the monitor can start up
                // without loading a rules configuration
                // we need to throw an exception because the router must display an error message
            }
        }

        private String getConfigurationFileName(MembraneCommandLine cl) {
            if (cl.hasConfiguration()) {
                log.info("loading configuration from command line argument: " + cl.getConfiguration());
                return FileUtil.prefixMembraneHomeIfNeeded(new File(cl.getConfiguration())).getAbsolutePath();
            }
            return System.getProperty("user.home") + System.getProperty("file.separator") + ".membrane.xml";
        }
    });
}

From source file:com.sisrni.managedbean.EtapaMovilidadMB.java

private void cargarEtapaMovilidad() {
    try {/*  ww  w. j a v  a 2  s.c  om*/
        actualizar = false;
        etapaMovilidad = new EtapaMovilidad();
        listadoEtapaMovilidad = etapaMovilidadService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.sisrni.managedbean.TipoCambioMB.java

private void cargarTipoCambio() {
    try {/*from ww w  .  j  a  va2 s . c o m*/
        actualizar = false;
        tipoCambio = new TipoCambio();
        listadoTipoCambio = tipoCambioService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.sisrni.managedbean.TipoOrganismoMB.java

private void cargarTipoOrganismo() {
    try {//from  w  w  w . jav a 2  s  .  co  m
        actualizar = false;
        tipoOrganismo = new TipoOrganismo();
        listadoTipoOrganismo = tipoOrganismoService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.sisrni.managedbean.TipoPropuestaConvenioMB.java

private void cargarTipoPropuestaConvenio() {
    try {//from  ww  w .  j  a v  a2 s .  c  o m
        actualizar = false;
        tipoPropuestaConvenio = new TipoPropuestaConvenio();
        listadoTipoPropuestaConvenio = tipoPropuestaConvenioService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:com.sisrni.managedbean.ProgramaBecaMB.java

private void cargarProgramaBeca() {
    try {//from www.  j a va 2s.c om
        actualizar = false;
        programaBeca = new ProgramaBeca();
        listadoProgramaBeca = programaBecaService.getAllByIdDesc();
    } catch (Exception e) {
        log.debug("Error al tratar de cargar las solicitudes listar para realizar un analisis..."
                + e.getStackTrace());

    }
}

From source file:de.uzk.hki.da.webservice.HttpFileTransmissionClient.java

/**
 * Post file.//from   ww w .jav  a  2 s. co  m
 *
 * @param file the file
 * @param toFile the to file
 */
@SuppressWarnings("finally")
public File postFileAndReadResponse(File file, File toFile) {
    HttpClient httpclient = null;
    ;
    try {
        if (!file.exists()) {
            throw new RuntimeException("Source File does not exist " + file.getAbsolutePath());
        }
        if (url.isEmpty()) {
            throw new RuntimeException("Webservice called but Url is empty");
        }

        httpclient = new DefaultHttpClient();
        logger.info("starting new http client for url " + url);
        HttpPost httppost = new HttpPost(url);
        HttpParams httpRequestParameters = httppost.getParams();
        httpRequestParameters.setParameter(ClientPNames.HANDLE_REDIRECTS, true);
        httppost.setParams(httpRequestParameters);

        MultipartEntity multiPartEntity = new MultipartEntity();
        multiPartEntity.addPart("fileDescription", new StringBody("doxc Converison"));
        multiPartEntity.addPart("fileName", new StringBody(file.getName()));
        if (sourceMimeType.isEmpty())
            sourceMimeType = "application/octet-stream";
        if (destMimeType.isEmpty())
            destMimeType = "application/octet-stream";
        FileBody fileBody = new FileBody(file, sourceMimeType);
        multiPartEntity.addPart("attachment", fileBody);

        httppost.setEntity(multiPartEntity);

        logger.debug("calling webservice now. recieving response");
        HttpResponse response = httpclient.execute(httppost);

        HttpEntity resEntity = response.getEntity();
        StatusLine status = response.getStatusLine();
        if (status.getStatusCode() == 200 && resEntity.getContentType().getValue().startsWith(destMimeType)) {
            InputStream in = resEntity.getContent();

            FileOutputStream fos = new FileOutputStream(toFile);

            byte[] buffer = new byte[4096];
            int length;
            while ((length = in.read(buffer)) > 0) {
                fos.write(buffer, 0, length);
            }
            logger.debug("successfully stored recieved content to " + toFile.getAbsolutePath());
            in.close();
            fos.close();
            cleanup();
        } else {
            logger.error(
                    "Recieved reponse of " + resEntity.getContentType() + ", but expected " + destMimeType);
            printResponse(resEntity);
        }
    } catch (Exception e) {
        logger.error("Exception occured in remotefileTransmission " + e.getStackTrace());
        throw new RuntimeException("Webservice error " + url, e);
    } finally {
        if (httpclient != null)
            httpclient.getConnectionManager().shutdown();
        return toFile;
    }
}

From source file:io.bitgrillr.gocddockerexecplugin.DockerExecPlugin.java

private void logException(Exception e) {
    JobConsoleLogger.getConsoleLogger().printLine(e.getMessage());
    for (StackTraceElement ste : e.getStackTrace()) {
        JobConsoleLogger.getConsoleLogger().printLine("\t" + ste.toString());
    }//from  w  ww .j av a2s .  c  om
}

From source file:com.zinnia.nectar.regression.hadoop.primitive.jobs.SigmaJob.java

public Double call() throws NectarException {
    double value = 0;
    JobControl jobControl = new JobControl("sigmajob");
    try {/*  www .  jav a2 s  .  co  m*/
        job = new Job();
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    job.setJarByClass(SigmaJob.class);
    log.info("Sigma Job initialized");
    log.warn("Sigma job: Processing...Do not terminate/close");
    log.debug("Sigma job: Mapping process started");
    try {
        ChainMapper.addMapper(job, FieldSeperator.FieldSeperationMapper.class, LongWritable.class, Text.class,
                NullWritable.class, Text.class, job.getConfiguration());
        ChainMapper.addMapper(job, SigmaMapper.class, NullWritable.class, Text.class, Text.class,
                DoubleWritable.class, job.getConfiguration());
    } catch (IOException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    job.getConfiguration().set("fields.spec", "" + column);

    job.setReducerClass(DoubleSumReducer.class);
    try {
        FileInputFormat.addInputPath(job, new Path(inputFilePath));
        fs = FileSystem.get(job.getConfiguration());
        if (!fs.exists(new Path(inputFilePath))) {
            throw new NectarException("Exception occured:File " + inputFilePath + " not found ");
        }
    } catch (Exception e2) {
        // TODO Auto-generated catch block
        String trace = new String();
        log.error(e2.toString());
        for (StackTraceElement s : e2.getStackTrace()) {
            trace += "\n\t at " + s.toString();
        }
        log.debug(trace);
        log.debug("Sigma Job terminated abruptly\n");
        throw new NectarException();
    }
    FileOutputFormat.setOutputPath(job, new Path(outputFilePath));
    job.setMapOutputValueClass(DoubleWritable.class);
    job.setMapOutputKeyClass(Text.class);
    job.setInputFormatClass(TextInputFormat.class);
    log.debug("Sigma job: Mapping process completed");

    log.debug("Sigma job: Reducing process started");
    try {
        controlledJob = new ControlledJob(job.getConfiguration());
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    jobControl.addJob(controlledJob);
    Thread thread = new Thread(jobControl);
    thread.start();
    while (!jobControl.allFinished()) {
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    try {
        FSDataInputStream in = fs.open(new Path(outputFilePath + "/part-r-00000"));
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in));
        String valueLine = bufferedReader.readLine();
        String[] fields = valueLine.split("\t");
        value = Double.parseDouble(fields[1]);
        bufferedReader.close();
        in.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        log.error("Exception occured: Output file cannot be read.");
        log.debug(e.getMessage());
        log.debug("Sigma Job terminated abruptly\n");
        throw new NectarException();
    }
    log.debug("Sigma job: Reducing process completed");
    log.info("Sigma Job completed\n");
    return value;
}