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:org.kalypso.kalypsomodel1d2d.conv.results.differences.VeloDiff2DTest.java

private static void generateDifferences(final List<ResultType> parameters, final File outputDir1,
        final File outputDir2, final File templateFile, final File outputFile,
        final org.kalypso.kalypsomodel1d2d.conv.results.differences.ResultCalculatorType.TYPE differenceType)
        throws Exception {
    final InputStream is = new FileInputStream(templateFile);
    try {/*from  ww w.  j  a v  a2 s  . c om*/
        /* generate differences */
        final ResultType[] resultTypes = parameters.toArray(new ResultType[parameters.size()]);

        final GM_TriangulatedSurface[] minuendSurfaces = new GM_TriangulatedSurface[resultTypes.length];
        final GM_TriangulatedSurface[] subtrahentSurfaces = new GM_TriangulatedSurface[resultTypes.length];

        for (int i = 0; i < resultTypes.length; i++) {
            minuendSurfaces[i] = getSurfaces(outputDir1, resultTypes[i]);
            subtrahentSurfaces[i] = getSurfaces(outputDir2, resultTypes[i]);
        }

        final RMA10S2GmlConv converter = new RMA10S2GmlConv(null);

        final IRMA10SModelElementHandler handler = new DifferenceResultModel1d2dHandler(outputFile,
                minuendSurfaces, subtrahentSurfaces, resultTypes, differenceType);
        converter.setRMA10SModelElementHandler(handler);

        converter.parse(is);
        handler.end();
        is.close();
    } catch (final RuntimeException e) {
        e.printStackTrace();
    } finally {
        is.close();
    }
}

From source file:org.spring.springxdcloudInstaller.MainApp.java

private static void execute(EC2Client client, String name, DeployType type, CloudCommand cloudCommand)
        throws TimeoutException {
    System.out.println("about to run the instance.");
    RunningInstance instance = null;/*from   w ww  .java  2s.  co m*/
    // create a new instance
    try {
        deployXD(client, "xd-open-security-group", name, type, cloudCommand);
    } catch (RuntimeException e) {
        e.printStackTrace();
        throw e;
    }
}

From source file:org.zkoss.reference.developer.spring.security.SecurityUtil.java

/**
 * Return the current Authentication object.
 *///from   w w w .j a  v a  2 s .  co  m
