src/main/java/js/http/captcha/Captcha.java
@Override
	public void config(Config config) throws ConfigException {
		imagesRepositoryDir = config.getProperty("captcha.repository.path", File.class);
		if (imagesRepositoryDir == null) {
			throw new ConfigException("Missing <captcha.repository.path> property from CAPTCHA configuration.");
		}
		challengeSetSize = config.getProperty("captcha.set.size", int.class, 6);

		if (!imagesRepositoryDir.exists()) {
			throw new ConfigException("CAPTCHA images repository |%s| does not exist.", imagesRepositoryDir);
		}
		if (!imagesRepositoryDir.isDirectory()) {
			throw new ConfigException("CAPTCHA images repository |%s| is not a directory.", imagesRepositoryDir);
		}
		if (!imagesRepositoryDir.isAbsolute()) {
			throw new ConfigException("CAPTCHA images repository |%s| is not absolute path.", imagesRepositoryDir);
		}

		int imagesCount = imagesRepositoryDir.list().length;
		if (imagesCount == 0) {
			throw new ConfigException("CAPTCHA images repository |%s| is empty.", imagesRepositoryDir);
		}
		if (imagesCount <= challengeSetSize) {
			throw new ConfigException("Challenge set size is larger that avaliable images count from CAPTCHA repository.");
		}
	}
@Override
	public void config(Config config) throws ConfigException {
		imagesRepositoryDir = config.getProperty("captcha.repository.path", File.class);
		if (imagesRepositoryDir == null) {
			throw new ConfigException("Missing <captcha.repository.path> property from CAPTCHA configuration.");
		}
		challengeSetSize = config.getProperty("captcha.set.size", int.class, 6);

		if (!imagesRepositoryDir.exists()) {
			throw new ConfigException("CAPTCHA images repository |%s| does not exist.", imagesRepositoryDir);
		}
		if (!imagesRepositoryDir.isDirectory()) {
			throw new ConfigException("CAPTCHA images repository |%s| is not a directory.", imagesRepositoryDir);
		}
		if (!imagesRepositoryDir.isAbsolute()) {
			throw new ConfigException("CAPTCHA images repository |%s| is not absolute path.", imagesRepositoryDir);
		}

		int imagesCount = imagesRepositoryDir.list().length;
		if (imagesCount == 0) {
			throw new ConfigException("CAPTCHA images repository |%s| is empty.", imagesRepositoryDir);
		}
		if (imagesCount <= challengeSetSize) {
			throw new ConfigException("Challenge set size is larger that avaliable images count from CAPTCHA repository.");
		}
	}
@ Override public void config ( Config config ) throws ConfigException { imagesRepositoryDir = config . getProperty ( "captcha.repository.path" , File . class ) ; if ( imagesRepositoryDir == null ) { throw new ConfigException ( "Missing <captcha.repository.path> property from CAPTCHA configuration." ) ; } challengeSetSize = config . getProperty ( "captcha.set.size" , int . class , 6 ) ; if ( ! imagesRepositoryDir . exists ( ) ) { throw new ConfigException ( "CAPTCHA images repository |%s| does not exist." , imagesRepositoryDir ) ; } if ( ! imagesRepositoryDir . isDirectory ( ) ) { throw new ConfigException ( "CAPTCHA images repository |%s| is not a directory." , imagesRepositoryDir ) ; } if ( ! imagesRepositoryDir . isAbsolute ( ) ) { throw new ConfigException ( "CAPTCHA images repository |%s| is not absolute path." , imagesRepositoryDir ) ; } int imagesCount = imagesRepositoryDir . list ( ) . length ; if ( imagesCount == 0 ) { throw new ConfigException ( "CAPTCHA images repository |%s| is empty." , imagesRepositoryDir ) ; } if ( imagesCount <= challengeSetSize ) { throw new ConfigException ( "Challenge set size is larger that avaliable images count from CAPTCHA repository." ) ; } }
Configure Simple CAPTCHA service provider. See class description for configuration object properties.
<p>
Note that images repository should contain only images related to CAPTCHA; sub-directories are not scanned, only direct
child files.

@param config configuration section from application descriptor.
Configure Simple CAPTCHA service provider . See class description for configuration object properties . <p > Note that images repository should contain only images related to CAPTCHA ; sub - directories are not scanned only direct child files .