minor: moved blob variable to inner scope

This commit is contained in:
hrj 2021-04-12 09:25:33 +05:30
parent 43e1a379ac
commit 8840a13a8f
1 changed files with 1 additions and 4 deletions

View File

@ -5,20 +5,17 @@ import java.util.UUID
import java.io.ByteArrayInputStream
import lc.database.Statements
import lc.core.CaptchaProviders
import java.sql.Blob
object Captcha {
def getCaptcha(id: Id): Array[Byte] = {
var image: Array[Byte] = null
var blob: Blob = null
try {
val imagePstmt = Statements.tlStmts.get.imagePstmt
imagePstmt.setString(1, id.id)
val rs: ResultSet = imagePstmt.executeQuery()
if (rs.next()) {
blob = rs.getBlob("image")
val blob = rs.getBlob("image")
if (blob != null) {
image = blob.getBytes(1, blob.length().toInt)
}