Код: Выделить всё
public class FileId {
final long length;
final String hash;
FileId(File file) {
assert !file.isDirectory();
this.length = file.length();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
try (FileInputStream fis = new FileInputStream(file)) {
byte[] dataBytes = new byte[1024];
int nread = 0;
while ((nread = fis.read(dataBytes)) != -1) {
md.update(dataBytes, 0, nread);
}
this.hash = md.toString();
} catch (IOException e) {
// TBD: add warning
this.hash = "";
}
} catch (NoSuchAlgorithmException nsae) {
// TBD: emit warning
this.hash = "";
}
}
}
Код: Выделить всё
variable hash might already have been assigned
Например, если первое назначение выполнено, никаких исключений не создается
поэтому другие назначения не выполняются .
В чем моя ошибка?>
Подробнее здесь: https://stackoverflow.com/questions/788 ... mpiler-bug