List of usage examples for org.apache.commons.lang.exception NestableRuntimeException NestableRuntimeException
public NestableRuntimeException(String msg, Throwable cause)
NestableRuntimeException with specified detail message and nested Throwable. From source file:net.innig.macker.rule.RuleSet.java
public static RuleSet getMackerDefaults() { if (defaults == null) try {/*from w w w . ja v a2 s . c om*/ defaults = new RuleSet(); defaults.setPattern("from", new RegexPattern("${from-full}")); defaults.setPattern("to", new RegexPattern("${to-full}")); } catch (MackerRegexSyntaxException mrse) { throw new NestableRuntimeException("Macker built-ins are broken", mrse); } //! what else to throw? return defaults; }
From source file:com.alibaba.otter.node.etl.common.db.lob.LazyNativeJdbcExtractor.java
private synchronized NativeJdbcExtractor getDelegatedExtractor() { try {//from ww w.j a v a 2 s . c o m if (delegatedExtractor == null) { delegatedExtractor = (NativeJdbcExtractor) extractorClass.newInstance(); } } catch (IllegalAccessException e) { throw new NestableRuntimeException( "Error occurred trying to instantiate a native extractor of type: " + extractorClass, e); } catch (InstantiationException e) { throw new NestableRuntimeException( "Error occurred trying to instantiate a native extractor of type: " + extractorClass, e); } if (delegatedExtractor != null) { return delegatedExtractor; } else { throw new NestableRuntimeException( "Error occurred trying to instantiate a native extractor of type: " + extractorClass); } }
From source file:com.alibaba.otter.node.etl.common.db.dialect.mysql.MysqlDialect.java
private void initShardColumns() { this.shardColumns = OtterMigrateMap.makeSoftValueComputingMap(new Function<List<String>, String>() { public String apply(List<String> names) { Assert.isTrue(names.size() == 2); try { String result = DdlUtils.getShardKeyByDRDS(jdbcTemplate, names.get(0), names.get(0), names.get(1));/*from w w w . jav a 2 s . co m*/ if (StringUtils.isEmpty(result)) { return ""; } else { return result; } } catch (Exception e) { throw new NestableRuntimeException( "find table [" + names.get(0) + "." + names.get(1) + "] error", e); } } }); }
From source file:com.antsdb.saltedfish.sql.vdm.ExprUtil.java
/** * <p>Unescapes any Java literals found in the <code>String</code> to a * <code>Writer</code>.</p> * * <p>For example, it will turn a sequence of <code>'\'</code> and * <code>'n'</code> into a newline character, unless the <code>'\'</code> * is preceded by another <code>'\'</code>.</p> * /*from ww w .j a va2s . c o m*/ * <p>A <code>null</code> string input has no effect.</p> * * @see http://dev.mysql.com/doc/refman/5.7/en/string-literals.html * * @param out the <code>Writer</code> used to output unescaped characters * @param str the <code>String</code> to unescape, may be null * @throws IllegalArgumentException if the Writer is <code>null</code> * @throws IOException if error occurs on underlying Writer */ public static void unescapeJava(Writer out, String str) throws IOException { if (out == null) { throw new IllegalArgumentException("The Writer must not be null"); } if (str == null) { return; } int sz = str.length(); StrBuilder unicode = new StrBuilder(4); boolean hadSlash = false; boolean inUnicode = false; for (int i = 0; i < sz; i++) { char ch = str.charAt(i); if (inUnicode) { // if in unicode, then we're reading unicode // values in somehow unicode.append(ch); if (unicode.length() == 4) { // unicode now contains the four hex digits // which represents our unicode character try { int value = Integer.parseInt(unicode.toString(), 16); out.write((char) value); unicode.setLength(0); inUnicode = false; hadSlash = false; } catch (NumberFormatException nfe) { throw new NestableRuntimeException("Unable to parse unicode value: " + unicode, nfe); } } continue; } if (hadSlash) { // handle an escaped value hadSlash = false; switch (ch) { case '0': out.write(0); break; case '\'': out.write('\''); break; case '\"': out.write('"'); break; case 'b': out.write('\b'); break; case 'n': out.write('\n'); break; case 'r': out.write('\r'); break; case 't': out.write('\t'); break; case 'Z': out.write(26); break; case '\\': out.write('\\'); break; case '%': out.write('%'); break; case '_': out.write('_'); break; case 'u': { // uh-oh, we're in unicode country.... inUnicode = true; break; } default: out.write(ch); } continue; } else if (ch == '\\') { hadSlash = true; continue; } out.write(ch); } if (hadSlash) { // then we're in the weird case of a \ at the end of the // string, let's output it anyway. out.write('\\'); } }
From source file:com.netspective.commons.report.tabular.calc.TabularReportCalcs.java
public String[] getCalcIdentifiers(Class vsClass) { Method getIdsMethod = null;/*from w w w. j av a2s .co m*/ try { getIdsMethod = vsClass.getMethod(CALCMETHODNAME_GETIDENTIFIERS, null); } catch (NoSuchMethodException e) { log.error("Error retrieving method " + CALCMETHODNAME_GETIDENTIFIERS, e); throw new NestableRuntimeException("Static method 'String[] " + CALCMETHODNAME_GETIDENTIFIERS + "()' not found in column data calc " + vsClass.getName(), e); } try { return (String[]) getIdsMethod.invoke(null, null); } catch (Exception e) { log.error("Error executing method " + CALCMETHODNAME_GETIDENTIFIERS, e); throw new NestableRuntimeException("Exception while obtaining identifiers using 'String[] " + CALCMETHODNAME_GETIDENTIFIERS + "()' method in column data calc " + vsClass.getName(), e); } }
From source file:com.netspective.sparx.panel.HtmlIncludePanel.java
public void render(Writer writer, NavigationContext nc, Theme theme, int flags) throws IOException { BasicHtmlPanelValueContext vc = new BasicHtmlPanelValueContext(nc.getServlet(), nc.getRequest(), nc.getResponse(), this); vc.setNavigationContext(nc);//from w w w . j a v a 2s . c om HtmlPanelSkin templatePanelSkin = theme.getTemplatePanelSkin(); templatePanelSkin.renderFrameBegin(writer, vc); if (path == null) { writer.write("No path to resource or URL provided."); return; } String includePath = getPath().getTextValue(nc); if (local) { try { HttpUtils.includeServletResourceContent(writer, nc, includePath, REQATTRNAME_NAVIGATION_CONTEXT); } catch (ServletException e) { log.error(e); throw new NestableRuntimeException("Error including '" + includePath + "'", e); } } else HttpUtils.includeUrlContent(includePath, writer); templatePanelSkin.renderFrameEnd(writer, vc); }
From source file:com.netspective.commons.command.Commands.java
public String[] getCommandIdentifiers(Class cmdClass) { Method getIdsMethod = null;// w w w.jav a 2 s.c o m try { getIdsMethod = cmdClass.getMethod(CMDMETHODNAME_GETIDENTIFIERS, null); } catch (NoSuchMethodException e) { log.error("Error retreiving method " + CMDMETHODNAME_GETIDENTIFIERS, e); throw new NestableRuntimeException("Static method 'String[] " + CMDMETHODNAME_GETIDENTIFIERS + "()' not found in command " + cmdClass.getName(), e); } try { return (String[]) getIdsMethod.invoke(null, null); } catch (Exception e) { log.error("Error executing method " + CMDMETHODNAME_GETIDENTIFIERS, e); throw new NestableRuntimeException("Exception while obtaining identifiers using 'String[] " + CMDMETHODNAME_GETIDENTIFIERS + "()' method in command " + cmdClass.getName(), e); } }
From source file:com.netspective.sparx.panel.HtmlIncludePanel.java
public void render(Writer writer, DialogContext dc, Theme theme, int flags) throws IOException { BasicHtmlPanelValueContext vc = new BasicHtmlPanelValueContext(dc.getServlet(), dc.getRequest(), dc.getResponse(), this); vc.setNavigationContext(dc.getNavigationContext()); vc.setDialogContext(dc);/*from w w w .jav a 2 s . c om*/ HtmlPanelSkin templatePanelSkin = theme.getTemplatePanelSkin(); templatePanelSkin.renderFrameBegin(writer, vc); if (path == null) { writer.write("No path to resource or URL provided."); return; } String includePath = getPath().getTextValue(dc); if (local) { try { HttpUtils.includeServletResourceContent(writer, dc, includePath, REQATTRNAME_DIALOG_CONTEXT); } catch (ServletException e) { log.error(e); throw new NestableRuntimeException("Error including '" + includePath + "'", e); } } else HttpUtils.includeUrlContent(includePath, writer); templatePanelSkin.renderFrameEnd(writer, vc); }
From source file:de.iteratec.iteraplan.presentation.tags.StringEscapeUtilsFunction.java
public static void unescapeJava(Writer out, String str) throws IOException { if (out == null) { throw new IllegalArgumentException("The Writer must not be null"); }//from w w w . j a v a 2 s. c o m if (str == null) { return; } int sz = str.length(); StrBuilder unicode = new StrBuilder(4); boolean hadSlash = false; boolean inUnicode = false; for (int i = 0; i < sz; i++) { char ch = str.charAt(i); if (inUnicode) { // if in unicode, then we're reading unicode // values in somehow unicode.append(ch); if (unicode.length() == 4) { // unicode now contains the four hex digits // which represents our unicode character try { int value = Integer.parseInt(unicode.toString(), 16); out.write((char) value); unicode.setLength(0); inUnicode = false; hadSlash = false; } catch (NumberFormatException nfe) { throw new NestableRuntimeException("Unable to parse unicode value: " + unicode, nfe); } } continue; } if (hadSlash) { hadSlash = false; switch (ch) { case '\\': out.write('\\'); break; case '\'': out.write('\''); break; case '\"': out.write('"'); break; case 'r': out.write('\r'); break; case 'f': out.write('\f'); break; case 't': out.write('\t'); break; case 'n': out.write('\n'); break; case 'b': out.write('\b'); break; case 'u': { inUnicode = true; break; } default: out.write(ch); break; } continue; } else if (ch == '\\') { hadSlash = true; continue; } out.write(ch); } if (hadSlash) { out.write('\\'); } }
From source file:com.netspective.commons.value.ValueSources.java
/** * Gets all the identifiers available for a value source class *///from w w w .ja va 2s .c om public String[] getValueSourceIdentifiers(Class vsClass) { Method getIdsMethod = null; try { getIdsMethod = vsClass.getMethod(VSMETHODNAME_GETIDENTIFIERS, null); } catch (NoSuchMethodException e) { log.error("Error retrieving method " + VSMETHODNAME_GETIDENTIFIERS, e); throw new NestableRuntimeException("Static method 'String[] " + VSMETHODNAME_GETIDENTIFIERS + "()' not found in value source " + vsClass.getName(), e); } try { return (String[]) getIdsMethod.invoke(null, null); } catch (Exception e) { log.error("Error executing method " + VSMETHODNAME_GETIDENTIFIERS, e); throw new NestableRuntimeException("Exception while obtaining identifiers using 'String[] " + VSMETHODNAME_GETIDENTIFIERS + "()' method in value source " + vsClass.getName(), e); } }