i18n more database error strings.

This commit is contained in:
Brian Pellin committed 2012-09-23 17:30:49 -05:00
1 parent 6f226fa9dc
commit 118fd0b27d
8 files changed
+87 -11

No files matched your search

+1
View File
@@ -1,6 +1,7 @@
* Restore the timeout service, we need it to keep the app in memory long
enough to clear the clipboard and to remove the notifications.
* Autolink comment and advanced fields
* i18n more database error strings
KeePassDroid (1.9.18.2)
* Updated Dutch translations from Erik Jan Meijer
+3
View File
@@ -106,7 +106,10 @@
<string name="install_from_market">Install from Play Store</string>
<string name="install_from_website">Install from Web</string>
<string name="InvalidPassword">Invalid password or key file.</string>
<string name="invalid_algorithm">Invalid algorithm.</string>
<string name="invalid_db_sig">Database format not recognized.</string>
<string name="keyfile_does_not_exist">Key file does not exist.</string>
<string name="keyfile_is_empty">Key file is empty.</string>
<string name="length">Length</string>
<string name="list_size_title">Group list size</string>
<string name="list_size_summary">Text size in the group list</string>
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2011 Brian Pellin.
* Copyright 2009-2012 Brian Pellin.
*
* This file is part of KeePassDroid.
*
@@ -33,6 +33,7 @@ import java.util.List;
import com.keepassdroid.crypto.finalkey.FinalKey;
import com.keepassdroid.crypto.finalkey.FinalKeyFactory;
import com.keepassdroid.database.exception.InvalidKeyFileException;
import com.keepassdroid.database.exception.KeyFileEmptyException;
import com.keepassdroid.stream.NullOutputStream;
public abstract class PwDatabase {
@@ -111,7 +112,7 @@ public abstract class PwDatabase {
File keyfile = new File(fileName);
if ( ! keyfile.exists() ) {
throw new InvalidKeyFileException("Key file does not exist.");
throw new InvalidKeyFileException();
}
byte[] key = loadXmlKeyFile(fileName);
@@ -123,14 +124,14 @@ public abstract class PwDatabase {
try {
fis = new FileInputStream(keyfile);
} catch (FileNotFoundException e) {
throw new InvalidKeyFileException("Key file does not exist.");
throw new InvalidKeyFileException();
}
BufferedInputStream bis = new BufferedInputStream(fis, 64);
long fileSize = keyfile.length();
if ( fileSize == 0 ) {
throw new InvalidKeyFileException("Key file is empty.");
throw new KeyFileEmptyException();
} else if ( fileSize == 32 ) {
byte[] outputKey = new byte[32];
if ( bis.read(outputKey, 0, 32) != 32 ) {
+10 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2009 Brian Pellin.
* Copyright 2009-2012 Brian Pellin.
*
* This file is part of KeePassDroid.
*
@@ -30,11 +30,13 @@ import com.android.keepass.R;
import com.keepassdroid.Database;
import com.keepassdroid.app.App;
import com.keepassdroid.database.exception.ArcFourException;
import com.keepassdroid.database.exception.InvalidAlgorithmException;
import com.keepassdroid.database.exception.InvalidDBException;
import com.keepassdroid.database.exception.InvalidDBSignatureException;
import com.keepassdroid.database.exception.InvalidDBVersionException;
import com.keepassdroid.database.exception.InvalidKeyFileException;
import com.keepassdroid.database.exception.InvalidPasswordException;
import com.keepassdroid.database.exception.KeyFileEmptyException;
import com.keepassdroid.fileselect.FileDbHelper;
public class LoadDB extends RunnableOnFinish {
@@ -77,8 +79,14 @@ public class LoadDB extends RunnableOnFinish {
} catch (IOException e) {
finish(false, e.getMessage());
return;
} catch (KeyFileEmptyException e) {
finish(false, mCtx.getString(R.string.keyfile_is_empty));
return;
} catch (InvalidAlgorithmException e) {
finish(false, mCtx.getString(R.string.invalid_algorithm));
return;
} catch (InvalidKeyFileException e) {
finish(false, e.getMessage());
finish(false, mCtx.getString(R.string.keyfile_does_not_exist));
return;
} catch (InvalidDBSignatureException e) {
finish(false, mCtx.getString(R.string.invalid_db_sig));
@@ -0,0 +1,32 @@
/*
* Copyright 2012 Brian Pellin.
*
* This file is part of KeePassDroid.
*
* KeePassDroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* KeePassDroid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with KeePassDroid. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.keepassdroid.database.exception;
public class InvalidAlgorithmException extends InvalidDBException {
/**
*
*/
private static final long serialVersionUID = 3062682891863487208L;
public InvalidAlgorithmException() {
super();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2009 Brian Pellin.
* Copyright 2009-2012 Brian Pellin.
*
* This file is part of KeePassDroid.
*
@@ -24,7 +24,7 @@ public class InvalidKeyFileException extends InvalidDBException {
*/
private static final long serialVersionUID = 5540694419562294464L;
public InvalidKeyFileException(String str) {
super(str);
public InvalidKeyFileException() {
super();
}
}
@@ -0,0 +1,30 @@
/*
* Copyright 2012 Brian Pellin.
*
* This file is part of KeePassDroid.
*
* KeePassDroid is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* KeePassDroid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with KeePassDroid. If not, see <http://www.gnu.org/licenses/>.
*
*/package com.keepassdroid.database.exception;
public class KeyFileEmptyException extends InvalidKeyFileException {
/**
*
*/
private static final long serialVersionUID = -1630780661204212325L;
public KeyFileEmptyException() {
super();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2011 Brian Pellin.
* Copyright 2009-2012 Brian Pellin.
*
* This file is part of KeePassDroid.
*
@@ -75,6 +75,7 @@ import com.keepassdroid.database.PwDbHeaderV3;
import com.keepassdroid.database.PwEncryptionAlgorithm;
import com.keepassdroid.database.PwEntryV3;
import com.keepassdroid.database.PwGroupV3;
import com.keepassdroid.database.exception.InvalidAlgorithmException;
import com.keepassdroid.database.exception.InvalidDBException;
import com.keepassdroid.database.exception.InvalidDBSignatureException;
import com.keepassdroid.database.exception.InvalidDBVersionException;
@@ -164,7 +165,7 @@ public class ImporterV3 extends Importer {
} else if( (hdr.flags & PwDbHeaderV3.FLAG_TWOFISH) != 0 ) {
newManager.algorithm = PwEncryptionAlgorithm.Twofish;
} else {
throw new IOException( "Unknown algorithm." );
throw new InvalidAlgorithmException();
}