From 62815fe2b5873edcddc36f1fb377c7dda5d4ae2c Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 13 Nov 2019 09:41:54 +1100 Subject: [PATCH] More work on package processing robustness --- .../src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java | 1 + .../java/org/hl7/fhir/utilities/cache/PackageCacheManager.java | 1 - .../java/org/hl7/fhir/utilities/json/JsonTrackingParser.java | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java index 3c38f4e31..9122ad261 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java @@ -192,6 +192,7 @@ public class NpmPackage { try { res.readIndexFile((JsonObject) JsonTrackingParser.parseJson(new String(res.content.get("package/.index.json")))); } catch (Exception e) { + TextFile.bytesToFile(res.content.get("package/.index.json"), "c:\\temp\\.index.json"); throw new IOException("Error parsing package/.index.json: "+e.getMessage(), e); } return res; diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java index 95e1d6d68..2fba3ece0 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java @@ -565,7 +565,6 @@ public class PackageCacheManager { if (progress) System.out.println(" done."); - //todo: load dependencies NpmPackage pck = loadPackageInfo(packRoot); if (!id.equals(JSONUtil.str(npm.getNpm(), "name")) || !version.equals(JSONUtil.str(npm.getNpm(), "version"))) { if (!id.equals(JSONUtil.str(npm.getNpm(), "name"))) { diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java index e88f26e55..308710931 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java @@ -370,7 +370,7 @@ public class JsonTrackingParser { JsonTrackingParser self = new JsonTrackingParser(); self.map = map; self.setErrorOnDuplicates(!allowDuplicates); - return self.parse(source); + return self.parse(Utilities.stripBOM(source)); } private JsonObject parse(String source) throws IOException {