public Table apply(List<String> names) { Assert.isTrue(names.size() == 2); try { Table table = DdlUtils.findTable(jdbcTemplate, names.get(0), names.get(0), names.get(1)); if (table == null) { throw new NestableRuntimeException("no found table [" + names.get(0) + "." + names.get(1) + "] , pls check"); } else { return table; } } catch (Exception e) { throw new NestableRuntimeException("find table [" + names.get(0) + "." + names.get(1) + "] error", e); } } });
hadSlash = false; } catch (NumberFormatException nfe) { throw new NestableRuntimeException("Unable to parse unicode value: " + unicode, nfe);
public void handleCheckedException(Exception e) { // shouldn't ever happen throw new NestableRuntimeException(e); } }
public void handleCheckedException(Exception e) { // shouldn't ever happen throw new NestableRuntimeException(e); } }
public static String bytesToString(byte[] bytes) { try { return new String(bytes, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new NestableRuntimeException(e); } }
public static byte[] stringToBytes(String string) { try { return string.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { throw new NestableRuntimeException(e); } }
@SuppressWarnings({ "unchecked" }) public R getResult() throws E { if (exceptionClass.isInstance(ex)) { throw (E) ex; } else if (ex != null) { throw new NestableRuntimeException(ex); } return r; }
private synchronized NativeJdbcExtractor getDelegatedExtractor() { try { 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); } }
public static String bytesToBase64String(byte[] bytes) { try { return new String(Base64.encodeBase64(bytes), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new NestableRuntimeException(e); } }
public static byte[] base64StringToBytes(String string) { try { return Base64.decodeBase64(string.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new NestableRuntimeException(e); } }
public static String toSystemID(URL url) { try { if ("file".equals(url.getProtocol())) { return new File(url.toURI()).getAbsolutePath(); } else { return url.toString(); } } catch (URISyntaxException ex) { throw new NestableRuntimeException(ex); } }
public void handleCheckedException(Exception e) { if (_rops.length == 0) throw new NestableRuntimeException(e); _rops[0].handleCheckedException(e); }
private void _wait() { try { wait(this.timeout); } catch (InterruptedException e) { pushState(COMPLETE); throw new NestableRuntimeException(e); } }
public void handleCheckedException(Exception e) { if (_rops.length == 0) throw new NestableRuntimeException(e); _rops[0].handleCheckedException(e); }
private synchronized boolean checkRuntime() { try { return checkException(); } catch (RetsException e) { throw new NestableRuntimeException(e); } }
/** * Return a SAXParser with the specified configuration. */ public static SAXParser getSAXParser(boolean validating, boolean namespaceAware) { SAXParser sp; try { sp = _saxFactories[factoryIndex(validating, namespaceAware)]. newSAXParser(); } catch (ParserConfigurationException pce) { throw new NestableRuntimeException(pce); } catch (SAXException se) { throw new NestableRuntimeException(se); } if (validating) { try { sp.getXMLReader().setErrorHandler(_validating); } catch (SAXException se) { throw new NestableRuntimeException(se); } } return sp; }
/** * Return a SAXParser with the specified configuration. */ public static SAXParser getSAXParser(boolean validating, boolean namespaceAware) { SAXParser sp; try { sp = _saxFactories[factoryIndex(validating, namespaceAware)]. newSAXParser(); } catch (ParserConfigurationException pce) { throw new NestableRuntimeException(pce); } catch (SAXException se) { throw new NestableRuntimeException(se); } if (validating) { try { sp.getXMLReader().setErrorHandler(_validating); } catch (SAXException se) { throw new NestableRuntimeException(se); } } return sp; }
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)); if (StringUtils.isEmpty(result)) { return ""; } else { return result; } } catch (Exception e) { throw new NestableRuntimeException("find table [" + names.get(0) + "." + names.get(1) + "] error", e); } } });
private static synchronized void initializeForType1() { if (type1Initialized == true) { return; } // note that secure random is very slow the first time // it is used; consider switching to a standard random RANDOM = new SecureRandom(); _seq = (short) RANDOM.nextInt(MAX_14BIT); byte[] ip = null; try { ip = InetAddress.getLocalHost().getAddress(); } catch (IOException ioe) { throw new NestableRuntimeException(ioe); } IP = new byte[6]; RANDOM.nextBytes(IP); //OPENJPA-2055: account for the fact that 'getAddress' //may return an IPv6 address which is 16 bytes wide. for( int i = 0 ; i < ip.length; ++i ) { IP[2+(i%4)] ^= ip[i]; } type1Initialized = true; }
/** * Return a DocumentBuilder with the specified configuration. */ public static DocumentBuilder getDOMParser(boolean validating, boolean namespaceAware) { DocumentBuilder db; try { db = _domFactories[factoryIndex(validating, namespaceAware)]. newDocumentBuilder(); } catch (ParserConfigurationException pce) { throw new NestableRuntimeException(pce); } if (validating) db.setErrorHandler(_validating); return db; }