List of usage examples for java.lang RuntimeException getMessage
public String getMessage()
From source file:com.espertech.esper.view.ViewFactorySupport.java
private static Object validateAndEvaluateExpr(StatementContext statementContext, ExprNode expression, StreamTypeService streamTypeService, int expressionNumber) throws ViewParameterException { ExprNode validated = validateExpr(statementContext, expression, streamTypeService, expressionNumber); try {/*from w w w. j av a2 s .co m*/ return validated.getExprEvaluator().evaluate(null, true, new ExprEvaluatorContextStatement(statementContext)); } catch (RuntimeException ex) { String message = "Failed to evaluate parameter expression " + expressionNumber; if (ex.getMessage() != null) { message += ": " + ex.getMessage(); } log.error(message, ex); throw new ViewParameterException(message, ex); } }
From source file:com.nextep.designer.sqlclient.ui.helpers.SQLHelper.java
public static INextepMetadata createOfflineMetadata(ResultSetMetaData md, String sqlQuery) throws SQLException { final NextepResultSetMetaData nmd = new NextepResultSetMetaData(); DMLParseResult parseResult = null;/* ww w . java 2 s .c o m*/ nmd.setColumnCount(md.getColumnCount()); for (int i = 1; i <= md.getColumnCount(); i++) { nmd.setColumnName(i, md.getColumnName(i)); nmd.setColumnType(i, md.getColumnType(i)); // Fetching tablename from driver String tableName = md.getTableName(i); // If not available we try to parse ourselves if (tableName == null || "".equals(tableName)) { // Parsing if (parseResult == null) { try { parseResult = parseSQL(sqlQuery, 1); } catch (RuntimeException e) { LOGGER.error("Error while parsing SQL : " + e.getMessage(), e); } } // Only providing name on single table select if (parseResult != null && parseResult.getFromTables().size() == 1) { tableName = parseResult.getFromTables().iterator().next().getTableName(); } } nmd.setTableName(i, tableName); } return nmd; }
From source file:kilim.tools.Weaver.java
static void weaveFile(String name, InputStream is, Detector detector) throws IOException { try {/*w w w .jav a 2s .c om*/ ClassWeaver cw = new ClassWeaver(is, detector); cw.weave(); writeClasses(cw); } catch (KilimException ke) { log.error("***** Error weaving " + name + ". " + ke.getMessage()); // ke.printStackTrace(); err = 1; } catch (RuntimeException re) { log.error("***** Error weaving " + name + ". " + re.getMessage()); re.printStackTrace(); err = 1; } catch (IOException ioe) { err = 1; log.error("***** Unable to find/process '" + name + "'\n" + ioe.getMessage()); } }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsg.CFAccXMsgSchemaMessageFormatter.java
public static String formatRspnException(String separator, RuntimeException e) { String retval = "<RspnException " + CFLibXmlUtil.formatRequiredXmlString(null, "Name", e.getClass().getName()) + CFLibXmlUtil.formatRequiredXmlString(separator, "Message", e.getMessage()) + " />"; return (retval); }
From source file:com.steeleforge.aem.ironsites.xss.XSSUtil.java
/** * Given an anti-samy file path (component relative or absolute), an optional * protection context, and JSP page context, the input source is run * through the XSSFilter which applies the antisamy policy to source. * /* ww w . ja va 2 s.com*/ * @param policy policy name/path * @param context protection context name * @param source source string * @param request sling request * @return scrubbed source, or empty string if markup is malformed * @see XSSFilter#filter(ProtectionContext, String, String) */ public static String filterHTML(String policy, String context, String source, SlingHttpServletRequest request) { String output = ""; ProtectionContext pc = getProtectionContext(context); String policyPath = findPolicyPath(request, policy); XSSFilter xss = getXSSFilter(request); try { output = xss.filter(pc, source, policyPath); } catch (RuntimeException re) { LOG.error("Parsing/Filtering error: {}", source, re.getMessage()); } return output; }
From source file:de.jlo.talendcomp.json.TypeUtil.java
public static BigInteger convertToBigInteger(String value) throws Exception { if (value == null || value.isEmpty()) { return null; }/* w ww .j av a 2s . com*/ try { return new BigInteger(value); } catch (RuntimeException e) { throw new Exception("convertToBigDecimal:" + value + " failed:" + e.getMessage(), e); } }
From source file:de.jlo.talendcomp.json.TypeUtil.java
public static BigDecimal convertToBigDecimal(String value) throws Exception { if (value == null || value.isEmpty()) { return null; }/*from w ww .j a va2 s . co m*/ try { DecimalFormat decfrm = getNumberFormat(DEFAULT_LOCALE); decfrm.setParseBigDecimal(true); ParsePosition pp = new ParsePosition(0); return (BigDecimal) decfrm.parse(value, pp); } catch (RuntimeException e) { throw new Exception("convertToBigDecimal:" + value + " failed:" + e.getMessage(), e); } }
From source file:com.diversityarrays.kdxplore.KDXplore.java
private static void doStaticInitChecks(boolean quiet) { try {// w w w . j a va2s .co m KdxConstants.runStaticInitChecks(true, quiet); } catch (RuntimeException e) { String msg = e.getClass().getName() + "\n" + e.getMessage(); //$NON-NLS-1$ // deliberately NOT using MsgBox here JTextArea ta = new JTextArea(msg); ta.setEditable(false); JOptionPane.showMessageDialog(null, new JScrollPane(ta), "KDXplore Initialisation Error", //$NON-NLS-1$ JOptionPane.ERROR_MESSAGE); System.exit(1); } }
From source file:de.tuberlin.uebb.jbop.access.ClassAccessor.java
private static <T> T executePrivileged(final PrivilegedAction<T> action) throws JBOPClassException { try {//from w w w . j a v a 2 s. c om return AccessController.doPrivileged(action); } catch (final RuntimeException re) { throw new JBOPClassException(re.getMessage(), re.getCause()); } }
From source file:com.espertech.esper.epl.parse.ParseHelper.java
private static String getNoAnnotation(String expression, Tree tree, CommonTokenStream tokens) { Token lastAnnotationToken = null;/*from w w w.ja v a 2 s . c o m*/ for (int i = 0; i < tree.getChildCount(); i++) { if (tree.getChild(i).getType() == EsperEPL2Ast.ANNOTATION) { lastAnnotationToken = tokens.get(tree.getChild(i).getTokenStopIndex()); } else { break; } } if (lastAnnotationToken == null) { return null; } try { int line = lastAnnotationToken.getLine(); int charpos = lastAnnotationToken.getCharPositionInLine(); int fromChar = charpos + lastAnnotationToken.getText().length(); if (line == 1) { return expression.substring(fromChar).trim(); } String[] lines = expression.split("\r\n|\r|\n"); StringBuilder buf = new StringBuilder(); buf.append(lines[line - 1].substring(fromChar)); for (int i = line; i < lines.length; i++) { buf.append(lines[i]); if (i < lines.length - 1) { buf.append(newline); } } return buf.toString().trim(); } catch (RuntimeException ex) { log.error("Error determining non-annotated expression sting: " + ex.getMessage(), ex); } return null; }