From 5e15ca6c3585cafd37d22b3784e710136ecb426b Mon Sep 17 00:00:00 2001 From: Rahul Rudragoudar Date: Sun, 26 Dec 2021 22:01:18 +0530 Subject: [PATCH] Improve imports Signed-off-by: Rahul Rudragoudar --- src/main/scala/lc/core/captcha.scala | 11 ++++------- src/main/scala/lc/core/captchaProviders.scala | 4 ++-- src/main/scala/lc/database/DB.scala | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/scala/lc/core/captcha.scala b/src/main/scala/lc/core/captcha.scala index b350204..5c5f11e 100644 --- a/src/main/scala/lc/core/captcha.scala +++ b/src/main/scala/lc/core/captcha.scala @@ -1,13 +1,10 @@ package lc.core -import java.sql.ResultSet -import java.util.UUID -import java.io.ByteArrayInputStream +import lc.captchas.interfaces.{Challenge, ChallengeProvider} import lc.database.Statements -import lc.core.CaptchaProviders -import lc.captchas.interfaces.ChallengeProvider -import lc.captchas.interfaces.Challenge -import java.sql.Blob +import java.io.ByteArrayInputStream +import java.sql.{Blob, ResultSet} +import java.util.UUID class Captcha(config: Config, captchaProviders: CaptchaProviders) { diff --git a/src/main/scala/lc/core/captchaProviders.scala b/src/main/scala/lc/core/captchaProviders.scala index 96ad212..e2ed404 100644 --- a/src/main/scala/lc/core/captchaProviders.scala +++ b/src/main/scala/lc/core/captchaProviders.scala @@ -1,6 +1,6 @@ package lc.core -import lc.captchas._ +import lc.captchas.* import lc.captchas.interfaces.ChallengeProvider import lc.captchas.interfaces.Challenge import scala.collection.mutable.Map @@ -50,7 +50,7 @@ class CaptchaProviders(config: Config) { def getProvider(param: Parameters): Option[ChallengeProvider] = { val providerConfig = filterProviderByParam(param).toList - if (providerConfig.length > 0) { + if (providerConfig.nonEmpty) { val randomIndex = HelperFunctions.randomNumber(providerConfig.length) val providerIndex = providerConfig(randomIndex)._1 val selectedProvider = providers(providerIndex) diff --git a/src/main/scala/lc/database/DB.scala b/src/main/scala/lc/database/DB.scala index 646e053..207d372 100644 --- a/src/main/scala/lc/database/DB.scala +++ b/src/main/scala/lc/database/DB.scala @@ -1,6 +1,6 @@ package lc.database -import java.sql._ +import java.sql.{Connection, DriverManager, Statement} class DBConn() { val con: Connection = DriverManager.getConnection("jdbc:h2:./data/H2/captcha2", "sa", "")