fix bug loading package

This commit is contained in:
Grahame Grieve 2023-06-28 11:06:09 +10:00
parent 704d498300
commit 284ad1c2be
2 changed files with 28 additions and 30 deletions

View File

@ -42,7 +42,7 @@ public class CDARoundTripTests {
context.loadFromFile(TestingUtilities.loadTestResourceStream("validator", "cda", "cda.xml"), "cda.xml", null);
for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) {
if (!sd.hasSnapshot()) {
// System.out.println("generate snapshot for " + sd.getUrl());
// System.out.println("generate snapshot for " + sd.getUrl());
new ContextUtilities(context).generateSnapshot(sd, true);
}
}

View File

@ -361,10 +361,10 @@ public class NpmPackage {
d = Utilities.path("package", d);
}
File ij = new File(Utilities.path(f.getAbsolutePath(), ".index.json"));
if (ij.exists() || !minimalMemory) {
NpmPackageFolder folder = this.new NpmPackageFolder(d);
folder.folder = f;
this.folders.put(d, folder);
if (ij.exists() || !minimalMemory) {
if (!minimalMemory) {
try {
if (!ij.exists() || !folder.readIndex(JsonParser.parseObject(ij), folder.getTypes())) {
@ -397,21 +397,19 @@ public class NpmPackage {
if (!d.startsWith("package")) {
d = Utilities.path("package", d);
}
File ij = new File(Utilities.path(f.getAbsolutePath(), ".index.json"));
if (ij.exists()) {
NpmPackageFolder folder = this.new NpmPackageFolder(d);
folder.folder = f;
this.folders.put(d, folder);
if (!minimalMemory) {
File ij = new File(Utilities.path(f.getAbsolutePath(), ".index.json"));
if (ij.exists() || !minimalMemory) {
try {
if (!folder.readIndex(JsonParser.parseObject(ij), folder.getTypes())) {
if (!ij.exists() || !folder.readIndex(JsonParser.parseObject(ij), folder.getTypes())) {
indexFolder(folder.getFolderName(), folder);
}
} catch (Exception e) {
throw new IOException("Error parsing "+ij.getAbsolutePath()+": "+e.getMessage(), e);
}
}
}
loadSubFolders(rootPath, f);
}
}