CRC workaround for older versions

This commit is contained in:
Gerhard Stein
2017-01-29 20:38:36 +01:00
parent 23522adf4e
commit a877155344
3 changed files with 10 additions and 5 deletions

View File

@@ -750,14 +750,19 @@ class DataDownloader extends Thread
ret = check.read(buf, 0, buf.length);
}
check.close();
// NOTE: For some reason this not work properly on older Android versions (4.4 and below).
// Setting this to become a warning
if( check.getChecksum().getValue() != entry.getCrc() || count != entry.getSize() )
{
File ff = new File(path);
ff.delete();
//File ff = new File(path);
//ff.delete();
Log.i("SDL", "Saving file '" + path + "' - CRC check failed, ZIP: " +
String.format("%x", entry.getCrc()) + " actual file: " + String.format("%x", check.getChecksum().getValue()) +
" file size in ZIP: " + entry.getSize() + " actual size " + count );
throw new Exception();
Log.i("SDL", "If you still get problems try to reset the app or delete file at path " + path );
//throw new Exception();
}
} catch( Exception e ) {
Status.setText( res.getString(R.string.error_write, path) + ": " + e.getMessage() );