@Override public void validate(String token) throws ConfigurationException { try { if (token.length() % 2 == 1) token = "0" + token; Hex.hexToBytes(token); } catch (NumberFormatException e) { throw new ConfigurationException("Token " + token + " contains non-hex digits"); } }
public void setCompressionParameters(Map<String,String> opts) { try { metadata.compressionParameters = CompressionParameters.create(opts); } catch (ConfigurationException e) { throw new IllegalArgumentException(e.getMessage()); } }
private static AbstractType<?> getRawAbstractType(Class<? extends AbstractType<?>> typeClass, TypeParser parser) throws ConfigurationException { try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { throw new ConfigurationException("Invalid comparator class " + typeClass.getName() + ": must define a public static instance field or a public static method getInstance(TypeParser)."); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
throw new ConfigurationException("At least one DataFileDirectory must be specified", false); throw new ConfigurationException("commitlog_directory must be specified", false); FileUtils.createDirectory(conf.commitlog_directory); throw new ConfigurationException("hints_directory must be specified", false); FileUtils.createDirectory(conf.hints_directory); throw new ConfigurationException("saved_caches_directory must be specified", false); FileUtils.createDirectory(conf.saved_caches_directory); throw new ConfigurationException("cdc_raw_directory must be specified", false); FileUtils.createDirectory(conf.cdc_raw_directory); throw new IllegalArgumentException("Bad configuration; unable to start server: "+e.getMessage());
InvalidRequestException ex = new InvalidRequestException(e.getMessage()); ex.initCause(e); throw ex; InvalidRequestException ex = new InvalidRequestException(e.toString()); ex.initCause(e); throw ex; InvalidRequestException ex = new InvalidRequestException(e.toString()); ex.initCause(e); throw ex; InvalidRequestException ex = new InvalidRequestException(e.toString()); ex.initCause(e); throw ex; InvalidRequestException ex = new InvalidRequestException(e.getMessage()); ex.initCause(e); throw ex; InvalidRequestException ex = new InvalidRequestException(e.getMessage()); ex.initCause(e); throw ex; InvalidRequestException ex = new InvalidRequestException(e.getMessage()); ex.initCause(e); throw ex;
private List<ColumnDefinition> getColumns(CFMetaData cfm) throws InvalidRequestException { List<ColumnDefinition> columnDefs = new ArrayList<>(columns.size()); for (Map.Entry<Term, String> col : columns.entrySet()) { try { ByteBuffer columnName = cfm.comparator.asAbstractType().fromStringCQL2(col.getKey().getText()); String validatorClassName = CFPropDefs.comparators.containsKey(col.getValue()) ? CFPropDefs.comparators.get(col.getValue()) : col.getValue(); AbstractType<?> validator = TypeParser.parse(validatorClassName); columnDefs.add(ColumnDefinition.regularDef(cfm, columnName, validator, null)); } catch (ConfigurationException e) { InvalidRequestException ex = new InvalidRequestException(e.toString()); ex.initCause(e); throw ex; } catch (SyntaxException e) { InvalidRequestException ex = new InvalidRequestException(e.toString()); ex.initCause(e); throw ex; } } return columnDefs; }
throw new ConfigurationException("At least one DataFileDirectory must be specified", false); throw new ConfigurationException("commitlog_directory must be specified", false); FileUtils.createDirectory(conf.commitlog_directory); throw new ConfigurationException("hints_directory must be specified", false); FileUtils.createDirectory(conf.hints_directory); throw new ConfigurationException("saved_caches_directory must be specified", false); FileUtils.createDirectory(conf.saved_caches_directory); throw new ConfigurationException("cdc_raw_directory must be specified", false); FileUtils.createDirectory(conf.cdc_raw_directory); throw new IllegalArgumentException("Bad configuration; unable to start server: "+e.getMessage());
throw new InvalidRequestException(e.toString());
public void validateConfiguration() throws ConfigurationException { String pfilename = System.getProperty(SimpleAuthenticator.PASSWD_FILENAME_PROPERTY); if (pfilename == null) { throw new ConfigurationException("When using " + this.getClass().getCanonicalName() + " " + SimpleAuthenticator.PASSWD_FILENAME_PROPERTY + " properties must be defined."); } }
private static AbstractType<?> getRawAbstractType(Class<? extends AbstractType<?>> typeClass, TypeParser parser) throws ConfigurationException { try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { throw new ConfigurationException("Invalid comparator class " + typeClass.getName() + ": must define a public static instance field or a public static method getInstance(TypeParser)."); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
throw new ConfigurationException("At least one DataFileDirectory must be specified", false); throw new ConfigurationException("commitlog_directory must be specified", false); FileUtils.createDirectory(conf.commitlog_directory); throw new ConfigurationException("hints_directory must be specified", false); FileUtils.createDirectory(conf.hints_directory); throw new ConfigurationException("saved_caches_directory must be specified", false); FileUtils.createDirectory(conf.saved_caches_directory); throw new ConfigurationException("cdc_raw_directory must be specified", false); FileUtils.createDirectory(conf.cdc_raw_directory); throw new IllegalArgumentException("Bad configuration; unable to start server: "+e.getMessage());
public void setCompactionStrategyClass(String compactionStrategyClass) { try { metadata.compactionStrategyClass = CFMetaData.createCompactionStrategy(compactionStrategyClass); compactionStrategyWrapper.maybeReloadCompactionStrategy(metadata); } catch (ConfigurationException e) { throw new IllegalArgumentException(e.getMessage()); } }
public void validateConfiguration() throws ConfigurationException { String afilename = System.getProperty(ACCESS_FILENAME_PROPERTY); if (afilename == null) { throw new ConfigurationException(String.format("When using %s, '%s' property must be defined.", this .getClass().getCanonicalName(), ACCESS_FILENAME_PROPERTY)); } }
private static AbstractType<?> getRawAbstractType(Class<? extends AbstractType<?>> typeClass, TypeParser parser) throws ConfigurationException { try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { throw new ConfigurationException("Invalid comparator class " + typeClass.getName() + ": must define a public static instance field or a public static method getInstance(TypeParser)."); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
throw new ConfigurationException("At least one DataFileDirectory must be specified", false); throw new ConfigurationException("commitlog_directory must be specified", false); FileUtils.createDirectory(conf.commitlog_directory); throw new ConfigurationException("hints_directory must be specified", false); FileUtils.createDirectory(conf.hints_directory); throw new ConfigurationException("saved_caches_directory must be specified", false); FileUtils.createDirectory(conf.saved_caches_directory); throw new ConfigurationException("cdc_raw_directory must be specified", false); FileUtils.createDirectory(conf.cdc_raw_directory); throw new IllegalArgumentException("Bad configuration; unable to start server: "+e.getMessage());
public void setCompressionParameters(Map<String,String> opts) { try { metadata.compression(CompressionParams.fromMap(opts)); metadata.params.compression.validate(); } catch (ConfigurationException e) { throw new IllegalArgumentException(e.getMessage()); } }
public void check() throws ConfigurationException { if (!nullProperties.isEmpty()) { throw new ConfigurationException("Invalid yaml. Those properties " + nullProperties + " are not valid", false); } if (!missingProperties.isEmpty()) { throw new ConfigurationException("Invalid yaml. Please remove properties " + missingProperties + " from your cassandra.yaml", false); } } }
private static AbstractType<?> getRawAbstractType(Class<? extends AbstractType<?>> typeClass, TypeParser parser) throws ConfigurationException { try { Method method = typeClass.getDeclaredMethod("getInstance", TypeParser.class); return (AbstractType<?>) method.invoke(null, parser); } catch (NoSuchMethodException | IllegalAccessException e) { throw new ConfigurationException("Invalid comparator class " + typeClass.getName() + ": must define a public static instance field or a public static method getInstance(TypeParser)."); } catch (InvocationTargetException e) { ConfigurationException ex = new ConfigurationException("Invalid definition for comparator " + typeClass.getName() + "."); ex.initCause(e.getTargetException()); throw ex; } }
throw new ConfigurationException("At least one DataFileDirectory must be specified"); throw new ConfigurationException("commitlog_directory must be specified"); throw new ConfigurationException("saved_caches_directory must be specified"); logger.error("Fatal error: {}", e.getMessage()); System.err.println("Bad configuration; unable to start server"); System.exit(1);
public void setCompressionParameters(Map<String,String> opts) { try { metadata.compression(CompressionParams.fromMap(opts)); metadata.params.compression.validate(); } catch (ConfigurationException e) { throw new IllegalArgumentException(e.getMessage()); } }