Example usage for java.text ParseException getStackTrace

List of usage examples for java.text ParseException getStackTrace

Introduction

In this page you can find the example usage for java.text ParseException getStackTrace.

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

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

Usage

From source file:org.kalypso.wspwin.core.WspWinProfProj.java

/**
 * Reads the file profproj.txt/*from w ww .  j av  a  2 s  . c  o m*/
 */
public void read(final File wspwinDir) throws IOException, ParseException {
    final WspWinProject wspWinProject = new WspWinProject(wspwinDir);
    final File profprojFile = wspWinProject.getProfProjFile();

    try (LineNumberReader reader = new LineNumberReader(new FileReader(profprojFile));) {
        final int[] counts = readStrHeader(reader);
        final int profilCount = counts[0];
        final int relationCount = counts[1];

        if (relationCount == 0) {
            // ignore for now; later we may do sanity checks, if there are unused profiles
        }

        final ProfileBean[] profiles = ProfileBean.readProfiles(reader, profilCount);
        m_profiles.addAll(Arrays.asList(profiles));
    } catch (final ParseException pe) {
        final String msg = Messages.getString("org.kalypso.wspwin.core.WspCfg.6") //$NON-NLS-1$
                + profprojFile.getAbsolutePath() + " \n" + pe.getLocalizedMessage(); //$NON-NLS-1$
        final ParseException newPe = new ParseException(msg, pe.getErrorOffset());
        newPe.setStackTrace(pe.getStackTrace());
        throw newPe;
    }
}

From source file:org.wso2.carbon.logging.util.CassandraLogReader.java

private LogEvent[] getSortedLogInfo(LogEvent logs[]) {
    int maxLen = logs.length;
    final SimpleDateFormat formatter = new SimpleDateFormat(LoggingConstants.DATE_TIME_FORMATTER);
    if (maxLen > 0) {
        List<LogEvent> logInfoList = Arrays.asList(logs);
        Collections.sort(logInfoList, new Comparator<Object>() {
            public int compare(Object o1, Object o2) {
                LogEvent log1 = (LogEvent) o1;
                LogEvent log2 = (LogEvent) o2;
                Date d1 = null, d2 = null;
                try {
                    d1 = (Date) formatter.parse(log1.getLogTime());
                    d2 = (Date) formatter.parse(log2.getLogTime());

                } catch (ParseException e1) {
                    log.error(e1.getStackTrace());

                }/*from   w w w . j  a v  a  2s .  co  m*/
                return -d1.compareTo(d2);

            }

        });
        return (LogEvent[]) logInfoList.toArray(new LogEvent[logInfoList.size()]);
    }
    return null;
}