Fix warnings

This commit is contained in:
J-Jamet
2019-08-13 19:33:57 +02:00
parent 6dc46604a4
commit 732f472146
3 changed files with 4 additions and 6 deletions

View File

@@ -330,7 +330,7 @@ class FileDatabaseSelectActivity : StylishActivity(),
*/ */
private fun createDatabaseFile(path: Uri): Boolean { private fun createDatabaseFile(path: Uri): Boolean {
val pathString = URLDecoder.decode(path.path) val pathString = URLDecoder.decode(path.path, "UTF-8")
// Make sure file name exists // Make sure file name exists
if (pathString.isEmpty()) { if (pathString.isEmpty()) {
Log.e(TAG, getString(R.string.error_filename_required)) Log.e(TAG, getString(R.string.error_filename_required))

View File

@@ -158,7 +158,7 @@ class ImporterV3 : Importer<PwDatabaseV3>() {
throw InvalidPasswordException() throw InvalidPasswordException()
} }
var md: MessageDigest? = null val md: MessageDigest
try { try {
md = MessageDigest.getInstance("SHA-256") md = MessageDigest.getInstance("SHA-256")
} catch (e: NoSuchAlgorithmException) { } catch (e: NoSuchAlgorithmException) {
@@ -169,7 +169,7 @@ class ImporterV3 : Importer<PwDatabaseV3>() {
val dos = DigestOutputStream(nos, md) val dos = DigestOutputStream(nos, md)
dos.write(filebuf, PwDbHeaderV3.BUF_SIZE, encryptedPartSize) dos.write(filebuf, PwDbHeaderV3.BUF_SIZE, encryptedPartSize)
dos.close() dos.close()
val hash = md!!.digest() val hash = md.digest()
if (!Arrays.equals(hash, hdr.contentsHash)) { if (!Arrays.equals(hash, hdr.contentsHash)) {

View File

@@ -45,7 +45,6 @@ import com.kunzisoft.keepass.activities.dialogs.UnavailableFeatureDialogFragment
import com.kunzisoft.keepass.activities.dialogs.UnderDevelopmentFeatureDialogFragment import com.kunzisoft.keepass.activities.dialogs.UnderDevelopmentFeatureDialogFragment
import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper import com.kunzisoft.keepass.activities.helpers.ReadOnlyHelper
import com.kunzisoft.keepass.activities.stylish.Stylish import com.kunzisoft.keepass.activities.stylish.Stylish
import com.kunzisoft.keepass.app.App
import com.kunzisoft.keepass.database.element.Database import com.kunzisoft.keepass.database.element.Database
import com.kunzisoft.keepass.education.Education import com.kunzisoft.keepass.education.Education
import com.kunzisoft.keepass.fileselect.database.FileDatabaseHistory import com.kunzisoft.keepass.fileselect.database.FileDatabaseHistory
@@ -177,8 +176,7 @@ class NestedSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferen
context?.let { context -> context?.let { context ->
AlertDialog.Builder(context) AlertDialog.Builder(context)
.setMessage(resources.getString(R.string.fingerprint_delete_all_warning)) .setMessage(resources.getString(R.string.fingerprint_delete_all_warning))
.setIcon(resources.getDrawable( .setIcon(android.R.drawable.ic_dialog_alert)
android.R.drawable.ic_dialog_alert))
.setPositiveButton(resources.getString(android.R.string.yes) .setPositiveButton(resources.getString(android.R.string.yes)
) { _, _ -> ) { _, _ ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {