| Chunk |
|---|
| Conflicting content |
|---|
}
/**
<<<<<<< HEAD
* Check to see if a password matches any of the passwords stored in the
* password history.
*
* @param password The password to check.
* @return Whether the password matches any in the history.
*/
public boolean checkPasswordHistory(String password) {
String passwordHashString = new String(passwordToHash(password));
String passwordHistory = getString(PASSWORD_HISTORY_KEY);
if (passwordHistory == null) {
return false;
}
// Password History may be too long...
int passwordHashLength = passwordHashString.length();
int passwordHistoryLength = getRequestedPasswordHistoryLength();
if(passwordHistoryLength == 0) {
return false;
}
int neededPasswordHistoryLength = passwordHashLength * passwordHistoryLength
+ passwordHistoryLength - 1;
if (passwordHistory.length() > neededPasswordHistoryLength) {
passwordHistory = passwordHistory.substring(0, neededPasswordHistoryLength);
}
return passwordHistory.contains(passwordHashString);
}
/**
* Checks to see if the given file exists and contains any data. Returns
* true if it does, false otherwise.
*
* @param filename
* @return true if file exists and is non-empty.
*/
private boolean nonEmptyFileExists(String filename) {
try {
// Check if we can read a byte from the file
RandomAccessFile raf = new RandomAccessFile(filename, "r");
raf.readByte();
raf.close();
return true;
} catch (FileNotFoundException fnfe) {
return false;
} catch (IOException ioe) {
return false;
}
}
/**
=======
>>>>>>> 0b7b980761f3daa614ea725a5d432e8bd718eac6
* Check to see if the user has stored a lock pattern.
* @return Whether a saved pattern exists.
*/ |
| Solution content |
|---|
}
/**
* Check to see if a password matches any of the passwords stored in the
* password history.
*
* @param password The password to check.
* @return Whether the password matches any in the history.
*/
public boolean checkPasswordHistory(String password) {
String passwordHashString = new String(passwordToHash(password));
String passwordHistory = getString(PASSWORD_HISTORY_KEY);
if (passwordHistory == null) {
return false;
}
// Password History may be too long...
int passwordHashLength = passwordHashString.length();
int passwordHistoryLength = getRequestedPasswordHistoryLength();
if(passwordHistoryLength == 0) {
return false;
}
int neededPasswordHistoryLength = passwordHashLength * passwordHistoryLength
+ passwordHistoryLength - 1;
if (passwordHistory.length() > neededPasswordHistoryLength) {
passwordHistory = passwordHistory.substring(0, neededPasswordHistoryLength);
}
return passwordHistory.contains(passwordHashString);
}
/**
* Check to see if the user has stored a lock pattern.
* @return Whether a saved pattern exists.
*/ |
| File |
|---|
| LockPatternUtils.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Comment |
| Method declaration |