我正在使用带有SikuliLibrary的Robot Framework来比较一些报告,但是它间歇性地抛出超时异常。某些运行仅失败。
错误消息是:
linked.c
我创建了一个用于在测试中使用的辅助关键字:
private String getFIleHashValue(File updateFile) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
Log.e("calculateMD5", "Exception while getting Digest", e);
return "";
}
InputStream is;
try {
is = new FileInputStream(updateFile);
} catch (FileNotFoundException e) {
Log.e("calculateMD5", "Exception while getting FileInputStream", e);
return "";
}
byte[] buffer = new byte[8192];
int read;
try {
while ((read = is.read(buffer)) > 0) {
digest.update(buffer, 0, read);
}
byte[] md5sum = digest.digest();
BigInteger bigInt = new BigInteger(1, md5sum);
String output = bigInt.toString(16);
// Fill to 32 chars
output = String.format("%32s", output).replace(' ', '0');
return output;
} catch (IOException e) {
throw new RuntimeException("Unable to process file for MD5", e);
} finally {
try {
is.close();
} catch (IOException e) {
Log.e("calculateMD5", "Exception on closing MD5 input stream", e);
}
}
}