Issue #440 made PathManager not request data if there are no contexts to request for

Former-commit-id: e856cfedf4 [formerly d5ad7950c520e8b8d384b6dad73f0da6e84935d0]
Former-commit-id: db57eeee16
This commit is contained in:
Max Schenkelberg 2012-06-19 13:00:44 -05:00
parent 80faa5abf8
commit 1f10cddfa2

View file

@ -208,30 +208,35 @@ public class PathManager implements IPathManager {
}
}
ListResponse[] entry = null;
try {
entry = this.adapter.getLocalizationMetadata(ctxToCheck
.toArray(new LocalizationContext[ctxToCheck.size()]), name);
} catch (LocalizationException e) {
// Error on server, no files will be returned
e.printStackTrace();
}
if (ctxToCheck.size() > 0) {
ListResponse[] entry = null;
try {
entry = this.adapter.getLocalizationMetadata(ctxToCheck
.toArray(new LocalizationContext[ctxToCheck.size()]),
name);
} catch (LocalizationException e) {
// Error on server, no files will be returned
e.printStackTrace();
}
if (entry != null) {
for (ListResponse lr : entry) {
// A null File means the file can never exist, therefore we set
// the context/name key as a null file object to avoid
// requesting data about the non-existent file again
LocalizationFile file = new LocalizationFile();
File local = adapter.getPath(lr.context, name);
if (local != null) {
file = new LocalizationFile(this.adapter, lr.context,
local, lr.date, name, lr.checkSum, lr.isDirectory,
lr.existsOnServer, lr.isProtected);
availableFiles.put(file.getContext(), file);
if (entry != null) {
for (ListResponse lr : entry) {
// A null File means the file can never exist, therefore we
// set
// the context/name key as a null file object to avoid
// requesting data about the non-existent file again
LocalizationFile file = new LocalizationFile();
File local = adapter.getPath(lr.context, name);
if (local != null) {
file = new LocalizationFile(this.adapter, lr.context,
local, lr.date, name, lr.checkSum,
lr.isDirectory, lr.existsOnServer,
lr.isProtected);
availableFiles.put(file.getContext(), file);
}
fileCache.put(new LocalizationFileKey(lr.fileName,
lr.context), file);
}
fileCache.put(new LocalizationFileKey(lr.fileName, lr.context),
file);
}
}