private static String translate(String original, String findChars, String replaceChars) { if (StringUtils.isNullOrEmpty(original) || StringUtils.isNullOrEmpty(findChars)) { return original;
public RecoveryFile() throws IOException { if (!StringUtils.isNullOrEmpty(arguments.exportRecoveryFile)) { recoveryFile = new File(arguments.exportRecoveryFile); logger.info("Tracking exported metric names in " + recoveryFile.getAbsolutePath()); if (recoveryFile.exists()) { logger.info("Skipping metrics found in " + recoveryFile.getAbsolutePath()); List<String> list = Files.readLines(recoveryFile, Charset.defaultCharset()); metricsExported.addAll(list); } writer = new PrintWriter(new FileOutputStream(recoveryFile, true)); } }
if (StringUtils.isNullOrEmpty(driver)) { JdbcUtils.load(url); } else { String user = prop.getProperty("user"); String password = prop.getProperty("password"); if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) { return ds.getConnection();
@GET @Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8") @Path("/{service}/{serviceKey}") public Response listKeys(@PathParam("service") String service, @PathParam("serviceKey") String serviceKey, @QueryParam("startsWith") String startsWidth) { try { checkLocalService(service); Iterable<String> keys; keys = StringUtils.isNullOrEmpty(startsWidth) ? m_keyStore.listKeys(service, serviceKey) : m_keyStore.listKeys(service, serviceKey, startsWidth); ResponseBuilder responseBuilder = Response.status(Status.OK).entity( new ValuesStreamingOutput(jsonFormatter, keys)); setHeaders(responseBuilder); return responseBuilder.build(); } catch (NotAuthorizedException e) { logger.error("Attempt to access a local service."); return setHeaders(Response.status(Status.UNAUTHORIZED)).build(); } catch (Exception e) { logger.error("Failed to get keys.", e); return setHeaders(Response.status(Status.INTERNAL_SERVER_ERROR).entity(new ErrorResponse(e.getMessage()))).build(); } }
if (originalTable.indexOf('.') < 0 && !StringUtils.isNullOrEmpty(schema)) { qualifiedTableName = schema + "." + originalTable; } else {
@Override public Map<String, RollupTask> read() throws RollUpException { try { Map<String, RollupTask> tasks = new HashMap<>(); Iterable<String> keys = keyStore.listKeys(SERVICE, SERVICE_KEY_CONFIG); for (String key : keys) { ServiceKeyValue serviceKeyValue = keyStore.getValue(SERVICE, SERVICE_KEY_CONFIG, key); String value = serviceKeyValue.getValue(); if (!StringUtils.isNullOrEmpty(value)) { RollupTask task = parser.parseRollupTask(value); task.setLastModified(serviceKeyValue.getLastModified().getTime()); tasks.put(key, task); } else { logger.error("Null or empty rollup key"); } } return tasks; } catch (DatastoreException e) { throw new RollUpException("Failed to read roll-up tasks from the service keystore", e); } catch (BeanValidationException | QueryException e) { throw new RollUpException("Failed to read rollups from the keystore", e); } }
if (!StringUtils.isNullOrEmpty(arguments.propertiesFile)) propertiesFile = new File(arguments.propertiesFile); if (!StringUtils.isNullOrEmpty(arguments.exportFile)) if (!StringUtils.isNullOrEmpty(arguments.exportFile))
} else { String tmp = v.getString(); if (!StringUtils.isNullOrEmpty(separator) && !StringUtils.isNullOrEmpty(tmp)) { tmp = separator + tmp;
private static String translate(String original, String findChars, String replaceChars) { if (StringUtils.isNullOrEmpty(original) || StringUtils.isNullOrEmpty(findChars)) { return original;
private static String translate(String original, String findChars, String replaceChars) { if (StringUtils.isNullOrEmpty(original) || StringUtils.isNullOrEmpty(findChars)) { return original;
public static void create() throws SQLException, IOException { Server.createTcpServer().start(); try (final Connection connect = connection()) { final byte[] file = new byte[1024 * 1024]; InputStream input = Creator.class.getResourceAsStream("/ddl.sql"); int read = input.read(file); String content = new String(file, 0, read, "UTF-8"); String[] strings = content.split(";"); for (String string : strings) { final String query = string.trim(); if (StringUtils.isNullOrEmpty(query)) continue; try (final Statement statement = connect.createStatement()) { statement.execute(query); } } } } }
public String getDirection() { final String direction = this.getRequestParameter(RequestQueryParameter.PAGE_DIRECTION.toString()); return !StringUtils.isNullOrEmpty(direction) ? direction : "forward"; }
if (StringUtils.isNullOrEmpty(driver)) { JdbcUtils.load(url); } else { String user = prop.getProperty("user"); String password = prop.getProperty("password"); if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) { return ds.getConnection();
if (StringUtils.isNullOrEmpty(driver)) { JdbcUtils.load(url); } else { String user = prop.getProperty("user"); String password = prop.getProperty("password"); if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) { return ds.getConnection();
@Override public List<LocalLink> wikify(int wpId, String text) throws DaoException { if (text == null || text.isEmpty()) { return new ArrayList<LocalLink>(); } List<LocalLink> links = new ArrayList<LocalLink>(); for (LocalLink ll : linkDao.getLinks(language, wpId, true)) { if (ll.getLocation() >= 0 && ll.isParseable() && !StringUtils.isNullOrEmpty(ll.getAnchorText())) { links.add(ll); } } Collections.sort(links); return align(links, text); }
public static Connection getConnection(String driver, String url, Properties prop) throws SQLException { try { if (StringUtils.isNullOrEmpty(driver)) { JdbcDriverUtils.load(url); } else { String user = prop.getProperty("user"); String password = prop.getProperty("password"); if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) { return ds.getConnection(); } else {
String title = row.get("WB_TITLE"); double score = Double.valueOf(row.get("WB_SCORE")); if (StringUtils.isNullOrEmpty(title)) { continue;
String title = row.get("WB_TITLE"); double score = Double.valueOf(row.get("WB_SCORE")); if (StringUtils.isNullOrEmpty(title)) { continue;
if (originalTable.indexOf('.') < 0 && !StringUtils.isNullOrEmpty(schema)) { qualifiedTableName = schema + "." + originalTable; } else {
columnMap.put(n, col); if (originalTable.indexOf('.') < 0 && !StringUtils.isNullOrEmpty(schema)) { qualifiedTableName = schema + "." + originalTable; } else {