public static User getUser() {
    final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null) {
        try {
            Object p = auth.getPrincipal();
            if (p instanceof User)
                return (User) p;
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
    return null;
}

From source file:com.task.springsec.SecurityUtil.java

/**
 * Return the current Authentication object.
 *///from www .j  a  v a 2s  .c  o  m
public static MyUser getUser() {
    final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null) {
        try {
            Object p = auth.getPrincipal();
            if (p instanceof MyUser)
                return (MyUser) p;
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
    return null;
}

From source file:gov.nasa.ensemble.dictionary.nddl.ModelGenerator.java

public static boolean generateModel(URI uri) throws Exception {
    try {/*from   w ww .  ja  va 2  s.  com*/
        // Demand load resource for this file.
        //
        EActivityDictionary ad = DictionaryUtil.load(uri);
        return generateModel(ad);
    } catch (RuntimeException rte) {
        System.out.println("Problem loading " + uri);
        rte.printStackTrace();
    } catch (Exception e) {
        System.out.println("Problem generating NDDL files ");
        e.printStackTrace();
        throw e;
    }
    return false;
}

From source file:nc.noumea.mairie.appock.core.security.SecurityUtil.java

/**
 * @return the current Authentication object.
 *///from  ww w. j  a  v a 2 s .  c om
public static String getUser() {
    final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null) {
        try {
            Object p = auth.getPrincipal();
            if (p instanceof LdapUserDetails)
                return ((LdapUserDetails) p).getUsername();
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
    return null;
}

From source file:id.co.sigma.zk.spring.security.SecurityUtil.java

public static WebAuthenticationDetails getAuthDetails() {
    final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null) {
        try {// www.ja  v a  2 s . c o  m
            Object p = auth.getDetails();
            if (p instanceof WebAuthenticationDetails)
                return (WebAuthenticationDetails) p;
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
    return null;
}

From source file:id.co.sigma.zk.spring.security.SecurityUtil.java

/**
 * Return the current Authentication object.
 *//*from w ww .  jav  a 2  s. co m*/
public static UserData getUser() {
    final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null) {
        try {
            Object p = auth.getPrincipal();
            if (p instanceof UserData)
                return (UserData) p;
        } catch (RuntimeException e) {
            e.printStackTrace();
            throw e;
        }
    }
    return null;
}

From source file:com.medlog.webservice.services.tone.ToneProcessorFactory.java

/**
 *
 * @param dbc/*from w  ww  .  ja  va 2s. c  o  m*/
 * @param vo
 * @return
 * @see PersonalityInsights
 * @see WatsonService
 * @see ToneAnalyzer
 * @see DiaryVO
 */
public static String execute(DbConnection dbc, DiaryVO vo) {
    ToneAnalysis tone = null;
    Profile profile = null;
    try {
        ToneAnalyzer service = new ToneAnalyzer(ToneAnalyzer.VERSION_DATE_2016_05_19, SETTINGS.WATSON_USER,
                SETTINGS.WATSON_PASS);
        PersonalityInsights insights = new PersonalityInsights(PersonalityInsights.VERSION_DATE_2016_10_19,
                SETTINGS.WATSON_USER, SETTINGS.WATSON_PASS);
        //            service.setUsernameAndPassword(SETTINGS.WATSON_USER, SETTINGS.WATSON_PASS);
        String txtToProcess = buildTextToAnalyze(vo);

        //            profile = insights.getProfile(buildPersonalityProfileOPtions(txtToProcess)).execute();
        tone = service.getTone(txtToProcess, null).execute();
        //            List<Behavior> b = profile.getBehavior();
        //            List<ConsumptionPreferences> cp = profile.getConsumptionPreferences();
        //            List<Trait> prof = profile.getNeeds();
        //            List<Trait> person = profile.getPersonality();
        //            List<Trait> val = profile.getValues();
        //            profile.getWarnings();

        System.out.println("com.medlog.webservice.services.tone.ToneProcessorFactory.execute()" + tone);
        ArrayList<Integer> counts = processTone(dbc, tone, vo.getId());
        int successes = counts.size();

        if (false && counts != null) {
            Collections.sort(counts);
            for (int count : counts) {
                if (count == EXECUTE_FAILED) {
                    successes--;
                }
                if (count > 0) {
                    break;
                }
            }
            System.out.printf(
                    "\ncom.medlog.webservice.services.tone.ToneProcessorFactory.execute() [%d / %d ] rows addded.\n+++++++++++++++++++++++++++++++++++++++++++++\n",
                    successes, counts.size());
        }
    } catch (UnauthorizedException | TooManyRequestsException | RequestTooLargeException
            | BadRequestException e) {
        e.printStackTrace();
    } catch (RuntimeException ee) {
        ee.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    try {
        return toS(
                new GsonBuilder().setPrettyPrinting().create()
                        .toJson(ToneCategory.builder().profile(profile).tone(tone).build()),
                tone == null ? "" : tone.toString() + "\n" + profile.toString());
    } catch (Exception e) {
        e.printStackTrace();
        return "";
    }
}

From source file:com.asociate.dao.UsuarioDAO.java

/**
 *
 * @param id/*from w w  w  .j a va 2 s.c  om*/
 * @return
 */
public static Usuario getPorID(Long id) {
    Session sesion = HibernateUtil.getSessionFactory().openSession();
    Usuario salida = null;
    try {
        salida = (Usuario) sesion.get(Usuario.class, id);

    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        sesion.flush();
        sesion.close();
    }
    return salida;
}