@Validate public void validate() { if (count < 0) { throw new IllegalStateException("Count cannot be negative"); } }
@Validate public void validate() { if (compareColumn == null && compareValue == null) { throw new IllegalStateException("Either 'Compare value' or 'Compare column' needs to be specified."); } }
@Validate public void validate() { if (conditionValues.length != conditionColumnNames.length) { throw new IllegalStateException("Condition values and condition column names should have equal length"); } }
@Validate public void validate() { if (values.length != columnNames.length) { throw new IllegalStateException( "Length of 'Values' (" + values.length + ") and 'Column names' (" + columnNames.length + ") must be equal"); } }
@Validate public void validate() { if (compareColumn == null) { if (compareValues == null || compareValues.length == 0) { throw new IllegalStateException("Either 'Values' or 'Value column' needs to be specified."); } } }
@Validate public void validate() { if (lowestValue.compareTo(highestValue) > 0) { throw new IllegalStateException("Lowest value is greater than the highest value"); } }
@Validate public void validate() { if (values.length != columnNames.length) { throw new IllegalStateException("Values and column names should have equal length"); } if (conditionValues.length != conditionColumnNames.length) { throw new IllegalStateException("Condition values and condition column names should have equal length"); } }
@Validate public void validate() { if (maxRows <= 0) { throw new IllegalStateException("Max rows value must be a positive integer"); } if (firstRow <= 0) { throw new IllegalStateException("First row value must be a positive integer"); } }
@Validate public void validate() { try { TimeZone.getTimeZone(timeZone); } catch (final Exception e) { throw new IllegalStateException("Time zone '" + timeZone + "' not recognized."); } }
@Validate public final void validateFieldNames() { if (fields != null) { final Set<String> uniqueFieldNames = new HashSet<>(); for (final String fieldName : fields) { final String normalizedFieldName = fieldName.trim().toLowerCase(); final boolean added = uniqueFieldNames.add(normalizedFieldName); if (!added) { throw new IllegalStateException("Field names must be unique. Field name '" + normalizedFieldName + "' occurs multiple times."); } } } }
@Validate public void validate() { for (final CoalesceUnit unit : _units) { // Ensure that initialization is actually possible. unit.updateInputColumns(_input); } }
@Validate public void validate() { for (final Entry<String, String> entry : replacements.entrySet()) { final String searchString = entry.getKey(); if (Strings.isNullOrEmpty(searchString)) { throw new IllegalArgumentException("Search string cannot be empty"); } final String replacementString = entry.getValue(); if (!replaceEntireString && replacementString.indexOf(searchString) != -1) { throw new IllegalArgumentException( "Replacement string cannot contain the search string (implies an infinite replacement loop)"); } } }
@Validate public void validate() { if (!overwriteFileIfExists && file.isExists()) { throw new IllegalStateException( "The file already exists. Please configure the job to overwrite the existing file."); } }
@Validate public void validate() { if (isCarthesianProductMode()) { // carthesian product mode return; } final Column[] queryConditionColumns = getQueryConditionColumns(); final List<String> columnsNotFound = new ArrayList<>(); for (int i = 0; i < queryConditionColumns.length; i++) { if (queryConditionColumns[i] == null) { columnsNotFound.add(conditionColumns[i]); } } if (!columnsNotFound.isEmpty()) { throw new IllegalArgumentException("Could not find column(s): " + columnsNotFound); } }
@Validate public void validate() { if (!_hasBeenValidated) { Assert.assertNull("Spec defines that initializeOutputDataStream(...) is not called before validation time", collector1); Assert.assertNull("Spec defines that initializeOutputDataStream(...) is not called before validation time", collector2); } _hasBeenValidated = true; }
@Validate public void validate() { if (compare(getLowestValue(), getHighestValue()) > 0) { throw new IllegalStateException("Lowest value is greater than the highest value"); } }
@Validate public void validate() { if (!isDictionaryMatchingEnabled() && !isSynonymCatalogLookupEnabled() && !isStringPatternMatchingEnabled()) { throw new IllegalStateException("No dictionaries, synonym catalogs or string patterns selected"); } }
@Validate public void validate() { // The first time this method is invoked, the datastoreCatalog and // userPreferences fields haven't been populated yet, therefore we just // skip the check, because it is called a little bit later again, and // then these fields are populated. if (datastoreCatalog != null) { // Validate that the datastoreName doesn't conflict with one of the // datastores in the datastoreCatalog. final Datastore datastore = datastoreCatalog.getDatastore(datastoreName); if (datastore != null) { if (datastore instanceof JdbcDatastore && ((JdbcDatastore) datastore).getDriverClass() .equals(H2_DRIVER_CLASS_NAME)) { if (!((JdbcDatastore) datastore).getJdbcUrl().startsWith( H2_DATABASE_CONNECTION_PROTOCOL + userPreferences.getSaveDatastoreDirectory().getPath())) { throw new IllegalStateException("Datastore \"" + datastoreName + "\" is not located in \"Written datastores\" directory \"" + userPreferences .getSaveDatastoreDirectory().getPath() + "\"."); } } else { throw new IllegalStateException("Datastore \"" + datastoreName + "\" is not an H2 database, so it can't be used as a staging database."); } } } } }
@Validate public void validate() { sheetName = sheetName.trim(); if (sheetName.length() > SHEET_NAME_MAX_LENGTH) { throw new IllegalStateException("Sheet name must be maximum " + SHEET_NAME_MAX_LENGTH + " characters long"); } for (final char c : SHEET_NAME_ILLEGAL_CHARS) { if (sheetName.indexOf(c) != -1) { throw new IllegalStateException("Sheet name cannot contain '" + c + "'"); } } if (!overwriteSheetIfExists && file.exists()) { final Datastore datastore = new ExcelDatastore(file.getName(), new FileResource(file), file.getAbsolutePath()); try (DatastoreConnection connection = datastore.openConnection()) { final List<String> tableNames = connection.getDataContext().getDefaultSchema().getTableNames(); for (String tableName : tableNames) { if (tableName.equals(sheetName)) { throw new IllegalStateException( "The sheet '" + sheetName + "' already exists. Please select another sheet name."); } } } } if (!FilenameUtils.isExtension(file.getName(), excelExtension)) { throw new IllegalStateException("Please add the '.xlsx' or '.xls' extension to the filename"); } }
@Validate public void validate() { validateDictionaries(allWordsDictionaries); validateDictionaries(wordDictionaries); validateDictionaries(wordStartDictionaries); validateDictionaries(wordEndDictionaries); }