correcting bug when a localNew resource was here but not the local (if the app was stopped in the middle of dl for ex), it was valid and not installed, now it put in the _toBeInstalledResouces list for proper installation

This commit is contained in:
Paul-Yves Lucas
2017-06-29 10:51:33 +02:00
parent 61534b569c
commit e9774a0385
2 changed files with 6 additions and 2 deletions
@@ -1276,7 +1276,7 @@ public class Application
* @param unpacked a set to populate with unpacked resources. * @param unpacked a set to populate with unpacked resources.
*/ */
public List<Resource> verifyResources (ProgressObserver obs, int[] alreadyValid, public List<Resource> verifyResources (ProgressObserver obs, int[] alreadyValid,
Set<Resource> unpacked) throws InterruptedException Set<Resource> unpacked, List<Resource> toBeInstalled) throws InterruptedException
{ {
List<Resource> rsrcs = getAllActiveResources(); List<Resource> rsrcs = getAllActiveResources();
List<Resource> failures = new ArrayList<Resource>(); List<Resource> failures = new ArrayList<Resource>();
@@ -1306,6 +1306,10 @@ public class Application
try { try {
if (_digest.validateResource(rsrc, robs)) { if (_digest.validateResource(rsrc, robs)) {
//if the resource is valid but has no _local file, we add it to the resource to install
if (!rsrc.getLocal().exists() && rsrc.getLocalNew().exists() && !toBeInstalled.contains(rsrc)) {
toBeInstalled.add(rsrc);
}
// unpack this resource if appropriate // unpack this resource if appropriate
if (noUnpack || !rsrc.shouldUnpack()) { if (noUnpack || !rsrc.shouldUnpack()) {
// finally note that this resource is kosher // finally note that this resource is kosher
@@ -476,7 +476,7 @@ public abstract class Getdown extends Thread
// now verify our resources... // now verify our resources...
setStep(Step.VERIFY_RESOURCES); setStep(Step.VERIFY_RESOURCES);
setStatusAsync("m.validating", -1, -1L, false); setStatusAsync("m.validating", -1, -1L, false);
List<Resource> failures = _app.verifyResources(_progobs, alreadyValid, unpacked); List<Resource> failures = _app.verifyResources(_progobs, alreadyValid, unpacked, _toBeInstalledResouces);
if (failures == null) { if (failures == null) {
log.info("Resources verified."); log.info("Resources verified.");