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

View File

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